diff --git a/ZKuP/AddCardUser.xaml b/ZKuP/AddCardUser.xaml
index ba7b53e..1c65db6 100644
--- a/ZKuP/AddCardUser.xaml
+++ b/ZKuP/AddCardUser.xaml
@@ -17,12 +17,8 @@
-
-
-
-
-
-
+
+
diff --git a/ZKuP/AddCardUser.xaml.cs b/ZKuP/AddCardUser.xaml.cs
index 91ae8e7..4eaf782 100644
--- a/ZKuP/AddCardUser.xaml.cs
+++ b/ZKuP/AddCardUser.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -19,16 +20,35 @@ namespace ZKuP
///
public partial class AddCardUser : Window
{
- public AddCardUser(string user = "")
+ string _user = "";
+ string _ansprechpartnerFirma = "";
+ List comboList = new List() { "Grün", "Rot", "Gerätewagen" };
+ List comboListNurRot = new List() { "Rot" };
+
+ byte[] _signature = null;
+ string _ap = "";
+ bool _needTel = true;
+
+ public AddCardUser(string user = "", bool isBesucher = false, string nr = "", string ap = "", bool needTel = true)
{
+ _user = user;
+ _ap = ap;
+ _needTel = needTel;
+
InitializeComponent();
+ this.Title = "Karten ausgeben - " + nr;
+
+ //cbColor.ItemsSource = isBesucher ? comboListNurRot : comboList;
+ cbColor.ItemsSource = comboListNurRot;
+
if (!user.Contains("["))
{
tbUser.Text = user;
try
{
- tbTelnr.Text = SQL.ReadSingleValue($"SELECT Tel_Nr_Verantwortlicher_Firma FROM zkup.firmen WHERE Name='{user}'");
+ if (user != "")
+ tbTelnr.Text = SQL.ReadSingleValue($"SELECT Tel_Nr_Verantwortlicher_Firma FROM {MainWindow.table}.firmen WHERE Name='{user}'");
}
catch (Exception)
{
@@ -37,7 +57,7 @@ namespace ZKuP
else
{
tbUser.Text = user.Split(',')[1].TrimEnd(']').Trim();
- tbTelnr.Text = SQL.ReadSingleValue($"SELECT TelNr FROM zkup.family WHERE Name='{tbUser.Text}'");
+ tbTelnr.Text = SQL.ReadSingleValue($"SELECT TelNr FROM {MainWindow.table}.family WHERE Name='{tbUser.Text}'");
cbColor.SelectedIndex = 0;
tbNummer.Focus();
}
@@ -50,19 +70,31 @@ namespace ZKuP
else if (cbColor.SelectedIndex == -1)
MessageBox.Show(this, "Kartenfarbe auswählen!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (tbUser.Text == "")
- MessageBox.Show(this, "Firma / Benutzer angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
- else if (tbTelnr.Text == "")
+ MessageBox.Show(this, "Benutzer angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ else if (_needTel && tbTelnr.Text == "")
MessageBox.Show(this, "Telefonnummer angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else
{
try
{
- await SQL.WriteSQL($"REPLACE INTO karten (kartennr,farbe,benutzer,telnr) VALUES ('{tbNummer.Text}','{(cbColor.SelectedItem as ComboBoxItem).Content.ToString()}','{tbUser.Text}','{tbTelnr.Text}')");
+ var sig = new Signature(Signature.DisclaimerType.Rot, tbUser.Text, tbTelnr.Text);
- MessageBox.Show(this, "Karte erfolgreich verknüpft", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
+ if (sig.ShowDialog() == false)
+ {
+ _signature = sig.ResultByte;
+
+ if (_signature != null)
+ {
+ await SQL.WriteSQL($"REPLACE INTO karten (kartennr,farbe,benutzer,telnr,AusgegebenDurch,AusgegebenTimestamp,Signature,Ansprechpartner) VALUES ('{tbNummer.Text}','{cbColor.SelectedValue.ToString()}','{tbUser.Text}','{tbTelnr.Text}','{Environment.UserName}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', @signature, '{_ap}')", _signature);
+
+ MessageBox.Show(this, "Karte erfolgreich verknüpft", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ ResetValues();
+ this.Close();
+ }
+ else MessageBox.Show("Unterschrift nicht gefunden\nVorgang bitte wiederholen");
+ }
- ResetValues();
- //this.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
diff --git a/ZKuP/AddVisitorsList.xaml b/ZKuP/AddVisitorsList.xaml
new file mode 100644
index 0000000..e3f4677
--- /dev/null
+++ b/ZKuP/AddVisitorsList.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/ZKuP/AddVisitorsList.xaml.cs b/ZKuP/AddVisitorsList.xaml.cs
new file mode 100644
index 0000000..d5d4dba
--- /dev/null
+++ b/ZKuP/AddVisitorsList.xaml.cs
@@ -0,0 +1,126 @@
+using MahApps.Metro.Controls;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ZKuP
+{
+ ///
+ /// Interaktionslogik für AddVisitorsList.xaml
+ ///
+ public partial class AddVisitorsList : Window
+ {
+ public int GroupID { get; private set; }
+ int width = 0;
+
+ public AddVisitorsList(int VisitorCount)
+ {
+ InitializeComponent();
+
+ BuildWindow(VisitorCount);
+ //var col = (VisitorCount / 10) + 1;
+
+ //for (int j = 0; j < col; j++)
+ //{
+ // var spGroup = new StackPanel() { Orientation = Orientation.Vertical, Margin = new Thickness(0, 0, 0, 50) };
+
+ // for (int i = 0; i < VisitorCount; i++)
+ // {
+ // var sp = new StackPanel();
+ // var tb = new TextBlock() { Text = $"Besucher Nr. {i + 1}:", Margin = new Thickness(5), Height = 20 };
+ // tb.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
+ // MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb, "Vorname Nachname");
+ // sp.Children.Add(tb);
+ // sp.Children.Add(new TextBox() { Margin = new Thickness(10, 0, 10, 0), Height = 30 });
+
+ // spGroup.Children.Add(sp);
+ // }
+ //}
+ }
+
+ private void BuildWindow(int besucherAnzahl)
+ {
+ int maxProSpalte = 10; // Maximale Anzahl an Textfeldern pro Spalte
+
+ // PanelsContainer soll die WrapPanels halten
+ spGroup.Children.Clear(); // Vorherige Panels entfernen (falls schon welche existieren)
+
+ // Erstelle die WrapPanels und füge sie dem StackPanel hinzu
+ int columnCount = (int)Math.Ceiling((double)besucherAnzahl / maxProSpalte);
+
+ for (int i = 0; i < columnCount; i++)
+ {
+ WrapPanel wrapPanel = new WrapPanel
+ {
+ Orientation = Orientation.Vertical, // Jedes WrapPanel wird vertikal sein
+ Margin = new Thickness(10),
+ Width = 300
+ };
+
+ // Für jedes WrapPanel Textfelder hinzufügen
+ for (int j = 0; j < maxProSpalte && (i * maxProSpalte + j) < besucherAnzahl; j++)
+ {
+ var sp = new StackPanel();
+ var tb = new TextBlock() { Text = $"Besucher Nr. {i * maxProSpalte + j + 1}:", Margin = new Thickness(5), Height = 20 };
+ tb.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
+ MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb, "Vorname Nachname");
+ sp.Children.Add(tb);
+ sp.Children.Add(new TextBox() { Margin = new Thickness(10, 0, 10, 0), Height = 30, Width = 280 });
+
+
+ wrapPanel.Children.Add(sp);
+ }
+
+ // Das WrapPanel zum StackPanel hinzufügen
+ spGroup.Children.Add(wrapPanel);
+ }
+
+ width = (columnCount * 320) + 10;
+ }
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ this.Height = spGroup.DesiredSize.Height + 40;
+ this.Width = width;
+ }
+
+ private async void btnAdd_Click(object sender, RoutedEventArgs e)
+ {
+ var visitors = "";
+
+ foreach (var t in this.FindChildren())
+ {
+ if(string.IsNullOrWhiteSpace(t.Text))
+ {
+ MessageBox.Show("Alle Besucher müssen eingetragen werden!", "Unzureichende Eingabe", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+ visitors += t.Text + ";";
+ }
+
+ try
+ {
+ await SQL.WriteSQL($"Insert INTO {MainWindow.table}.besucherGroups (besucherList) VALUES ('{visitors}')");
+ GroupID = Convert.ToInt32(SQL.ReadSingleValue($"SELECT LAST_INSERT_ID()"));
+
+ this.DialogResult = true;
+ this.Close();
+ }
+ catch (Exception ex)
+ {
+ Log.WriteLog(ex.ToString());
+ MessageBox.Show("Es ist ein Fehler beim hinzufügen der Besucher aufgetreten, bitte erneut versuchen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ }
+ }
+}
diff --git a/ZKuP/Arrivals.xaml b/ZKuP/Arrivals.xaml
index 89a17c6..cf15908 100644
--- a/ZKuP/Arrivals.xaml
+++ b/ZKuP/Arrivals.xaml
@@ -1,18 +1,19 @@
-
+ Title="Ankunft bestätigen" Height="720" Width="479" ResizeMode="NoResize" Topmost="True" PreviewGotKeyboardFocus="Window_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="Window_PreviewLostKeyboardFocus" WindowStyle="None" AllowsTransparency="True" Loaded="Window_Loaded">
-
+
@@ -26,64 +27,142 @@
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZKuP/Arrivals.xaml.cs b/ZKuP/Arrivals.xaml.cs
index 56c1af1..8794281 100644
--- a/ZKuP/Arrivals.xaml.cs
+++ b/ZKuP/Arrivals.xaml.cs
@@ -1,11 +1,14 @@
-using System;
+using MahApps.Metro.Controls;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
+using System.Web.UI.WebControls.WebParts;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@@ -36,6 +39,7 @@ namespace ZKuP
int fzgCount = 0;
+
///
///
///
@@ -52,11 +56,33 @@ namespace ZKuP
selectedID = id == -1 ? name : id.ToString();
isBesucher = IsBesucher;
Name = name;
+
+ if(isBesucher == 1)
+ {
+ TextBoxHelper.SetWatermark(tbVerantwortlPerson, "Verantwortlicher Besucher");
+ TextBoxHelper.SetWatermark(tbNrVerantwortlPerson, "Telefonnummer Besucher");
+ }
+
+ var park = SQL.ReadListString($"SELECT parkplatznr FROM {MainWindow.table}.`parkplaetze` WHERE parkplatznr LIKE 'G%'").Result;
+ var rectsG = BesuchP.Children.OfType();
+
+ foreach (Rectangle s in rectsG)
+ {
+ if (park.Contains(s.Name))
+ {
+ //var x = Helper.FindVisualChildren(BE, s.Name).First();
+ s.Fill = new SolidColorBrush(Colors.Red);
+ }
+ else if (!s.Name.StartsWith("Red"))
+ {
+ s.Fill = new SolidColorBrush(Colors.Green);
+ }
+ }
}
private async Task initialize()
{
- var list = await SQL.ReadDictionary("Select idFirmen, Name FROM zkup.firmen ORDER BY Name", 0, 1);
+ var list = await SQL.ReadDictionary($"Select idFirmen, Name FROM {MainWindow.table}.firmen ORDER BY Name", 0, 1);
//list = list.OrderBy(p => p.Value).ToDictionary();
NamesList.Add(0, "Firmen:");
@@ -72,7 +98,7 @@ namespace ZKuP
firmenCount = NamesList.Count;
- list = await SQL.ReadDictionary("Select idBesucher, Name FROM zkup.besucher ORDER BY Name", 0, 1);
+ list = await SQL.ReadDictionary($"Select idBesucher, Name FROM {MainWindow.table}.besucher ORDER BY Name", 0, 1);
//list.OrderBy(p => p).ToList();
NamesList.Add(999994, "Besucher:");
@@ -89,7 +115,7 @@ namespace ZKuP
besucherCount = NamesList.Count - firmenCount;
- list = await SQL.ReadDictionary("Select idfamily, Name FROM zkup.family ORDER BY Name", 0, 1);
+ list = await SQL.ReadDictionary($"Select idfamily, Name FROM {MainWindow.table}.family ORDER BY Name", 0, 1);
//list.OrderBy(p => p).ToList();
NamesList.Add(999999, "Führung:");
@@ -127,19 +153,19 @@ namespace ZKuP
if (isBesucher == 0)
{
- tbVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA_Firma FROM zkup.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1");
- tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Tel_Nr_Verantwortlicher_Firma FROM zkup.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1");
+ tbVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA_Firma FROM {MainWindow.table}.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1");
+ tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Tel_Nr_Verantwortlicher_Firma FROM {MainWindow.table}.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1");
}
else if (isBesucher == 1)
{
- tbVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Name FROM zkup.besucher WHERE `idbesucher` = '{selectedID}' LIMIT 1");
- tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Tel_Nr_Besucher FROM zkup.besucher WHERE `idbesucher` = '{selectedID}' LIMIT 1");
+ tbVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA FROM {MainWindow.table}.besucher WHERE `idbesucher` = '{selectedID}' LIMIT 1");
+ tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Tel_Nr_Besucher FROM {MainWindow.table}.besucher WHERE `idbesucher` = '{selectedID}' LIMIT 1");
}
else if (isBesucher == 2)
{
tbVerantwortlPerson.Text = Name;
- tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT TelNr AS Tel_Nr_Besucher FROM zkup.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
- tbAnzahlPersonen.Text = await SQL.ReadSingleValueAsync($"SELECT AnzBegleiter FROM zkup.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
+ tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT TelNr AS Tel_Nr_Besucher FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
+ tbAnzahlPersonen.Text = await SQL.ReadSingleValueAsync($"SELECT AnzBegleiter FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
}
}
//else if (isBesucher == 2)
@@ -152,8 +178,8 @@ namespace ZKuP
// //cbName.SelectedItem = cbName.Items.IndexOf(cbName.ItemsSource as )
// //cbName.SelectedValue = Name;
// tbVerantwortlPerson.Text = Name;
- // tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT TelNr AS Tel_Nr_Besucher FROM zkup.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
- // tbAnzahlPersonen.Text = await SQL.ReadSingleValueAsync($"SELECT AnzBegleiter FROM zkup.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
+ // tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT TelNr AS Tel_Nr_Besucher FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
+ // tbAnzahlPersonen.Text = await SQL.ReadSingleValueAsync($"SELECT AnzBegleiter FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
//}
else
{
@@ -169,15 +195,53 @@ namespace ZKuP
btnSignature.ToolTip = "Kein Unterschriftenpad gefunden";
}
}));
+
+ string x = SQL.ReadSingleValue($"SELECT BEint FROM {MainWindow.table}.firmen WHERE idFirmen = '{selectedID}'");
+ int beID = Convert.ToInt16(x != "" ? x : "-1");
+ if (isBesucher == 0 && (beID != -1))
+ {
+ imgBE.Source = new BitmapImage(new Uri(@"pack://application:,,,/"
+ + System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
+ + ";component/"
+ + $"Assets/BE{beID.ToString()}.png", UriKind.Absolute));
+ popBE.IsOpen = true;
+ }
+
+ if (isBesucher == 1)
+ {
+ gridBesucherPark.Visibility = Visibility.Visible;
+ GParkRow.Height = new GridLength(1.8, GridUnitType.Star);
+ this.Height = this.Height + 100;
+ GParkTop.Height = new GridLength(GParkTop.Height.Value + 100, GridUnitType.Pixel);
+
+ var besucher = SQL.ReadSingleValue($"SELECT besucherList FROM {MainWindow.table}.besucherGroups WHERE idBesucher = '{selectedID}'");
+
+ if (besucher.Contains(';'))
+ {
+ var finalBesucher = besucher.TrimEnd(';').Split(';');
+ lblAngemeldeteBesucher.Text = $"{finalBesucher.Length} angemeldet";
+
+ foreach (var b in finalBesucher)
+ {
+ var lbl = new TextBlock() { Text = "- " + b, Height = 25, FontSize = 14 };
+ lbl.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
+
+ spBesucher.Children.Add(lbl);
+ }
+
+ popBesucher.Height = 50 + (finalBesucher.Length * 25) + 10;
+ popBesucher.IsOpen = true;
+ }
+ }
}
private async void BtnCheck_Click(object sender, RoutedEventArgs e)
{
var zutritt = "";
+ string kat = "1";
var einweis = "";
var kl_einweis = "";
- string kat = "1";
string asp = "";
string anzFzg = "";
int klUnterweis = 0;
@@ -187,17 +251,17 @@ namespace ZKuP
if (cbName.SelectedIndex < firmenCount)
{
- table = await SQL.ReadSQL("Select * FROM zkup.firmen");
+ table = await SQL.ReadSQL($"Select * FROM {MainWindow.table}.firmen");
kat = "1";
}
else if (cbName.SelectedIndex >= (firmenCount + besucherCount + 2))
{
- table = await SQL.ReadSQL("Select * FROM zkup.family");
+ table = await SQL.ReadSQL($"Select * FROM {MainWindow.table}.family");
kat = "5";
}
else
{
- table = await SQL.ReadSQL("Select * FROM zkup.besucher");
+ table = await SQL.ReadSQL($"Select * FROM {MainWindow.table}.besucher");
kat = "2";
}
@@ -290,7 +354,8 @@ namespace ZKuP
}
if (kat == "2")
- {
+ {
+
if (DateTime.TryParse(row.ItemArray[5].ToString(), out beginnDT))
{
if (DateTime.Now.Date == beginnDT)
@@ -421,7 +486,12 @@ namespace ZKuP
btnSignature.Content = "Unterschrift bereits vorhanden";
}
- if (arrivalClicked) btnClose.IsEnabled = true;
+ if (arrivalClicked) btnKarte.IsEnabled = true;
+ if (kat == "2")
+ {
+ Helper.PrintPDF("\\\\mhb00swfs003v.fv-werke.db.de\\GLW99\\ZKuP\\Einweisungsflyer.pdf");
+ btnCheck.Content = "Einweisungflyer wird gedruckt...";
+ }
}
@@ -487,7 +557,7 @@ namespace ZKuP
string a_Fzg = "0";
if (cbName.SelectedIndex < firmenCount)
{
- a_Fzg = await SQL.ReadSingleValueAsync($"SELECT Anzahl_Fzg FROM zkup.firmen WHERE `idFirmen`='{selectedID}' AND `Arbeitsbeginn` <= current_date() AND `Arbeitsende` >= current_date()");
+ a_Fzg = await SQL.ReadSingleValueAsync($"SELECT Anzahl_Fzg FROM {MainWindow.table}.firmen WHERE `idFirmen`='{selectedID}' AND `Arbeitsbeginn` <= current_date() AND `Arbeitsende` >= current_date()");
lblAngemeldeteFzg.Text = !string.IsNullOrWhiteSpace(a_Fzg) ? a_Fzg + " Fzg. angemeldet" : "keine Fzg. angemeldet";
}
else
@@ -527,7 +597,7 @@ namespace ZKuP
Padding = new Thickness(5, 0, 0, 0)
});
- this.Height = this.Height + 11;
+ this.Height = this.Height + 15;
}
}
@@ -536,6 +606,53 @@ namespace ZKuP
}
}
+
+
+
+
+
+
+ List selectedGPark = new List();
+ private async void G_ParkPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ var block = sender as TextBlock;
+ var parkplatz = block.Text;
+
+ foreach (var rect in BesuchP.Children.OfType())
+ {
+ if (rect.Name == "G" + parkplatz)
+ {
+ if (rect.Fill.ToString() == Colors.Red.ToString())
+ {
+ rect.Fill = new SolidColorBrush(Colors.Green);
+ await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.parkplaetze WHERE parkplatznr='G{parkplatz}'");
+ selectedGPark.Remove(parkplatz);
+ }
+ else if (rect.Fill.ToString() == Colors.Green.ToString())
+ {
+ rect.Fill = new SolidColorBrush(Colors.Red);
+ await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.parkplaetze (parkplatznr) VALUES ('G{parkplatz}')");
+ selectedGPark.Add(parkplatz);
+ }
+ }
+ }
+
+ if (selectedGPark.Count > 0)
+ {
+ string s = "";
+ s = String.Join(", ", selectedGPark.OrderBy(p => p));
+ //s = s.TrimEnd(',');
+ borderParkkarteAusgeben.Visibility = Visibility.Visible;
+ lblParkkarteAusgeben.Text = $"Parkkarte Nr. {s}\nan Besucher {cbName.Text} ausgeben";
+ }
+ else
+ {
+ lblParkkarteAusgeben.Text = "";
+ borderParkkarteAusgeben.Visibility = Visibility.Collapsed;
+ }
+ }
+
+
private async void btnSignature_Click(object sender, RoutedEventArgs e)
{
string kat = "1";
@@ -559,12 +676,12 @@ namespace ZKuP
//if (cbName.SelectedIndex < firmenCount)
//{
// //firmaBesucher = cbName.SelectedItem.ToString();
- // name = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA_Firma FROM zkup.firmen WHERE `idFirmen` = '{selectedID}'");
+ // name = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA_Firma FROM {MainWindow.table}.firmen WHERE `idFirmen` = '{selectedID}'");
//}
//else
//{
// //firmaBesucher = cbName.SelectedItem.ToString();
- // name = await SQL.ReadSingleValueAsync($"SELECT Ansprechpartner_Intern FROM zkup.besucher WHERE `idBesucher` = '{selectedID}'");
+ // name = await SQL.ReadSingleValueAsync($"SELECT Ansprechpartner_Intern FROM {MainWindow.table}.besucher WHERE `idBesucher` = '{selectedID}'");
//}
name = tbVerantwortlPerson.Text;
@@ -593,9 +710,9 @@ namespace ZKuP
else { btnSignature.IsEnabled = true; btnSignature.Content = "Unterschrift einholen!"; }
if (!cbName.SelectedValue.ToString().StartsWith("9999"))
- await SQL.WriteSQL($"UPDATE zkup.firmen SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idFirmen` = '{selectedID}'");
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.firmen SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idFirmen` = '{selectedID}'");
else
- await SQL.WriteSQL($"UPDATE zkup.besucher SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idBesucher` = '{selectedID}'");
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idBesucher` = '{selectedID}'");
//
@@ -611,9 +728,38 @@ namespace ZKuP
private void btnKarte_Click(object sender, RoutedEventArgs e)
{
- AddCardUser aI = new AddCardUser(cbName.SelectedItem.ToString());
- aI.Owner = this;
- aI.ShowDialog();
+ if (!string.IsNullOrWhiteSpace(tbAnzahlPersonen.Text))
+ {
+ var ap = SQL.ReadSingleValue($"SELECT Ansprechpartner_Intern FROM {MainWindow.table}.firmen WHERE idFirmen='{selectedID}'");
+ var user = "";
+ if(isBesucher == 1 && Convert.ToInt16(tbAnzahlPersonen.Text) > 1)
+ {
+ user = SQL.ReadSingleValue($"SELECT besucherList FROM {MainWindow.table}.besucherGroups WHERE idbesucher = '{selectedID}'");
+ }
+
+ for (var i = 0; i < Convert.ToInt16(tbAnzahlPersonen.Text); i++)
+ {
+ if (i == 0)
+ {
+ AddCardUser aI = new AddCardUser(cbName.SelectedItem.ToString(), isBesucher == 1 ? true : false, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap);
+ aI.Owner = this;
+ aI.ShowDialog();
+ }
+ else
+ {
+ var u = "";
+ if (user.Contains(';')) u = user.Split(';')[i - 1];
+
+ AddCardUser aI = new AddCardUser(u, isBesucher == 1 ? true : false, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap, false);
+ aI.Owner = this;
+ aI.ShowDialog();
+ }
+ }
+
+
+ if (arrivalClicked) btnClose.IsEnabled = true;
+ }
+ else MessageBox.Show("Anzahl Personen muss angegeben werden", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
private void Window_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
@@ -658,6 +804,12 @@ namespace ZKuP
private void tbAnzahlFzg_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
+ if(isBesucher == 1)
+ {
+ MessageBox.Show("Besucher dürfen nicht mit einem Fahrzeug einfahren!\nDem Besucher einen Besucherparkplatz zuweisen!", "Einfahrt verboten!", MessageBoxButton.OK, MessageBoxImage.Error);
+ e.Handled = true;
+ }
+
if (!Regex.IsMatch(e.Text, "[0-9]"))
{
e.Handled = true;
@@ -668,5 +820,15 @@ namespace ZKuP
tip.IsOpen = true;
}
}
+
+ private void btnCloseBE_Click(object sender, RoutedEventArgs e)
+ {
+ popBE.IsOpen = false;
+ }
+
+ private void btnClosePopBesucher_Click(object sender, RoutedEventArgs e)
+ {
+ popBesucher.IsOpen = false;
+ }
}
}
diff --git a/ZKuP/ArrivalsOverview.xaml b/ZKuP/ArrivalsOverview.xaml
index dc45bcb..5927887 100644
--- a/ZKuP/ArrivalsOverview.xaml
+++ b/ZKuP/ArrivalsOverview.xaml
@@ -80,7 +80,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
diff --git a/ZKuP/Cards.xaml.cs b/ZKuP/Cards.xaml.cs
index 6e0e10b..e667134 100644
--- a/ZKuP/Cards.xaml.cs
+++ b/ZKuP/Cards.xaml.cs
@@ -1,5 +1,7 @@
-using System;
+using ControlzEx.Standard;
+using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -33,10 +35,10 @@ namespace ZKuP
{
InitializeComponent();
- karten = SQL.ReadSQL("Select * from zkup.karten", karten).Result;
+ karten = SQL.ReadSQL($"Select * from {MainWindow.table}.karten", karten).Result;
dgCards.DataContext = karten;
- mcFit = SQL.ReadSQL("SELECT * FROM zkup.mcFit", mcFit).Result;
+ mcFit = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.mcFit", mcFit).Result;
dgMcFit.DataContext = mcFit;
textInputTimer.Interval = TimeSpan.FromSeconds(0.5);
@@ -45,20 +47,7 @@ namespace ZKuP
private async void dgCards_PreviewKeyDown(object sender, KeyEventArgs e)
{
- var dg = sender as DataGrid;
- var row = dg.SelectedItem as System.Data.DataRowView;
- var arr = row.Row.ItemArray;
-
- if (e.Key == Key.Delete)
- {
- if (MessageBox.Show(this, $"Karte {arr[1]},\nausgegeben an {arr[3]} wirklich entfernen?", "Karte entfernen?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
- {
- await SQL.WriteSQL($"DELETE FROM zkup.karten WHERE `kartennr` = '{arr[1]}'");
-
- karten = await SQL.ReadSQL("Select * FROM zkup.karten", karten);
- dgCards.DataContext = karten;
- }
- }
+ if (e.Key == Key.Delete) await DeleteCard();
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
@@ -67,7 +56,7 @@ namespace ZKuP
addCardUser.Owner = this;
addCardUser.ShowDialog();
- karten = SQL.ReadSQL("Select * from zkup.karten", karten).Result;
+ karten = SQL.ReadSQL($"Select * from {MainWindow.table}.karten", karten).Result;
dgCards.DataContext = karten;
}
@@ -81,18 +70,101 @@ namespace ZKuP
else btnDelete.IsEnabled = false;
}
private async void btnDelete_Click(object sender, RoutedEventArgs e)
+ {
+ await DeleteCard();
+ }
+
+ private async Task DeleteCard()
{
var dg = dgCards;
var row = dg.SelectedItem as System.Data.DataRowView;
var arr = row.Row.ItemArray;
- if(MessageBox.Show(this, $"Karte {arr[1]},\nausgegeben an {arr[3]} wirklich entfernen?", "Karte entfernen?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
+ string cardsQuery = "";
+ string cardsQueryTimestamp = "";
+ string rueckgeber = "";
+
+ for (int i = 0; i < dg.Items.Count; i++)
{
+ DataRowView item = dg.Items[i] as DataRowView;
+ var r = dg.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow;
+ if (r != null)
+ {
+ var mycheckbox = dg.Columns[0].GetCellContent(r) as CheckBox;
+ if ((bool)mycheckbox.IsChecked)
+ {
+ cardsQuery += (item as DataRowView).Row.ItemArray[1].ToString() + ";";
+ cardsQueryTimestamp += (item as DataRowView).Row.ItemArray[6].ToString() + ";";
- await SQL.WriteSQL($"DELETE FROM zkup.karten WHERE `kartennr` = '{arr[1]}'");
+ if (!string.IsNullOrWhiteSpace((item as DataRowView).Row.ItemArray[7].ToString()))
+ rueckgeber = (item as DataRowView).Row.ItemArray[7].ToString();
+ }
+ }
+ }
- karten = await SQL.ReadSQL("Select * FROM zkup.karten", karten);
- dgCards.DataContext = karten;
+ if (cardsQuery == "")
+ {
+ if (MessageBox.Show(this, $"Karte {arr[1]},\nausgegeben an {arr[3]} wurde zurückgegeben?\n\nUnterschrift des Zurückgebers wird abgefragt...", "Karte zurückgegeben?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
+ {
+ var sig = new Signature(Signature.DisclaimerType.Rueck, arr[3].ToString(), arr[1].ToString(), "", true, arr[7].ToString());
+
+ if (sig.ShowDialog() == false)
+ {
+ _signature = sig.ResultByte;
+
+ if (_signature != null)
+ {
+ await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.karten WHERE `kartennr` = '{arr[1]}'");
+
+ karten = await SQL.ReadSQL($"Select * FROM {MainWindow.table}.karten", karten);
+ dgCards.DataContext = karten;
+
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.kartenLog SET RueckgabeSignature = @signature, Ansprechpartner = '{arr[7]}' WHERE idkarten = '{arr[0]}' AND Ausgebucht = 1 AND `timestamp` > (now() - INTERVAL 2 MINUTE)", _signature);
+
+ this.Close();
+ }
+ }
+ }
+ }
+ else
+ {
+ string cards = "";
+ string delCards = "";
+ string delCardsLog = "";
+ for(var i = 0; i < cardsQuery.Split(';').Length - 1; i++)
+ {
+ cards += $"{cardsQuery.Split(';')[i].Trim()} ausgegeben am: {cardsQueryTimestamp.Split(';')[i]}\n";
+ delCards += $"`kartennr` = '{cardsQuery.Split(';')[i].Trim()}' OR ";
+
+ delCardsLog += $"(`kartennr` = '{cardsQuery.Split(';')[i].Trim()}' AND Ausgebucht = 1 AND `timestamp` > (now() - INTERVAL 2 MINUTE)) OR ";
+ }
+ int lastIndex = delCards.LastIndexOf(" OR ");
+ if (lastIndex != -1) delCards = delCards.Remove(lastIndex);
+
+ int lastIndexLog = delCardsLog.LastIndexOf(" OR ");
+ if (lastIndexLog != -1) delCardsLog = delCardsLog.Remove(lastIndexLog);
+
+ if (MessageBox.Show(this, $"Die Karten\n\n{cards}\nwurden zurückgegeben?\n\nUnterschrift des Zurückgebers wird abgefragt...", "Karten zurückgegeben?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
+ {
+ var sig = new Signature(Signature.DisclaimerType.Rueck, arr[3].ToString(), arr[1].ToString(), "", true, rueckgeber);
+
+ if (sig.ShowDialog() == false)
+ {
+ _signature = sig.ResultByte;
+
+ if (_signature != null)
+ {
+ await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.karten WHERE {delCards}");
+
+ karten = await SQL.ReadSQL($"Select * FROM {MainWindow.table}.karten", karten);
+ dgCards.DataContext = karten;
+
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.kartenLog SET RueckgabeSignature = @signature WHERE {delCardsLog}", _signature);
+
+ this.Close();
+ }
+ }
+ }
}
}
@@ -117,7 +189,7 @@ namespace ZKuP
{
textInputTimer.Stop();
- var cBItemSource = await SQL.ReadListStringMultipleColumns($"SELECT idmcFitUsers, Name, Vorname FROM zkup.mcFitUsers WHERE `Name` LIKE '{lastTextBox.Text}%'");
+ var cBItemSource = await SQL.ReadListStringMultipleColumns($"SELECT idmcFitUsers, Name, Vorname FROM {MainWindow.table}.mcFitUsers WHERE `Name` LIKE '{lastTextBox.Text}%'");
List temp = new List();
foreach (var line in cBItemSource)
@@ -139,7 +211,7 @@ namespace ZKuP
{
if (cBNameAusgabe != null && cBNameAusgabe.SelectedItem != null)
{
- var result = await SQL.ReadListStringMultipleColumns($"SELECT Name,Vorname,Abteilung,Handynr,Email FROM zkup.mcFitUsers WHERE idmcFitUsers = '{cBNameAusgabe.SelectedItem.ToString().Split(' ')[0]}'", 5);
+ var result = await SQL.ReadListStringMultipleColumns($"SELECT Name,Vorname,Abteilung,Handynr,Email FROM {MainWindow.table}.mcFitUsers WHERE idmcFitUsers = '{cBNameAusgabe.SelectedItem.ToString().Split(' ')[0]}'", 5);
tbAusNachname.TextChanged -= tbAusNachname_TextChanged;
@@ -157,7 +229,7 @@ namespace ZKuP
{
int Kartennr = Convert.ToInt32(cBZurKarte.SelectedValue.ToString().Split(' ')[2]);
- var result = await SQL.ReadListStringMultipleColumns($"SELECT Nachname,Vorname,Abteilung,Handynr,Email FROM zkup.mcFit WHERE Kartennr = '{Kartennr}'", 5);
+ var result = await SQL.ReadListStringMultipleColumns($"SELECT Nachname,Vorname,Abteilung,Handynr,Email FROM {MainWindow.table}.mcFit WHERE Kartennr = '{Kartennr}'", 5);
tbZurNachname.Text = result.First().Split(';')[0];
tbZurVorname.Text = result.First().Split(';')[1];
@@ -190,9 +262,9 @@ namespace ZKuP
int Kartennr = Convert.ToInt32(cBAusKarte.SelectedValue.ToString().Split(' ')[2]);
- await SQL.WriteSQL($"UPDATE zkup.mcFit SET Vorname = '{tbAusVorname.Text}', Nachname = '{tbAusNachname.Text}', Abteilung = '{tbAusAbteilung.Text}', Handynr = '{tbAusHandy.Text}', Email = '{tbAusEmail.Text}', AusgabeTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', ZurueckTimestamp = null, AktuellAusgegeben = '1', Signature = @signature WHERE Kartennr = '{Kartennr}'", _signature);
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.mcFit SET Vorname = '{tbAusVorname.Text}', Nachname = '{tbAusNachname.Text}', Abteilung = '{tbAusAbteilung.Text}', Handynr = '{tbAusHandy.Text}', Email = '{tbAusEmail.Text}', AusgabeTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', ZurueckTimestamp = null, AktuellAusgegeben = '1', Signature = @signature, AusgegebenDruch = '{Environment.UserName}' WHERE Kartennr = '{Kartennr}'", _signature);
- mcFit = SQL.ReadSQL("SELECT * FROM zkup.mcFit", mcFit).Result;
+ mcFit = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.mcFit", mcFit).Result;
dgMcFit.DataContext = mcFit;
}
}
@@ -212,9 +284,9 @@ namespace ZKuP
{
int Kartennr = Convert.ToInt32(cBZurKarte.SelectedValue.ToString().Split(' ')[2]);
- await SQL.WriteSQL($"UPDATE zkup.mcFit SET ZurueckTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', AktuellAusgegeben = '0' WHERE Kartennr = '{Kartennr}'");
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.mcFit SET ZurueckTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', AktuellAusgegeben = '0' WHERE Kartennr = '{Kartennr}'");
- mcFit = SQL.ReadSQL("SELECT * FROM zkup.mcFit", mcFit).Result;
+ mcFit = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.mcFit", mcFit).Result;
dgMcFit.DataContext = mcFit;
}
@@ -222,7 +294,7 @@ namespace ZKuP
{
var signBtn = ((sender as Button).DataContext) as System.Data.DataRowView;
- var i = SQL.ReadSingleByteArr($"SELECT Signature FROM zkup.mcFit WHERE Kartennr = '{(signBtn).Row.ItemArray[0].ToString()}'");
+ var i = SQL.ReadSingleByteArr($"SELECT Signature FROM {MainWindow.table}.mcFit WHERE Kartennr = '{(signBtn).Row.ItemArray[0].ToString()}'");
BitmapImage image = null;
if (i != null)
@@ -234,5 +306,15 @@ namespace ZKuP
iv.Owner = this;
iv.ShowDialog();
}
+
+ private void GruenRot_Click(object sender, RoutedEventArgs e)
+ {
+ tabcontrol.SelectedIndex = 0;
+ }
+
+ private void McFit_Click(object sender, RoutedEventArgs e)
+ {
+ tabcontrol.SelectedIndex = 1;
+ }
}
}
diff --git a/ZKuP/CheckKennzeichen.xaml.cs b/ZKuP/CheckKennzeichen.xaml.cs
index d735b1c..1dd000a 100644
--- a/ZKuP/CheckKennzeichen.xaml.cs
+++ b/ZKuP/CheckKennzeichen.xaml.cs
@@ -40,7 +40,7 @@ namespace ZKuP
{
if (!string.IsNullOrWhiteSpace(tbKennzeichen.Text))
{
- var list = SQL.ReadSQL($"SELECT Kennzeichen, Name, Ansprechpartner, DATE_FORMAT(Zutritt, \"%d.%m.%y %I:%i\") AS \"Zutritt\" FROM zkup.zutritte WHERE Kennzeichen LIKE '%{tbKennzeichen.Text}%'").Result;
+ var list = SQL.ReadSQL($"SELECT Kennzeichen, Name, Ansprechpartner, DATE_FORMAT(Zutritt, \"%d.%m.%y %I:%i\") AS \"Zutritt\" FROM {MainWindow.table}.zutritte WHERE Kennzeichen LIKE '%{tbKennzeichen.Text}%'").Result;
if (list.Rows.Count == 0)
list.Rows.Add("Keine Ergebnisse...");
diff --git a/ZKuP/CheckParkausweis.xaml.cs b/ZKuP/CheckParkausweis.xaml.cs
index 771408b..497b7a7 100644
--- a/ZKuP/CheckParkausweis.xaml.cs
+++ b/ZKuP/CheckParkausweis.xaml.cs
@@ -23,14 +23,14 @@ namespace ZKuP
{
InitializeComponent();
- var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM zkup.parkausweise WHERE Genehmigt = '1'").Result;
+ var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM {MainWindow.table}.parkausweise WHERE Genehmigt = '1'").Result;
dgCheck.DataContext = list;
}
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
- var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM zkup.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
+ var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM {MainWindow.table}.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
dgCheck.DataContext = list;
}
@@ -49,7 +49,7 @@ namespace ZKuP
{
if(e.Key == Key.Enter)
{
- var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM zkup.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
+ var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM {MainWindow.table}.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
dgCheck.DataContext = list;
}
}
@@ -60,7 +60,7 @@ namespace ZKuP
await Task.Run(() =>
{
- var res = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM zkup.parkausweise WHERE Gedruckt = '1'").Result;
+ var res = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM {MainWindow.table}.parkausweise WHERE Gedruckt = '1'").Result;
var ex = new ExcelExporter();
ex.Export(res);
});
diff --git a/ZKuP/CreateFirma.xaml b/ZKuP/CreateFirma.xaml
index 9bb6ac3..e1543b9 100644
--- a/ZKuP/CreateFirma.xaml
+++ b/ZKuP/CreateFirma.xaml
@@ -7,7 +7,7 @@
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" x:Class="ZKuP.CreateFirma"
mc:Ignorable="d"
Title="Firmen verwalten" Height="682" Width="1378"
- WindowStartupLocation="CenterOwner">
+ WindowStartupLocation="CenterOwner" Closing="Window_Closing">
@@ -191,7 +191,7 @@
-
+
@@ -205,8 +205,8 @@
-
-
+
+
+
+ Setter setter = new Setter();
+ setter.Property = Calendar.TemplateProperty;
+ ControlTemplate template = new ControlTemplate(typeof(Calendar));
+ var stackPanel = new FrameworkElementFactory(typeof(StackPanel));
+ stackPanel.Name = "PART_Root";
+ stackPanel.SetValue(StackPanel.HorizontalAlignmentProperty, HorizontalAlignment.Center);
+
+ var calendar = new FrameworkElementFactory(typeof(CalendarItem));
+ calendar.Name = "PART_CalendarItem";
+
+ calendar.SetBinding(CalendarItem.BackgroundProperty,
+ new Binding(CalendarItem.BackgroundProperty.Name)
+ {
+ Path = new PropertyPath(Control.BackgroundProperty),
+ RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent)
+ });
+
+ calendar.SetBinding(CalendarItem.BorderBrushProperty, new Binding(CalendarItem.BorderBrushProperty.Name)
+ {
+ Path = new PropertyPath(Control.BorderBrushProperty),
+ RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent)
+ });
+
+ calendar.SetBinding(CalendarItem.BorderThicknessProperty, new Binding(CalendarItem.BorderThicknessProperty.Name)
+ {
+ Path = new PropertyPath(Control.BorderThicknessProperty),
+ RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent)
+ });
+
+ calendar.SetBinding(CalendarItem.StyleProperty, new Binding(CalendarItem.StyleProperty.Name)
+ {
+ Path = new PropertyPath(Calendar.CalendarItemStyleProperty),
+ RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent)
+ });
+
+ stackPanel.AppendChild(calendar);
+
+ var btn = new FrameworkElementFactory(typeof(Button));
+ btn.SetValue(Button.ContentProperty, GetShowTodayButtonContent(d));
+
+ var SelectToday = new RoutedCommand("Today", typeof(DatePickerHelper));
+
+ d.CommandBindings.Add(new CommandBinding(SelectToday,
+ (s, ea) =>
+ {
+ (s as DatePicker).SelectedDate = DateTime.Now.Date;
+ (s as DatePicker).IsDropDownOpen = false;
+ },
+ (s, ea) => { ea.CanExecute = true; }));
+
+ btn.SetValue(Button.CommandProperty, SelectToday);
+
+ stackPanel.AppendChild(btn);
+
+ template.VisualTree = stackPanel;
+ setter.Value = template;
+
+ Style Temp = new Style(typeof(Calendar));
+
+ Temp.Setters.Add(setter);
+
+ d.CalendarStyle = Temp;
+ }
+ }
+ }
+
+ [AttachedPropertyBrowsableForType(typeof(DatePicker))]
+ public static bool GetShowTodayButton(DependencyObject obj)
+ {
+ return (bool)obj.GetValue(ShowTodayButtonProperty);
+ }
+
+ [AttachedPropertyBrowsableForType(typeof(DatePicker))]
+ public static void SetShowTodayButton(DependencyObject obj, bool value)
+ {
+ obj.SetValue(ShowTodayButtonProperty, value);
+ }
+
+ [AttachedPropertyBrowsableForType(typeof(DatePicker))]
+ public static string GetShowTodayButtonContent(Control obj)
+ {
+ return (string)obj.GetValue(ShowTodayButtonContentProperty);
+ }
+
+ [AttachedPropertyBrowsableForType(typeof(DatePicker))]
+ public static void SetShowTodayButtonContent(Control obj, string value)
+ {
+ obj.SetValue(ShowTodayButtonContentProperty, value);
+ }
+ }
}
diff --git a/ZKuP/ImageView.xaml b/ZKuP/ImageView.xaml
index aa29814..8185861 100644
--- a/ZKuP/ImageView.xaml
+++ b/ZKuP/ImageView.xaml
@@ -5,20 +5,28 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
- Title="Unterschriftenanzeige" Height="342" Width="419">
+ Title="Unterschriftenanzeige" Height="370" Width="419" Loaded="Window_Loaded">
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZKuP/ImageView.xaml.cs b/ZKuP/ImageView.xaml.cs
index fb787c7..8cc6424 100644
--- a/ZKuP/ImageView.xaml.cs
+++ b/ZKuP/ImageView.xaml.cs
@@ -19,12 +19,31 @@ namespace ZKuP
///
public partial class ImageView : Window
{
-
+ Categories category = Categories.Zutritte;
+
+
+ enum Categories
+ {
+ Zutritte,
+ Karten,
+ McFit
+ }
+
+
+ BitmapImage _image = null;
+ bool _showComboBox = false;
+
public ImageView(BitmapImage image, bool showComboBox = false)
{
- InitializeComponent();
+ _image = image;
+ _showComboBox = showComboBox;
- Task.Run(() => Init(image, showComboBox));
+ InitializeComponent();
+ }
+
+ private async void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ await Task.Run(() => Init(_image, _showComboBox));
dPDate.SelectedDate = DateTime.Now;
}
@@ -44,32 +63,64 @@ namespace ZKuP
}));
else
{
- var list = await SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM zkup.zutritteLog");
- list = list.OrderByDescending(p => p).ToList();
+ //var list = await SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog");
+ //list = list.OrderByDescending(p => p).ToList();
Dispatcher.Invoke(new Action(() =>
{
- cBSignature.ItemsSource = list;
+ //cBSignature.ItemsSource = list;
gridSpinner.Visibility = Visibility.Collapsed;
}));
- }
+ }
}
private void cBSignature_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (cBSignature.SelectedItem != null && cBSignature.SelectedIndex != -1)
+ switch (category)
{
- var i = SQL.ReadSingleByteArr($"SELECT signature_blob FROM zkup.zutritteLog WHERE Name = '{cBSignature.SelectedItem.ToString().Split(';')[1]}' AND Zutritt = '{cBSignature.SelectedItem.ToString().Split(';')[0]}'");
+ case Categories.Zutritte:
+ if (cBSignature.SelectedItem != null && cBSignature.SelectedIndex != -1)
+ {
+ var i = SQL.ReadSingleByteArr($"SELECT signature_blob FROM {MainWindow.table}.zutritteLog WHERE Name = '{cBSignature.SelectedItem.ToString().Split(';')[1]}' AND Zutritt = '{cBSignature.SelectedItem.ToString().Split(';')[0]}'");
- if (i != null)
- imageSignature.Source = Helper.ConvertBitmapToImage(i);
- else
- imageSignature.Source = new BitmapImage(new Uri(@"/Resources/NoSignature.png", UriKind.Relative));
- //MessageBox.Show(this, "Keine Unterschrift vorhanden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ if (i != null)
+ imageSignature.Source = Helper.ConvertBitmapToImage(i);
+ else
+ imageSignature.Source = new BitmapImage(new Uri(@"/Resources/NoSignature.png", UriKind.Relative));
+ //MessageBox.Show(this, "Keine Unterschrift vorhanden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ break;
+ case Categories.Karten:
+ if (cBSignature.SelectedItem != null && cBSignature.SelectedIndex != -1)
+ {
+ var i = SQL.ReadSingleByteArr($"SELECT Signature FROM {MainWindow.table}.kartenLog WHERE benutzer = '{cBSignature.SelectedItem.ToString().Split(';')[1]}' AND AusgegebenTimestamp = '{cBSignature.SelectedItem.ToString().Split(';')[0]}'");
+
+
+ if (i != null)
+ imageSignature.Source = Helper.ConvertBitmapToImage(i);
+ else
+ imageSignature.Source = new BitmapImage(new Uri(@"/Resources/NoSignature.png", UriKind.Relative));
+ //MessageBox.Show(this, "Keine Unterschrift vorhanden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ break;
+ case Categories.McFit:
+ if (cBSignature.SelectedItem != null && cBSignature.SelectedIndex != -1)
+ {
+ var i = SQL.ReadSingleByteArr($"SELECT Signature FROM {MainWindow.table}.mcFitLog WHERE Nachname = '{cBSignature.SelectedItem.ToString().Split(';')[1]}' AND AusgabeTimestamp = '{cBSignature.SelectedItem.ToString().Split(';')[0]}'");
+
+
+ if (i != null)
+ imageSignature.Source = Helper.ConvertBitmapToImage(i);
+ else
+ imageSignature.Source = new BitmapImage(new Uri(@"/Resources/NoSignature.png", UriKind.Relative));
+ //MessageBox.Show(this, "Keine Unterschrift vorhanden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ break;
}
+
}
private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
@@ -122,25 +173,46 @@ namespace ZKuP
}
private void Filtern()
+ {
+ switch (category)
+ {
+ case Categories.Zutritte:
+ FilterZutritte();
+ break;
+ case Categories.Karten:
+ FilterKarten();
+ break;
+ case Categories.McFit:
+ FilterMcFit();
+ break;
+ }
+
+ if (cBSignature.Items.Count == 0) cBSignature.ItemsSource = new List() { "Keine Einträge gefunden..." };
+
+ //cBSignature.IsDropDownOpen = false;
+ //cBSignature.IsDropDownOpen = true;
+ }
+
+ private void FilterZutritte()
{
string withSign = "";
if (cbOnlyWithSignature.IsChecked.Value) withSign = " AND signature_blob IS NOT NULL";
if (dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
{
- var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM zkup.zutritteLog WHERE Zutritt LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%' AND Name LIKE '%{tbFilter.Text}%'{withSign}").Result;
+ var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog WHERE Zutritt LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%' AND Name LIKE '%{tbFilter.Text}%'{withSign}").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
}
else if (!dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
{
- var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM zkup.zutritteLog WHERE Name LIKE '%{tbFilter.Text}%'{withSign}").Result;
+ var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog WHERE Name LIKE '%{tbFilter.Text}%'{withSign}").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
}
else if (dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
{
- var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM zkup.zutritteLog WHERE Zutritt LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%'{withSign}").Result;
+ var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog WHERE Zutritt LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%'{withSign}").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
}
@@ -148,15 +220,78 @@ namespace ZKuP
{
if (cbOnlyWithSignature.IsChecked.Value) withSign = " WHERE signature_blob IS NOT NULL";
cbOnlyWithSignature.IsChecked = false;
- var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM zkup.zutritteLog{withSign}").Result;
+ var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog{withSign}").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
}
+ }
- if (cBSignature.Items.Count == 0) cBSignature.ItemsSource = new List() { "Keine Einträge gefunden..." };
+ private void FilterKarten()
+ {
+ //throw new NotImplementedException();
+ string withSign = "";
+ if (cbOnlyWithSignature.IsChecked.Value) withSign = " AND signature_blob IS NOT NULL";
- cBSignature.IsDropDownOpen = false;
- cBSignature.IsDropDownOpen = true;
+ if (dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE AusgegebenTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%' AND Name LIKE '%{tbFilter.Text}%'{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
+ else if (!dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE benutzer LIKE '%{tbFilter.Text}%'{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
+ else if (dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE AusgegebenTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%'{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
+ else if (!dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ if (cbOnlyWithSignature.IsChecked.Value) withSign = " WHERE signature_blob IS NOT NULL";
+ cbOnlyWithSignature.IsChecked = false;
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
+ }
+
+ private void FilterMcFit()
+ {
+
+ string withSign = "";
+ if (cbOnlyWithSignature.IsChecked.Value) withSign = " AND signature_blob IS NOT NULL";
+
+ if (dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog WHERE AusgabeTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%' AND Name LIKE '%{tbFilter.Text}%'{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
+ else if (!dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog WHERE Nachname LIKE '%{tbFilter.Text}%'{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
+ else if (dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog WHERE AusgabeTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%'{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
+ else if (!dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
+ {
+ if (cbOnlyWithSignature.IsChecked.Value) withSign = " WHERE signature_blob IS NOT NULL";
+ cbOnlyWithSignature.IsChecked = false;
+ var list = SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog{withSign}").Result;
+
+ cBSignature.ItemsSource = list.OrderByDescending(p => p);
+ }
}
private void cbOnlyWithSignature_Unchecked(object sender, RoutedEventArgs e)
@@ -173,5 +308,43 @@ namespace ZKuP
{
MessageBox.Show("Kein gültiges Datumsformat in Feld 'Datum'", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
}
+
+ private async void RadioButton_Checked(object sender, RoutedEventArgs e)
+ {
+ List list = new List();
+
+ switch ((sender as RadioButton).Content)
+ {
+ case "Zutritte":
+ category = Categories.Zutritte;
+ list = await SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog");
+ list = list.OrderByDescending(p => p).ToList();
+ break;
+
+ case "Karten":
+ category = Categories.Karten;
+ list = await SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog");
+ list = list.OrderByDescending(p => p).ToList();
+ break;
+
+ case "McFit":
+ category = Categories.McFit;
+ list = await SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog");
+ list = list.OrderByDescending(p => p).ToList();
+ break;
+ }
+
+
+
+ Dispatcher.Invoke(new Action(() =>
+ {
+ if (cBSignature != null)
+ {
+ cBSignature.ItemsSource = list;
+ gridSpinner.Visibility = Visibility.Collapsed;
+ }
+
+ }));
+ }
}
}
diff --git a/ZKuP/KartenTausch.xaml b/ZKuP/KartenTausch.xaml
new file mode 100644
index 0000000..f1007fc
--- /dev/null
+++ b/ZKuP/KartenTausch.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ZKuP/KartenTausch.xaml.cs b/ZKuP/KartenTausch.xaml.cs
new file mode 100644
index 0000000..7dcf27e
--- /dev/null
+++ b/ZKuP/KartenTausch.xaml.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ZKuP
+{
+ ///
+ /// Interaktionslogik für KartenTausch.xaml
+ ///
+ public partial class KartenTausch : Window
+ {
+
+ public KartenTausch()
+ {
+ InitializeComponent();
+
+ cbRot.ItemsSource = SQL.ReadListString($"SELECT kartennr From {MainWindow.table}.karten WHERE farbe = 'Rot'").Result;
+ }
+
+ private void cbRot_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ var info = SQL.ReadListStringTwoColumns($"SELECT benutzer,telnr From {MainWindow.table}.karten WHERE kartennr = '{(sender as ComboBox).SelectedValue}'").Result;
+ var split = info.First().ToString().Split(';');
+
+ lblRotInfo.Text = $"Benutzer: {split[0]} Telefon: {split[1]}";
+ }
+
+ private async void btnClose_Click(object sender, RoutedEventArgs e)
+ {
+ byte[] _signature = null;
+
+
+ var info = SQL.ReadListStringTwoColumns($"SELECT benutzer,telnr From {MainWindow.table}.karten WHERE kartennr = '{cbRot.SelectedValue}'").Result;
+ var split = info.First().ToString().Split(';');
+
+ var sig = new Signature(Signature.DisclaimerType.Gruen, split[0], split[1]);
+
+ if (cbRot.SelectedIndex != -1 && !string.IsNullOrWhiteSpace(tbGruen.Text))
+ {
+ if (sig.ShowDialog() == false)
+ {
+ _signature = sig.ResultByte;
+
+ if (_signature != null)
+ {
+ var red = SQL.ReadListStringMultipleColumns($"SELECT * From {MainWindow.table}.karten WHERE kartennr = '{cbRot.SelectedValue}'", 5).Result.First().Split(';');
+ SQL.WriteSQL($"DELETE FROM {MainWindow.table}.karten WHERE kartennr = '{red[1]}'");
+
+ SQL.WriteSQL($"INSERT INTO {MainWindow.table}.karten (kartennr,farbe,benutzer,telnr,AusgegebenDurch,AusgegebenTimestamp,Signature) VALUES ('{tbGruen.Text}','Grün','{red[3]}','{red[4]}','{Environment.UserName}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', @signature)", _signature);
+
+
+ this.Close();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ZKuP/MainWindow.xaml b/ZKuP/MainWindow.xaml
index 19f55e7..b4891fd 100644
--- a/ZKuP/MainWindow.xaml
+++ b/ZKuP/MainWindow.xaml
@@ -15,7 +15,7 @@
Top="{Binding Source={x:Static p:Settings.Default}, Path=Top, Mode=TwoWay}"
MinHeight="610"
- MinWidth="1360"
+ MinWidth="1660"
Closing="Window_Closing"
PreviewKeyDown="Window_PreviewKeyDown" Loaded="Window_Loaded" ContentRendered="Window_ContentRendered" SizeChanged="Window_SizeChanged"
>
@@ -36,13 +36,21 @@
+
+
+
+
+
+
+
+
-
+
@@ -54,7 +62,7 @@
-
+
diff --git a/ZKuP/ManageParkausweis.xaml.cs b/ZKuP/ManageParkausweis.xaml.cs
index 0840e77..ca014e0 100644
--- a/ZKuP/ManageParkausweis.xaml.cs
+++ b/ZKuP/ManageParkausweis.xaml.cs
@@ -24,7 +24,7 @@ namespace ZKuP
{
InitializeComponent();
- var list = SQL.ReadSQL($"SELECT * FROM zkup.parkausweise").Result;
+ var list = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.parkausweise").Result;
dgManage.DataContext = list;
}
@@ -37,9 +37,9 @@ namespace ZKuP
if (e.Key == Key.Delete)
{
- await SQL.WriteSQL($"DELETE FROM zkup.parkausweise WHERE `idparkausweise` = '{arr[0]}'");
+ await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.parkausweise WHERE `idparkausweise` = '{arr[0]}'");
- var list = SQL.ReadSQL($"SELECT * FROM zkup.parkausweise").Result;
+ var list = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.parkausweise").Result;
dgManage.DataContext = list;
}
}
@@ -52,11 +52,11 @@ namespace ZKuP
if (!((sender as DataGridCell).Content as CheckBox).IsChecked.Value)
{
if (myDRV != null)
- await SQL.WriteSQL($"UPDATE zkup.parkausweise SET `{columnToSet}` = '1' WHERE `idparkausweise` = '{myDRV.Row.ItemArray[0]}'");
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.parkausweise SET `{columnToSet}` = '1' WHERE `idparkausweise` = '{myDRV.Row.ItemArray[0]}'");
}
else if (((sender as DataGridCell).Content as CheckBox).IsChecked.Value)
if (myDRV != null)
- await SQL.WriteSQL($"UPDATE zkup.parkausweise SET `{columnToSet}` = '0' WHERE `idparkausweise` = '{myDRV.Row.ItemArray[0]}'");
+ await SQL.WriteSQL($"UPDATE {MainWindow.table}.parkausweise SET `{columnToSet}` = '0' WHERE `idparkausweise` = '{myDRV.Row.ItemArray[0]}'");
//await Task.Run(() => QueryProjekte());
diff --git a/ZKuP/ManageUsers.xaml b/ZKuP/ManageUsers.xaml
index 2877916..3fe86b1 100644
--- a/ZKuP/ManageUsers.xaml
+++ b/ZKuP/ManageUsers.xaml
@@ -10,16 +10,18 @@
-
+
+
-
-
+
+
-
+
-
+
+
-
+
diff --git a/ZKuP/ManageUsers.xaml.cs b/ZKuP/ManageUsers.xaml.cs
index 49cc774..3f68363 100644
--- a/ZKuP/ManageUsers.xaml.cs
+++ b/ZKuP/ManageUsers.xaml.cs
@@ -38,14 +38,14 @@ namespace ZKuP
{
InitializeComponent();
- userList = SQL.ReadSQL("Select * from zkup.users", userList).Result;
+ userList = SQL.ReadSQL($"Select * from {MainWindow.table}.users", userList).Result;
userList.DefaultView.Sort = "Username";
userList = userList.DefaultView.ToTable();
UserView = Users.DataTableToUserList(userList);
dgUsers.DataContext = userList;
}
- private void BtnAddUser_Click(object sender, RoutedEventArgs e)
+ private async void BtnAddUser_Click(object sender, RoutedEventArgs e)
{
if(tbUsername.Text == "")
{
@@ -60,9 +60,9 @@ namespace ZKuP
}
- SQL.WriteSQL($"Insert into zkup.users (Username,Role) VALUES ('{tbUsername.Text}','{cbRole.SelectedIndex}')");
+ await SQL.WriteSQL($"Insert into {MainWindow.table}.users (Username,Role) VALUES ('{tbUsername.Text}','{cbRole.SelectedIndex}')");
- userList = SQL.ReadSQL("Select * from zkup.users", userList).Result;
+ userList = SQL.ReadSQL($"Select * from {MainWindow.table}.users", userList).Result;
userList.DefaultView.Sort = "Username";
userList = userList.DefaultView.ToTable();
UserView = Users.DataTableToUserList(userList);
@@ -71,6 +71,18 @@ namespace ZKuP
dgUsers.ScrollIntoView(UserView.Last());
}
+ private async void btnDelUser_Click(object sender, RoutedEventArgs e)
+ {
+ if (dgUsers.SelectedIndex != -1)
+ {
+ var dg = dgUsers;
+ var row = dg.SelectedItem as DataRowView;
+ var arr = row.Row.ItemArray;
+
+ await DeleteUser(arr);
+ }
+ }
+
private void BtnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
@@ -86,29 +98,23 @@ namespace ZKuP
if (e.Key == Key.Delete)
{
- await SQL.WriteSQL($"DELETE FROM zkup.users WHERE `Username` = '{arr[1]}'");
+ await DeleteUser(arr);
+ }
+ }
- userList = SQL.ReadSQL("Select * from zkup.users", userList).Result;
+ private async Task DeleteUser(object[] arr)
+ {
+ if (MessageBoxResult.Yes == MessageBox.Show($"User {arr[1]} sicher löschen?", "Sicher löschen?", MessageBoxButton.YesNo, MessageBoxImage.Question))
+ {
+ await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.users WHERE `Username` = '{arr[1]}'");
+
+ userList = SQL.ReadSQL($"Select * from {MainWindow.table}.users", userList).Result;
userList.DefaultView.Sort = "Username asc";
userList = userList.DefaultView.ToTable();
UserView = Users.DataTableToUserList(userList);
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
diff --git a/ZKuP/ManageVisitor.xaml b/ZKuP/ManageVisitor.xaml
index e0dedd1..70ea776 100644
--- a/ZKuP/ManageVisitor.xaml
+++ b/ZKuP/ManageVisitor.xaml
@@ -188,21 +188,21 @@
-
+
-
+
-
+
@@ -258,7 +258,7 @@
-->
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
diff --git a/ZKuP/PrintParkausweis.xaml.cs b/ZKuP/PrintParkausweis.xaml.cs
index 05d5acd..8d7a0e1 100644
--- a/ZKuP/PrintParkausweis.xaml.cs
+++ b/ZKuP/PrintParkausweis.xaml.cs
@@ -33,7 +33,7 @@ namespace ZKuP
if (MessageBox.Show(this, $"Möchten Sie den Parkausweis für {arr[1].ToString()} {arr[2].ToString()} sicher drucken?", "Sicher?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes)
{
- if (Helper.OpenAndEditWord($"{arr[1].ToString()} {arr[2].ToString()}", arr[3].ToString(), arr[7].ToString(), arr[0].ToString()))
+ if (Helper.OpenAndEditWord($"{arr[1].ToString()} {arr[2].ToString()}", arr[3].ToString(), arr[7].ToString(), arr[0].ToString(), Convert.ToInt16(arr[19]), arr[6].ToString()))
{
if (MessageBox.Show(this, "Wurde der Parkausweis erfolgreich gedruckt?", "Erfolgreich gedruckt?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
diff --git a/ZKuP/Resources/AusweisGruen.png b/ZKuP/Resources/AusweisGruen.png
new file mode 100644
index 0000000..b104cfa
Binary files /dev/null and b/ZKuP/Resources/AusweisGruen.png differ
diff --git a/ZKuP/Resources/AusweisGruen_small.png b/ZKuP/Resources/AusweisGruen_small.png
new file mode 100644
index 0000000..1f460d4
Binary files /dev/null and b/ZKuP/Resources/AusweisGruen_small.png differ
diff --git a/ZKuP/Resources/AusweisRot.png b/ZKuP/Resources/AusweisRot.png
new file mode 100644
index 0000000..d55f26d
Binary files /dev/null and b/ZKuP/Resources/AusweisRot.png differ
diff --git a/ZKuP/Resources/AusweisRot_small.png b/ZKuP/Resources/AusweisRot_small.png
new file mode 100644
index 0000000..af2cccc
Binary files /dev/null and b/ZKuP/Resources/AusweisRot_small.png differ
diff --git a/ZKuP/Resources/Bike.png b/ZKuP/Resources/Bike.png
new file mode 100644
index 0000000..1859de6
Binary files /dev/null and b/ZKuP/Resources/Bike.png differ
diff --git a/ZKuP/Resources/Bike_dark.png b/ZKuP/Resources/Bike_dark.png
new file mode 100644
index 0000000..e4bb2c7
Binary files /dev/null and b/ZKuP/Resources/Bike_dark.png differ
diff --git a/ZKuP/Resources/ConnBackground.png b/ZKuP/Resources/ConnBackground.png
new file mode 100644
index 0000000..f5fb7e8
Binary files /dev/null and b/ZKuP/Resources/ConnBackground.png differ
diff --git a/ZKuP/Resources/Connected.png b/ZKuP/Resources/Connected.png
new file mode 100644
index 0000000..866ae7e
Binary files /dev/null and b/ZKuP/Resources/Connected.png differ
diff --git a/ZKuP/Resources/Disconnected.png b/ZKuP/Resources/Disconnected.png
new file mode 100644
index 0000000..1c36f7e
Binary files /dev/null and b/ZKuP/Resources/Disconnected.png differ
diff --git a/ZKuP/Resources/Edit.png b/ZKuP/Resources/Edit.png
new file mode 100644
index 0000000..91d078f
Binary files /dev/null and b/ZKuP/Resources/Edit.png differ
diff --git a/ZKuP/Resources/In.png b/ZKuP/Resources/In.png
new file mode 100644
index 0000000..5ae3527
Binary files /dev/null and b/ZKuP/Resources/In.png differ
diff --git a/ZKuP/Resources/KarteAusgeben_small.png b/ZKuP/Resources/KarteAusgeben_small.png
new file mode 100644
index 0000000..eca1147
Binary files /dev/null and b/ZKuP/Resources/KarteAusgeben_small.png differ
diff --git a/ZKuP/Resources/KarteZuruecknehmen_small.png b/ZKuP/Resources/KarteZuruecknehmen_small.png
new file mode 100644
index 0000000..4233274
Binary files /dev/null and b/ZKuP/Resources/KarteZuruecknehmen_small.png differ
diff --git a/ZKuP/Resources/Karten.png b/ZKuP/Resources/Karten.png
new file mode 100644
index 0000000..c9e8fff
Binary files /dev/null and b/ZKuP/Resources/Karten.png differ
diff --git a/ZKuP/Resources/KartenTausch.png b/ZKuP/Resources/KartenTausch.png
new file mode 100644
index 0000000..c71fd9a
Binary files /dev/null and b/ZKuP/Resources/KartenTausch.png differ
diff --git a/ZKuP/Resources/LKW.png b/ZKuP/Resources/LKW.png
new file mode 100644
index 0000000..25c1594
Binary files /dev/null and b/ZKuP/Resources/LKW.png differ
diff --git a/ZKuP/Resources/LKWLang.png b/ZKuP/Resources/LKWLang.png
new file mode 100644
index 0000000..86d2733
Binary files /dev/null and b/ZKuP/Resources/LKWLang.png differ
diff --git a/ZKuP/Resources/LKWLang_button.png b/ZKuP/Resources/LKWLang_button.png
new file mode 100644
index 0000000..be930ef
Binary files /dev/null and b/ZKuP/Resources/LKWLang_button.png differ
diff --git a/ZKuP/Resources/LKWLang_dark.png b/ZKuP/Resources/LKWLang_dark.png
new file mode 100644
index 0000000..df4b726
Binary files /dev/null and b/ZKuP/Resources/LKWLang_dark.png differ
diff --git a/ZKuP/Resources/LKW_button.png b/ZKuP/Resources/LKW_button.png
new file mode 100644
index 0000000..ec77823
Binary files /dev/null and b/ZKuP/Resources/LKW_button.png differ
diff --git a/ZKuP/Resources/LKW_dark.png b/ZKuP/Resources/LKW_dark.png
new file mode 100644
index 0000000..ef86da3
Binary files /dev/null and b/ZKuP/Resources/LKW_dark.png differ
diff --git a/ZKuP/Resources/Out.png b/ZKuP/Resources/Out.png
new file mode 100644
index 0000000..dcb6287
Binary files /dev/null and b/ZKuP/Resources/Out.png differ
diff --git a/ZKuP/Resources/PKW.png b/ZKuP/Resources/PKW.png
new file mode 100644
index 0000000..40a554a
Binary files /dev/null and b/ZKuP/Resources/PKW.png differ
diff --git a/ZKuP/Resources/PKW_button.png b/ZKuP/Resources/PKW_button.png
new file mode 100644
index 0000000..00c187f
Binary files /dev/null and b/ZKuP/Resources/PKW_button.png differ
diff --git a/ZKuP/Resources/PKW_dark.png b/ZKuP/Resources/PKW_dark.png
new file mode 100644
index 0000000..c2641cf
Binary files /dev/null and b/ZKuP/Resources/PKW_dark.png differ
diff --git a/ZKuP/Resources/PadDanke.png b/ZKuP/Resources/PadDanke.png
new file mode 100644
index 0000000..ea4db10
Binary files /dev/null and b/ZKuP/Resources/PadDanke.png differ
diff --git a/ZKuP/Resources/Sprinter.png b/ZKuP/Resources/Sprinter.png
new file mode 100644
index 0000000..74bfd4b
Binary files /dev/null and b/ZKuP/Resources/Sprinter.png differ
diff --git a/ZKuP/Resources/Sprinter_button.png b/ZKuP/Resources/Sprinter_button.png
new file mode 100644
index 0000000..baa32b2
Binary files /dev/null and b/ZKuP/Resources/Sprinter_button.png differ
diff --git a/ZKuP/Resources/Sprinter_dark.png b/ZKuP/Resources/Sprinter_dark.png
new file mode 100644
index 0000000..6eca6e7
Binary files /dev/null and b/ZKuP/Resources/Sprinter_dark.png differ
diff --git a/ZKuP/SQL.cs b/ZKuP/SQL.cs
index 01a099b..9fbb139 100644
--- a/ZKuP/SQL.cs
+++ b/ZKuP/SQL.cs
@@ -6,6 +6,7 @@ using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
@@ -17,9 +18,35 @@ namespace ZKuP
private static string s = "KYgjkRVn0edFDca2GbZq/A==";
private static string u = "F/u2njMf6aE4krZGTjzgZw==";
private static string d = "xWb4X9gPEzwe76zqpysF3w==";
+ private static string dTest = "e+tv3ZaP+cewOJgE7jNNlA==";
static MySqlConnection conn = new MySqlConnection(GetConnstr());
static MySqlDataAdapter adp = new MySqlDataAdapter();
+ public static bool CheckOnline()
+ {
+ System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
+ //change the following ip variable into the ip adress you are looking for
+ System.Net.IPAddress address = System.Net.IPAddress.Parse(GetIP());
+ System.Net.NetworkInformation.PingReply pong = ping.Send(address);
+ if (pong.Status == System.Net.NetworkInformation.IPStatus.Success)
+ {
+ return true;
+ }
+ else
+ {
+ pong = ping.Send(address);
+
+ if (pong.Status == System.Net.NetworkInformation.IPStatus.Success)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ return false;
+ }
+ }
public static bool CheckDeviceConnection()
{
@@ -57,10 +84,17 @@ namespace ZKuP
internal static string GetConnstr()
{
+#if !DEBUG
return $"Server={GetIP()};" +
$"Uid={Crypto.Decrypt(Crypto.GetHashKey("990C535389C3A18FFD44951DAA291161"), u)};" +
$"Pwd={Crypto.Decrypt(Crypto.GetHashKey("71A209CC81FDB2F458C4EC8DF7090154"), p)};" +
$"database={Crypto.Decrypt(Crypto.GetHashKey("8EB0CC56E502BFC5C19F6A0A0A53D543"), d)}";
+#elif DEBUG
+ return $"Server={GetIP()};" +
+ $"Uid={Crypto.Decrypt(Crypto.GetHashKey("990C535389C3A18FFD44951DAA291161"), u)};" +
+ $"Pwd={Crypto.Decrypt(Crypto.GetHashKey("71A209CC81FDB2F458C4EC8DF7090154"), p)};" +
+ $"database={Crypto.Decrypt(Crypto.GetHashKey("B79DE37BC846D9B1054EE837AAA45D83"), dTest)}";
+#endif
}
public static MySqlDataAdapter GetAdapter()
{
@@ -591,9 +625,14 @@ namespace ZKuP
}
- public static async Task RowExists(string Table, string Column, string Value)
+ public static async Task RowExists(string Table, string Column, string Value, bool isLike = false)
{
- MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand($"SELECT EXISTS(SELECT * FROM {Table} WHERE {Column} = '{Value}')", conn);
+ MySqlCommand cmd;
+
+ if (!isLike)
+ cmd = new MySql.Data.MySqlClient.MySqlCommand($"SELECT EXISTS(SELECT * FROM {Table} WHERE {Column} = '{Value}')", conn);
+ else
+ cmd = new MySql.Data.MySqlClient.MySqlCommand($"SELECT EXISTS(SELECT * FROM {Table} WHERE {Column} LIKE '%{Value}%')", conn);
object queryResult;
var res = 0;
diff --git a/ZKuP/SetHinweis.xaml.cs b/ZKuP/SetHinweis.xaml.cs
index bbcdb76..622b748 100644
--- a/ZKuP/SetHinweis.xaml.cs
+++ b/ZKuP/SetHinweis.xaml.cs
@@ -25,19 +25,19 @@ namespace ZKuP
{
InitializeComponent();
- Text = SQL.ReadSingleValue("SELECT Hinweis FROM zkup.misc");
+ Text = SQL.ReadSingleValue($"SELECT Hinweis FROM {MainWindow.table}.misc");
lblHinweis.Text = Text;
}
private async void btnSetHinweis_Click(object sender, RoutedEventArgs e)
{
- await SQL.WriteSQL($"REPLACE INTO zkup.misc VALUES (1,'{lblHinweis.Text}','{Environment.UserName}')");
+ await SQL.WriteSQL($"REPLACE INTO {MainWindow.table}.misc VALUES (1,'{lblHinweis.Text}','{Environment.UserName}')");
this.Close();
}
private async void btnDeleteHinweis_Click(object sender, RoutedEventArgs e)
{
- await SQL.WriteSQL($"REPLACE INTO zkup.misc VALUES (1,'','{Environment.UserName}')");
+ await SQL.WriteSQL($"REPLACE INTO {MainWindow.table}.misc VALUES (1,'','{Environment.UserName}')");
this.Close();
}
diff --git a/ZKuP/Signature.xaml b/ZKuP/Signature.xaml
index 279e1d7..ccdba15 100644
--- a/ZKuP/Signature.xaml
+++ b/ZKuP/Signature.xaml
@@ -49,6 +49,9 @@
+
+
+
diff --git a/ZKuP/Signature.xaml.cs b/ZKuP/Signature.xaml.cs
index 7d1fbbe..a1c4915 100644
--- a/ZKuP/Signature.xaml.cs
+++ b/ZKuP/Signature.xaml.cs
@@ -1,6 +1,7 @@
using signotec.STPadLibNet;
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -25,7 +26,7 @@ namespace ZKuP
//private STPadLibControl _stPad = new STPadLibControl();
System.Windows.Threading.DispatcherTimer confirmedTimer = new System.Windows.Threading.DispatcherTimer();
- public Signature(DisclaimerType type, string Name = "", string Firma_Abteilung = "", string Kennzeichen_Handynr = "", bool showDisclaimer = true)
+ public Signature(DisclaimerType type, string Name = "", string Firma_Abteilung = "", string Kennzeichen_Handynr = "", bool showDisclaimer = true, string ansprechpartner = "")
{
InitializeComponent();
@@ -55,6 +56,15 @@ namespace ZKuP
case DisclaimerType.McFit:
signoPad.ShowDisclaimerMcFit(Name, Firma_Abteilung, Kennzeichen_Handynr, showDisclaimer);
break;
+ case DisclaimerType.Gruen:
+ signoPad.ShowDisclaimerGruen(Name, Kennzeichen_Handynr, showDisclaimer);
+ break;
+ case DisclaimerType.Rot:
+ signoPad.ShowDisclaimerRot(Name, Kennzeichen_Handynr, showDisclaimer);
+ break;
+ case DisclaimerType.Rueck:
+ signoPad.ShowDisclaimerRueck(ansprechpartner, showDisclaimer);
+ break;
default:
signoPad.ShowDisclaimerParken(Name, Firma_Abteilung, Kennzeichen_Handynr, showDisclaimer);
break;
@@ -73,44 +83,46 @@ namespace ZKuP
{
if (signoPad.SignatureConfirmed)
{
+ STPadLibControlHost.Visibility = Visibility.Collapsed;
btnConfirm.IsEnabled = true;
confirmedTimer.Stop();
+
+ if (signoPad.Result != null)
+ imgSignature.Source = Helper.ConvertBitmapToImage(signoPad.Result);
+ else
+ {
+ MessageBox.Show("Fehler beim Erfassen der Unterschrift\nBitte erneut versuchen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ Log.WriteLog("Fehler bei Erfassen der Unterschrift");
+ signoPad._stPad.SignatureRetry();
+ }
}
}
private void btnConfirm_Click(object sender, RoutedEventArgs e)
- {
+ {
System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Tiff;
- SignatureImageFlag options = signotec.STPadLibNet.SignatureImageFlag.Timestamp | signotec.STPadLibNet.SignatureImageFlag.TimestampRelToImage | signotec.STPadLibNet.SignatureImageFlag.DontSmooth;;
-
+ SignatureImageFlag options = signotec.STPadLibNet.SignatureImageFlag.Timestamp | signotec.STPadLibNet.SignatureImageFlag.TimestampRelToImage | signotec.STPadLibNet.SignatureImageFlag.DontSmooth; ;
+
int resolution = 300;
int width = 0;
int height = 0;
int penWidth = 0;
- System.Drawing.Color penColor = System.Drawing.Color.FromArgb(255,0,0,0);
+ System.Drawing.Color penColor = System.Drawing.Color.FromArgb(255, 0, 0, 0);
try
{
- string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\temp.tif";
- // save as file
- //Result = signoPad._stPad.SignatureSaveAsStreamEx(resolution, width, height, penWidth, penColor, options);
- //if (signoPad._stPad.SignatureState == true)
- //{
- signoPad._stPad.SignatureSaveAsFileEx(path, resolution, width, height, System.Drawing.Imaging.ImageFormat.Tiff, penWidth, penColor, options);
+ //signoPad._stPad.SignatureSaveAsFileEx(path, resolution, width, height, System.Drawing.Imaging.ImageFormat.Tiff, penWidth, penColor, options);
- ResultByte = DBImageManager.ImageFromFileToByte(path);
- MessageBox.Show(this, "Unterschrift erfolgreich gespeichert", "Gespeichert", MessageBoxButton.OK, MessageBoxImage.Information);
+ //ResultByte = DBImageManager.ImageFromFileToByte(signoPad.signaturePath);
+ ResultByte = Helper.ConvertImageToByteArray(signoPad.Result);
+ MessageBox.Show(this, "Unterschrift erfolgreich gespeichert", "Gespeichert", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ //signoPad.CloseConnection();
+ this.Close();
- //signoPad.CloseConnection();
- this.Close();
- //}
- //else
- //{
- // MessageBox.Show($"Unterschriftenerfassung wurde noch nicht gestartet\nErfassung über Pad starten oder mit \"Abbrechen\" das Fenster schließen");
- //}
}
catch (STPadException exc)
{
@@ -119,7 +131,7 @@ namespace ZKuP
//signoPad.CloseConnection();
this.Close();
}
-
+
}
private async void GetSignatureImage()
@@ -150,7 +162,10 @@ namespace ZKuP
public enum DisclaimerType
{
Parken,
- McFit
+ McFit,
+ Gruen,
+ Rot,
+ Rueck
}
}
}
diff --git a/ZKuP/XMessageBox.xaml.cs b/ZKuP/XMessageBox.xaml.cs
index 1ee99ad..6369f11 100644
--- a/ZKuP/XMessageBox.xaml.cs
+++ b/ZKuP/XMessageBox.xaml.cs
@@ -22,13 +22,16 @@ namespace ZKuP
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
int timerCount = 0;
- public XMessageBox(string Title, string Message, MessageBoxImage image)
+ public XMessageBox(string Title, string Message, MessageBoxImage image, bool withTimer = true)
{
InitializeComponent();
- timer.Interval = TimeSpan.FromSeconds(1);
- timer.Tick += Timer_Tick;
- timer.Start();
+ if (withTimer)
+ {
+ timer.Interval = TimeSpan.FromSeconds(1);
+ timer.Tick += Timer_Tick;
+ timer.Start();
+ }
this.Title = Title;
this.Message.Text = Message;
diff --git a/ZKuP/XMessageBoxWithReturn.xaml b/ZKuP/XMessageBoxWithReturn.xaml
new file mode 100644
index 0000000..d80eed1
--- /dev/null
+++ b/ZKuP/XMessageBoxWithReturn.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ZKuP/XMessageBoxWithReturn.xaml.cs b/ZKuP/XMessageBoxWithReturn.xaml.cs
new file mode 100644
index 0000000..8758318
--- /dev/null
+++ b/ZKuP/XMessageBoxWithReturn.xaml.cs
@@ -0,0 +1,111 @@
+using MahApps.Metro.Controls;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ZKuP
+{
+ ///
+ /// Interaktionslogik für XMessageBox.xaml
+ ///
+ public partial class XMessageBoxWithReturn : MetroWindow
+ {
+ System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
+ int timerCount = 0;
+ string _errorMessageIfNothingProvided = "";
+ string _Watermark = "";
+
+ public string Result { get; set; }
+
+ public XMessageBoxWithReturn(string Title, string Message, MessageBoxImage image, bool withTimer = true, string Watermark = "", string errorMessageIfNothingProvided = "", bool alwaysOnTop = true)
+ {
+ InitializeComponent();
+
+ if (withTimer)
+ {
+ timer.Interval = TimeSpan.FromSeconds(1);
+ timer.Tick += Timer_Tick;
+ timer.Start();
+ }
+
+ _errorMessageIfNothingProvided = errorMessageIfNothingProvided;
+ _Watermark = Watermark;
+
+ this.Title = Title;
+ this.Message.Text = Message;
+ this.Topmost = alwaysOnTop;
+ if (!string.IsNullOrWhiteSpace(Watermark)) MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tbTextBox, _Watermark);
+
+ var selectedImage = System.Drawing.SystemIcons.Error;
+ switch (image)
+ {
+ case MessageBoxImage.Error:
+ selectedImage = System.Drawing.SystemIcons.Error;
+ break;
+ case MessageBoxImage.Information:
+ selectedImage = System.Drawing.SystemIcons.Information;
+ break;
+ case MessageBoxImage.Question:
+ selectedImage = System.Drawing.SystemIcons.Question;
+ break;
+ case MessageBoxImage.Warning:
+ selectedImage = System.Drawing.SystemIcons.Warning;
+ break;
+ default:
+ selectedImage = System.Drawing.SystemIcons.Error;
+ break;
+ }
+
+ this.Image.Source = Helper.ConvertBitmapToImage(selectedImage.ToBitmap());
+ }
+
+ private void Timer_Tick(object sender, EventArgs e)
+ {
+ timerCount += 1;
+ btnBox.Content = $"OK - {(10 - timerCount).ToString()}";
+
+ if (timerCount >= 10)
+ Application.Current.Shutdown();
+ }
+
+ private void btnBox_Click(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrWhiteSpace(tbTextBox.Text) && !string.IsNullOrWhiteSpace(_errorMessageIfNothingProvided))
+ {
+ MessageBox.Show($"{_Watermark} muss angegeben werden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+
+ Result = tbTextBox.Text;
+
+ this.DialogResult = true;
+ this.Close();
+ }
+
+ private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+ if (string.IsNullOrWhiteSpace(tbTextBox.Text) && !string.IsNullOrWhiteSpace(_errorMessageIfNothingProvided))
+ {
+ e.Cancel = true;
+ MessageBox.Show($"{_Watermark} muss angegeben werden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ return;
+ }
+ else
+ {
+ Result = tbTextBox.Text;
+
+ this.DialogResult = true;
+ }
+ }
+ }
+}
diff --git a/ZKuP/ZKuP.csproj b/ZKuP/ZKuP.csproj
index 54e0d47..e0db631 100644
--- a/ZKuP/ZKuP.csproj
+++ b/ZKuP/ZKuP.csproj
@@ -169,6 +169,9 @@
AddCardUser.xaml
+
+ AddVisitorsList.xaml
+
Arrivals.xaml
@@ -231,6 +234,9 @@
ImageView.xaml
+
+ KartenTausch.xaml
+
ManageDeliveries.xaml
@@ -268,6 +274,9 @@
ucSpinnerPiston.xaml
+
+ XMessageBoxWithReturn.xaml
+
XMessageBox.xaml
@@ -275,6 +284,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -355,6 +368,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -411,6 +428,10 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
Designer
MSBuild:Compile
@@ -505,18 +526,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -527,19 +536,21 @@
-
-
-
-
1.8.9
+
+ 1.8.1
+
5.2.0
runtime; build; native; contentfiles; analyzers; buildtransitive
all
+
+ 2.0.2
+
3.17.3
@@ -664,5 +675,108 @@
1.1.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ZKuP/signoPad.cs b/ZKuP/signoPad.cs
index 0f2ee6e..976b3be 100644
--- a/ZKuP/signoPad.cs
+++ b/ZKuP/signoPad.cs
@@ -1,6 +1,7 @@
using signotec.STPadLibNet;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -38,7 +39,8 @@ namespace ZKuP
set { _signatureConfirmed = value; }
}
-
+ public static System.Drawing.Bitmap Result { get; set; }
+ //public static string signaturePath { get; private set; }
private static SignPad[] _signPads = null;
private static DisplayTarget _storeIdSigning = DisplayTarget.NewStandardStore;
@@ -101,6 +103,17 @@ namespace ZKuP
}
+ private static void SayThankYou()
+ {
+ System.Drawing.Bitmap bitmap = null;
+
+ bitmap = Helper.LoadBitmapFromResource("Resources/PadDanke.png");
+
+ //Debug.WriteLine(_stPad.);
+ _stPad.DisplaySetImage(0, 0, bitmap);
+ }
+
+
public static bool ShowDisclaimerParken(string Name = "", string Firma = "", string Kennzeichen = "", bool showDisclaimer = true)
@@ -175,11 +188,11 @@ namespace ZKuP
if (showDisclaimer) // display disclaimer
{
if (Firma != "" && Name != "" && Kennzeichen != "")
- _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich eine Einweisung inkl. Flyer vom Pförtner erhalten habe\n\nFirma / Besucher: {Firma}\nVerantwortlicher: {Name}\nKennzeichen: {Kennzeichen}");
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit den Erhalt eines Parkschein durch den Pförtner und das ich über die Parkordnung, sowie deren Folgen bei Missachtung, ausreichend informiert wurde\n\nFirma / Besucher: {Firma}\nVerantwortlicher: {Name}\nKennzeichen: {Kennzeichen}");
else if (Firma != "" && Name != "" && Kennzeichen == "")
- _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich eine Einweisung inkl. Flyer vom Pförtner erhalten habe\n\nFirma / Besucher: {Firma}\nVerantwortlicher: {Name}");
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit den Erhalt eines Parkschein durch den Pförtner und das ich über die Parkordnung, sowie deren Folgen bei Missachtung, ausreichend informiert wurde\n\nFirma / Besucher: {Firma}\nVerantwortlicher: {Name}");
else
- _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich eine Einweisung inkl. Flyer vom Pförtner erhalten habe\n\nFirma / Besucher: {Firma}");
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit den Erhalt eines Parkschein durch den Pförtner und das ich über die Parkordnung, sowie deren Folgen bei Missachtung, ausreichend informiert wurde\n\nFirma / Besucher: {Firma}");
}
else
{
@@ -593,7 +606,737 @@ namespace ZKuP
return true;
}
+ public static bool ShowDisclaimerRot(string Name = "", string Handynr = "", bool showDisclaimer = true)
+ {
+ SignatureConfirmed = false;
+ // display disclaimer and two buttons "Cancel" and "Confirm"
+ if (!GetDevices())
+ return false;
+ try
+ {
+ //_stPad.DeviceOpen(_signPads.Length - 1, true);
+ _stPad.DeviceOpen(0, true);
+
+ _stPad.DisplaySetStandbyImage(Helper.LoadBitmapFromResource("Resources/db-logo.png"));
+ // clear all hot spots
+ ClearHotSpots();
+
+ // clear signature window
+ _stPad.SensorClearSignRect();
+
+
+ // erase LCD and background buffer
+ _stPad.DisplayErase();
+
+ var nCapabilities = _stPad.DeviceGetCapabilities(0);
+ if (nCapabilities != null && nCapabilities.HasBacklight)
+ _stPad.DisplaySetBacklight(BacklightMode.On);
+
+ // set font
+ float fontSize = 0;
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Sigma:
+ case PadModel.Zeta:
+ fontSize = 20;
+ break;
+ case PadModel.Omega:
+ fontSize = 40;
+ break;
+ case PadModel.Gamma:
+ fontSize = 45;
+ break;
+ case PadModel.Delta:
+ case PadModel.Alpha:
+ fontSize = 60;
+ break;
+ }
+ _stPad.DisplaySetFont(new System.Drawing.Font("Arial", fontSize));
+
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Sigma:
+ case PadModel.Zeta:
+ // do all the following drawing operations in the background buffer
+ _stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
+
+ // load button bitmaps and set hot spots
+ // "Cancel" button
+ System.Drawing.Bitmap button = Helper.LoadBitmapFromResource("Resources/Cancel BW.png");
+ int x = 20;
+ int y = _stPad.DisplayHeight - button.Height - 7;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonCancelId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // "Confirm" button
+ button = Helper.LoadBitmapFromResource("Resources/OK BW.png");
+ x = _stPad.DisplayWidth - button.Width - 20;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonConfirmId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ if (showDisclaimer) // display disclaimer
+ {
+ if (Name != "" && Handynr != "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit den Erhalt des Sicherheitsflyer und einer roten Gastkarte vom Pförtner\n\nBenutzer: {Name}\nHandynr: {Handynr}");
+ else if (Name != "" && Handynr == "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit den Erhalt des Sicherheitsflyer und einer roten Gastkarte vom Pförtner\n\nBenutzer: {Name}");
+ else
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit den Erhalt des Sicherheitsflyer und einer roten Gastkarte vom Pförtner\n\nBenutzer: {Name}");
+ }
+ else
+ {
+ if (Name != "" && Handynr != "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Benutzer: {Name}\nHandynr: {Handynr}");
+ else if (Name != "" && Handynr == "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Benutzer: {Name}");
+ else
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Benutzer: {Name}");
+ }
+
+
+ break;
+ case PadModel.Omega:
+ case PadModel.Gamma:
+ case PadModel.Delta:
+ if (_signPads[0].FastConnection)
+ // fast connection: do all drawing operations in the overlay buffer
+ _storeIdOverlay = _stPad.DisplaySetTarget(DisplayTarget.OverlayBuffer);
+ else
+ // do all the following drawing operations in the permanent memory
+ _storeIdOverlay = _stPad.DisplaySetTarget(_storeIdOverlay);
+
+ // load button bitmaps and set hot spots for toolbar
+ // "Cancel" button
+ button = Helper.LoadBitmapFromResource("Resources/Cancel RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 24;
+ break;
+ default:
+ x = 45;
+ break;
+ }
+ y = _stPad.DisplayHeight - button.Height - 14;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonCancelId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // "Confirm" button
+ button = Helper.LoadBitmapFromResource("Resources/OK RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 234;
+ break;
+ case PadModel.Gamma:
+ x = 315;
+ break;
+ case PadModel.Delta:
+ x = 555;
+ break;
+ }
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonConfirmId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // Scroll buttons
+ button = Helper.LoadBitmapFromResource("Resources/Scroll RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 444;
+ break;
+ case PadModel.Gamma:
+ x = 585;
+ break;
+ case PadModel.Delta:
+ x = 1065;
+ break;
+ }
+ _stPad.DisplaySetImage(x, y, button);
+ _stPad.SensorAddScrollHotSpot(x, y, 66, 66, ScrollOption.ScrollDown);
+ x += 104;
+ _stPad.SensorAddScrollHotSpot(x, y, 66, 66, ScrollOption.ScrollUp);
+
+ if (!_signPads[0].FastConnection)
+ {
+ // do all the following drawing operations in the overlay buffer
+ _stPad.DisplaySetTarget(DisplayTarget.OverlayBuffer);
+
+ // copy stored image to overlay buffer
+ _stPad.DisplaySetImageFromStore(_storeIdOverlay);
+ }
+
+ // do all the following drawing operations in the background buffer
+ _stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
+
+ // draw disclaimer
+ x = 10;
+ y = 10;
+ int size = _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 80, signotec.STPadLibNet.TextAlignment.Left, _disclaimer);
+
+ // use font size of the disclaimer text
+ if (size != (int)fontSize)
+ _stPad.DisplaySetFont(new System.Drawing.Font("Arial", size, System.Drawing.FontStyle.Regular));
+
+ // set scroll text
+ y = _stPad.DisplayHeight - 80;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 100, signotec.STPadLibNet.TextAlignment.Left, "Congratulations! If you can read this text you have found the scroll buttons!");
+ if (_signPads[0].PadModel == PadModel.Delta)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 200, 0, "Doesn't the Delta have an impressive large image buffer?");
+ const int x2 = 320;
+ while ((y + _stPad.DisplayHeight) < _stPad.DisplayTargetHeight)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 200, 0, String.Format("You've reached line {0} of {1}!", y, _stPad.DisplayTargetHeight));
+
+ if ((y + _stPad.DisplayHeight) < _stPad.DisplayTargetHeight)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x2, y, _stPad.DisplayWidth - 2 * x2, 200, signotec.STPadLibNet.TextAlignment.CenterCenteredVertically, "Click me, I'm a scrollable button!");
+ _stPad.SensorAddScrollHotSpot(x2, y, _stPad.DisplayWidth - 2 * x2, 200, ScrollOption.Scrollable);
+ }
+ }
+ }
+
+ // set end text
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ y = _stPad.DisplayTargetHeight - 120;
+ break;
+ case PadModel.Gamma:
+ y = _stPad.DisplayTargetHeight - 140;
+ break;
+ case PadModel.Delta:
+ y = _stPad.DisplayTargetHeight - 160;
+ break;
+ }
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 60, signotec.STPadLibNet.TextAlignment.Left, "You have scrolled to the end of this text!");
+
+ // set overlay rect
+ y = _stPad.DisplayHeight - 80;
+ _stPad.DisplaySetOverlayRect(0, y, _stPad.DisplayWidth, 80);
+ break;
+ }
+
+ // do all drawing operations on the LCD
+ _stPad.DisplaySetTarget(DisplayTarget.ForegroundBuffer);
+
+ // draw buffered image
+ _stPad.DisplaySetImageFromStore(DisplayTarget.BackgroundBuffer);
+
+ // set complete buffer for scrolling
+ _stPad.SensorSetScrollArea(0, 0, 0, 0);
+
+ if (_signPads[0].SupportsPenScrolling)
+ // enable pen scrolling
+ _stPad.SensorSetPenScrollingEnabled(true);
+
+ //ButtonRetry.IsEnabled = false;
+ }
+ catch (STPadException exc)
+ {
+ Log.WriteLog(exc.ToString());
+ MessageBox.Show(exc.Message);
+ //throw;
+ return false;
+ }
+ finally
+ {
+ //this.Cursor = Cursors.Arrow;
+ }
+ return true;
+ }
+
+ public static bool ShowDisclaimerGruen(string Name = "", string Handynr = "", bool showDisclaimer = true)
+ {
+ SignatureConfirmed = false;
+ // display disclaimer and two buttons "Cancel" and "Confirm"
+ if (!GetDevices())
+ return false;
+
+ try
+ {
+ //_stPad.DeviceOpen(_signPads.Length - 1, true);
+ _stPad.DeviceOpen(0, true);
+
+ _stPad.DisplaySetStandbyImage(Helper.LoadBitmapFromResource("Resources/db-logo.png"));
+ // clear all hot spots
+ ClearHotSpots();
+
+ // clear signature window
+ _stPad.SensorClearSignRect();
+
+
+ // erase LCD and background buffer
+ _stPad.DisplayErase();
+
+ var nCapabilities = _stPad.DeviceGetCapabilities(0);
+ if (nCapabilities != null && nCapabilities.HasBacklight)
+ _stPad.DisplaySetBacklight(BacklightMode.On);
+
+ // set font
+ float fontSize = 0;
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Sigma:
+ case PadModel.Zeta:
+ fontSize = 20;
+ break;
+ case PadModel.Omega:
+ fontSize = 40;
+ break;
+ case PadModel.Gamma:
+ fontSize = 45;
+ break;
+ case PadModel.Delta:
+ case PadModel.Alpha:
+ fontSize = 60;
+ break;
+ }
+ _stPad.DisplaySetFont(new System.Drawing.Font("Arial", fontSize));
+
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Sigma:
+ case PadModel.Zeta:
+ // do all the following drawing operations in the background buffer
+ _stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
+
+ // load button bitmaps and set hot spots
+ // "Cancel" button
+ System.Drawing.Bitmap button = Helper.LoadBitmapFromResource("Resources/Cancel BW.png");
+ int x = 20;
+ int y = _stPad.DisplayHeight - button.Height - 7;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonCancelId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // "Confirm" button
+ button = Helper.LoadBitmapFromResource("Resources/OK BW.png");
+ x = _stPad.DisplayWidth - button.Width - 20;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonConfirmId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ if (showDisclaimer) // display disclaimer
+ {
+ if (Name != "" && Handynr != "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich eine Einweisung vom Fremdfirmenkoordinator erhalten habe\n\nBenutzer: {Name}\nHandynr: {Handynr}");
+ else if (Name != "" && Handynr == "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich eine Einweisung vom Fremdfirmenkoordinator erhalten habe\n\nBenutzer: {Name}");
+ else
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich eine Einweisung vom Fremdfirmenkoordinator erhalten habe\n\nBenutzer: {Name}");
+ }
+ else
+ {
+ if (Name != "" && Handynr != "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Benutzer: {Name}\nHandynr: {Handynr}");
+ else if (Name != "" && Handynr == "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Benutzer: {Name}");
+ else
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Benutzer: {Name}");
+ }
+
+
+ break;
+ case PadModel.Omega:
+ case PadModel.Gamma:
+ case PadModel.Delta:
+ if (_signPads[0].FastConnection)
+ // fast connection: do all drawing operations in the overlay buffer
+ _storeIdOverlay = _stPad.DisplaySetTarget(DisplayTarget.OverlayBuffer);
+ else
+ // do all the following drawing operations in the permanent memory
+ _storeIdOverlay = _stPad.DisplaySetTarget(_storeIdOverlay);
+
+ // load button bitmaps and set hot spots for toolbar
+ // "Cancel" button
+ button = Helper.LoadBitmapFromResource("Resources/Cancel RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 24;
+ break;
+ default:
+ x = 45;
+ break;
+ }
+ y = _stPad.DisplayHeight - button.Height - 14;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonCancelId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // "Confirm" button
+ button = Helper.LoadBitmapFromResource("Resources/OK RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 234;
+ break;
+ case PadModel.Gamma:
+ x = 315;
+ break;
+ case PadModel.Delta:
+ x = 555;
+ break;
+ }
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonConfirmId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // Scroll buttons
+ button = Helper.LoadBitmapFromResource("Resources/Scroll RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 444;
+ break;
+ case PadModel.Gamma:
+ x = 585;
+ break;
+ case PadModel.Delta:
+ x = 1065;
+ break;
+ }
+ _stPad.DisplaySetImage(x, y, button);
+ _stPad.SensorAddScrollHotSpot(x, y, 66, 66, ScrollOption.ScrollDown);
+ x += 104;
+ _stPad.SensorAddScrollHotSpot(x, y, 66, 66, ScrollOption.ScrollUp);
+
+ if (!_signPads[0].FastConnection)
+ {
+ // do all the following drawing operations in the overlay buffer
+ _stPad.DisplaySetTarget(DisplayTarget.OverlayBuffer);
+
+ // copy stored image to overlay buffer
+ _stPad.DisplaySetImageFromStore(_storeIdOverlay);
+ }
+
+ // do all the following drawing operations in the background buffer
+ _stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
+
+ // draw disclaimer
+ x = 10;
+ y = 10;
+ int size = _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 80, signotec.STPadLibNet.TextAlignment.Left, _disclaimer);
+
+ // use font size of the disclaimer text
+ if (size != (int)fontSize)
+ _stPad.DisplaySetFont(new System.Drawing.Font("Arial", size, System.Drawing.FontStyle.Regular));
+
+ // set scroll text
+ y = _stPad.DisplayHeight - 80;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 100, signotec.STPadLibNet.TextAlignment.Left, "Congratulations! If you can read this text you have found the scroll buttons!");
+ if (_signPads[0].PadModel == PadModel.Delta)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 200, 0, "Doesn't the Delta have an impressive large image buffer?");
+ const int x2 = 320;
+ while ((y + _stPad.DisplayHeight) < _stPad.DisplayTargetHeight)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 200, 0, String.Format("You've reached line {0} of {1}!", y, _stPad.DisplayTargetHeight));
+
+ if ((y + _stPad.DisplayHeight) < _stPad.DisplayTargetHeight)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x2, y, _stPad.DisplayWidth - 2 * x2, 200, signotec.STPadLibNet.TextAlignment.CenterCenteredVertically, "Click me, I'm a scrollable button!");
+ _stPad.SensorAddScrollHotSpot(x2, y, _stPad.DisplayWidth - 2 * x2, 200, ScrollOption.Scrollable);
+ }
+ }
+ }
+
+ // set end text
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ y = _stPad.DisplayTargetHeight - 120;
+ break;
+ case PadModel.Gamma:
+ y = _stPad.DisplayTargetHeight - 140;
+ break;
+ case PadModel.Delta:
+ y = _stPad.DisplayTargetHeight - 160;
+ break;
+ }
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 60, signotec.STPadLibNet.TextAlignment.Left, "You have scrolled to the end of this text!");
+
+ // set overlay rect
+ y = _stPad.DisplayHeight - 80;
+ _stPad.DisplaySetOverlayRect(0, y, _stPad.DisplayWidth, 80);
+ break;
+ }
+
+ // do all drawing operations on the LCD
+ _stPad.DisplaySetTarget(DisplayTarget.ForegroundBuffer);
+
+ // draw buffered image
+ _stPad.DisplaySetImageFromStore(DisplayTarget.BackgroundBuffer);
+
+ // set complete buffer for scrolling
+ _stPad.SensorSetScrollArea(0, 0, 0, 0);
+
+ if (_signPads[0].SupportsPenScrolling)
+ // enable pen scrolling
+ _stPad.SensorSetPenScrollingEnabled(true);
+
+ //ButtonRetry.IsEnabled = false;
+ }
+ catch (STPadException exc)
+ {
+ Log.WriteLog(exc.ToString());
+ MessageBox.Show(exc.Message);
+ //throw;
+ return false;
+ }
+ finally
+ {
+ //this.Cursor = Cursors.Arrow;
+ }
+ return true;
+ }
+
+ public static bool ShowDisclaimerRueck(string Rueckgebender = "", bool showDisclaimer = true)
+ {
+ SignatureConfirmed = false;
+ // display disclaimer and two buttons "Cancel" and "Confirm"
+ if (!GetDevices())
+ return false;
+
+ try
+ {
+ //_stPad.DeviceOpen(_signPads.Length - 1, true);
+ _stPad.DeviceOpen(0, true);
+
+ _stPad.DisplaySetStandbyImage(Helper.LoadBitmapFromResource("Resources/db-logo.png"));
+ // clear all hot spots
+ ClearHotSpots();
+
+ // clear signature window
+ _stPad.SensorClearSignRect();
+
+
+ // erase LCD and background buffer
+ _stPad.DisplayErase();
+
+ var nCapabilities = _stPad.DeviceGetCapabilities(0);
+ if (nCapabilities != null && nCapabilities.HasBacklight)
+ _stPad.DisplaySetBacklight(BacklightMode.On);
+
+ // set font
+ float fontSize = 0;
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Sigma:
+ case PadModel.Zeta:
+ fontSize = 20;
+ break;
+ case PadModel.Omega:
+ fontSize = 40;
+ break;
+ case PadModel.Gamma:
+ fontSize = 45;
+ break;
+ case PadModel.Delta:
+ case PadModel.Alpha:
+ fontSize = 60;
+ break;
+ }
+ _stPad.DisplaySetFont(new System.Drawing.Font("Arial", fontSize));
+
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Sigma:
+ case PadModel.Zeta:
+ // do all the following drawing operations in the background buffer
+ _stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
+
+ // load button bitmaps and set hot spots
+ // "Cancel" button
+ System.Drawing.Bitmap button = Helper.LoadBitmapFromResource("Resources/Cancel BW.png");
+ int x = 20;
+ int y = _stPad.DisplayHeight - button.Height - 7;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonCancelId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // "Confirm" button
+ button = Helper.LoadBitmapFromResource("Resources/OK BW.png");
+ x = _stPad.DisplayWidth - button.Width - 20;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonConfirmId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+
+ if (Rueckgebender != "")
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich alle an die Firma/Besucher ausgegebenen Karten vollständig zurückgebe\n\nBenutzer: {Rueckgebender}");
+ else
+ {
+ string Rueckgeber = "";
+ //MessageBox.Show("Rückgebende Person muss angegeben werden", "Fehlende Daten", MessageBoxButtons.OK, MessageBoxIcon.Stop);
+ XMessageBoxWithReturn messageBox = new XMessageBoxWithReturn("Fehlende Daten", "Rückgebende Person muss angegeben werden", System.Windows.MessageBoxImage.Exclamation, false, "Rückgebender", "Rückgebender muss angegeben werden!");
+
+ if (messageBox.ShowDialog() == true)
+ {
+ Rueckgeber = messageBox.Result;
+ }
+
+ _stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Ich bestätige hiermit dass ich alle an die Firma/Besucher ausgegebenen Karten vollständig zurückgebe\n\nBenutzer: {Rueckgeber}");
+ }
+
+ break;
+ case PadModel.Omega:
+ case PadModel.Gamma:
+ case PadModel.Delta:
+ if (_signPads[0].FastConnection)
+ // fast connection: do all drawing operations in the overlay buffer
+ _storeIdOverlay = _stPad.DisplaySetTarget(DisplayTarget.OverlayBuffer);
+ else
+ // do all the following drawing operations in the permanent memory
+ _storeIdOverlay = _stPad.DisplaySetTarget(_storeIdOverlay);
+
+ // load button bitmaps and set hot spots for toolbar
+ // "Cancel" button
+ button = Helper.LoadBitmapFromResource("Resources/Cancel RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 24;
+ break;
+ default:
+ x = 45;
+ break;
+ }
+ y = _stPad.DisplayHeight - button.Height - 14;
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonCancelId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // "Confirm" button
+ button = Helper.LoadBitmapFromResource("Resources/OK RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 234;
+ break;
+ case PadModel.Gamma:
+ x = 315;
+ break;
+ case PadModel.Delta:
+ x = 555;
+ break;
+ }
+ _stPad.DisplaySetImage(x, y, button);
+ _buttonConfirmId = _stPad.SensorAddHotSpot(x, y, button.Width, button.Height);
+
+ // Scroll buttons
+ button = Helper.LoadBitmapFromResource("Resources/Scroll RGB.png");
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ x = 444;
+ break;
+ case PadModel.Gamma:
+ x = 585;
+ break;
+ case PadModel.Delta:
+ x = 1065;
+ break;
+ }
+ _stPad.DisplaySetImage(x, y, button);
+ _stPad.SensorAddScrollHotSpot(x, y, 66, 66, ScrollOption.ScrollDown);
+ x += 104;
+ _stPad.SensorAddScrollHotSpot(x, y, 66, 66, ScrollOption.ScrollUp);
+
+ if (!_signPads[0].FastConnection)
+ {
+ // do all the following drawing operations in the overlay buffer
+ _stPad.DisplaySetTarget(DisplayTarget.OverlayBuffer);
+
+ // copy stored image to overlay buffer
+ _stPad.DisplaySetImageFromStore(_storeIdOverlay);
+ }
+
+ // do all the following drawing operations in the background buffer
+ _stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
+
+ // draw disclaimer
+ x = 10;
+ y = 10;
+ int size = _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 80, signotec.STPadLibNet.TextAlignment.Left, _disclaimer);
+
+ // use font size of the disclaimer text
+ if (size != (int)fontSize)
+ _stPad.DisplaySetFont(new System.Drawing.Font("Arial", size, System.Drawing.FontStyle.Regular));
+
+ // set scroll text
+ y = _stPad.DisplayHeight - 80;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 100, signotec.STPadLibNet.TextAlignment.Left, "Congratulations! If you can read this text you have found the scroll buttons!");
+ if (_signPads[0].PadModel == PadModel.Delta)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 200, 0, "Doesn't the Delta have an impressive large image buffer?");
+ const int x2 = 320;
+ while ((y + _stPad.DisplayHeight) < _stPad.DisplayTargetHeight)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 200, 0, String.Format("You've reached line {0} of {1}!", y, _stPad.DisplayTargetHeight));
+
+ if ((y + _stPad.DisplayHeight) < _stPad.DisplayTargetHeight)
+ {
+ y += _stPad.DisplayHeight;
+ _stPad.DisplaySetTextInRect(x2, y, _stPad.DisplayWidth - 2 * x2, 200, signotec.STPadLibNet.TextAlignment.CenterCenteredVertically, "Click me, I'm a scrollable button!");
+ _stPad.SensorAddScrollHotSpot(x2, y, _stPad.DisplayWidth - 2 * x2, 200, ScrollOption.Scrollable);
+ }
+ }
+ }
+
+ // set end text
+ switch (_signPads[0].PadModel)
+ {
+ case PadModel.Omega:
+ y = _stPad.DisplayTargetHeight - 120;
+ break;
+ case PadModel.Gamma:
+ y = _stPad.DisplayTargetHeight - 140;
+ break;
+ case PadModel.Delta:
+ y = _stPad.DisplayTargetHeight - 160;
+ break;
+ }
+ _stPad.DisplaySetTextInRect(x, y, _stPad.DisplayWidth - 20, 60, signotec.STPadLibNet.TextAlignment.Left, "You have scrolled to the end of this text!");
+
+ // set overlay rect
+ y = _stPad.DisplayHeight - 80;
+ _stPad.DisplaySetOverlayRect(0, y, _stPad.DisplayWidth, 80);
+ break;
+ }
+
+ // do all drawing operations on the LCD
+ _stPad.DisplaySetTarget(DisplayTarget.ForegroundBuffer);
+
+ // draw buffered image
+ _stPad.DisplaySetImageFromStore(DisplayTarget.BackgroundBuffer);
+
+ // set complete buffer for scrolling
+ _stPad.SensorSetScrollArea(0, 0, 0, 0);
+
+ if (_signPads[0].SupportsPenScrolling)
+ // enable pen scrolling
+ _stPad.SensorSetPenScrollingEnabled(true);
+
+ //ButtonRetry.IsEnabled = false;
+ }
+ catch (STPadException exc)
+ {
+ Log.WriteLog(exc.ToString());
+ MessageBox.Show(exc.Message);
+ //throw;
+ return false;
+ }
+ finally
+ {
+ //this.Cursor = Cursors.Arrow;
+ }
+ return true;
+ }
@@ -703,7 +1446,24 @@ namespace ZKuP
// accept disclaimer and start capturing
StartDefaultCapturing();
else
+ {
ConfirmCapturing();
+
+ SignatureImageFlag options = signotec.STPadLibNet.SignatureImageFlag.Timestamp | signotec.STPadLibNet.SignatureImageFlag.TimestampRelToImage | signotec.STPadLibNet.SignatureImageFlag.DontSmooth; ;
+
+ int resolution = 300;
+ int width = 0;
+ int height = 0;
+ int penWidth = 0;
+ System.Drawing.Color penColor = System.Drawing.Color.FromArgb(255, 0, 0, 0);
+
+ Result = _stPad.SignatureSaveAsStreamEx(resolution, width, height, penWidth, penColor, options);
+ //signaturePath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + $"\\signature{new Random().Next(9999)}.tif";
+
+ //signoPad._stPad.SignatureSaveAsFileEx(signaturePath, resolution, width, height, System.Drawing.Imaging.ImageFormat.Tiff, penWidth, penColor, options);
+
+ SayThankYou();
+ }
}
private static bool StartDefaultCapturing()