5.1.0.6: Asp verwalten entfernt jetzt für die SQL Query die Zwischeninitiale des Username

This commit is contained in:
Marcus 2025-08-28 14:12:42 +02:00
parent a658357c7e
commit cca69b619d
4 changed files with 50 additions and 2 deletions

View File

@ -43,7 +43,7 @@ namespace ZKuP
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public const string Version = "5.1.0.5";
public const string Version = "5.1.0.6";
public static Roles LoggedInRole { get; private set; } = Roles.None;

View File

@ -54,7 +54,11 @@ namespace ZKuP
}
else
{
asp = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.ansprechpartner WHERE Name LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}%' OR Vertreter LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}%' OR Vorgesetzter LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}%' OR CreatorID = '{UserID}' ORDER BY Name ASC", asp).Result;
asp = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.ansprechpartner WHERE " +
$"Name LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName.ReplaceMiddleInitialWithSpace()).ReplaceUmlaute()}%' OR " +
$"Vertreter LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName.ReplaceMiddleInitialWithSpace()).ReplaceUmlaute()}%' OR " +
$"Vorgesetzter LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName.ReplaceMiddleInitialWithSpace()).ReplaceUmlaute()}%' OR " +
$"CreatorID = '{UserID}' ORDER BY Name ASC", asp).Result;
}
//aspView = Asp.DataTableToAsp(asp);

43
ZKuP/StringExtensions.cs Normal file
View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ZKuP
{
public static class StringExtensions
{
public static string ReplaceUmlaute(this string input)
{
if (string.IsNullOrEmpty(input))
return input;
return input
.Replace("ä", "ae")
.Replace("ö", "oe")
.Replace("ü", "ue")
.Replace("Ä", "Ae")
.Replace("Ö", "Oe")
.Replace("Ü", "Ue")
.Replace("ß", "ss");
}
public static string ReplaceMiddleInitialWithSpace(this string input)
{
if (string.IsNullOrEmpty(input))
return input;
var pattern = @"^([A-Za-z]{2,})([A-Z][a-z]?)([A-Z][A-Za-z]+)$";
var match = Regex.Match(input, pattern);
if (match.Success)
{
return match.Groups[1].Value + " " + match.Groups[3].Value;
}
return input;
}
}
}

View File

@ -323,6 +323,7 @@
</Compile>
<Compile Include="signoPad.cs" />
<Compile Include="SQL.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="ucSpinnerPiston.xaml.cs">
<DependentUpon>ucSpinnerPiston.xaml</DependentUpon>
</Compile>