Compare commits

..

No commits in common. "cca69b619d282f6974f6b1443991c357bcb1a9b4" and "1172b4a90aad8a77c00a87de0014384b055a35a6" have entirely different histories.

10 changed files with 59 additions and 139 deletions

View File

@ -62,8 +62,7 @@ namespace ZKuP
{
if (SQL.isOnline && !e.Exception.ToString().Contains("System.Windows.Automation.ElementNotAvailableException:")
&& !e.Exception.ToString().Contains("System.OperationCanceledException")
&& !e.Exception.ToString().Contains("System.ObjectDisposedException")
&& !e.Exception.ToString().Contains("System.IO.IOException")
&& !e.Exception.ToString().Contains("System.ObjectDisposedException")
&& !e.Exception.ToString().Contains("signotec.STPadLibNet.STPadException: Zu dem ausgewählten Signierpad wurde keine Verbindung geöffnet.")
&& !e.Exception.ToString().Contains("Derzeit ist kein Layout"))
Log.WriteLog("2: " + e.Exception.ToString() + "\n" + e.ToString() + "\n" + (sender.GetType().ToString()));

View File

@ -1433,7 +1433,7 @@ namespace ZKuP
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValue}' in der Spalte 'Anspr. intern' sicher zu '{box.Text}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.firmen SET Ansprechpartner_Intern = '{box.Text}',Tel_Nr_Ansprechpartner_Intern = '{SQL.ReadSingleValue($"SELECT Tel_Nr FROM {MainWindow.table}.ansprechpartner WHERE Name = '{(sender as ComboBox).Text}'")}', Bearbeiter = '{Environment.UserName}' WHERE idfirmen = '{id}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.firmen SET Ansprechpartner_Intern = @box,Tel_Nr_Ansprechpartner_Intern = '{SQL.ReadSingleValue($"SELECT Tel_Nr FROM {MainWindow.table}.ansprechpartner WHERE Name = '{(sender as ComboBox).Text}'")}', Bearbeiter = @UserName WHERE idfirmen = @id", new List<MySqlParameter>()
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.firmen SET Ansprechpartner_Intern = @box,Tel_Nr_Ansprechpartner_Intern = {SQL.ReadSingleValue($"SELECT Tel_Nr FROM {MainWindow.table}.ansprechpartner WHERE Name = '{(sender as ComboBox).Text}'")}, Bearbeiter = @UserName WHERE idfirmen = @id", new List<MySqlParameter>()
{
new MySqlParameter("@box", box.Text),
new MySqlParameter("@UserName", Environment.UserName),

View File

@ -498,7 +498,7 @@ namespace ZKuP
var cmd = SQL.CreateAndReturnSQLCommand($"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung, signature_blob) VALUES (@Kategorie,@tbFirma,@time,'--','--','1','1',@tbHandy,'1','1',@tbKennzeichen,@tbBemerkung, @signature)", new List<MySqlParameter>()
{
new MySqlParameter("@Kategorie", Kategorie),
new MySqlParameter("@tbFirma", $"Firma: {tbFirma.Text.Trim()}, Fahrer: {tbFahrer.Text}"),
new MySqlParameter("@tbFirma", $"Firma: {tbFirma.Text}, Fahrer: {tbFahrer.Text}"),
new MySqlParameter("@time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
new MySqlParameter("@tbHandy", tbHandy.Text),
new MySqlParameter("@tbKennzeichen", tbKennzeichen.Text),

View File

@ -1,5 +1,4 @@
using MahApps.Metro.Controls;
using Microsoft.Win32;
using Microsoft.Win32;
using System;
using System.Collections;
using System.Collections.Generic;
@ -37,7 +36,6 @@ namespace ZKuP
{
public static double width = 0;
public static double height = 0;
public static double scale = 0;
public static bool? IsFileLocked(FileInfo file)
{
try
@ -811,67 +809,54 @@ namespace ZKuP
return GetCell(grid, rowContainer, column);
}
internal static void initScaler(double Width, double Height)
{
width = Width;
height = Height;
}
static double lastDpiScale = -1;
static bool _isCurrentlyScaled = false;
internal static async void CheckScale(Window mainWindow)
{
if (!(width == 0 || height == 0))
var dpi = VisualTreeHelper.GetDpi(mainWindow);
double dpiScale = dpi.DpiScaleX; // or DpiScaleY
double scaledWidth = width * dpiScale;
double scaledHeight = height * dpiScale;
var screen = WpfScreenHelper.Screen.FromHandle(new WindowInteropHelper(mainWindow).Handle);
var workingArea = screen.WorkingArea;
bool needsScaling = (width * dpiScale) > workingArea.Width || (height * dpiScale) > workingArea.Height;
lastDpiScale = dpiScale;
if (needsScaling)
{
var dpi = VisualTreeHelper.GetDpi(mainWindow);
double dpiScale = dpi.DpiScaleX; // or DpiScaleY
// Calculate the scale to fit in working area
double scaleX = workingArea.Width / width;
double scaleY = workingArea.Height / height;
double scale = Math.Min(scaleX, scaleY);
scale = Math.Round(scale * 4) / 4.0;
double scaledWidth = width * dpiScale;
double scaledHeight = height * dpiScale;
mainWindow.MinWidth = scale * width;
mainWindow.MinHeight = scale * height;
mainWindow.LayoutTransform = new ScaleTransform(scale, scale);
var screen = WpfScreenHelper.Screen.FromHandle(new WindowInteropHelper(mainWindow).Handle);
var workingArea = screen.WorkingArea;
mainWindow.Width = mainWindow.MinWidth;
mainWindow.Height = mainWindow.MinHeight;
bool needsScaling = (width * dpiScale) > workingArea.Width || (height * dpiScale) > workingArea.Height;
TextOptions.SetTextFormattingMode(mainWindow, TextFormattingMode.Display);
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.ClearType);
_isCurrentlyScaled = true;
}
else if (_isCurrentlyScaled)
{
// Reset to normal scale
mainWindow.LayoutTransform = Transform.Identity;
lastDpiScale = dpiScale;
mainWindow.MinWidth = width != 0 ? width : mainWindow.MinWidth;
mainWindow.MinHeight = height != 0 ? height : mainWindow.MinHeight;
if (needsScaling && !_isCurrentlyScaled)
{
// Calculate the scale to fit in working area
double scaleX = width / workingArea.Width;
double scaleY = height / workingArea.Height;
scale = Math.Min(scaleX, scaleY);
scale = Math.Round(scale * 4) / 4.0;
mainWindow.MinWidth = scale * width;
mainWindow.MinHeight = scale * height;
mainWindow.LayoutTransform = new ScaleTransform(scale, scale);
mainWindow.Width = mainWindow.MinWidth;
mainWindow.Height = mainWindow.MinHeight;
TextOptions.SetTextFormattingMode(mainWindow, TextFormattingMode.Display);
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.ClearType);
_isCurrentlyScaled = true;
}
else if (_isCurrentlyScaled && !needsScaling)
{
// Reset to normal scale
mainWindow.LayoutTransform = Transform.Identity;
mainWindow.MinWidth = width != 0 ? width : mainWindow.MinWidth;
mainWindow.MinHeight = height != 0 ? height : mainWindow.MinHeight;
TextOptions.SetTextFormattingMode(mainWindow, TextFormattingMode.Ideal);
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.Auto);
_isCurrentlyScaled = false;
}
TextOptions.SetTextFormattingMode(mainWindow, TextFormattingMode.Ideal);
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.Auto);
}
}

View File

@ -407,7 +407,7 @@
<TextBlock x:Name="lblmcfit" Text="Aktuell verfügbare McFit Karten: " FontSize="12" HorizontalAlignment="Right" Margin="0,140,420,0" Visibility="Visible"/>
<Button x:Name="btnIvoBackground" VerticalAlignment="Top" HorizontalAlignment="Right" Height="95" Width="10" Margin="0,13,20,0" Click="btnIvoBackground_Click" Visibility="Collapsed"/>
<Button x:Name="btnIvoBackground" VerticalAlignment="Top" HorizontalAlignment="Right" Height="95" Width="10" Margin="0,13,-3,0" Click="btnIvoBackground_Click" Visibility="Collapsed"/>
<!--<Button x:Name="btnNew" Content="Firma/Besucher kommt an" Height="23" FontSize="12" Padding="-5" HorizontalAlignment="Left" FontWeight="Regular" Margin="0,13,0,0" VerticalAlignment="Top" Width="200" Click="BtnNew_Click" Visibility="Collapsed"/>-->
<Button x:Name="btnDelivery" Content="Lieferant kommt an" Tag="Lieferant" Height="30" FontSize="12" Padding="-5" HorizontalAlignment="Left" FontWeight="Regular" Margin="0,30,0,0" VerticalAlignment="Top" Width="200" Click="btnDelivery_Click" Visibility="Collapsed"/>
@ -607,7 +607,7 @@
</Grid>
<Grid x:Name="gridToday" Grid.Row="1" Visibility="Collapsed" VerticalAlignment="Stretch" MinHeight="100" Margin="0,-10,0,0" >
<Grid x:Name="gridToday" Grid.Row="1" Visibility="Collapsed" VerticalAlignment="Stretch" MinHeight="100" Margin="0,-10,0,0" MaxWidth="{Binding ActualWidth, ElementName=metroWindow, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="columnLeft" Width="1.456*" MinWidth="1000"/>
<ColumnDefinition Width="15"/>

View File

@ -43,7 +43,7 @@ namespace ZKuP
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public const string Version = "5.1.0.6";
public const string Version = "5.1.0.2";
public static Roles LoggedInRole { get; private set; } = Roles.None;
@ -291,7 +291,8 @@ namespace ZKuP
if (actualheight <= 191) gridBackground.RowDefinitions[1].Height = new GridLength(maxheight);
//gridSpinner.Visibility = Visibility.Collapsed;
Helper.initScaler(this.MinWidth, this.MinHeight);
Helper.width = this.MinWidth;
Helper.height = this.MinHeight;
connTimer.Interval = TimeSpan.FromSeconds(2);
@ -1716,7 +1717,7 @@ namespace ZKuP
var park = await SQL.ReadListString($"SELECT Parkplatz FROM {MainWindow.table}.`beParkplaetze` LEFT JOIN {MainWindow.table}.`beBelegung` ON beParkplaetze.beNr = beBelegung.beNr WHERE Parkplatz IS NOT null AND CURDATE() BETWEEN beBelegung.von AND beBelegung.bis");
//var singlePark = await SQL.ReadDictionary2($"SELECT parkplatznr, FROM {MainWindow.table}.`parkplaetze`", 0 , 1);
var singlePark = await SQL.ReadDictionary2($"SELECT LPAD(p.parkplatznr, 2, '0'), f.Name FROM {MainWindow.table}.parkplaetze p LEFT JOIN {MainWindow.table}.firmen f ON f.idFirmen = p.firma", 0, 1);
var singlePark = await SQL.ReadDictionary2($"SELECT p.parkplatznr, f.Name FROM {MainWindow.table}.parkplaetze p LEFT JOIN {MainWindow.table}.firmen f ON f.idFirmen = p.firma", 0, 1);
string list = "";
@ -1725,10 +1726,8 @@ namespace ZKuP
park = list.Split(',').ToList();
park = park.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
for(var p = 0; p < park.Count; p++)
park[p] = park[p].PadLeft(2, '0');
for(var p = 0; p < park.Count; p++) park[p] = park[p].PadLeft(2, '0');
var justPark = park.ToList();
@ -3037,10 +3036,10 @@ namespace ZKuP
Point splitterPosition = splitter.TransformToAncestor(window).Transform(new Point(0, 0));
if (splitterPosition.Y > ((this.ActualHeight - 190) / Helper.scale))
if (splitterPosition.Y > (this.ActualHeight - 190))
{
e.Handled = true; // Bewegung stoppen
gridRowTop.Height = new GridLength((this.ActualHeight - 160 - 190) / Helper.scale);
gridRowTop.Height = new GridLength(this.ActualHeight - 160 - 190);
}
}

View File

@ -54,11 +54,7 @@ namespace ZKuP
}
else
{
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;
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;
}
//aspView = Asp.DataTableToAsp(asp);

View File

@ -913,31 +913,16 @@ namespace ZKuP
{
using (cmd)
{
var firstVal = "";
var secondVal = "";
while (reader.Read())
{
if (reader.IsDBNull(FirstColumn))
firstVal = "";
else firstVal = reader.GetValue(FirstColumn).ToString();
if (reader.IsDBNull(SecondColumn))
secondVal = "";
else secondVal = reader.GetValue(SecondColumn).ToString();
if (!queryResult.ContainsKey(firstVal))
queryResult.Add(firstVal, secondVal);
//if (!reader.IsDBNull(FirstColumn) && !reader.IsDBNull(SecondColumn))
// if (!queryResult.ContainsKey(reader.GetValue(FirstColumn).ToString()))
// queryResult.Add(reader.GetValue(FirstColumn).ToString(), reader.GetValue(SecondColumn).ToString());
// else if (reader.IsDBNull(FirstColumn) && !reader.IsDBNull(SecondColumn))
// continue;// queryResult.Add("", reader.GetString(SecondColumn));
// else if (!reader.IsDBNull(FirstColumn) && reader.IsDBNull(SecondColumn))
// if (!queryResult.ContainsKey(reader.GetValue(FirstColumn).ToString()))
// queryResult.Add(reader.GetValue(FirstColumn).ToString(), "");
if (!reader.IsDBNull(FirstColumn) && !reader.IsDBNull(SecondColumn))
if (!queryResult.ContainsKey(reader.GetValue(FirstColumn).ToString()))
queryResult.Add(reader.GetValue(FirstColumn).ToString(), reader.GetValue(SecondColumn).ToString());
else if (reader.IsDBNull(FirstColumn) && !reader.IsDBNull(SecondColumn))
continue;// queryResult.Add("", reader.GetString(SecondColumn));
else if (!reader.IsDBNull(FirstColumn) && reader.IsDBNull(SecondColumn))
if (!queryResult.ContainsKey(reader.GetValue(FirstColumn).ToString()))
queryResult.Add(reader.GetValue(FirstColumn).ToString(), "");
}
}

View File

@ -1,43 +0,0 @@
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,7 +323,6 @@
</Compile>
<Compile Include="signoPad.cs" />
<Compile Include="SQL.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="ucSpinnerPiston.xaml.cs">
<DependentUpon>ucSpinnerPiston.xaml</DependentUpon>
</Compile>