Projektdateien hinzufügen.
31
ZKuP/AddCardUser.xaml
Normal file
@ -0,0 +1,31 @@
|
||||
<Window x:Class="ZKuP.AddCardUser"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Kartenbenutzer" Height="392" Width="594">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Margin="10,10,10,0" TextWrapping="Wrap" Text="Kartennummer" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbNummer" Margin="10,0,10,10" TextWrapping="Wrap" Height="23" VerticalAlignment="Bottom"/>
|
||||
<TextBlock Margin="10,10,10,0" Grid.Row="1" TextWrapping="Wrap" Text="Farbe" VerticalAlignment="Top"/>
|
||||
<ComboBox x:Name="cbColor" Margin="10,0,10,10" Grid.Row="1" Height="22" VerticalAlignment="Bottom">
|
||||
<ComboBoxItem Content="Grün"/>
|
||||
<ComboBoxItem Content="Rot"/>
|
||||
<ComboBoxItem Content="Gerätewagen"/>
|
||||
</ComboBox>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Firma / Benutzer" VerticalAlignment="Top" Width="226"/>
|
||||
<TextBox x:Name="tbUser" Margin="10,0,10,10" Grid.Row="2" TextWrapping="Wrap" Height="23" VerticalAlignment="Bottom" PreviewTextInput="tbUser_PreviewTextInput"/>
|
||||
<TextBlock Margin="10,10,10,0" Grid.Row="3" TextWrapping="Wrap" Text="Telefonnummer" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbTelnr" Height="23" Margin="10,0,10,10" Grid.Row="3" TextWrapping="Wrap" VerticalAlignment="Bottom"/>
|
||||
<Button x:Name="btnAdd" Content="Hinzufügen" Margin="10,0,10,10" Grid.Row="4" Height="20" VerticalAlignment="Bottom" Click="btnAdd_Click"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
79
ZKuP/AddCardUser.xaml.cs
Normal file
@ -0,0 +1,79 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AddCardUser.xaml
|
||||
/// </summary>
|
||||
public partial class AddCardUser : Window
|
||||
{
|
||||
public AddCardUser(string user = "")
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
tbUser.Text = user;
|
||||
|
||||
try
|
||||
{
|
||||
tbTelnr.Text = SQL.ReadSingleValue($"SELECT Tel_Nr_Verantwortlicher_Firma FROM zkup.firmen WHERE Name='{user}'");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (tbNummer.Text == "")
|
||||
MessageBox.Show(this, "Kartennummer angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
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, "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}')");
|
||||
|
||||
MessageBox.Show(this, "Karte erfolgreich verknüpft", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
ResetValues();
|
||||
//this.Close();
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException ex)
|
||||
{
|
||||
if (MessageBox.Show(this, "Beim verknüpfen der Karte ist ein Fehler aufgetreten\n\nMöchten Sie die interne Fehlermeldung anzeigen?", "Fehler", MessageBoxButton.YesNo, MessageBoxImage.Error, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
MessageBox.Show(this, $"Fehlermeldung:\n\n{ex.Message}", "Fehlermeldung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetValues()
|
||||
{
|
||||
|
||||
tbNummer.Text = "";
|
||||
tbTelnr.Text = "";
|
||||
|
||||
}
|
||||
|
||||
private void tbUser_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if (tbUser.Text.Length >= 254) e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
ZKuP/App.config
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="ZKuP.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<ZKuP.Properties.Settings>
|
||||
<setting name="Height" serializeAs="String">
|
||||
<value>747</value>
|
||||
</setting>
|
||||
<setting name="Width" serializeAs="String">
|
||||
<value>1624</value>
|
||||
</setting>
|
||||
<setting name="Top" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="Left" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="gridOverviewHeight" serializeAs="String">
|
||||
<value>300</value>
|
||||
</setting>
|
||||
<setting name="State" serializeAs="String">
|
||||
<value>Normal</value>
|
||||
</setting>
|
||||
<setting name="ShowParkcardAccept" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="gridTodayHeight" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
</ZKuP.Properties.Settings>
|
||||
</userSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
9
ZKuP/App.xaml
Normal file
@ -0,0 +1,9 @@
|
||||
<Application x:Class="ZKuP.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
76
ZKuP/App.xaml.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für "App.xaml"
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
Log.WriteLog(e.Exception.ToString());
|
||||
// Process unhandled exception
|
||||
if(MessageBox.Show(MainWindow, "Es ist ein unbehandelter Fehler aufgetreten\n\nMöchten Sie einen Bericht an den Entwickler der Anwendung senden?", "Unbehandelter Fehler", MessageBoxButton.YesNo, MessageBoxImage.Error, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
Helper.SendMail(e.Exception.ToString());
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
|
||||
FirstChanceEx();
|
||||
|
||||
}
|
||||
|
||||
void FirstChanceEx()
|
||||
{
|
||||
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
|
||||
{
|
||||
Log.WriteLog(eventArgs.Exception.ToString());
|
||||
|
||||
if (MessageBox.Show(MainWindow, "Es ist ein unbehandelter Fehler aufgetreten\n\nMöchten Sie einen Bericht an den Entwickler der Anwendung senden?", "Unbehandelter Fehler", MessageBoxButton.YesNo, MessageBoxImage.Error, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
Helper.SendMail(eventArgs.Exception.ToString());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Exception ex = e.ExceptionObject as Exception;
|
||||
|
||||
Log.WriteLog(ex.ToString());
|
||||
|
||||
if (MessageBox.Show(MainWindow, "Es ist ein unbehandelter Fehler aufgetreten\n\nMöchten Sie einen Bericht an den Entwickler der Anwendung senden?", "Unbehandelter Fehler", MessageBoxButton.YesNo, MessageBoxImage.Error, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
Helper.SendMail(ex.ToString());
|
||||
}
|
||||
|
||||
//MessageBox.Show(ex.Message, "Uncaught Thread Exception", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
}
|
||||
|
||||
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||
{
|
||||
Log.WriteLog(e.Exception.Message.ToString());
|
||||
|
||||
// Log the exception, display it, etc
|
||||
if (MessageBox.Show("Es ist ein unbehandelter Fehler aufgetreten\n\nMöchten Sie einen Bericht an den Entwickler der Anwendung senden?", "Unbehandelter Fehler", MessageBoxButton.YesNo, MessageBoxImage.Error, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
Helper.SendMail(e.Exception.Message.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
62
ZKuP/Arrivals.xaml
Normal file
@ -0,0 +1,62 @@
|
||||
<Window x:Class="ZKuP.Arrivals"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Title="Ankunft bestätigen" Height="736" Width="479" ResizeMode="NoResize" Topmost="True" PreviewGotKeyboardFocus="Window_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="Window_PreviewLostKeyboardFocus" WindowStyle="None" AllowsTransparency="True">
|
||||
<Grid>
|
||||
<Grid x:Name="WindowBar" VerticalAlignment="Top" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Height="30" PreviewMouseDown="Window_PreviewMouseDown">
|
||||
<TextBlock Text="Ankunft bestätigen" Margin="10,5,364,0" Padding="0" Foreground="White"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,30,0,0" Background="#FBFFFFFF">
|
||||
<ComboBox x:Name="cbName" Margin="45,45,46,0" VerticalAlignment="Top" TabIndex="7" SelectionChanged="CbName_SelectionChanged"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="23" Margin="30,22,0,0" TextWrapping="Wrap" Text="Firma/Besucher:" VerticalAlignment="Top" Width="120"/>
|
||||
<Button x:Name="btnCheck" HorizontalContentAlignment="Center" Margin="45,291,46,0" VerticalAlignment="Top" Height="80" Click="BtnCheck_Click" TabIndex="5" IsEnabled="False">
|
||||
<Button.Background>
|
||||
<LinearGradientBrush EndPoint="190,80" StartPoint="190,0" MappingMode="Absolute">
|
||||
<GradientStop Color="#FFA2FF00" Offset="1"/>
|
||||
<GradientStop Color="#FF00C300"/>
|
||||
</LinearGradientBrush>
|
||||
</Button.Background>
|
||||
<Button.BorderThickness>
|
||||
<Thickness Bottom="5" Left="5" Right="5" Top="5" />
|
||||
</Button.BorderThickness>
|
||||
<Button.BorderBrush>
|
||||
<LinearGradientBrush EndPoint="190,80" StartPoint="190,0" MappingMode="Absolute">
|
||||
<GradientStop Color="#FFB08000" Offset="1"/>
|
||||
<GradientStop Color="#FFCB0000"/>
|
||||
</LinearGradientBrush>
|
||||
</Button.BorderBrush>
|
||||
<TextBlock TextAlignment="Center" IsHitTestVisible="False" FontWeight="Bold">Ankunft jetzt<LineBreak/>↓↓<LineBreak/>Einweisung und Anmeldung<LineBreak/>werden überprüft</TextBlock>
|
||||
</Button>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="30,386,0,0" TextWrapping="Wrap" Text="Anmeldung:" VerticalAlignment="Top" Width="190"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="30,486,0,0" TextWrapping="Wrap" Text="Einweisung:" VerticalAlignment="Top" Width="190"/>
|
||||
|
||||
<Label x:Name="lblAnmeldung" Margin="45,407,46,0" VerticalAlignment="Top" Height="24" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="1"/>
|
||||
<Label x:Name="lblEinweisung" Margin="45,507,46,0" VerticalAlignment="Top" Height="24" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
|
||||
<Label x:Name="lblKleineUnterweisung" Margin="45,557,46,0" VerticalAlignment="Top" Height="24" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
|
||||
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,0,-2" Height="28" BorderBrush="{x:Null}" Click="Close_Click" VerticalAlignment="Bottom" TabIndex="6" IsEnabled="False"/>
|
||||
<TextBox x:Name="tbAnzahlPersonen" Height="23" Margin="45,81,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="1"/>
|
||||
<TextBox x:Name="tbAnzahlFzg" Height="23" Margin="45,106,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="2"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="30,536,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Kleine Unterweisung"/><Run Text=":"/></TextBlock>
|
||||
<TextBlock Margin="45,84,311,0" TextWrapping="Wrap" Text="Anzahl Personen" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>
|
||||
<TextBlock Margin="45,110,311,0" TextWrapping="Wrap" Text="Anzahl Fahrzeuge" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="30,436,0,0" TextWrapping="Wrap" Text="Fahrzeuge:" VerticalAlignment="Top" Width="190"/>
|
||||
<Label x:Name="lblFahrzeuge" Margin="45,457,46,0" VerticalAlignment="Top" Height="24" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="1"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="30,270,0,0" TextWrapping="Wrap" Text="Ankunft bestätigen:" VerticalAlignment="Top" Width="170"/>
|
||||
<TextBlock x:Name="lblAngemeldeteFzg" Margin="290,110,46,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#CCFF0000" Padding="0,0,5,0" TextAlignment="Right"/>
|
||||
<TextBox x:Name="tbKennzeichen" Height="23" Margin="45,130,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="3"/>
|
||||
<TextBlock Margin="45,134,311,0" TextWrapping="Wrap" Text="Kennzeichen" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>
|
||||
<TextBox x:Name="tbBemerkung" Height="72" Margin="45,180,46,0" TextWrapping="Wrap" VerticalAlignment="Top" Padding="0,2,0,0" TabIndex="4" VerticalScrollBarVisibility="Auto" AcceptsReturn="True"/>
|
||||
<TextBlock Margin="30,158,326,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="Black" Padding="0" Height="22"><Run Text="Bemerkung"/><Run Text=":"/></TextBlock>
|
||||
<Button x:Name="btnSignature" Content="Unterschrift für Einweisung" Margin="45,610,46,0" Height="24" VerticalAlignment="Top" Click="btnSignature_Click" ToolTipService.ShowOnDisabled="True" IsEnabled="False"/>
|
||||
<Button x:Name="btnKlEinweisung_durchgeführt" Content="Hier bestätigen wenn kleine Einweisung durchgeführt wurde" Margin="45,584,46,0" IsEnabled="False" Click="btnKlEinweisung_durchgeführt_Click" VerticalAlignment="Top" Height="24"/>
|
||||
<Button x:Name="btnKarte" Content="Karte(n) ausgegeben" HorizontalAlignment="Left" Margin="45,648,0,0" VerticalAlignment="Top" Width="382" Click="btnKarte_Click" IsEnabled="False"/>
|
||||
<Button x:Name="btnClose_Copy" Content="✕" Padding="0,0,0,0" Margin="0,-25,4,713" Height="18" BorderBrush="{x:Null}" Background="PaleVioletRed" Click="CloseWithX_Click" VerticalAlignment="Bottom" TabIndex="6" IsEnabled="True" HorizontalAlignment="Right" Width="20"/>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
445
ZKuP/Arrivals.xaml.cs
Normal file
@ -0,0 +1,445 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Arrivals.xaml
|
||||
/// </summary>
|
||||
public partial class Arrivals : Window
|
||||
{
|
||||
List<string> NamesList = new List<string>();
|
||||
int firmenCount = 0;
|
||||
int besucherCount = 0;
|
||||
bool arrivalClicked = false;
|
||||
bool kl_EinweisungClicked = false;
|
||||
string query = "";
|
||||
byte[] _signature = null;
|
||||
Window mainWindow = null;
|
||||
|
||||
public Arrivals(Window main, string Parameter = "")
|
||||
{
|
||||
InitializeComponent();
|
||||
arrivalClicked = false;
|
||||
|
||||
mainWindow = main;
|
||||
|
||||
var list = SQL.ReadListString("Select Name FROM zkup.firmen").Result;
|
||||
list = list.OrderBy(p => p).ToList();
|
||||
|
||||
NamesList.Add("Firmen:");
|
||||
NamesList.Add("------------");
|
||||
NamesList.AddRange(list);
|
||||
NamesList.Add("");
|
||||
NamesList.Add("============");
|
||||
NamesList.Add("");
|
||||
|
||||
firmenCount = NamesList.Count;
|
||||
|
||||
|
||||
list = SQL.ReadListString("Select Name FROM zkup.besucher").Result;
|
||||
list.OrderBy(p => p).ToList();
|
||||
|
||||
NamesList.Add("Besucher:");
|
||||
NamesList.Add("------------");
|
||||
NamesList.AddRange(list);
|
||||
|
||||
besucherCount = NamesList.Count - firmenCount;
|
||||
|
||||
|
||||
cbName.ItemsSource = NamesList;
|
||||
|
||||
|
||||
if (Parameter != "")
|
||||
{
|
||||
cbName.SelectionChanged += CbName_SelectionChanged;
|
||||
cbName.SelectedItem = Parameter;
|
||||
tbAnzahlPersonen.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
cbName.SelectionChanged += CbName_SelectionChanged;
|
||||
cbName.IsDropDownOpen = true;
|
||||
}
|
||||
|
||||
if(signoPad._stPad.DeviceGetCount() <= 0)
|
||||
{
|
||||
btnSignature.IsEnabled = false;
|
||||
btnCheck.IsEnabled = true;
|
||||
|
||||
btnSignature.ToolTip = "Kein Unterschriftenpad gefunden";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async void BtnCheck_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var zutritt = "";
|
||||
|
||||
var einweis = "";
|
||||
var kl_einweis = "";
|
||||
string kat = "1";
|
||||
string asp = "";
|
||||
string anzFzg = "";
|
||||
int klUnterweis = 0;
|
||||
int anzFzgGemeldet = 0;
|
||||
|
||||
DataTable table = new DataTable();
|
||||
|
||||
if (cbName.SelectedIndex < firmenCount)
|
||||
{
|
||||
table = await SQL.ReadSQL("Select * FROM zkup.firmen");
|
||||
kat = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
table = await SQL.ReadSQL("Select * FROM zkup.besucher");
|
||||
kat = "2";
|
||||
}
|
||||
|
||||
foreach(DataRow row in table.Rows)
|
||||
{
|
||||
if(row.ItemArray[1].ToString() == cbName.SelectedValue.ToString())
|
||||
{
|
||||
DateTime beginnDT;
|
||||
DateTime endeDT;
|
||||
DateTime einweisDT;
|
||||
DateTime kl_einweisDT;
|
||||
|
||||
|
||||
if (kat == "1")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tbAnzahlFzg.Text))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Fahrzeuge eingeben", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(tbAnzahlPersonen.Text))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Personen eingeben", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (DateTime.TryParse(row.ItemArray[7].ToString(), out beginnDT)
|
||||
&& DateTime.TryParse(row.ItemArray[8].ToString(), out endeDT))
|
||||
{
|
||||
if (DateTime.Now.Date >= beginnDT.Date && DateTime.Now.Date <= endeDT.Date)
|
||||
zutritt = "OK";
|
||||
else zutritt = "Prüfen!";
|
||||
}
|
||||
else
|
||||
{
|
||||
zutritt = $"Fehler! Bitte bei {row.ItemArray[10]} nachfragen";
|
||||
einweis = $"Fehler! Bitte bei {row.ItemArray[10]} nachfragen";
|
||||
}
|
||||
|
||||
if (Convert.ToInt16(tbAnzahlFzg.Text) <= Convert.ToInt16(row.ItemArray[5]))
|
||||
{
|
||||
anzFzg = "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
anzFzg = $"Nur {row.ItemArray[5].ToString()} Fahrzeug(e) angemeldet";
|
||||
}
|
||||
|
||||
anzFzgGemeldet = row.ItemArray[5] != null ? Convert.ToInt16(row.ItemArray[5]) : 0;
|
||||
|
||||
|
||||
if (DateTime.TryParse(row.ItemArray[9].ToString(), out einweisDT))
|
||||
{
|
||||
if(row.ItemArray[9].ToString() == "01.01.1903 00:00:00")
|
||||
{
|
||||
einweis = "Nur in Begleitung";
|
||||
}
|
||||
else if (DateTime.Now.Date <= einweisDT)
|
||||
einweis = "OK";
|
||||
else einweis = "Prüfen!";
|
||||
}
|
||||
else
|
||||
{
|
||||
zutritt = $"Fehler! Bitte bei {row.ItemArray[10]} nachfragen";
|
||||
einweis = $"Fehler! Bitte bei {row.ItemArray[10]} nachfragen";
|
||||
}
|
||||
|
||||
if(DateTime.TryParse(row.ItemArray[12].ToString(), out kl_einweisDT))
|
||||
{
|
||||
if (DateTime.Now.Date <= einweisDT)
|
||||
{
|
||||
kl_einweis = "OK";
|
||||
klUnterweis = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
kl_einweis = "Kleine Unterweisung durchführen!";
|
||||
klUnterweis = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kl_einweis = "Bitte kleine Unterweisung durchführen!";
|
||||
klUnterweis = 0;
|
||||
}
|
||||
|
||||
asp = row.ItemArray[10].ToString();
|
||||
}
|
||||
|
||||
if (kat == "2")
|
||||
{
|
||||
if (DateTime.TryParse(row.ItemArray[5].ToString(), out beginnDT))
|
||||
{
|
||||
if (DateTime.Now.Date == beginnDT)
|
||||
zutritt = "OK";
|
||||
else zutritt = "Prüfen!";
|
||||
}
|
||||
else
|
||||
{
|
||||
zutritt = $"Fehler! Bitte bei {row.ItemArray[7]} nachfragen";
|
||||
einweis = $"Fehler! Bitte bei {row.ItemArray[7]} nachfragen";
|
||||
}
|
||||
|
||||
//if (DateTime.TryParse(row.ItemArray[6].ToString(), out einweisDT))
|
||||
//{
|
||||
// if (DateTime.Now.Date <= einweisDT)
|
||||
// einweis = "OK";
|
||||
// else einweis = "Prüfen!";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// zutritt = $"Fehler! Bitte bei {row.ItemArray[7]} nachfragen";
|
||||
// einweis = $"Fehler! Bitte bei {row.ItemArray[7]} nachfragen";
|
||||
//}
|
||||
einweis = "--";
|
||||
anzFzg = "--";
|
||||
|
||||
if (DateTime.TryParse(row.ItemArray[9].ToString(), out kl_einweisDT))
|
||||
{
|
||||
if (DateTime.Now.Date <= kl_einweisDT)
|
||||
{
|
||||
kl_einweis = "OK";
|
||||
klUnterweis = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
kl_einweis = "Kleine Unterweisung durchführen!";
|
||||
klUnterweis = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kl_einweis = "Kleine Unterweisung durchführen!";
|
||||
klUnterweis = 0;
|
||||
}
|
||||
|
||||
asp = row.ItemArray[7].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lblAnmeldung.Content = zutritt;
|
||||
if (zutritt == "OK") lblAnmeldung.Background = new SolidColorBrush(Colors.LightGreen);
|
||||
else if (zutritt == "Prüfen!") lblAnmeldung.Background = new SolidColorBrush(Colors.LightYellow);
|
||||
else lblAnmeldung.Background = new SolidColorBrush(Colors.LightSalmon);
|
||||
|
||||
lblFahrzeuge.Content = anzFzg;
|
||||
if (anzFzg == "OK") lblFahrzeuge.Background = new SolidColorBrush(Colors.LightGreen);
|
||||
else if (anzFzg.StartsWith("Nur")) lblFahrzeuge.Background = new SolidColorBrush(Colors.LightYellow);
|
||||
else if (anzFzg == "--") lblFahrzeuge.Background = new SolidColorBrush(Colors.LightGray);
|
||||
else lblFahrzeuge.Background = new SolidColorBrush(Colors.LightSalmon);
|
||||
|
||||
|
||||
lblEinweisung.Content = einweis;
|
||||
if (einweis == "OK") lblEinweisung.Background = new SolidColorBrush(Colors.LightGreen);
|
||||
else if (einweis == "Prüfen!") lblEinweisung.Background = new SolidColorBrush(Colors.LightYellow);
|
||||
else if (einweis == "--") lblEinweisung.Background = new SolidColorBrush(Colors.LightGray);
|
||||
else lblEinweisung.Background = new SolidColorBrush(Colors.LightSalmon);
|
||||
|
||||
lblKleineUnterweisung.Content = kl_einweis;
|
||||
if (kl_einweis == "OK") lblKleineUnterweisung.Background = new SolidColorBrush(Colors.LightGreen);
|
||||
else if (kl_einweis == "Kleine Unterweisung durchführen!")
|
||||
{
|
||||
lblKleineUnterweisung.Background = new SolidColorBrush(Colors.LightYellow);
|
||||
lblKleineUnterweisung.Content = "↓ " + kl_einweis + " ↓";
|
||||
}
|
||||
else lblKleineUnterweisung.Background = new SolidColorBrush(Colors.LightSalmon);
|
||||
|
||||
|
||||
var AnzPers = "0";
|
||||
var AnzFzg = "0";
|
||||
|
||||
if (tbAnzahlFzg.Text != "")
|
||||
AnzFzg = tbAnzahlFzg.Text;
|
||||
|
||||
if (tbAnzahlPersonen.Text != "")
|
||||
AnzPers = tbAnzahlPersonen.Text;
|
||||
|
||||
if (einweis == "") einweis = "Fehlerhaft";
|
||||
if (zutritt == "") zutritt = "Fehlerhaft";
|
||||
|
||||
arrivalClicked = true;
|
||||
|
||||
query = $"INSERT INTO zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung,signature_blob) VALUES ('{kat}','{cbName.SelectedValue.ToString().Replace(",",";")}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt}','{einweis}','{AnzPers.Replace(",",";")}','{AnzFzg.Replace(",", ";")}','{asp.Replace(",", ";")}','{klUnterweis}','{anzFzgGemeldet}','{tbKennzeichen.Text}','{tbBemerkung.Text}',@signature)";
|
||||
|
||||
btnSignature.IsEnabled = true;
|
||||
|
||||
if (klUnterweis == 0) btnKlEinweisung_durchgeführt.IsEnabled = true;
|
||||
else if (klUnterweis == 1)
|
||||
{
|
||||
btnKlEinweisung_durchgeführt.ToolTip = "Kleine Unterweisung wurde bereits durchgeführt\nBestätigung nicht nötig";
|
||||
btnSignature.ToolTip = "Kleine Unterweisung wurde bereits durchgeführt\nUnterschrift nicht nötig";
|
||||
btnSignature.Content = "Unterschrift bereits vorhanden";
|
||||
}
|
||||
|
||||
if (arrivalClicked) btnClose.IsEnabled = true;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (arrivalClicked)
|
||||
{
|
||||
e.Cancel = true;
|
||||
MessageBox.Show(this, "Ankunft wurde geklickt\n\nBitte Fenster über \"Schließen\"-Button schließen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
signoPad.CloseConnection();
|
||||
mainWindow.Focus();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
|
||||
MessageBox.Show("Fehler: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (arrivalClicked)
|
||||
{
|
||||
await SQL.WriteSQL(query, _signature);
|
||||
|
||||
arrivalClicked = false;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
signoPad.CloseConnection();
|
||||
}
|
||||
|
||||
private async void CbName_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (cbName.SelectedValue != null)
|
||||
{
|
||||
if(cbName.SelectedItem.ToString() == "------------" || cbName.SelectedItem.ToString() == "============" || cbName.SelectedItem.ToString() == "Besucher:" || cbName.SelectedItem.ToString() == "Firmen:" || (cbName.SelectedItem.ToString() == "" && cbName.SelectedIndex != -1))
|
||||
{
|
||||
cbName.SelectedIndex = -1;
|
||||
MessageBox.Show(this, "Dieses Feld kann nicht gewählt werden", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
string a_Fzg = await SQL.ReadSingleValueAsync($"SELECT Anzahl_Fzg FROM zkup.firmen WHERE `Name`='{cbName.SelectedValue.ToString()}' AND `Arbeitsbeginn` <= current_date() AND `Arbeitsende` >= current_date()");
|
||||
lblAngemeldeteFzg.Text = !string.IsNullOrWhiteSpace(a_Fzg) ? a_Fzg + " Fzg. angemeldet" : "keine Fzg. angemeldet";
|
||||
|
||||
|
||||
btnCheck.IsEnabled = true;
|
||||
btnKarte.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnSignature_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string kat = "1";
|
||||
string firmaBesucher = "";
|
||||
string name = "";
|
||||
|
||||
if (cbName.SelectedIndex < firmenCount)
|
||||
{
|
||||
firmaBesucher = cbName.SelectedValue.ToString();
|
||||
name = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA_Firma FROM zkup.firmen WHERE Name = '{cbName.SelectedValue.ToString()}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
firmaBesucher = cbName.SelectedValue.ToString();
|
||||
name = await SQL.ReadSingleValueAsync($"SELECT Ansprechpartner_Intern FROM zkup.besucher WHERE Name = '{cbName.SelectedValue.ToString()}'");
|
||||
}
|
||||
|
||||
var sig = new Signature(name, cbName.SelectedValue.ToString(), tbKennzeichen.Text);
|
||||
if(sig.ShowDialog() == false)
|
||||
{
|
||||
_signature = sig.ResultByte;
|
||||
|
||||
btnCheck.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnKlEinweisung_durchgeführt_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (signoPad._stPad.DeviceGetCount() <= 0)
|
||||
{
|
||||
btnSignature.IsEnabled = false;
|
||||
btnSignature.ToolTip = "Kein Unterschriftenpad gefunden";
|
||||
}
|
||||
else { btnSignature.IsEnabled = true; btnSignature.Content = "Unterschrift einholen!"; }
|
||||
|
||||
if (cbName.SelectedIndex < firmenCount)
|
||||
await SQL.WriteSQL($"UPDATE zkup.firmen SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE Name = '{cbName.SelectedValue.ToString()}'");
|
||||
else
|
||||
await SQL.WriteSQL($"UPDATE zkup.besucher SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE Name = '{cbName.SelectedValue.ToString()}'");
|
||||
|
||||
var s = query.Split(',');
|
||||
s[20] = "1";
|
||||
query = string.Join(",", s);
|
||||
|
||||
btnKlEinweisung_durchgeführt.Background = new SolidColorBrush(Colors.GreenYellow);
|
||||
}
|
||||
|
||||
private void btnKarte_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AddCardUser aI = new AddCardUser(cbName.SelectedItem.ToString());
|
||||
aI.Owner = this;
|
||||
aI.ShowDialog();
|
||||
}
|
||||
|
||||
private void Window_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
this.Opacity = 1;
|
||||
}
|
||||
|
||||
private void Window_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
this.Opacity = 0.5;
|
||||
}
|
||||
|
||||
private void CloseWithX_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Window_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
112
ZKuP/ArrivalsOverview.xaml
Normal file
@ -0,0 +1,112 @@
|
||||
<Window x:Class="ZKuP.ArrivalsOverview"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Ankunftsübersicht" Height="750" Width="1300">
|
||||
<Window.Resources>
|
||||
<local:ConvertToBackground2 x:Key="ConvertToBackground2"></local:ConvertToBackground2>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
||||
<DataGrid x:Name="dgArrivalsOverview" Margin="10,65,10,10" AutoGenerateColumns="False" ItemsSource="{Binding .}" CanUserDeleteRows="False" CanUserAddRows="False" RowHeaderWidth="0">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Name, Converter={StaticResource ConvertToBackground2}}" Value="1">
|
||||
<Setter Property="Background" Value="#3000FF00"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Name, Converter={StaticResource ConvertToBackground2}}" Value="0">
|
||||
<Setter Property="Background" Value="#30FF0000"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*" SortDirection="Ascending">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Verantwortlicher Firma / Besucher" Binding="{Binding Verantwortlicher_MA_Firma}" Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Tel. Firma / Besucher" Binding="{Binding Tel_Nr_Verantwortlicher_Firma}" Width="140">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Ansprechpartner Intern" Binding="{Binding Ansprechpartner_Intern}" Width="140">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Auftrag" Binding="{Binding Beauftragte_Leistung}" Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Arbeitsbeginn" Binding="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}" Width="90">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Arbeitsende" Binding="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}" Width="90">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<DatePicker x:Name="dPOverviewVon" HorizontalAlignment="Left" Margin="90,10,0,0" VerticalAlignment="Top" Width="100" SelectedDateChanged="dPOverviewVon_SelectedDateChanged">
|
||||
<DatePicker.Resources>
|
||||
<Style TargetType="DatePickerTextBox">
|
||||
<Setter Property="IsReadOnly" Value="True"/>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="IsEnabled" Value="False"/>
|
||||
<Setter Property="Background" Value="{Binding ElementName=dPOverviewVon, Path=Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{Binding ElementName=dPOverviewBis, Path=Background}"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DatePicker.Resources>
|
||||
</DatePicker>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,14,0,0" TextWrapping="Wrap" Text="Ansicht von:" VerticalAlignment="Top" Height="20" Width="75"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="200,14,0,0" TextWrapping="Wrap" Text="bis:" VerticalAlignment="Top" Height="20" Width="26"/>
|
||||
<DatePicker x:Name="dPOverviewBis" HorizontalAlignment="Left" Margin="230,10,0,0" VerticalAlignment="Top" Width="100" SelectedDateChanged="dPOverviewBis_SelectedDateChanged">
|
||||
<DatePicker.Resources>
|
||||
<Style TargetType="DatePickerTextBox">
|
||||
<Setter Property="IsReadOnly" Value="True"/>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="IsEnabled" Value="False"/>
|
||||
<Setter Property="Background" Value="{Binding ElementName=dPOverviewBis, Path=Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{Binding ElementName=dPOverviewBis, Path=Background}"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DatePicker.Resources>
|
||||
</DatePicker>
|
||||
<!--<Button x:Name="btnOK" Content="OK" IsEnabled="False" HorizontalAlignment="Left" Margin="345,10,0,0" VerticalAlignment="Top" Width="75" Height="24" Click="btnOK_Click"/>-->
|
||||
<TextBlock x:Name="lblAnwesend" Text="Anwesende Firmen/Besucher zwischen dem '' und '':" HorizontalAlignment="Left" Margin="10,45,0,0" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
110
ZKuP/ArrivalsOverview.xaml.cs
Normal file
@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ArrivalsOverview.xaml
|
||||
/// </summary>
|
||||
public partial class ArrivalsOverview : Window
|
||||
{
|
||||
Roles LoggedInRole = Roles.None;
|
||||
|
||||
DataTable overv = new DataTable("Overview");
|
||||
DataTable todayFirm = new DataTable("TodayFirm");
|
||||
DataTable todayBesuch = new DataTable("TodayBesuch");
|
||||
|
||||
|
||||
|
||||
public ArrivalsOverview(Roles role)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
LoggedInRole = role;
|
||||
|
||||
dPOverviewVon.SelectedDate = DateTime.Now.Date;
|
||||
dPOverviewBis.SelectedDate = DateTime.Now.Date.AddDays(14);
|
||||
FillDataGrid(DateTime.Now.Date, DateTime.Now.Date.AddDays(14));
|
||||
}
|
||||
|
||||
|
||||
private async void FillDataGrid(DateTime von, DateTime bis)
|
||||
{
|
||||
if (LoggedInRole == Roles.Admin || LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
todayFirm = await SQL.ReadSQL($"Select * From zkup.firmen where (Arbeitsbeginn >= '{von.ToString("yyyy-MM-dd")}' AND Arbeitsende <= '{bis.ToString("yyyy-MM-dd")}') OR '{von.ToString("yyyy-MM-dd")}' BETWEEN Arbeitsbeginn AND Arbeitsende", todayFirm);
|
||||
todayBesuch = await SQL.ReadSQL($"SELECT idbesucher, concat('Besucher: ', Name) AS Name, Verantwortlicher_MA AS Verantwortlicher_MA_Firma,Tel_Nr_Besucher AS Tel_Nr_Verantwortlicher_Firma,Besuchstag AS Arbeitsbeginn,Grund_des_Besuchs AS Beauftragte_Leistung,Ansprechpartner_Intern from zkup.besucher WHERE (Besuchstag >= '{von.ToString("yyyy-MM-dd")}' AND Besuchstag <= '{bis.ToString("yyyy-MM-dd")}')", todayBesuch);
|
||||
}
|
||||
else
|
||||
{
|
||||
todayFirm = await SQL.ReadSQL($"Select * From zkup.firmen where ((Arbeitsbeginn >= '{von.ToString("yyyy-MM-dd")}' AND Arbeitsende <= '{bis.ToString("yyyy-MM-dd")}') OR '{von.ToString("yyyy-MM-dd")}' BETWEEN Arbeitsbeginn AND Arbeitsende) AND (Ersteller = '{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{Environment.UserDomainName}{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{SQL.ReadSingleValue($"SELECT Vertreter FROM zkup.ansprechpartner WHERE Name = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'")}' " +
|
||||
$"OR Ansprechpartner_Intern = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}')", todayFirm);
|
||||
todayBesuch = await SQL.ReadSQL($"SELECT idbesucher, concat('Besucher: ', Name) AS Name, Verantwortlicher_MA AS Verantwortlicher_MA_Firma,Tel_Nr_Besucher AS Tel_Nr_Verantwortlicher_Firma,Besuchstag AS Arbeitsbeginn,Grund_des_Besuchs AS Beauftragte_Leistung,Ansprechpartner_Intern from zkup.besucher WHERE (Besuchstag >= '{von.ToString("yyyy-MM-dd")}' AND Besuchstag <= '{bis.ToString("yyyy-MM-dd")}') AND (Ersteller = '{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{Environment.UserDomainName}{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{SQL.ReadSingleValue($"SELECT Vertreter FROM zkup.ansprechpartner WHERE Name = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'")}' " +
|
||||
$"OR Ansprechpartner_Intern = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}')", todayBesuch);
|
||||
}
|
||||
|
||||
var firmview = todayFirm.DefaultView;
|
||||
firmview.Sort = "Name";
|
||||
todayFirm = firmview.ToTable();
|
||||
|
||||
var besuchview = todayBesuch.DefaultView;
|
||||
besuchview.Sort = "Name";
|
||||
todayBesuch = besuchview.ToTable();
|
||||
|
||||
todayFirm.Merge(todayBesuch);
|
||||
dgArrivalsOverview.DataContext = todayFirm;
|
||||
}
|
||||
|
||||
|
||||
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FillDataGrid(dPOverviewVon.SelectedDate.Value, dPOverviewBis.SelectedDate.Value);
|
||||
}
|
||||
|
||||
private void dPOverviewVon_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dPOverviewVon.SelectedDate.HasValue && dPOverviewBis.SelectedDate.HasValue && dPOverviewBis.SelectedDate.Value >= dPOverviewVon.SelectedDate.Value)
|
||||
{
|
||||
//btnOK.IsEnabled = true;
|
||||
FillDataGrid(dPOverviewVon.SelectedDate.Value, dPOverviewBis.SelectedDate.Value);
|
||||
lblAnwesend.Text = $"Ihre anwesenden Firmen/Besucher zwischen dem {dPOverviewVon.SelectedDate.Value.ToString("dd.MM.yy")} und {dPOverviewBis.SelectedDate.Value.ToString("dd.MM.yy")}:";
|
||||
dPOverviewVon.ClearValue(DatePicker.BackgroundProperty);
|
||||
dPOverviewBis.ClearValue(DatePicker.BackgroundProperty);
|
||||
}
|
||||
else
|
||||
dPOverviewVon.Background = new SolidColorBrush(Colors.Red);
|
||||
|
||||
}
|
||||
|
||||
private void dPOverviewBis_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dPOverviewVon.SelectedDate.HasValue && dPOverviewBis.SelectedDate.HasValue && dPOverviewBis.SelectedDate.Value >= dPOverviewVon.SelectedDate.Value)
|
||||
{
|
||||
//btnOK.IsEnabled = true;
|
||||
FillDataGrid(dPOverviewVon.SelectedDate.Value, dPOverviewBis.SelectedDate.Value);
|
||||
lblAnwesend.Text = $"Ihre anwesenden Firmen/Besucher zwischen dem {dPOverviewVon.SelectedDate.Value.ToString("dd.MM.yy")} und {dPOverviewBis.SelectedDate.Value.ToString("dd.MM.yy")}:";
|
||||
dPOverviewBis.ClearValue(DatePicker.BackgroundProperty);
|
||||
dPOverviewVon.ClearValue(DatePicker.BackgroundProperty);
|
||||
}
|
||||
else
|
||||
dPOverviewBis.Background = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
43
ZKuP/AspInfo.xaml
Normal file
@ -0,0 +1,43 @@
|
||||
<Window x:Class="ZKuP.AspInfo"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Info zu Ansprechpartnern" Height="591" Width="354" ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Grid x:Name="gridInfo">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Name="lblAsp" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Ansprechpartner:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbAsp" Margin="10,0,10,10" TextWrapping="Wrap" VerticalAlignment="Bottom" IsReadOnly="True"/>
|
||||
<TextBlock x:Name="lblTelVertreter_Besucher" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Telefonnummer Vertreter:" VerticalAlignment="Top" Grid.Row="3"/>
|
||||
<TextBox x:Name="tbTelVertreter" Margin="10,0,10,10" TextWrapping="Wrap" VerticalAlignment="Bottom" Grid.Row="3" IsReadOnly="True"/>
|
||||
<TextBlock x:Name="lblVertreter_Besucher" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Vertreter:" VerticalAlignment="Top" Grid.Row="2"/>
|
||||
<TextBox x:Name="tbVertreter" Margin="10,0,10,10" TextWrapping="Wrap" VerticalAlignment="Bottom" Grid.Row="2" IsReadOnly="True"/>
|
||||
<TextBlock x:Name="lblTelAsp" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Telefonnummer Ansprechpartner:" VerticalAlignment="Top" Grid.Row="1"/>
|
||||
<TextBox x:Name="tbTelAsp" Margin="10,0,10,10" TextWrapping="Wrap" VerticalAlignment="Bottom" Grid.Row="1" IsReadOnly="True"/>
|
||||
<TextBlock x:Name="lblVorgesetzter" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Vorgesetzter:" VerticalAlignment="Top" Grid.Row="4"/>
|
||||
<TextBox x:Name="tbVorgesetzter" Margin="10,0,10,10" TextWrapping="Wrap" VerticalAlignment="Bottom" Grid.Row="4" IsReadOnly="True"/>
|
||||
<TextBlock x:Name="lblTelVorgesetzter" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Telefonnummer Vorgesetzter:" VerticalAlignment="Top" Grid.Row="5"/>
|
||||
<TextBox x:Name="tbTelVorgesetzter" Margin="10,0,10,10" TextWrapping="Wrap" VerticalAlignment="Bottom" Grid.Row="5" IsReadOnly="True"/>
|
||||
<TextBlock x:Name="lblBemerkung" Margin="10,10,10,0" TextWrapping="Wrap" Text="Bemerkung" VerticalAlignment="Top" Grid.Row="6" Height="20"/>
|
||||
<TextBox x:Name="tbBemerkung" Margin="10,35,10,10" TextWrapping="Wrap" VerticalAlignment="Stretch" Grid.Row="6" IsReadOnly="True" VerticalScrollBarVisibility="Auto"/>
|
||||
<Button x:Name="btnSignature" Content="Unterschrift" Margin="10" Click="btnSignature_Click" Grid.Row="7"/>
|
||||
<Button x:Name="btnClose" Content="Schließen" Margin="10" Click="BtnClose_Click" Grid.Row="8"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
139
ZKuP/AspInfo.xaml.cs
Normal file
@ -0,0 +1,139 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AspInfo.xaml
|
||||
/// </summary>
|
||||
public partial class AspInfo : Window
|
||||
{
|
||||
public int id { get; set; }
|
||||
|
||||
//info = Welcher InfoButton wurde gedrückt? 1 = Ankunft heute; 2 = bereits bestätigt
|
||||
public AspInfo(string name, string kat, int info = 1, string idzutritte = "1")
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (idzutritte != "1") id = Convert.ToInt32(idzutritte);
|
||||
|
||||
if (info == 1) { lblBemerkung.Visibility = Visibility.Collapsed; tbBemerkung.Visibility = Visibility.Collapsed; btnSignature.Visibility = Visibility.Collapsed; }
|
||||
else if (info == 2) { lblBemerkung.Visibility = Visibility.Visible; tbBemerkung.Visibility = Visibility.Visible; }
|
||||
else { lblBemerkung.Visibility = Visibility.Visible; tbBemerkung.Visibility = Visibility.Visible; }
|
||||
|
||||
if (kat == "1")
|
||||
{
|
||||
tbVorgesetzter.Visibility = Visibility.Visible;
|
||||
tbTelVorgesetzter.Visibility = Visibility.Visible;
|
||||
lblVorgesetzter.Visibility = Visibility.Visible;
|
||||
lblTelVorgesetzter.Visibility = Visibility.Visible;
|
||||
|
||||
lblVertreter_Besucher.Text = "Vertreter";
|
||||
lblTelVertreter_Besucher.Text = "Telefonnummer Vertreter";
|
||||
|
||||
System.Data.DataTable asp = SQL.ReadSQL($"SELECT * FROM zkup.ansprechpartner WHERE Name='{name}'").Result;
|
||||
|
||||
if (asp.Rows.Count > 0)
|
||||
{
|
||||
tbAsp.Text = asp.Rows[0].ItemArray[0].ToString();
|
||||
tbVertreter.Text = asp.Rows[0].ItemArray[1].ToString();
|
||||
tbTelAsp.Text = asp.Rows[0].ItemArray[2].ToString();
|
||||
tbVorgesetzter.Text = asp.Rows[0].ItemArray[3].ToString();
|
||||
tbTelVertreter.Text = asp.Rows[0].ItemArray[4].ToString();
|
||||
tbTelVorgesetzter.Text = asp.Rows[0].ItemArray[5].ToString();
|
||||
|
||||
|
||||
tbBemerkung.Text = SQL.ReadSingleValue($"SELECT Bemerkung FROM zkup.zutritte WHERE idzutritte='{idzutritte}'");
|
||||
}
|
||||
else MessageBox.Show(this, "Keine oder fehlerhafte Daten angegeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
else if (kat == "2")
|
||||
{
|
||||
tbVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
tbTelVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
lblVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
lblTelVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
|
||||
lblVertreter_Besucher.Text = "Besucher";
|
||||
lblTelVertreter_Besucher.Text = "Telefonnummer Besucher";
|
||||
|
||||
System.Data.DataTable asp = SQL.ReadSQL($"SELECT * FROM zkup.besucher WHERE Name='{name}'").Result;
|
||||
if (asp.Rows.Count > 0)
|
||||
{
|
||||
tbAsp.Text = asp.Rows[0].ItemArray[7].ToString();
|
||||
tbTelAsp.Text = asp.Rows[0].ItemArray[8].ToString();
|
||||
tbVertreter.Text = asp.Rows[0].ItemArray[1].ToString();
|
||||
tbTelVertreter.Text = asp.Rows[0].ItemArray[3].ToString();
|
||||
|
||||
tbBemerkung.Text = SQL.ReadSingleValue($"SELECT Bemerkung FROM zkup.zutritte WHERE idzutritte='{idzutritte}'");
|
||||
}
|
||||
else MessageBox.Show(this, "Keine oder fehlerhafte Daten angegeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
else if (kat == "")
|
||||
{
|
||||
tbVertreter.Visibility = Visibility.Collapsed;
|
||||
tbTelVertreter.Visibility = Visibility.Collapsed;
|
||||
tbVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
tbTelVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
lblVertreter_Besucher.Visibility = Visibility.Collapsed;
|
||||
lblTelVertreter_Besucher.Visibility = Visibility.Collapsed;
|
||||
lblVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
lblTelVorgesetzter.Visibility = Visibility.Collapsed;
|
||||
|
||||
btnSignature.Visibility = Visibility.Collapsed;
|
||||
|
||||
lblAsp.Text = "Fahrer:";
|
||||
lblTelAsp.Text = "Telefonnummer Fahrer:";
|
||||
lblBemerkung.Text = "Parkplatz / Bemerkung";
|
||||
|
||||
System.Data.DataTable asp = SQL.ReadSQL($"SELECT * FROM zkup.zutritte WHERE idzutritte='{idzutritte}'").Result;
|
||||
if (asp.Rows.Count > 0)
|
||||
{
|
||||
tbAsp.Text = asp.Rows[0].ItemArray[2].ToString().Split(new[] { "Fahrer: " }, StringSplitOptions.None)[1];
|
||||
tbTelAsp.Text = asp.Rows[0].ItemArray[8].ToString();
|
||||
|
||||
gridInfo.RowDefinitions[4].Height = new GridLength(0);
|
||||
gridInfo.RowDefinitions[5].Height = new GridLength(0);
|
||||
gridInfo.RowDefinitions[6].Height = new GridLength(4, GridUnitType.Star);
|
||||
|
||||
tbBemerkung.Text = asp.Rows[0].ItemArray[12].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnSignature_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var x = SQL.ReadSingleByteArr($"SELECT signature_blob FROM zkup.zutritte WHERE idzutritte = '{id}'");
|
||||
//var i = DBImageManager.ImageFromByte(x);
|
||||
ImageView iv;
|
||||
|
||||
if (x != null)
|
||||
iv = new ImageView(Helper.ConvertBitmapToImage(x), false);
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "Keine Unterschrift vorhanden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
//iv.BackgroundImage = Helper.ConvertBitmapToImage(x);
|
||||
iv.ShowDialog();
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
ZKuP/Cards.xaml
Normal file
@ -0,0 +1,22 @@
|
||||
<Window x:Class="ZKuP.Cards"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Karten" Height="450" Width="800">
|
||||
<Grid>
|
||||
<DataGrid x:Name="dgCards" Margin="10,35,10,10" ItemsSource="{Binding Path=., Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" AutoGenerateColumns="False" CanUserDeleteRows="False" PreviewKeyDown="dgCards_PreviewKeyDown" SelectionChanged="dgCards_SelectionChanged">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding kartennr}" ClipboardContentBinding="{x:Null}" Header="Kartennummer" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding farbe}" ClipboardContentBinding="{x:Null}" Header="Farbe" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding benutzer}" ClipboardContentBinding="{x:Null}" Header="Firma / Benutzer" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding telnr}" ClipboardContentBinding="{x:Null}" Header="Telefonnummer" Width="*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button x:Name="btnAdd" Content="Karte hinzufügen" Margin="0,10,10,0" VerticalAlignment="Top" Click="btnAdd_Click" HorizontalAlignment="Right" Width="152"/>
|
||||
<Button x:Name="btnDelete" Content="Markierte Karte löschen" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="135" IsEnabled="False" Click="btnDelete_Click"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
86
ZKuP/Cards.xaml.cs
Normal file
@ -0,0 +1,86 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Cards.xaml
|
||||
/// </summary>
|
||||
public partial class Cards : Window
|
||||
{
|
||||
System.Data.DataTable karten = new System.Data.DataTable("karten");
|
||||
|
||||
|
||||
public Cards()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
karten = SQL.ReadSQL("Select * from zkup.karten", karten).Result;
|
||||
dgCards.DataContext = karten;
|
||||
}
|
||||
|
||||
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 = SQL.ReadSQL("Select * FROM zkup.karten", karten).Result;
|
||||
dgCards.DataContext = karten;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AddCardUser addCardUser = new AddCardUser();
|
||||
addCardUser.Owner = this;
|
||||
addCardUser.ShowDialog();
|
||||
|
||||
karten = SQL.ReadSQL("Select * from zkup.karten", karten).Result;
|
||||
dgCards.DataContext = karten;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void dgCards_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dgCards.SelectedIndex != -1) btnDelete.IsEnabled = true;
|
||||
else btnDelete.IsEnabled = false;
|
||||
}
|
||||
private async void btnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.karten WHERE `kartennr` = '{arr[1]}'");
|
||||
|
||||
karten = SQL.ReadSQL("Select * FROM zkup.karten", karten).Result;
|
||||
dgCards.DataContext = karten;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
ZKuP/CheckParkausweis.xaml
Normal file
@ -0,0 +1,17 @@
|
||||
<Window x:Class="ZKuP.CheckParkausweis"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Parkausweise überprüfen" Height="450" MinHeight="300" Width="320" MinWidth="320">
|
||||
<Grid>
|
||||
<TextBox x:Name="tbSearch" Margin="10,10,150,0" Height="25" Padding="2" VerticalAlignment="Top" PreviewGotKeyboardFocus="tbSearch_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="tbSearch_PreviewLostKeyboardFocus"/>
|
||||
<TextBlock x:Name="lblSearch" Text="Kennzeichen suchen..." Margin="15,12,150,0" Height="25" VerticalAlignment="Top" Foreground="Gray" IsHitTestVisible="False" PreviewKeyDown="lblSearch_PreviewKeyDown"/>
|
||||
<Button x:Name="btnSearch" Content="Suchen" Margin="155,10,10,0" Height="25" VerticalAlignment="Top" HorizontalAlignment="Right" Width="115" Click="btnSearch_Click"/>
|
||||
<DataGrid Margin="10,45,10,10" x:Name="dgCheck" ItemsSource="{Binding .}" CanUserDeleteRows="False" CanUserAddRows="False" CanUserReorderColumns="False" ColumnWidth="*">
|
||||
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
57
ZKuP/CheckParkausweis.xaml.cs
Normal file
@ -0,0 +1,57 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für CheckParkausweis.xaml
|
||||
/// </summary>
|
||||
public partial class CheckParkausweis : Window
|
||||
{
|
||||
public CheckParkausweis()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT Kennzeichen FROM zkup.parkausweise WHERE Genehmigt = '1'").Result;
|
||||
dgCheck.DataContext = list;
|
||||
}
|
||||
|
||||
|
||||
private void btnSearch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var list = SQL.ReadSQL($"SELECT Kennzeichen FROM zkup.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
|
||||
dgCheck.DataContext = list;
|
||||
}
|
||||
|
||||
private void tbSearch_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (tbSearch.Text == "")
|
||||
lblSearch.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void tbSearch_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
lblSearch.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private void lblSearch_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.Key == Key.Enter)
|
||||
{
|
||||
var list = SQL.ReadSQL($"SELECT Kennzeichen FROM zkup.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
|
||||
dgCheck.DataContext = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
427
ZKuP/CreateFirma.xaml
Normal file
@ -0,0 +1,427 @@
|
||||
<Window x:Class="ZKuP.CreateFirma"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Firmen verwalten" Height="661" Width="1378" ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ControlTemplate x:Key="ComboBoxControlTemplate1" TargetType="{x:Type ComboBox}">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="True" Grid.ColumnSpan="2" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||
<!--</Themes:SystemDropShadowChrome>-->
|
||||
<!--<Themes:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}">-->
|
||||
<Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
|
||||
<ScrollViewer x:Name="DropDownScrollViewer">
|
||||
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
|
||||
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
||||
<Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
|
||||
</Canvas>
|
||||
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
<ToggleButton x:Name="toggleButton" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ToggleButton.Style>
|
||||
<Style TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="ClickMode" Value="Press"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border x:Name="templateRoot" BorderBrush="#99ACACAC" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#99F0F0F0" Offset="0"/>
|
||||
<GradientStop Color="#99FFFFFF" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="True" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
|
||||
<Path x:Name="Arrow" Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z" Fill="#CC000000" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CABADB3"/>
|
||||
<Setter Property="Background" TargetName="splitBorder" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="Transparent"/>
|
||||
</MultiDataTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Fill" TargetName="Arrow" Value="Black"/>
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#4CECF4FC" Offset="0"/>
|
||||
<GradientStop Color="#4CDCECFC" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C7EB4EA"/>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C7EB4EA"/>
|
||||
<Setter Property="Background" TargetName="splitBorder">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#4CEBF4FC" Offset="0"/>
|
||||
<GradientStop Color="#4CDCECFC" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="#4C7EB4EA"/>
|
||||
</MultiDataTrigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Fill" TargetName="Arrow" Value="Black"/>
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#4CDAECFC" Offset="0"/>
|
||||
<GradientStop Color="#4CC4E0FC" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C569DE5"/>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C569DE5"/>
|
||||
<Setter Property="Background" TargetName="splitBorder">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
||||
<GradientStop Color="#4CDAEBFC" Offset="0"/>
|
||||
<GradientStop Color="#4CC4E0FC" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="#4C569DE5"/>
|
||||
</MultiDataTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Fill" TargetName="Arrow" Value="#4C000000"/>
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="#4CF0F0F0"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CD9D9D9"/>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
|
||||
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CBFBFBF"/>
|
||||
<Setter Property="Background" TargetName="splitBorder" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" TargetName="splitBorder" Value="Transparent"/>
|
||||
</MultiDataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ToggleButton.Style>
|
||||
</ToggleButton>
|
||||
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<!--<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="True">
|
||||
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
|
||||
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
|
||||
</Trigger>-->
|
||||
<Trigger Property="HasItems" Value="False">
|
||||
<Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsGrouping" Value="True"/>
|
||||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
|
||||
</MultiTrigger>
|
||||
<Trigger Property="CanContentScroll" SourceName="DropDownScrollViewer" Value="False">
|
||||
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
|
||||
|
||||
<Grid x:Name="grid">
|
||||
<TextBox x:Name="tbName" HorizontalAlignment="Left" Height="23" Margin="10,57,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="1" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Name der Firma"/></TextBlock>
|
||||
<TextBox x:Name="tbVerantwortlicher_MA" HorizontalAlignment="Left" Height="23" Margin="10,106,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,85,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Verantwortlicher Mitarbeiter der Firma"/></TextBlock>
|
||||
<TextBox x:Name="tbTel_Firma" HorizontalAlignment="Left" Height="23" Margin="10,155,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="3" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,134,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Telefonnummer Mitarbeiter der Firma"/></TextBlock>
|
||||
<TextBox x:Name="tbAnzahl_Begleiter" HorizontalAlignment="Left" Height="23" Margin="10,204,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="4" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewTextInput="tbAnzahl_Begleiter_PreviewTextInput" ToolTip="Nur Zahlen und max. 2 Stellen" CommandManager.PreviewExecuted="Textboxes_PreviewExecuted" ContextMenu="{x:Null}"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,183,0,0" TextWrapping="Wrap" Text="Anzahl Begleitpersonen" VerticalAlignment="Top"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,330,0,0" TextWrapping="Wrap" Text="Arbeitsbeginn ab" VerticalAlignment="Top"/>
|
||||
<TextBlock x:Name="lbl1" HorizontalAlignment="Left" Margin="10,380,0,0" TextWrapping="Wrap" Text="Personen in Baumaßnahme eingewiesen bis" VerticalAlignment="Top"/>
|
||||
<ComboBox x:Name="cbAnsprechpartner_Intern" HorizontalAlignment="Left" Height="23" Margin="10,504,0,0" Text="" VerticalAlignment="Top" Width="340" SelectionChanged="CbAnsprechpartner_Intern_SelectionChanged" TabIndex="13"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,483,0,0" TextWrapping="Wrap" Text="Ansprechpartner intern" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbTel_Nr_Ansprechpartner_Intern" HorizontalAlignment="Left" Height="23" Margin="10,553,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="14" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,532,0,0" TextWrapping="Wrap" Text="Telefonnummer Ansprechpartner" VerticalAlignment="Top"/>
|
||||
<DatePicker x:Name="dpArbeitsbeginn" HorizontalAlignment="Left" Margin="10,351,0,0" VerticalAlignment="Top" TabIndex="7" PreviewKeyDown="DpArbeitsbeginn_PreviewKeyDown" IsTabStop="True"/>
|
||||
<DatePicker x:Name="dpEinweisung_Bis" HorizontalAlignment="Left" Margin="10,401,0,0" VerticalAlignment="Top" Width="340" TabIndex="9" IsTabStop="True" Focusable="True" PreviewKeyDown="DpEinweisung_Bis_PreviewKeyDown">
|
||||
<DatePicker.Resources>
|
||||
<Style x:Key="dpEinweisungStyle" TargetType="DatePickerTextBox">
|
||||
<Setter Property="Text" Value="Datum auswählen →"/>
|
||||
<Setter Property="IsReadOnly" Value="True"/>
|
||||
</Style>
|
||||
</DatePicker.Resources>
|
||||
|
||||
</DatePicker>
|
||||
<Button x:Name="btnAdd" Content="Hinzufügen
 →" HorizontalAlignment="Left" Margin="355,36,0,0" VerticalAlignment="Top" Width="75" Height="553" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Click="btnAdd_Click" TabIndex="15"/>
|
||||
<DataGrid x:Name="dgFirmen" Margin="435,36,10,43" KeyboardNavigation.TabNavigation="None" ItemsSource="{Binding Path=., Mode=OneWay}" AutoGenerateColumns="False" CanUserAddRows="False" IsTabStop="False" HorizontalScrollBarVisibility="Visible" CellEditEnding="DgFirmen_CellEditEnding" CanUserDeleteRows="False" PreviewKeyDown="DgFirmen_PreviewKeyDown" BeginningEdit="dgFirmen_BeginningEdit" SelectionChanged="dgFirmen_SelectionChanged" SelectionMode="Single" PreparingCellForEdit="dgFirmen_PreparingCellForEdit" ToolTip="Daten können per Doppelklick geändert werden">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Örtliche_Einweisung_bis, StringFormat=\{0:dd.MM.yyyy\}}" Value="01.01.1902">
|
||||
<Setter Property="Background" Value="Red"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Örtliche_Einweisung_bis, StringFormat=\{0:dd.MM.yyyy\}}" Value="01.01.1903">
|
||||
<Setter Property="Background" Value="LightYellow"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<!--Override Highlighting so that its easy to see what is selected even when the control is not focused-->
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="True" />
|
||||
<Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=IsKeyboardFocusWithin}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.Setters>
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
</MultiDataTrigger.Setters>
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" ClipboardContentBinding="{x:Null}" Header="Name" SortDirection="Ascending">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="5,0,0,0"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Verantwortlicher_MA_Firma}" ClipboardContentBinding="{x:Null}" Header="Verantw. MA">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="5,0,0,0"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Nr_Verantwortlicher_Firma}" ClipboardContentBinding="{x:Null}" Header="Tel. Firma">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="5,0,0,0"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Anzahl_Begleiter}" ClipboardContentBinding="{x:Null}" Header="Anz. Begleitp.">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Anzahl_Fzg}" ClipboardContentBinding="{x:Null}" Header="Anz. Fzg.">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Beauftragte_Leistung}" ClipboardContentBinding="{x:Null}" Header="Beauftragte Leistung">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="5,0,0,0"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}" ClipboardContentBinding="{x:Null}" Header="Arbeitsbeginn">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}" ClipboardContentBinding="{x:Null}" Header="Arbeitsende">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Örtliche_Einweisung_bis, StringFormat=\{0:dd.MM.yyyy\}}" Header="Unterwiesen bis">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<!--<Setter Property="Background" Value="{Binding Örtliche_Einweisung_bis, StringFormat=\{0:dd.MM.yyyy\}, Converter={StaticResource ConvertDateToBackground}}"/>-->
|
||||
<Setter Property="TextAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<!--<DataGridTextColumn Binding="{Binding Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Anspr. intern"/>-->
|
||||
<DataGridTemplateColumn Header="Anspr. intern" MinWidth="150">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox x:Name="dg_cbASP" Template="{DynamicResource ComboBoxControlTemplate1}" ItemsSource="{Binding asp, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" SelectedItem="{Binding Ansprechpartner_Intern, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" DropDownClosed="dg_cbAsp_DropDownClosed" DropDownOpened="dg_cbASP_DropDownOpened">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Nr_Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Tel. Ansprechp.">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Padding" Value="5,0,0,0"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="98" Height="28" Click="BtnClose_Click" TabIndex="16"/>
|
||||
<TextBox x:Name="tbAnzahl_Fzg" HorizontalAlignment="Left" Height="23" Margin="10,253,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="5" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewTextInput="tbAnzahl_Fzg_PreviewTextInput" ToolTip="Nur Zahlen und max. 2 Stellen" CommandManager.PreviewExecuted="Textboxes_PreviewExecuted" ContextMenu="{x:Null}"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,232,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Anzahl "/><Run Text="Fahrzeuge"/></TextBlock>
|
||||
<TextBox x:Name="tbBeauftragte_Leistung" HorizontalAlignment="Left" Height="23" Margin="10,302,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="6" PreviewKeyDown="TbBeauftragte_Leistung_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,281,0,0" TextWrapping="Wrap" Text="Beauftragte Leistung" VerticalAlignment="Top"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="170,330,0,0" TextWrapping="Wrap" Text="Arbeitsende bis" VerticalAlignment="Top"/>
|
||||
<DatePicker x:Name="dpArbeitsende" HorizontalAlignment="Left" Margin="170,351,0,0" VerticalAlignment="Top" TabIndex="8" PreviewKeyDown="DpArbeitsende_PreviewKeyDown" IsTabStop="True"/>
|
||||
<Button x:Name="btnEinweisung_1Jahr" Content="↑ Für ein Jahr" HorizontalAlignment="Left" Margin="245,425,0,0" VerticalAlignment="Top" Width="105" Click="BtnEinweisung_PreValues_Click" Padding="1" Height="24" TabIndex="12" ToolTip="Firma hat bereits eine Einweisung bekommen
Ablauf in einem Jahr wird automatisch eingetragen"/>
|
||||
<Button x:Name="btnEinweisung_1Monat" Content="↑ Für einen Monat" HorizontalAlignment="Left" Margin="124,425,0,0" VerticalAlignment="Top" Width="116" Click="BtnEinweisung_PreValues_Click" Padding="1" Height="24" TabIndex="11" ToolTip="Firma hat bereits eine Einweisung bekommen
Ablauf in einem Monat wird automatisch eingetragen"/>
|
||||
<Button x:Name="btnEinweisung_1Woche" Content="↑ Für eine Woche" HorizontalAlignment="Left" Margin="10,425,0,0" VerticalAlignment="Top" Width="109" Click="BtnEinweisung_PreValues_Click" Padding="1" Height="24" TabIndex="10" ToolTip="Firma hat bereits eine Einweisung bekommen
Ablauf in einer Woche wird automatisch eingetragen"/>
|
||||
<Button x:Name="btnEinweisungFolgt" Content="↑ Einweisung folgt" HorizontalAlignment="Left" Margin="10,454,0,0" VerticalAlignment="Top" Width="165" Padding="1" Height="24" TabIndex="12" Click="BtnEinweisung_PreValues_Click" BorderBrush="#FFF50707" Background="#FFFF9191" ToolTip="Für Firmen die eine Einweisung (durch Projektleiter oä.) bekommen, aber bis jetzt keine haben"/>
|
||||
<Button x:Name="btnDelete" Content="Markierte Firma löschen" Margin="0,10,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="187" Click="btnDelete_Click" IsEnabled="False"/>
|
||||
<Button x:Name="btnBegleitung" Content="↑ Nur in Begleitung" HorizontalAlignment="Left" Margin="180,454,0,0" VerticalAlignment="Top" Width="170" Height="24" Background="#CCFFA200" BorderBrush="#FFFF8B00" Click="BtnEinweisung_PreValues_Click" ToolTip="Für Fimen die sich nur in Begleitung auf dem Gelände bewegen dürfen"/>
|
||||
<Button x:Name="btnHelp" Content="Hilfe zur Tabelle" HorizontalAlignment="Left" Margin="435,11,0,0" VerticalAlignment="Top" Width="160" Click="btnHelp_Click"/>
|
||||
<Canvas x:Name="canvasHelp" HorizontalAlignment="Center" Height="370" Margin="0" VerticalAlignment="Center" Width="600" Background="WhiteSmoke" Visibility="Collapsed">
|
||||
<RichTextBox Height="350" Canvas.Left="10" Canvas.Top="10" Width="580" Background="{x:Null}" IsReadOnlyCaretVisible="True" Focusable="False" AllowDrop="False">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Run Text="Erklärung zur Tabelle:"/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6">
|
||||
<Run Text="Daten in der Tabelle können per Doppelklick geändert werden."/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6">
|
||||
<Run Text="Änderungen werden mit ENTER oder Klick auf ein anderes Feld bestätigt."/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6">
|
||||
<Run Text="Falls eine Firma in der Vergangenheit bereits angelegt wurde, muss diese nicht erneut angelegt werden,"/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6">
|
||||
<Run Text="sondern es können die entsprechenden Daten direkt in der Tabelle geändert werden."/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6">
|
||||
<Run/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6">
|
||||
<Run Foreground="Red" Text="Rote Zeilen "/>
|
||||
<Run Text="stehen für Einträge die mit "Einweisung folgt" angelegt wurden"/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="20,Auto,Auto,Auto">
|
||||
<Run Foreground="Red" Text="Bei diesen Einträgen muss das Einweisungsdatum nach erfolgter Einweisung eingetragen werden!"/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
|
||||
<Run Text="Das Datum "01.01.1902" in der Spalte "Unterwiesen bis" steht für "Einweisung folgt""/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="20,Auto,Auto,Auto">
|
||||
<Run Foreground="Red"/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
|
||||
<Run Foreground="#FFFFB533" Text="Gelbe Zeilen "/>
|
||||
<Run Text="stehen für Einträge die mit "Nur in Begleitung" angelegt wurden"/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto" TextIndent="20">
|
||||
<Run Text=" "/>
|
||||
<Run Foreground="Red" Text="Diese Firmen dürfen sich nur in Begleitung eines internen MA auf dem Gelände bewegen!"/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
|
||||
<Run Text="Das Datum "01.01.1903" in der Spalte "Unterwiesen bis" steht für "Nur in Begleitung""/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
|
||||
<Run/>
|
||||
</Paragraph>
|
||||
<Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
|
||||
<Run Foreground="Red" Text="Änderungen werden in der Datenbank protokolliert!!"/>
|
||||
|
||||
|
||||
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
<Button x:Name="btnCloseHelp" Content="Schließen" Width="96" HorizontalAlignment="Right" VerticalAlignment="Bottom" Canvas.Left="494" Canvas.Top="340" Click="btnCloseHelp_Click"/>
|
||||
</Canvas>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
765
ZKuP/CreateFirma.xaml.cs
Normal file
@ -0,0 +1,765 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für CreateFirma.xaml
|
||||
/// </summary>
|
||||
public partial class CreateFirma : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private List<Firma> myVar;
|
||||
public List<Firma> FirmaView
|
||||
{
|
||||
get { return myVar; }
|
||||
set { myVar = value; }
|
||||
}
|
||||
|
||||
DataTable firmen = new DataTable("Firmen");
|
||||
|
||||
private List<string> aspVar;
|
||||
public List<string> asp
|
||||
{
|
||||
get { return aspVar; }
|
||||
set { aspVar = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
//public List<string> Ansprechpartner { get; set; }
|
||||
|
||||
|
||||
public CreateFirma()
|
||||
{
|
||||
this.DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
updateList();
|
||||
|
||||
dgFirmen.Items.SortDescriptions.Clear();
|
||||
dgFirmen.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
|
||||
dgFirmen.UpdateLayout();
|
||||
|
||||
asp = SQL.ReadListString("SELECT Name FROM zkup.ansprechpartner").Result;
|
||||
asp = asp.OrderBy(p => p).ToList();
|
||||
cbAnsprechpartner_Intern.ItemsSource = asp;
|
||||
|
||||
dpEinweisung_Bis.DisplayDateEnd = DateTime.Now + TimeSpan.FromDays(365);
|
||||
}
|
||||
|
||||
private void updateList()
|
||||
{
|
||||
if (MainWindow.LoggedInRole == Roles.Admin || MainWindow.LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
requestListAdmin();
|
||||
}
|
||||
else
|
||||
{
|
||||
requestList();
|
||||
}
|
||||
}
|
||||
|
||||
private void requestList()
|
||||
{
|
||||
firmen = SQL.ReadSQL($"SELECT * FROM zkup.firmen WHERE Ersteller = '{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{Environment.UserDomainName}{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{SQL.ReadSingleValue($"SELECT Vertreter FROM zkup.ansprechpartner WHERE Name = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'")}' " +
|
||||
$"OR Ansprechpartner_Intern = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'"
|
||||
, firmen).Result;
|
||||
FirmaView = Firma.DataTableToFirma(firmen);
|
||||
dgFirmen.DataContext = firmen;
|
||||
}
|
||||
|
||||
private void requestListAdmin()
|
||||
{
|
||||
firmen = SQL.ReadSQL("SELECT * FROM zkup.firmen", firmen).Result;
|
||||
FirmaView = Firma.DataTableToFirma(firmen);
|
||||
dgFirmen.DataContext = firmen;
|
||||
}
|
||||
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
dpArbeitsbeginn.IsDropDownOpen = false;
|
||||
dpArbeitsende.IsDropDownOpen = false;
|
||||
dpEinweisung_Bis.IsDropDownOpen = false;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tbName.Text))
|
||||
{
|
||||
MessageBox.Show("Namen eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(tbVerantwortlicher_MA.Text))
|
||||
{
|
||||
MessageBox.Show("Verantwortlichen MA eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(tbTel_Firma.Text))
|
||||
{
|
||||
MessageBox.Show("Telefonnummer der Firma eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (!dpArbeitsbeginn.SelectedDate.HasValue)
|
||||
{
|
||||
MessageBox.Show("Arbeitsbeginn eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (!dpArbeitsende.SelectedDate.HasValue)
|
||||
{
|
||||
MessageBox.Show("Arbeitsende eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(tbAnzahl_Fzg.Text))
|
||||
{
|
||||
MessageBox.Show("Anzahl Fahrzeuge eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(tbBeauftragte_Leistung.Text))
|
||||
{
|
||||
MessageBox.Show("Beauftragte Leistung eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (!dpEinweisung_Bis.SelectedDate.HasValue && (GetDPText() != "...Einweisung folgt..." && GetDPText() != "...Nur in Begleitung..."))
|
||||
{
|
||||
MessageBox.Show("'Einweisung bis' eintragen", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (cbAnsprechpartner_Intern.SelectedIndex == -1)
|
||||
{
|
||||
MessageBox.Show("'Ansprechpartner intern' auswählen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
else if (!dpEinweisung_Bis.SelectedDate.HasValue && GetDPText() == "...Einweisung folgt...")
|
||||
{
|
||||
if (dpArbeitsende.SelectedDate.Value < dpArbeitsbeginn.SelectedDate.Value)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitsende darf nicht kleiner als Arbeitsbeginn sein", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
else if (dpArbeitsbeginn.SelectedDate.Value > dpArbeitsende.SelectedDate.Value)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitsbeginn darf nicht größer als Arbeitsende sein", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MessageBox.Show(this, "Einweisung muss durchgeführt und manuell nachgetragen werden!!\n\nMit dem Hinzufügen fortfahren?", "Achtung!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
|
||||
{
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Begleiter.Text, "^[0-9]*$"))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Begleiter darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
else if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Fzg.Text, "^[0-9]*$"))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Fzg. darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
await SQL.WriteSQL("INSERT INTO firmen (Name,Verantwortlicher_MA_Firma,Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleiter,Anzahl_Fzg,Beauftragte_Leistung,Arbeitsbeginn,Arbeitsende,Örtliche_Einweisung_bis,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Ersteller) VALUES " +
|
||||
$"('{tbName.Text}','{tbVerantwortlicher_MA.Text}','{tbTel_Firma.Text}','{tbAnzahl_Begleiter.Text}','{tbAnzahl_Fzg.Text}','{tbBeauftragte_Leistung.Text}','{dpArbeitsbeginn.SelectedDate.Value.ToString("yyyy-MM-dd")}','{dpArbeitsende.SelectedDate.Value.ToString("yyyy-MM-dd")}','1902-01-01','{cbAnsprechpartner_Intern.Text}','{tbTel_Nr_Ansprechpartner_Intern.Text}','{Environment.UserName}')");
|
||||
|
||||
|
||||
updateList();
|
||||
|
||||
dgFirmen.ScrollIntoView(dgFirmen.Items[dgFirmen.Items.Count - 1]); //scroll to last
|
||||
dgFirmen.UpdateLayout();
|
||||
ResetInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!dpEinweisung_Bis.SelectedDate.HasValue && GetDPText() == "...Nur in Begleitung...")
|
||||
{
|
||||
if (dpArbeitsende.SelectedDate.Value < dpArbeitsbeginn.SelectedDate.Value)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitsende darf nicht kleiner als Arbeitsbeginn sein", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
else if (dpArbeitsbeginn.SelectedDate.Value > dpArbeitsende.SelectedDate.Value)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitsbeginn darf nicht größer als Arbeitsende sein", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MessageBox.Show(this, "Firmen dürfen sich nur in Begleitung auf dem Gelände bewegen!!\n\nMit dem Hinzufügen fortfahren?", "Achtung!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
|
||||
{
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Begleiter.Text, "^[0-9]*$"))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Begleiter darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
else if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Fzg.Text, "^[0-9]*$"))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Fzg. darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
await SQL.WriteSQL("INSERT INTO firmen (Name,Verantwortlicher_MA_Firma,Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleiter,Anzahl_Fzg,Beauftragte_Leistung,Arbeitsbeginn,Arbeitsende,Örtliche_Einweisung_bis,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Ersteller) VALUES " +
|
||||
$"('{tbName.Text}','{tbVerantwortlicher_MA.Text}','{tbTel_Firma.Text}','{tbAnzahl_Begleiter.Text}','{tbAnzahl_Fzg.Text}','{tbBeauftragte_Leistung.Text}','{dpArbeitsbeginn.SelectedDate.Value.ToString("yyyy-MM-dd")}','{dpArbeitsende.SelectedDate.Value.ToString("yyyy-MM-dd")}','1903-01-01','{cbAnsprechpartner_Intern.Text}','{tbTel_Nr_Ansprechpartner_Intern.Text}','{Environment.UserName}')");
|
||||
|
||||
|
||||
updateList();
|
||||
|
||||
dgFirmen.ScrollIntoView(dgFirmen.Items[dgFirmen.Items.Count - 1]); //scroll to last
|
||||
dgFirmen.UpdateLayout();
|
||||
ResetInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Begleiter.Text, "^[0-9]*$"))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Begleiter darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
else if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Fzg.Text, "^[0-9]*$"))
|
||||
{
|
||||
MessageBox.Show(this, "Anzahl Fzg. darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
else if (dpArbeitsende.SelectedDate.Value < dpArbeitsbeginn.SelectedDate.Value)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitsende darf nicht kleiner als Arbeitsbeginn sein", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
else if (dpArbeitsbeginn.SelectedDate.Value > dpArbeitsende.SelectedDate.Value)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitsbeginn darf nicht größer als Arbeitsende sein", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
await SQL.WriteSQL("INSERT INTO firmen (Name,Verantwortlicher_MA_Firma,Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleiter,Anzahl_Fzg,Beauftragte_Leistung,Arbeitsbeginn,Arbeitsende,Örtliche_Einweisung_bis,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Ersteller) VALUES " +
|
||||
$"('{tbName.Text}','{tbVerantwortlicher_MA.Text}','{tbTel_Firma.Text}','{tbAnzahl_Begleiter.Text}','{tbAnzahl_Fzg.Text}','{tbBeauftragte_Leistung.Text}','{dpArbeitsbeginn.SelectedDate.Value.ToString("yyyy-MM-dd")}','{dpArbeitsende.SelectedDate.Value.ToString("yyyy-MM-dd")}','{dpEinweisung_Bis.SelectedDate.Value.ToString("yyyy-MM-dd")}','{cbAnsprechpartner_Intern.Text}','{tbTel_Nr_Ansprechpartner_Intern.Text}','{Environment.UserName}')");
|
||||
|
||||
|
||||
updateList();
|
||||
|
||||
dgFirmen.ScrollIntoView(dgFirmen.Items[dgFirmen.Items.Count - 1]); //scroll to last
|
||||
dgFirmen.UpdateLayout();
|
||||
ResetInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetInput()
|
||||
{
|
||||
tbName.Text = "";
|
||||
tbVerantwortlicher_MA.Text = "";
|
||||
tbTel_Firma.Text = "";
|
||||
tbAnzahl_Begleiter.Text = "";
|
||||
tbAnzahl_Fzg.Text = "";
|
||||
tbBeauftragte_Leistung.Text = "";
|
||||
dpArbeitsbeginn.Text = "";
|
||||
dpArbeitsende.Text = "";
|
||||
dpEinweisung_Bis.Text = "";
|
||||
cbAnsprechpartner_Intern.SelectedIndex = -1;
|
||||
tbTel_Nr_Ansprechpartner_Intern.Text = "";
|
||||
}
|
||||
|
||||
private void CbAnsprechpartner_Intern_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
string test = SQL.ReadSingleValueAsync($"SELECT Tel_Nr FROM zkup.ansprechpartner WHERE Name='{cbAnsprechpartner_Intern.SelectedValue}'").Result;
|
||||
tbTel_Nr_Ansprechpartner_Intern.Text = test;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void dgFirmen_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
dgFirmen.PreviewKeyDown -= DgFirmen_PreviewKeyDown;
|
||||
}
|
||||
|
||||
private async void DgFirmen_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var dg = sender as DataGrid;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (e.Key == Key.Delete)
|
||||
{
|
||||
deleteRow(arr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void DgFirmen_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var header = e.Column.Header;
|
||||
var newValue = (e.EditingElement as TextBox).Text;
|
||||
|
||||
|
||||
|
||||
var id = (e.Row.Item as DataRowView).Row.ItemArray[0];
|
||||
DateTime date = DateTime.Now;
|
||||
|
||||
if (DateTime.TryParse(newValue, out date))
|
||||
if (date <= DateTime.Now + TimeSpan.FromDays(365)) newValue = date.ToString("yyyy-MM-dd");
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "Daten dürfen maximal 365 Tage in der Zukunft liegen", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
newValue = (DateTime.Now + TimeSpan.FromDays(365)).ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
var MessageValue = newValue;
|
||||
var MessageDate = DateTime.Now;
|
||||
if (DateTime.TryParse(newValue, out MessageDate))
|
||||
MessageValue = MessageDate.ToString("dd.MM.yyyy");
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(newValue.ToString()))
|
||||
{
|
||||
MessageBox.Show(this, "Eintrag darf nicht leer sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
e.Cancel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldValue != MessageValue)
|
||||
{
|
||||
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValue}' in der Spalte '{header}' sicher zu '{MessageValue}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
{
|
||||
switch (header)
|
||||
{
|
||||
case "Name":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Name = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Verantw. MA":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Verantwortlicher_MA_Firma = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Tel. Firma":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Tel_Nr_Verantwortlicher_Firma = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Anz. Begleitp.":
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(newValue, "^[0-9]*$"))
|
||||
MessageBox.Show(this, "Anzahl Begleiter darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Anzahl_Begleiter = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Anz. Fzg.":
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(newValue, "^[0-9]*$"))
|
||||
MessageBox.Show(this, "Anzahl Fzg. darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Anzahl_Fzg = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Beauftragte Leistung":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Beauftragte_Leistung = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Arbeitsbeginn":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Arbeitsbeginn = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
if (Convert.ToDateTime(SQL.ReadSingleValue($"SELECT Arbeitsende FROM zkup.firmen WHERE idFirmen = '{id}'")) < MessageDate)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitsende darf nicht kleiner als Arbeitsbeginn sein\nDatum wird automatisch angepasst", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Arbeitsende = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
}
|
||||
break;
|
||||
case "Arbeitsende":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Arbeitsende = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
if (Convert.ToDateTime(SQL.ReadSingleValue($"SELECT Arbeitsbeginn FROM zkup.firmen WHERE idFirmen = '{id}'")) > MessageDate)
|
||||
{
|
||||
MessageBox.Show(this, "Arbeitbeginn darf nicht größer als Arbeitsende sein\nDatum wird automatisch angepasst", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Arbeitsbeginn = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
}
|
||||
break;
|
||||
case "Unterwiesen bis":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Örtliche_Einweisung_bis = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Anspr. intern":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
case "Tel. Ansprechp.":
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Tel_Nr_Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idFirmen = '{id}'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index = e.Row.GetIndex();
|
||||
|
||||
dgFirmen.PreviewKeyDown += DgFirmen_PreviewKeyDown;
|
||||
|
||||
dgFirmen.RowValidationErrorTemplate = new ControlTemplate();
|
||||
|
||||
updateList();
|
||||
|
||||
dgFirmen.SelectedIndex = (index);
|
||||
dgFirmen.ScrollIntoView(dgFirmen.Items[index]);
|
||||
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
MessageBox.Show($"Es ist ein Fehler aufgetreten\n\n{ex.Message}", "Schwerer Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
timer.Interval = TimeSpan.FromMilliseconds(50);
|
||||
timer.Tick += Timer_Tick;
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
|
||||
|
||||
private async void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
await ScrollTo();
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
private async Task ScrollTo()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (index > 0 && dgFirmen.Items.Count >= index)
|
||||
{
|
||||
dgFirmen.SelectedIndex = index;
|
||||
dgFirmen.ScrollIntoView(dgFirmen.Items[index], dgFirmen.Columns[0]);
|
||||
|
||||
|
||||
//DataGridRow row = (DataGridRow)dgFirmen.ItemContainerGenerator.ContainerFromIndex(index - 1);
|
||||
|
||||
//row.Focusable = true;
|
||||
//row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Right));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
MessageBox.Show($"Es ist ein Fehler aufgetreten\n\n{ex.Message}", "Schwerer Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void BtnEinweisung_PreValues_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string Value = (sender as Button).Content.ToString();
|
||||
|
||||
if (Value.EndsWith("Jahr"))
|
||||
dpEinweisung_Bis.SelectedDate = DateTime.Now.AddYears(1);
|
||||
else if (Value.EndsWith("Monat"))
|
||||
dpEinweisung_Bis.SelectedDate = DateTime.Now.AddMonths(1);
|
||||
else if (Value.EndsWith("Woche"))
|
||||
dpEinweisung_Bis.SelectedDate = DateTime.Now.AddDays(7);
|
||||
else if (Value.EndsWith("folgt"))
|
||||
{
|
||||
SetDPText("...Einweisung folgt...");
|
||||
}
|
||||
else if (Value.EndsWith("Begleitung"))
|
||||
{
|
||||
SetDPText("...Nur in Begleitung...");
|
||||
}
|
||||
//Debug.WriteLine(x.ToString());
|
||||
}
|
||||
|
||||
private void SetDPText(string Text)
|
||||
{
|
||||
dpEinweisung_Bis.Text = "";
|
||||
|
||||
System.Reflection.FieldInfo fiTextBox = typeof(DatePicker).GetField("_textBox", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
if (fiTextBox != null)
|
||||
{
|
||||
DatePickerTextBox dateTextBox =
|
||||
(DatePickerTextBox)fiTextBox.GetValue(dpEinweisung_Bis);
|
||||
|
||||
if (dateTextBox != null)
|
||||
{
|
||||
System.Reflection.PropertyInfo piWatermark = dateTextBox.GetType()
|
||||
.GetProperty("Watermark", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
if (piWatermark != null)
|
||||
{
|
||||
piWatermark.SetValue(dateTextBox, Text, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetDPText()
|
||||
{
|
||||
System.Reflection.FieldInfo fiTextBox = typeof(DatePicker).GetField("_textBox", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
if (fiTextBox != null)
|
||||
{
|
||||
DatePickerTextBox dateTextBox =
|
||||
(DatePickerTextBox)fiTextBox.GetValue(dpEinweisung_Bis);
|
||||
|
||||
if (dateTextBox != null)
|
||||
{
|
||||
System.Reflection.PropertyInfo piWatermark = dateTextBox.GetType()
|
||||
.GetProperty("Watermark", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
|
||||
if (piWatermark != null)
|
||||
{
|
||||
return (string)piWatermark.GetValue(dateTextBox, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private void TbBeauftragte_Leistung_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpArbeitsbeginn.Focus();
|
||||
dpArbeitsbeginn.IsDropDownOpen = true;
|
||||
}
|
||||
|
||||
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private void DpArbeitsbeginn_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpArbeitsbeginn.IsDropDownOpen = false;
|
||||
dpArbeitsende.Focus();
|
||||
dpArbeitsende.IsDropDownOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DpArbeitsende_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpArbeitsende.IsDropDownOpen = false;
|
||||
dpEinweisung_Bis.Focus();
|
||||
dpEinweisung_Bis.IsDropDownOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DpEinweisung_Bis_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpEinweisung_Bis.IsDropDownOpen = false;
|
||||
dpEinweisung_Bis.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void dgFirmen_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dgFirmen.SelectedIndex != -1) btnDelete.IsEnabled = true;
|
||||
else btnDelete.IsEnabled = false;
|
||||
|
||||
//ScrollTo();
|
||||
}
|
||||
private async void btnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dg = dgFirmen;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (MessageBox.Show(this, $"Markierte Firma wirklich entfernen?", "Firma entfernen?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
deleteRow(arr);
|
||||
}
|
||||
}
|
||||
|
||||
private async void deleteRow(object[] arr)
|
||||
{
|
||||
await SQL.WriteSQL("INSERT INTO firmenLog (idfirmen,Name,Verantwortlicher_MA_Firma,Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleiter,Anzahl_Fzg,Beauftragte_Leistung,Arbeitsbeginn,Arbeitsende,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Geloescht_Von) VALUES " +
|
||||
$"('{arr[0]}','{arr[1].ToString()}','{arr[2].ToString()}','{arr[3].ToString()}','{arr[4].ToString()}','{arr[5].ToString()}','{arr[6].ToString()}','{Convert.ToDateTime(arr[7].ToString()).ToString("yyyy-MM-dd")}','{Convert.ToDateTime(arr[8].ToString()).ToString("yyyy-MM-dd")}','{arr[10].ToString()}','{arr[11].ToString()}','{Environment.UserName}')");
|
||||
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.firmen WHERE `idFirmen` = '{arr[0]}'");
|
||||
|
||||
updateList();
|
||||
}
|
||||
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void TextBoxes_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string oldValue = "";
|
||||
private void dgFirmen_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
|
||||
{
|
||||
if (e.Column.Header.ToString() == "Anspr. intern")
|
||||
oldValue = (e.EditingElement as ComboBox) != null ? (e.EditingElement as ComboBox).Text : "";
|
||||
else
|
||||
oldValue = (e.EditingElement as TextBox) != null ? (e.EditingElement as TextBox).Text : "";
|
||||
}
|
||||
|
||||
|
||||
private void dg_cbASP_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
oldValue = (sender as ComboBox) != null ? (sender as ComboBox).Text : "";
|
||||
}
|
||||
|
||||
private async void dg_cbAsp_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
var box = sender as ComboBox;
|
||||
DataGridRow dataGridRow = Helper.FindParent<DataGridRow>(box);
|
||||
int index = dataGridRow.GetIndex();
|
||||
|
||||
var id = ((System.Data.DataRowView)dataGridRow.DataContext).Row.ItemArray[0];
|
||||
|
||||
if ((sender as ComboBox).SelectedIndex != -1 && (sender as ComboBox).SelectedItem.ToString() != "")
|
||||
{
|
||||
if (oldValue != box.Text)
|
||||
{
|
||||
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValue}' in der Spalte 'Anspr. intern' sicher zu '{box.Text}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE firmen SET Ansprechpartner_Intern = '{box.Text}',Tel_Nr_Ansprechpartner_Intern = '{SQL.ReadSingleValue($"SELECT Tel_Nr FROM zkup.ansprechpartner WHERE Name = '{(sender as ComboBox).Text}'")}', Bearbeiter = '{Environment.UserName}' WHERE idfirmen = '{id}'");
|
||||
|
||||
updateList();
|
||||
|
||||
|
||||
dgFirmen.RowValidationErrorTemplate = new ControlTemplate();
|
||||
|
||||
dgFirmen.SelectedIndex = (index);
|
||||
dgFirmen.ScrollIntoView(dgFirmen.Items[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//tbAnsprechp_Intern.Text = "";
|
||||
//tbTel_Ansprechp.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void btnHelp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
canvasHelp.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void btnCloseHelp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
canvasHelp.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void tbAnzahl_Fzg_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 2) e.Handled = true;
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[0-9]*$")) e.Handled = true;
|
||||
}
|
||||
|
||||
private void tbAnzahl_Begleiter_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 2) e.Handled = true;
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[0-9]*$")) e.Handled = true;
|
||||
}
|
||||
|
||||
private void Textboxes_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (e.Command == ApplicationCommands.Paste)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Firma
|
||||
{
|
||||
string Name;
|
||||
string Verantwortlicher_MA_Firma;
|
||||
string Tel_Nr_Verantwortlicher_Firma;
|
||||
string Anzahl_Begleiter;
|
||||
string Anzahl_Fzg;
|
||||
string Beauftragte_Leistung;
|
||||
string Arbeitsbeginn;
|
||||
string Arbeitsende;
|
||||
string Örtliche_Einweisung_bis;
|
||||
string Ansprechpartner_Intern;
|
||||
string Tel_Nr_Ansprechpartner_Intern;
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<Firma> DataTableToFirma(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Firma> x = new List<Firma>();
|
||||
|
||||
foreach (DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Firma()
|
||||
{
|
||||
Name = dr[1].ToString(),
|
||||
Verantwortlicher_MA_Firma = dr[2].ToString(),
|
||||
Tel_Nr_Verantwortlicher_Firma = dr[3].ToString(),
|
||||
Anzahl_Begleiter = dr[4].ToString(),
|
||||
Anzahl_Fzg = dr[5].ToString(),
|
||||
Beauftragte_Leistung = dr[6].ToString(),
|
||||
Arbeitsbeginn = dr[7].ToString(),
|
||||
Arbeitsende = dr[8].ToString(),
|
||||
Örtliche_Einweisung_bis = dr[9].ToString(),
|
||||
Ansprechpartner_Intern = dr[10].ToString(),
|
||||
Tel_Nr_Ansprechpartner_Intern = dr[11].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
78
ZKuP/CreateParkausweis.xaml
Normal file
@ -0,0 +1,78 @@
|
||||
<Window x:Class="ZKuP.CreateParkausweis"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Parkausweis beantragen" Height="800" Width="330" MinWidth="330" MinHeight="707">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition x:Name="CommentRow" Height="2*" />
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Vorname*" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbVorname" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Nachname*" VerticalAlignment="Top" Grid.Row="1"/>
|
||||
<TextBox x:Name="tbNachname" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="1" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="E-Mail*" VerticalAlignment="Top" Grid.Row="2"/>
|
||||
<TextBox x:Name="tbEmail" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="2" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewLostKeyboardFocus="tbEmail_PreviewLostKeyboardFocus"/>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Telefon" VerticalAlignment="Top" Grid.Row="3"/>
|
||||
<TextBox x:Name="tbTelefon" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="3" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Abteilung*" VerticalAlignment="Top" Grid.Row="4"/>
|
||||
<TextBox x:Name="tbAbteilung" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="4" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Firma*" VerticalAlignment="Top" Grid.Row="5"/>
|
||||
<ComboBox x:Name="cbFirma" Margin="10,27.5,10,0" Grid.Row="5">
|
||||
<ComboBoxItem Content="DB Fernverkehr AG" IsSelected="True"/>
|
||||
<ComboBoxItem Content="DB Netz AG"/>
|
||||
<ComboBoxItem Content="DB Services GmbH"/>
|
||||
<ComboBoxItem Content="DB Gastronomie GmbH"/>
|
||||
<ComboBoxItem Content="DB Regio AG"/>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Private Adresse (Straße und Hausnummer)*" VerticalAlignment="Top" Grid.Row="6"/>
|
||||
<TextBox x:Name="tbAdresse" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="6" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewLostKeyboardFocus="tbAdresse_PreviewLostKeyboardFocus"/>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Postleitzahl*" VerticalAlignment="Top" Grid.Row="7"/>
|
||||
<TextBox x:Name="tbPLZ" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="7" PreviewTextInput="tbPLZ_PreviewTextInput" TextInput="tbPLZ_TextInput" CommandManager.PreviewExecuted="tbPLZ_PreviewExecuted" TextChanged="tbPLZ_TextChanged" ContextMenu="{x:Null}"/>
|
||||
<!---->
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Kennzeichen*" VerticalAlignment="Top" Grid.Row="8"/>
|
||||
<TextBlock Margin="48,26,0,0" TextWrapping="Wrap" Grid.Row="8" Text="-" HorizontalAlignment="Left" Visibility="Visible" FontSize="14" FontWeight="SemiBold" Padding="0,2,0,0"/>
|
||||
<TextBox x:Name="tbDTownKennzeichen" Margin="10,26,0,0" CharacterCasing="Upper" HorizontalAlignment="Left" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="8" Visibility="Visible" PreviewKeyDown="TextBoxes_PreviewKeyDown" TextAlignment="Center" Width="37" PreviewTextInput="tbDTownKennzeichen_PreviewTextInput" TextChanged="Textboxes_Changed"/>
|
||||
<TextBox x:Name="tbDCharsKennzeichen" Margin="55,26,0,0" CharacterCasing="Upper" HorizontalAlignment="Left" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="8" Visibility="Visible" PreviewKeyDown="TextBoxes_PreviewKeyDown" TextAlignment="Center" Width="32" PreviewTextInput="tbDCharsKennzeichen_PreviewTextInput" TextChanged="Textboxes_Changed"/>
|
||||
<TextBox x:Name="tbDDigitsKennzeichen" Margin="95,26,0,0" HorizontalAlignment="Left" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="8" Visibility="Visible" PreviewKeyDown="TextBoxes_PreviewKeyDown" TextAlignment="Center" Width="39" PreviewTextInput="tbDDigitsKennzeichen_PreviewTextInput" TextChanged="Textboxes_Changed"/>
|
||||
<TextBox x:Name="tbOtherKennzeichen" Margin="10,26,0,0" CharacterCasing="Upper" HorizontalAlignment="Left" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="8" Visibility="Hidden" PreviewKeyDown="TextBoxes_PreviewKeyDown" TextChanged="Textboxes_Changed" Width="124"/>
|
||||
<RadioButton x:Name="rbDKennzeichen" Content="Deutsches Kennzeichen" Margin="139,0,10,15" Grid.Row="8" VerticalAlignment="Bottom" IsChecked="True" Checked="rbDKennzeichen_Checked"/>
|
||||
<RadioButton x:Name="rbOtherKennzeichen" Content="Ausländisches Kennzeichen" Margin="139,0,10,0" VerticalAlignment="Bottom" Grid.Row="8" Checked="rbOtherKennzeichen_Checked"/>
|
||||
|
||||
<TextBlock Margin="10,5,10,0" TextWrapping="Wrap" Text="Vorgesetzter*" VerticalAlignment="Top" Grid.Row="9"/>
|
||||
<TextBox x:Name="tbVorgesetzter" Margin="10,26,10,0" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="9" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
|
||||
<CheckBox x:Name="cBSchicht" Content="Beantrager in Wechsel- oder Schichtdienst tätig" ToolTip="Es sind nur Personen berechtigt für eine Parkkarte, die in Wechsel- oder Schichtdienst tätig sind" Grid.Row="10" VerticalAlignment="Center" Margin="10,18,10,10" HorizontalAlignment="Left" Height="24" Width="292" Checked="cBSchicht_Checked" Unchecked="cBSchicht_Unchecked"/>
|
||||
|
||||
<CheckBox x:Name="cBCorrectness" Content="Hiermit bestätige ich die Richtigkeit 
und Vollständigkeit der Angaben" Grid.Row="11" HorizontalAlignment="Center" VerticalAlignment="Center" Unchecked="cBCorrectness_Unchecked" Checked="cBCorrectness_Checked"/>
|
||||
|
||||
<TextBox x:Name="tbBemerkung" Margin="10" Grid.Row="12" TextWrapping="Wrap" AutomationProperties.HelpText="Bemerkung" ToolTip="Bemerkung" PreviewGotKeyboardFocus="tbBemerkung_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="tbBemerkung_PreviewLostKeyboardFocus"/>
|
||||
<TextBlock x:Name="lblBemerkung" Margin="15" Grid.Row="12" Text="Bemerkung" TextWrapping="Wrap" Foreground="Gray" IsHitTestVisible="False"/>
|
||||
|
||||
<Button x:Name="btnCreate" Content="Beantragen" Margin="10" Grid.Row="13" Click="btnCreate_Click" IsEnabled="False"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
386
ZKuP/CreateParkausweis.xaml.cs
Normal file
@ -0,0 +1,386 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für CreateParkausweis.xaml
|
||||
/// </summary>
|
||||
public partial class CreateParkausweis : Window
|
||||
{
|
||||
List<string> plz = new List<string>();
|
||||
public bool special { get; private set; }
|
||||
|
||||
public CreateParkausweis(bool Special = false)
|
||||
{
|
||||
InitializeComponent();
|
||||
special = Special;
|
||||
|
||||
if(special)
|
||||
{
|
||||
CommentRow.Height = new GridLength(2, GridUnitType.Star);
|
||||
MinWidth = 330;
|
||||
MinHeight = 800;
|
||||
Width = 330;
|
||||
Height = 800;
|
||||
}
|
||||
else
|
||||
{
|
||||
CommentRow.Height = new GridLength(0, GridUnitType.Star);
|
||||
MinWidth = 330;
|
||||
MinHeight = 707;
|
||||
Width = 330;
|
||||
Height = 707;
|
||||
}
|
||||
|
||||
//var uri = new Uri("pack://application:,,,/Resources/PLZ_MUC.txt");
|
||||
//var resourceStream = Application.GetResourceStream(uri);
|
||||
|
||||
using (var reader = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ZKuP.Resources.PLZ_MUC.txt")))
|
||||
{
|
||||
plz = reader.ReadToEnd().Replace("\r", "").Split('\n').ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private void Textboxes_Changed(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(tbAdresse.Text, @"^.+\s{1}\d+\s*\w*"))
|
||||
{
|
||||
tbAdresse.Foreground = new SolidColorBrush(Colors.Black);
|
||||
}
|
||||
|
||||
if (System.Text.RegularExpressions.Regex.IsMatch(tbEmail.Text, @"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"))
|
||||
{
|
||||
tbEmail.Foreground = new SolidColorBrush(Colors.Black);
|
||||
}
|
||||
|
||||
checkButton();
|
||||
}
|
||||
|
||||
private void checkButton()
|
||||
{
|
||||
if (special)
|
||||
btnCreate.IsEnabled = true;
|
||||
else
|
||||
{
|
||||
if (
|
||||
tbVorname.Text != "" &&
|
||||
tbNachname.Text != "" &&
|
||||
tbEmail.Text != "" &&
|
||||
tbAbteilung.Text != "" &&
|
||||
tbAdresse.Text != "" &&
|
||||
tbPLZ.Text != "" &&
|
||||
tbVorgesetzter.Text != "" &&
|
||||
cbFirma.SelectedIndex != -1 &&
|
||||
cBCorrectness.IsChecked.Value == true &&
|
||||
cBSchicht.IsChecked.Value == true &&
|
||||
(rbDKennzeichen.IsChecked.Value && (!string.IsNullOrWhiteSpace(tbDTownKennzeichen.Text)
|
||||
&& !string.IsNullOrWhiteSpace(tbDCharsKennzeichen.Text)
|
||||
&& !string.IsNullOrWhiteSpace(tbDDigitsKennzeichen.Text))
|
||||
||
|
||||
(rbOtherKennzeichen.IsChecked.Value &&
|
||||
!string.IsNullOrWhiteSpace(tbOtherKennzeichen.Text)))
|
||||
)
|
||||
btnCreate.IsEnabled = true;
|
||||
else btnCreate.IsEnabled = false;
|
||||
//tbTelefon != "";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbPLZ_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (tbPLZ.Text.Length == 5 && !special)
|
||||
{
|
||||
foreach (var s in plz)
|
||||
{
|
||||
if (tbPLZ.Text == s)
|
||||
{
|
||||
MessageBox.Show(this, "Mitarbeiter im Stadtgebiet München sind nicht berechtigt Parkkarten zu beantragen!\n\nDie Angabe falscher Daten stellt einen fristlosen Kündigungsgrund dar!!", "Keine Berechtigung!", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
tbPLZ.Text = "";
|
||||
btnCreate.IsEnabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
checkButton();
|
||||
}
|
||||
else btnCreate.IsEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private async void btnCreate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(!System.Text.RegularExpressions.Regex.IsMatch(tbPLZ.Text, @"^\d{5}$"))
|
||||
{
|
||||
MessageBox.Show(this, "Postleitzahl muss exakt 5 Stellen haben und darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if(rbDKennzeichen.IsChecked.Value &&
|
||||
(string.IsNullOrWhiteSpace(tbDTownKennzeichen.Text) ||
|
||||
(string.IsNullOrWhiteSpace(tbDCharsKennzeichen.Text) ||
|
||||
string.IsNullOrWhiteSpace(tbDDigitsKennzeichen.Text))))
|
||||
{
|
||||
MessageBox.Show(this, "Kennzeichen muss vollständig ausgefüllt sein", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if(rbOtherKennzeichen.IsChecked.Value &&
|
||||
string.IsNullOrWhiteSpace(tbOtherKennzeichen.Text))
|
||||
{
|
||||
MessageBox.Show(this, "Kennzeichen muss ausgefüllt sein", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbEmail.Text, @"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"))
|
||||
{
|
||||
MessageBox.Show(this, "Email nicht vollständig oder falsches Format", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!System.Text.RegularExpressions.Regex.IsMatch(tbAdresse.Text, @"^.+\s{1}\d+\s*\w*"))
|
||||
{
|
||||
MessageBox.Show(this, "Adresse nicht vollständig oder falsches Format\n\nFormat: Straße Leerzeichen Hausnummer Zusatz(wenn vorhanden)", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(string.IsNullOrWhiteSpace(tbVorname.Text) &&
|
||||
string.IsNullOrWhiteSpace(tbNachname.Text) &&
|
||||
string.IsNullOrWhiteSpace(tbEmail.Text) &&
|
||||
string.IsNullOrWhiteSpace(tbAbteilung.Text) &&
|
||||
string.IsNullOrWhiteSpace(tbAdresse.Text) &&
|
||||
string.IsNullOrWhiteSpace(tbPLZ.Text) &&
|
||||
string.IsNullOrWhiteSpace(tbVorgesetzter.Text) &&
|
||||
!cBSchicht.IsChecked.Value &&
|
||||
!cBCorrectness.IsChecked.Value)
|
||||
|| special)
|
||||
{
|
||||
|
||||
int _schicht = 0, _correctness = 0;
|
||||
string _bemerkung = "Erstellt durch ZKuP";
|
||||
|
||||
if (cBSchicht.IsChecked.Value) _schicht = 1;
|
||||
if (cBCorrectness.IsChecked.Value) _correctness = 1;
|
||||
if (!string.IsNullOrWhiteSpace(tbBemerkung.Text)) _bemerkung = tbBemerkung.Text;
|
||||
|
||||
if (rbOtherKennzeichen.IsChecked.Value)
|
||||
{
|
||||
await SQL.WriteSQL($"INSERT INTO parkausweise (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbOtherKennzeichen.Text}','{tbEmail.Text}','{tbTelefon.Text}','{tbAbteilung.Text}','{cbFirma.Text}','{tbAdresse.Text}','{tbPLZ.Text}','{tbVorgesetzter.Text}','{_correctness}','{_schicht}','{_bemerkung}')");
|
||||
var id = SQL.ReadSingleValue($"SELECT idparkausweise FROM zkup.parkausweise ORDER BY idparkausweise DESC LIMIT 1");
|
||||
MessageBox.Show(this, $"Antrag erfolgreich abgeschickt\n\nIhre Karte hat die Nr. {id}", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
this.Close();
|
||||
}
|
||||
else if (rbDKennzeichen.IsChecked.Value)
|
||||
{
|
||||
await SQL.WriteSQL($"INSERT INTO parkausweise (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbDTownKennzeichen.Text}-{tbDCharsKennzeichen.Text} {tbDDigitsKennzeichen.Text}','{tbEmail.Text}','{tbTelefon.Text}','{tbAbteilung.Text}','{cbFirma.Text}','{tbAdresse.Text}','{tbPLZ.Text}','{tbVorgesetzter.Text}','{_correctness}','{_schicht}','{_bemerkung}')");
|
||||
var id = SQL.ReadSingleValue($"SELECT idparkausweise FROM zkup.parkausweise ORDER BY idparkausweise DESC LIMIT 1");
|
||||
MessageBox.Show(this, $"Antrag erfolgreich abgeschickt\n\nIhre Karte hat die Nr. {id}", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
else MessageBox.Show(this, "Es müssen alle benötigten(*) Felder ausgefüllt werden", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void cBCorrectness_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
btnCreate.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void cBCorrectness_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
checkButton();
|
||||
}
|
||||
|
||||
private void cBSchicht_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
checkButton();
|
||||
}
|
||||
|
||||
private void cBSchicht_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(!special) btnCreate.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void tbPLZ_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 5)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[0-9]*$"))
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void tbPLZ_TextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 5)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[0-9]*$"))
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBoxes_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private void tbPLZ_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (e.Command == ApplicationCommands.Paste)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void rbDKennzeichen_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbOtherKennzeichen.Visibility = Visibility.Hidden;
|
||||
|
||||
tbDTownKennzeichen.Visibility = Visibility.Visible;
|
||||
tbDCharsKennzeichen.Visibility = Visibility.Visible;
|
||||
tbDDigitsKennzeichen.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void rbOtherKennzeichen_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(this, "Diese Funktion darf nicht für deutsche Kennzeichen genutzt werden\nDie Kennzeichen werden überprüft und bei deutschem Kennzeichen abgelehnt\n\nMöchten Sie sicher ein ausländisches Kennzeichen eingeben?", "Achtung!", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
tbDTownKennzeichen.Visibility = Visibility.Collapsed;
|
||||
tbDCharsKennzeichen.Visibility = Visibility.Collapsed;
|
||||
tbDDigitsKennzeichen.Visibility = Visibility.Collapsed;
|
||||
|
||||
tbOtherKennzeichen.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
rbDKennzeichen.IsChecked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void tbDTownKennzeichen_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 3)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[A-ZÄÖÜ]?[A-ZÄÖÜ]?[A-ZÄÖÜ]?"))
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void tbDCharsKennzeichen_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 2)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[A-ZÄÖÜ]?[A-ZÄÖÜ]?"))
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void tbDDigitsKennzeichen_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 5)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[0-9]*$"))
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void tbAdresse_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbAdresse.Text, @"^.+\s{1}\d+\s*\w*"))
|
||||
{
|
||||
tbAdresse.Foreground = new SolidColorBrush(Colors.Red);
|
||||
tbAdresse.ToolTip = "Adresse nicht vollständig oder falsches Format";
|
||||
}
|
||||
else
|
||||
{
|
||||
tbAdresse.Foreground = new SolidColorBrush(Colors.Black);
|
||||
tbAdresse.ToolTip = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void tbEmail_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbEmail.Text, @"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"))
|
||||
{
|
||||
tbEmail.Foreground = new SolidColorBrush(Colors.Red);
|
||||
tbEmail.ToolTip = "Email nicht vollständig oder falsches Format";
|
||||
}
|
||||
else
|
||||
{
|
||||
tbEmail.Foreground = new SolidColorBrush(Colors.Black);
|
||||
tbEmail.ToolTip = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void tbBemerkung_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
lblBemerkung.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void tbBemerkung_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tbBemerkung.Text)) lblBemerkung.Visibility = Visibility.Visible;
|
||||
else lblBemerkung.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
ZKuP/CreateVisitor.xaml
Normal file
@ -0,0 +1,32 @@
|
||||
<Window x:Class="ZKuP.CreateVisitor"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Besucher erstellen" Height="626" Width="369" ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Grid>
|
||||
<TextBox x:Name="tbName" HorizontalAlignment="Left" Height="23" Margin="10,57,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="1" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<TextBlock Margin="10,36,13,0" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"><Run Text="Name"/><Run Text=" des Besuchers / Firmenname des Besuchers"/></TextBlock>
|
||||
<TextBox x:Name="tbVerantwortlicher_MA" HorizontalAlignment="Left" Height="23" Margin="10,106,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="2" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<TextBlock Margin="10,85,13,0" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"><Run Text="Verantwortlicher Mitarbeiter"/><Run Text=" der Firma oder Intern"/></TextBlock>
|
||||
<TextBox x:Name="tbTel_Besucher" HorizontalAlignment="Left" Height="23" Margin="10,155,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="3" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,134,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"><Run Text="Telefonnummer "/><Run Text="Besucher"/></TextBlock>
|
||||
<TextBox x:Name="tbAnzahl_Begleiter" HorizontalAlignment="Left" Height="23" Margin="10,204,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="4" PreviewKeyDown="TbAnzahl_Begleiter_PreviewKeyDown" PreviewTextInput="tbAnzahl_Begleiter_PreviewTextInput" ToolTip="Nur Zahlen und max. 2 Stellen" Grid.ColumnSpan="2" AllowDrop="False" CommandManager.PreviewExecuted="Textboxes_PreviewExecuted" ContextMenu="{x:Null}"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,183,0,0" TextWrapping="Wrap" Text="Anzahl Begleitpersonen" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,232,0,0" TextWrapping="Wrap" Text="Besuchstag" VerticalAlignment="Top"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,282,0,0" TextWrapping="Wrap" Text="Grund des Besuchs" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
|
||||
<TextBox x:Name="tbAnsprechp_Intern" HorizontalAlignment="Left" Height="23" Margin="10,401,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="8" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,380,0,0" TextWrapping="Wrap" Text="Ansprechpartner intern" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
|
||||
<TextBox x:Name="tbTel_Ansprechp" HorizontalAlignment="Left" Height="23" Margin="10,450,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="9" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,429,0,0" TextWrapping="Wrap" Text="Telefonnummer Ansprechpartner" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
|
||||
<DatePicker x:Name="dpBesuchstag" HorizontalAlignment="Left" Margin="10,253,0,0" VerticalAlignment="Top" TabIndex="5" PreviewKeyDown="DpBesuchstag_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<Button x:Name="btnAdd" Content="Besucher erstellen" HorizontalAlignment="Center" Margin="12,526,11,0" VerticalAlignment="Top" Width="340" Height="61" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Click="BtnAdd_Click" TabIndex="10" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<TextBox x:Name="tbGrundDesBesuchs" Height="23" Margin="10,303,13,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" TabIndex="6" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,331,0,0" TextWrapping="Wrap" Text="Örtlichkeit" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbOertlichkeit" Height="23" Margin="12,352,11,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" TabIndex="7" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
|
||||
<Button x:Name="btnMyVisitors" Content="Meine erstellten Besucher" Margin="10,478,13,0" VerticalAlignment="Top" Click="btnMyVisitors_Click" Grid.ColumnSpan="2" ToolTip="Nur bereits erstellte Besucher können eingesehen werden"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
141
ZKuP/CreateVisitor.xaml.cs
Normal file
@ -0,0 +1,141 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für CreateVisitor.xaml
|
||||
/// </summary>
|
||||
public partial class CreateVisitor : Window
|
||||
{
|
||||
public CreateVisitor()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void BtnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (tbAnzahl_Begleiter.Text == "") tbAnzahl_Begleiter.Text = "0";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(tbName.Text))
|
||||
MessageBox.Show("Name eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbVerantwortlicher_MA.Text))
|
||||
MessageBox.Show("Verantwortlichen MA eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbTel_Besucher.Text))
|
||||
MessageBox.Show("Telefonnummer Besucher eintragen!", "Fehler");
|
||||
else if (!dpBesuchstag.SelectedDate.HasValue)
|
||||
MessageBox.Show("Besuchstag eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbGrundDesBesuchs.Text))
|
||||
MessageBox.Show("'Grund des Besuchs' eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbOertlichkeit.Text))
|
||||
MessageBox.Show("'Örtlichkeit' eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbAnsprechp_Intern.Text))
|
||||
MessageBox.Show("'Ansprechpartner intern' eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbTel_Ansprechp.Text))
|
||||
MessageBox.Show("'Telefonnr. Ansprechpartner intern' eintragen!", "Fehler");
|
||||
else
|
||||
{
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Begleiter.Text, "^[0-9]*$"))
|
||||
MessageBox.Show(this, "Anzahl Begleiter darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
await SQL.WriteSQL("REPLACE INTO besucher (Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Ersteller) VALUES " +
|
||||
$"('{tbName.Text}','{tbVerantwortlicher_MA.Text}','{tbTel_Besucher.Text}','{tbAnzahl_Begleiter.Text}','{dpBesuchstag.SelectedDate.Value.ToString("yyyy-MM-dd")}','{tbGrundDesBesuchs.Text}','{tbAnsprechp_Intern.Text}','{tbTel_Ansprechp.Text}','{tbOertlichkeit.Text}','{Environment.UserName}')");
|
||||
}
|
||||
|
||||
if (await SQL.RowExists("besucher", "Name", tbName.Text))
|
||||
{
|
||||
MessageBox.Show("Besucher erfolgreich erstellt", "Erfolg!", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
|
||||
tbName.Text = "";
|
||||
tbVerantwortlicher_MA.Text = "";
|
||||
tbTel_Besucher.Text = "";
|
||||
tbAnzahl_Begleiter.Text = "";
|
||||
tbAnsprechp_Intern.Text = "";
|
||||
tbTel_Ansprechp.Text = "";
|
||||
dpBesuchstag.SelectedDate = null;
|
||||
tbGrundDesBesuchs.Text = "";
|
||||
tbOertlichkeit.Text = "";
|
||||
}
|
||||
else MessageBox.Show("Fehler beim erstellen des Besuchers", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void TbAnzahl_Begleiter_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpBesuchstag.IsDropDownOpen = true;
|
||||
dpBesuchstag.Focus();
|
||||
}
|
||||
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
private void DpBesuchstag_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpBesuchstag.IsDropDownOpen = false;
|
||||
dpBesuchstag.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBoxes_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
private void tbAnzahl_Begleiter_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 2) e.Handled = true;
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[0-9]*$")) e.Handled = true;
|
||||
}
|
||||
|
||||
private void Textboxes_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (e.Command == ApplicationCommands.Paste)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMyVisitors_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CreateVisitor_List cVL = new CreateVisitor_List();
|
||||
cVL.Owner = this;
|
||||
cVL.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
40
ZKuP/CreateVisitor_List.xaml
Normal file
@ -0,0 +1,40 @@
|
||||
<Window x:Class="ZKuP.CreateVisitor_List"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Besucherliste" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Button x:Name="btnDelete" Content="Markierten Besucher löschen" Margin="0,10,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="167" Click="btnDelete_Click" IsEnabled="False"/>
|
||||
|
||||
<DataGrid x:Name="dgVisitors" ItemsSource="{Binding Path=., Mode=OneWay}" KeyboardNavigation.TabNavigation="None" Margin="10,45,10,44" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="True" HorizontalScrollBarVisibility="Visible" PreviewKeyDown="DgVisitors_PreviewKeyDown" CellEditEnding="DgVisitors_CellEditEnding" BeginningEdit="DgVisitors_BeginningEdit" SelectionChanged="dgVisitors_SelectionChanged" PreparingCellForEdit="dgVisitors_PreparingCellForEdit" ToolTip="Daten können per Doppelklick geändert werden">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" ClipboardContentBinding="{x:Null}" Header="Name" Width="*" MinWidth="150" SortDirection="Ascending"/>
|
||||
<DataGridTextColumn Binding="{Binding Verantwortlicher_MA}" ClipboardContentBinding="{x:Null}" Header="Verantw. MA" MinWidth="150"/>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Nr_Besucher}" ClipboardContentBinding="{x:Null}" Header="Tel. Besucher" MinWidth="150"/>
|
||||
<DataGridTextColumn Binding="{Binding Anzahl_Begleitpersonen}" ClipboardContentBinding="{x:Null}" Header="Anz. Begleitp." MinWidth="50">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Besuchstag, StringFormat=\{0:dd.MM.yyyy\}}" ClipboardContentBinding="{x:Null}" Header="Besuchstag" MinWidth="75">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Grund_des_Besuchs}" ClipboardContentBinding="{x:Null}" Header="Grund des Besuchs" MinWidth="200"/>
|
||||
<DataGridTextColumn Binding="{Binding Oertlichkeit}" ClipboardContentBinding="{x:Null}" Header="Örtlichkeit" MinWidth="150"/>
|
||||
<DataGridTextColumn Binding="{Binding Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Anspr. intern" MinWidth="150"/>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Nr_Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Tel. Ansprechp." MinWidth="150"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="98" Height="28" Click="BtnClose_Click" TabIndex="11"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
180
ZKuP/CreateVisitor_List.xaml.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für CreateVisitor_List.xaml
|
||||
/// </summary>
|
||||
public partial class CreateVisitor_List : Window
|
||||
{
|
||||
private List<Visitor> myVar;
|
||||
public List<Visitor> VisitorView
|
||||
{
|
||||
get { return myVar; }
|
||||
set { myVar = value; }
|
||||
}
|
||||
|
||||
DataTable visitors = new DataTable("Visitors");
|
||||
|
||||
|
||||
int index = 0;
|
||||
|
||||
public CreateVisitor_List()
|
||||
{
|
||||
this.DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this.Title = "Besucherliste von: " + Helper.InsertSpaceBeforeUpperCase(Environment.UserName);
|
||||
|
||||
visitors = SQL.ReadSQL($"SELECT * FROM zkup.besucher WHERE Ersteller = '{Environment.UserName}'", visitors).Result;
|
||||
VisitorView = Visitor.DataTableToVisitor(visitors);
|
||||
dgVisitors.DataContext = visitors;
|
||||
|
||||
dgVisitors.Items.SortDescriptions.Clear();
|
||||
dgVisitors.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
|
||||
dgVisitors.UpdateLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private async void DgVisitors_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
var header = e.Column.Header;
|
||||
var newValue = (e.EditingElement as TextBox).Text;
|
||||
var id = (e.Row.Item as DataRowView).Row.ItemArray[0];
|
||||
DateTime date = DateTime.Now;
|
||||
|
||||
if (DateTime.TryParseExact(newValue, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out date))
|
||||
newValue = date.ToString("yyyy-MM-dd");
|
||||
|
||||
var MessageValue = newValue;
|
||||
var MessageDate = DateTime.Now;
|
||||
if (DateTime.TryParse(newValue, out MessageDate))
|
||||
MessageValue = MessageDate.ToString("dd.MM.yyyy");
|
||||
|
||||
if (oldValue != MessageValue)
|
||||
{
|
||||
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValue}' in der Spalte '{header}' sicher zu '{MessageValue}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
{
|
||||
switch (header)
|
||||
{
|
||||
case "Name":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Name = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Verantw. MA":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Verantwortlicher_MA = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Tel. Besucher":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Tel_Nr_Besucher = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Anz. Begleitp.":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Anzahl_Begleitpersonen = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Besuchstag":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Besuchstag = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Grund des Besuchs":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Grund_des_Besuchs = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Örtlichkeit":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Oertlichkeit = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Anspr. intern":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Tel. Ansprechp.":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Tel_Nr_Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index = e.Row.GetIndex();
|
||||
dgVisitors.PreviewKeyDown += DgVisitors_PreviewKeyDown;
|
||||
|
||||
visitors = SQL.ReadSQL($"Select * from zkup.besucher WHERE Ersteller = '{Environment.UserName}'", visitors).Result;
|
||||
VisitorView = Visitor.DataTableToVisitor(visitors);
|
||||
|
||||
|
||||
dgVisitors.RowValidationErrorTemplate = new ControlTemplate();
|
||||
|
||||
dgVisitors.SelectedIndex = (index);
|
||||
dgVisitors.ScrollIntoView(dgVisitors.Items[index]);
|
||||
|
||||
//ScrollTo();
|
||||
}
|
||||
|
||||
private async void DgVisitors_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var dg = sender as DataGrid;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (e.Key == Key.Delete)
|
||||
{
|
||||
deleteRow(arr);
|
||||
}
|
||||
}
|
||||
|
||||
private void DgVisitors_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
dgVisitors.PreviewKeyDown -= DgVisitors_PreviewKeyDown;
|
||||
}
|
||||
|
||||
string oldValue = "";
|
||||
private void dgVisitors_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
|
||||
{
|
||||
oldValue = (e.EditingElement as TextBox) != null ? (e.EditingElement as TextBox).Text : "";
|
||||
}
|
||||
|
||||
private void dgVisitors_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dgVisitors.SelectedIndex != -1) btnDelete.IsEnabled = true;
|
||||
else btnDelete.IsEnabled = false;
|
||||
|
||||
}
|
||||
|
||||
private async void btnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dg = dgVisitors;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (MessageBox.Show(this, $"Markierten Besucher wirklich entfernen?", "Besucher entfernen?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
deleteRow(arr);
|
||||
}
|
||||
}
|
||||
|
||||
private async void deleteRow(object[] arr)
|
||||
{
|
||||
await SQL.WriteSQL("INSERT INTO besucherLog (idbesucher, Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Geloescht_Von) VALUES " +
|
||||
$"('{arr[0]}','{arr[1].ToString()}','{arr[2].ToString()}','{arr[3].ToString()}','{arr[4].ToString()}','{Convert.ToDateTime(arr[5].ToString()).ToString("yyyy-MM-dd")}','{arr[6].ToString()}','{arr[7].ToString()}','{arr[8].ToString()}','{arr[10].ToString()}','{Environment.UserName}')");
|
||||
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.besucher WHERE `idbesucher` = '{arr[0]}'");
|
||||
|
||||
visitors = SQL.ReadSQL($"Select * from zkup.besucher WHERE Ersteller = '{Environment.UserName}'", visitors).Result;
|
||||
VisitorView = Visitor.DataTableToVisitor(visitors);
|
||||
}
|
||||
}
|
||||
}
|
||||
93
ZKuP/DBImageManager.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
public static class DBImageManager
|
||||
{
|
||||
public static BitmapImage ImageFromByte(byte[] array)
|
||||
{
|
||||
//Store binary data read from the database in a byte array
|
||||
byte[] blob = array;
|
||||
MemoryStream stream = new MemoryStream();
|
||||
stream.Write(blob, 0, blob.Length);
|
||||
stream.Position = 0;
|
||||
|
||||
System.Drawing.Image img = System.Drawing.Image.FromStream(stream,false,true);
|
||||
BitmapImage bi = new BitmapImage();
|
||||
bi.BeginInit();
|
||||
|
||||
MemoryStream ms = new MemoryStream();
|
||||
img.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
bi.StreamSource = ms;
|
||||
bi.EndInit();
|
||||
|
||||
return bi;
|
||||
}
|
||||
|
||||
public static byte[] ByteFromImage(Image image)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
//Initialize a file stream to read the image file
|
||||
MemoryStream fs = new MemoryStream();
|
||||
image.Save(fs, ImageFormat.Tiff);
|
||||
|
||||
//Initialize a byte array with size of stream
|
||||
byte[] imgByteArr = new byte[fs.Length];
|
||||
|
||||
//Read data from the file stream and put into the byte array
|
||||
fs.Read(imgByteArr, 0, Convert.ToInt32(fs.Length));
|
||||
|
||||
//Close a file stream
|
||||
fs.Close();
|
||||
|
||||
return imgByteArr;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
MessageBox.Show(ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static byte[] ImageFromFileToByte(string fileName)
|
||||
{
|
||||
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
|
||||
|
||||
//Initialize a byte array with size of stream
|
||||
byte[] imgByteArr = new byte[fs.Length];
|
||||
|
||||
//Read data from the file stream and put into the byte array
|
||||
fs.Read(imgByteArr, 0, Convert.ToInt32(fs.Length));
|
||||
|
||||
//Close a file stream
|
||||
fs.Close();
|
||||
|
||||
return imgByteArr;
|
||||
}
|
||||
|
||||
public static string StringFromImage(Image image)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
image.Save(ms, ImageFormat.Tiff);
|
||||
return Convert.ToBase64String(ms.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
45
ZKuP/Delivery.xaml
Normal file
@ -0,0 +1,45 @@
|
||||
<Window x:Class="ZKuP.Delivery"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Lieferant" Height="657" Width="434" MinHeight="540">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="0.8*"/>
|
||||
<RowDefinition Height="0.8*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Margin="10,10,10,0" TextWrapping="Wrap" Text="Lieferantenliste filtern:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbFilter" Margin="10,0,0,0" TextWrapping="Wrap" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="255"/>
|
||||
<Button x:Name="btnFiltern" Content="Filtern" Margin="270,36,10,0" Click="btnFiltern_Click"/>
|
||||
<TextBlock Margin="12,10,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Grid.Row="1"><Run Text="Hinterlegte"/><Run Text=" Lieferanten"/><Run Text=":"/></TextBlock>
|
||||
<ComboBox x:Name="cBLieferfirma" Margin="10,0" Height="21" VerticalAlignment="Bottom" SelectionChanged="cBLieferfirma_SelectionChanged" Grid.Row="1"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Firma:" VerticalAlignment="Top" Grid.Row="2"/>
|
||||
<TextBox x:Name="tbFirma" Margin="10,31,10,0" TextWrapping="Wrap" Padding="2" Grid.Row="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Fahrername:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbFahrer" Margin="10,31,10,0" Grid.Row="3" TextWrapping="Wrap" Padding="3" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="4" TextWrapping="Wrap" Text="Handynummer:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbHandy" Margin="10,31,10,0" Grid.Row="4" TextWrapping="Wrap" Padding="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="5" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Kennzeichen:"/></TextBlock>
|
||||
<TextBox x:Name="tbKennzeichen" Margin="10,31,10,0" Grid.Row="5" TextWrapping="Wrap" Padding="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="6" TextWrapping="Wrap" Text="Parkplatz:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbParkplatz" Margin="10,31,10,0" Grid.Row="6" TextWrapping="Wrap" Padding="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="7" TextWrapping="Wrap" Text="Bemerkung:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbBemerkung" Margin="10,35,10,10" Grid.Row="7" TextWrapping="Wrap" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
|
||||
<Button x:Name="btnSignature" Content="Unterschrift" Margin="10,5" Grid.Row="8" Click="btnSignature_Click"/>
|
||||
<Button x:Name="btnAdd" Content="Hinzufügen" HorizontalAlignment="Stretch" Margin="10,5" Grid.Row="9" Click="btnAdd_Click"/>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
122
ZKuP/Delivery.xaml.cs
Normal file
@ -0,0 +1,122 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Delivery.xaml
|
||||
/// </summary>
|
||||
public partial class Delivery : Window
|
||||
{
|
||||
string query = "";
|
||||
|
||||
byte[] _signature = null;
|
||||
|
||||
public Delivery()
|
||||
{
|
||||
InitializeComponent();
|
||||
var list = SQL.ReadListStringTwoColumns($"SELECT Firma, Fahrer FROM zkup.lieferanten", " Fahrer: ").Result;
|
||||
list = list.OrderBy(p => p).ToList();
|
||||
cBLieferfirma.ItemsSource = list;
|
||||
}
|
||||
|
||||
|
||||
private void btnFiltern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var list = SQL.ReadListStringTwoColumns($"SELECT Firma, Fahrer FROM zkup.lieferanten WHERE Firma LIKE '%{tbFilter.Text}%' OR Fahrer LIKE '%{tbFilter.Text}%'", " Fahrer: ").Result;
|
||||
list = list.OrderBy(p => p).ToList();
|
||||
cBLieferfirma.ItemsSource = list;
|
||||
|
||||
cBLieferfirma.IsDropDownOpen = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void btnSignature_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(tbFahrer.Text) && !string.IsNullOrWhiteSpace(tbFirma.Text))
|
||||
{
|
||||
var sig = new Signature(tbFahrer.Text, tbFirma.Text, tbKennzeichen.Text, false);
|
||||
if (sig.ShowDialog() == false)
|
||||
{
|
||||
_signature = sig.ResultByte;
|
||||
}
|
||||
}
|
||||
else MessageBox.Show(this, "Firma und Fahrer müssen ausgefüllt werden", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
MessageBox.Show($"Es ist ein Fehler aufgetreten\n\nInterne Meldung: {ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (tbParkplatz.Text != "")
|
||||
query = ($"INSERT INTO zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung, signature_blob) VALUES ('3','Firma: {tbFirma.Text}, Fahrer: {tbFahrer.Text}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','--','--','1','1','{tbHandy.Text}','1','1','{tbKennzeichen.Text}','Parkplatz: {tbParkplatz.Text}\n\nBemerkung:\n{tbBemerkung.Text}', @signature)");
|
||||
else
|
||||
query = ($"INSERT INTO zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung, signature_blob) VALUES ('3','Firma: {tbFirma.Text}, Fahrer: {tbFahrer.Text}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','--','--','1','1','{tbHandy.Text}','1','1','{tbKennzeichen.Text}','{tbBemerkung.Text}', @signature)");
|
||||
|
||||
await SQL.WriteSQL(query, _signature);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
MessageBox.Show(this, "Fehler beim Eintragen des Lieferanten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private async void cBLieferfirma_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
System.Data.DataTable result = new System.Data.DataTable();
|
||||
string firma = (sender as ComboBox).SelectedItem.ToString().Split(new string[] { " Fahrer: " }, StringSplitOptions.None)[0];
|
||||
string fahrer = (sender as ComboBox).SelectedItem.ToString().Split(new string[] { " Fahrer: " }, StringSplitOptions.None)[1];
|
||||
|
||||
if (fahrer != "")
|
||||
result = await SQL.ReadSQL($"SELECT * FROM zkup.lieferanten WHERE Firma = '{firma}' AND Fahrer = '{fahrer}' LIMIT 1");
|
||||
else
|
||||
result = await SQL.ReadSQL($"SELECT * FROM zkup.lieferanten WHERE Firma = '{firma}' LIMIT 1");
|
||||
|
||||
|
||||
tbFirma.Text = result.Rows[0].ItemArray[0] != null ? result.Rows[0].ItemArray[0].ToString() : "";
|
||||
tbFahrer.Text = result.Rows[0].ItemArray[1] != null ? result.Rows[0].ItemArray[1].ToString() : "";
|
||||
tbHandy.Text = result.Rows[0].ItemArray[2] != null ? result.Rows[0].ItemArray[2].ToString() : "";
|
||||
tbKennzeichen.Text = result.Rows[0].ItemArray[3] != null ? result.Rows[0].ItemArray[3].ToString() : "";
|
||||
}
|
||||
|
||||
private void TextBoxes_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
4
ZKuP/FodyWeavers.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Costura CreateTemporaryAssemblies='true'/>
|
||||
</Weavers>
|
||||
111
ZKuP/FodyWeavers.xsd
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCompression" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCleanup" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
54
ZKuP/GrantParkausweis.xaml
Normal file
@ -0,0 +1,54 @@
|
||||
<Window x:Class="ZKuP.GrantParkausweis"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Parkausweis(e) genehmigen" Height="450" Width="1300">
|
||||
<Grid>
|
||||
<DataGrid x:Name="dgGrant" AutoGenerateColumns="False" ItemsSource="{Binding .}" CanUserDeleteRows="False" CanUserAddRows="False" CanUserReorderColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding idparkausweise}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="ID" IsReadOnly="True" Width="40"/>
|
||||
<DataGridTextColumn Binding="{Binding MA_Vorname}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Vorname" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding MA_Name}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Nachname" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Abteilung}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Abteilung" IsReadOnly="True" Width="80"/>
|
||||
<DataGridTextColumn Binding="{Binding Firma}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Firma" IsReadOnly="True" Width="90"/>
|
||||
<DataGridTextColumn Binding="{Binding Adresse}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Adresse" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding PLZ}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Postleitzahl" IsReadOnly="True" Width="75">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Kennzeichen}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Kennzeichen" IsReadOnly="True" Width="85">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Email}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="E-Mail" IsReadOnly="True" Width="220"/>
|
||||
<DataGridTextColumn Binding="{Binding Telefon}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Telefon" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Vorgesetzter}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Vorgesetzter" IsReadOnly="True" Width="110"/>
|
||||
<DataGridCheckBoxColumn Binding="{Binding Schicht}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Schicht" IsReadOnly="True" Width="50"/>
|
||||
<DataGridTemplateColumn CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Genehmigen" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button x:Name="btnGrant" Content="Genehmigen" Click="btnGrant_Click"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Ablehnen" Width="75">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button x:Name="btnDecline" Content="Ablehnen" Click="btnDecline_Click"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
135
ZKuP/GrantParkausweis.xaml.cs
Normal file
@ -0,0 +1,135 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für GrantParkausweis.xaml
|
||||
/// </summary>
|
||||
public partial class GrantParkausweis : Window
|
||||
{
|
||||
public GrantParkausweis()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT * FROM zkup.parkausweise WHERE Genehmigt = '0'").Result;
|
||||
dgGrant.DataContext = list;
|
||||
}
|
||||
|
||||
private async void btnGrant_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var arr = ((sender as Button).DataContext as System.Data.DataRowView).Row.ItemArray;
|
||||
|
||||
if (MessageBox.Show(this, $"Möchten Sie den Parkausweis für {arr[1].ToString()} {arr[2].ToString()} sicher genehmigen?", "Sicher?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE parkausweise SET Genehmigt = '1', Genehmiger = '{Environment.UserName}' WHERE idparkausweise = '{(int)arr[0]}'");
|
||||
|
||||
SendMail((int)arr[0], $"{arr[1].ToString()} {arr[2].ToString()}", arr[3].ToString(), arr[4].ToString(), arr[7].ToString(), true);
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT * FROM zkup.parkausweise WHERE Genehmigt = '0'").Result;
|
||||
dgGrant.DataContext = list;
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnDecline_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var arr = ((sender as Button).DataContext as System.Data.DataRowView).Row.ItemArray;
|
||||
|
||||
if (MessageBox.Show(this, $"Möchten Sie den Parkausweis für {arr[1].ToString()} {arr[2].ToString()} sicher ablehnen?\n\nDer Antrag wird dadurch gelöscht!", "Sicher?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.parkausweise WHERE idparkausweise = '{(int)arr[0]}'");
|
||||
|
||||
SendMail((int)arr[0], $"{arr[1].ToString()} {arr[2].ToString()}", "", arr[4].ToString(), "", false);
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT * FROM zkup.parkausweise WHERE Genehmigt = '0'").Result;
|
||||
dgGrant.DataContext = list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SendMail(int id, string Name, string Kennzeichen, string Email, string Firma, bool Genehmigt)
|
||||
{
|
||||
var user = System.Text.RegularExpressions.Regex.Split(Environment.UserName, @"(?<!^)(?=[A-Z])");
|
||||
|
||||
switch (Genehmigt)
|
||||
{
|
||||
case true:
|
||||
System.Diagnostics.Process.Start($"mailto:DBSi-S.ICE.Werk@deutschebahn.com?subject=Neue Parkkarte&cc={Email}&body=" +
|
||||
"Guten Tag,%0D%0A%0D%0A" +
|
||||
"eine neue Parkkarte wurde genehmigt%0D%0A%0D%0A" +
|
||||
$"Parkausweis Nr.: {id}%0D%0A" +
|
||||
$"Name: {Name}%0D%0A" +
|
||||
$"Kennzeichen: {Kennzeichen}%0D%0A" +
|
||||
$"E-Mail: {Email}%0D%0A" +
|
||||
$"Firma: {Firma}%0D%0A%0D%0A" +
|
||||
"Mit freundlichen Grüßen%0D%0A" +
|
||||
$"{user[0]} {user[1]}%0D%0A" +
|
||||
"Anlagenmanagement und IT-Service(P.FBW-M2(1))");
|
||||
break;
|
||||
case false:
|
||||
System.Diagnostics.Process.Start($"mailto:{Email}?subject=Parkkarte abgelehnt&body=" +
|
||||
$"Guten Tag {Name},%0D%0A%0D%0A" +
|
||||
"Ihr Antrag auf eine Parkkarte wurde abgelehnt%0D%0A%0D%0A" +
|
||||
"Mit freundlichen Grüßen%0D%0A" +
|
||||
$"{user[0]} {user[1]}%0D%0A" +
|
||||
"Anlagenmanagement und IT-Service(P.FBW-M2(1))");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Grant
|
||||
{
|
||||
int idparkausweise;
|
||||
string MA_Vorname;
|
||||
string MA_Name;
|
||||
string Kennzeichen;
|
||||
string Email;
|
||||
string Telefon;
|
||||
string Abteilung;
|
||||
string Firma;
|
||||
string Adresse;
|
||||
string PLZ;
|
||||
string Vorgesetzter;
|
||||
int Schicht;
|
||||
|
||||
|
||||
public static List<Grant> DataTableToGrant(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Grant> x = new List<Grant>();
|
||||
|
||||
foreach (System.Data.DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Grant()
|
||||
{
|
||||
idparkausweise = (int)dr[0],
|
||||
MA_Vorname = dr[1].ToString(),
|
||||
MA_Name = dr[2].ToString(),
|
||||
Kennzeichen = dr[3].ToString(),
|
||||
Email = dr[4].ToString(),
|
||||
Telefon = dr[5].ToString(),
|
||||
Abteilung = dr[6].ToString(),
|
||||
Firma = dr[7].ToString(),
|
||||
Adresse = dr[8].ToString(),
|
||||
PLZ = dr[9].ToString(),
|
||||
Vorgesetzter = dr[10].ToString(),
|
||||
Schicht = (int)dr[11]
|
||||
});
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
446
ZKuP/Helper.cs
Normal file
@ -0,0 +1,446 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Word = Microsoft.Office.Interop.Word;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
class Helper
|
||||
{
|
||||
|
||||
public static List<Tuple<string, string>> DataTableToTuple(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Tuple<string, string>> x = new List<Tuple<string, string>>();
|
||||
|
||||
foreach (System.Data.DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Tuple<string, string>(dr[0].ToString(), dr[1].ToString()));
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
public static List<string> DataTableToListString(System.Data.DataTable dataTable, int Columns = 1, int startColumn = 0)
|
||||
{
|
||||
switch (Columns)
|
||||
{
|
||||
case 1:
|
||||
return (from System.Data.DataRow dr in dataTable.Rows select dr[startColumn + 0].ToString()).ToList();
|
||||
break;
|
||||
case 2:
|
||||
return (from System.Data.DataRow dr in dataTable.Rows select dr[startColumn + 0].ToString() + " " + dr[startColumn + 1].ToString()).ToList();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return (from System.Data.DataRow dr in dataTable.Rows select dr[0].ToString()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj,
|
||||
string name) where T : DependencyObject
|
||||
{
|
||||
if (depObj != null)
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
|
||||
{
|
||||
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
|
||||
if (child != null && child is T &&
|
||||
(child as FrameworkElement).Name.Equals(name))
|
||||
{
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindVisualChildren<T>(child, name))
|
||||
{
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Parent FindParent<Parent>(DependencyObject child)
|
||||
where Parent : DependencyObject
|
||||
{
|
||||
DependencyObject parentObject = child;
|
||||
|
||||
//We are not dealing with Visual, so either we need to fnd parent or
|
||||
//get Visual to get parent from Parent Heirarchy.
|
||||
while (!((parentObject is System.Windows.Media.Visual)
|
||||
|| (parentObject is System.Windows.Media.Media3D.Visual3D)))
|
||||
{
|
||||
if (parentObject is Parent || parentObject == null)
|
||||
{
|
||||
return parentObject as Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
parentObject = (parentObject as FrameworkContentElement).Parent;
|
||||
}
|
||||
}
|
||||
|
||||
//We have not found parent yet , and we have now visual to work with.
|
||||
parentObject = VisualTreeHelper.GetParent(parentObject);
|
||||
|
||||
//check if the parent matches the type we're looking for
|
||||
if (parentObject is Parent || parentObject == null)
|
||||
{
|
||||
return parentObject as Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
//use recursion to proceed with next level
|
||||
return FindParent<Parent>(parentObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static DependencyObject GetScrollViewer(DependencyObject o)
|
||||
{
|
||||
// Return the DependencyObject if it is a ScrollViewer
|
||||
if (o is System.Windows.Controls.ScrollViewer)
|
||||
{ return o; }
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(o); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(o, i);
|
||||
|
||||
var result = GetScrollViewer(child);
|
||||
if (result == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void SendMail(string body = "")
|
||||
{
|
||||
if (body != "") body = "Exception:%0D%0A%0D%0A" + body;
|
||||
|
||||
System.Diagnostics.Process.Start($"mailto:marcus.bachler@deutschebahn.com?subject=Fehlermeldung_ZKuP&body=" + body);
|
||||
}
|
||||
|
||||
public static string InsertSpaceBeforeUpperCase(string str)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
char previousChar = char.MinValue; // Unicode '\0'
|
||||
|
||||
foreach (char c in str)
|
||||
{
|
||||
if (char.IsUpper(c))
|
||||
{
|
||||
// If not the first character and previous character is not a space, insert a space before uppercase
|
||||
|
||||
if (sb.Length != 0 && previousChar != ' ')
|
||||
{
|
||||
sb.Append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append(c);
|
||||
|
||||
previousChar = c;
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load a resource WPF-BitmapImage (png, bmp, ...) from embedded resource defined as 'Resource' not as 'Embedded resource'.
|
||||
/// </summary>
|
||||
/// <param name="pathInApplication">Path without starting slash</param>
|
||||
/// <param name="assembly">Usually 'Assembly.GetExecutingAssembly()'. If not mentionned, I will use the calling assembly</param>
|
||||
/// <returns></returns>
|
||||
public static System.Drawing.Bitmap LoadBitmapFromResource(string pathInApplication, System.Reflection.Assembly assembly = null)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
assembly = System.Reflection.Assembly.GetCallingAssembly();
|
||||
}
|
||||
|
||||
if (pathInApplication[0] == '/')
|
||||
{
|
||||
pathInApplication = pathInApplication.Substring(1);
|
||||
}
|
||||
return BitmapImage2Bitmap(new System.Windows.Media.Imaging.BitmapImage(new Uri(@"pack://application:,,,/" + assembly.GetName().Name + ";component/" + pathInApplication, UriKind.Absolute)));
|
||||
}
|
||||
|
||||
private static System.Drawing.Bitmap BitmapImage2Bitmap(System.Windows.Media.Imaging.BitmapImage bitmapImage)
|
||||
{
|
||||
// BitmapImage bitmapImage = new BitmapImage(new Uri("../Images/test.png", UriKind.Relative));
|
||||
|
||||
using (System.IO.MemoryStream outStream = new System.IO.MemoryStream())
|
||||
{
|
||||
System.Windows.Media.Imaging.BitmapEncoder enc = new System.Windows.Media.Imaging.TiffBitmapEncoder();
|
||||
enc.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(bitmapImage));
|
||||
enc.Save(outStream);
|
||||
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(outStream);
|
||||
|
||||
return new System.Drawing.Bitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Takes a bitmap and converts it to an image that can be handled by WPF ImageBrush
|
||||
/// </summary>
|
||||
/// <param name="src">A bitmap image</param>
|
||||
/// <returns>The image as a BitmapImage for WPF</returns>
|
||||
public static BitmapImage ConvertBitmapToImage(System.Drawing.Bitmap src)
|
||||
{
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
src.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff);
|
||||
BitmapImage image = new BitmapImage();
|
||||
image.BeginInit();
|
||||
ms.Seek(0, System.IO.SeekOrigin.Begin);
|
||||
image.StreamSource = ms;
|
||||
image.EndInit();
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
public static BitmapImage ConvertByteArrayToBitmapImage(Byte[] bytes)
|
||||
{
|
||||
var stream = new System.IO.MemoryStream(bytes);
|
||||
stream.Seek(0, System.IO.SeekOrigin.Begin);
|
||||
var image = new System.Windows.Media.Imaging.BitmapImage();
|
||||
image.BeginInit();
|
||||
image.StreamSource = stream;
|
||||
image.EndInit();
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
public static bool OpenAndEditWord(string Name, string Kennzeichen, string Firma, string Nr)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var regWord = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey("Word.Application"))
|
||||
{
|
||||
if (regWord == null)
|
||||
{
|
||||
MessageBox.Show("Microsoft Word wird benötigt, ist aber nicht installiert\nFunktion kann nicht ausgeführt werden", "Word nicht installiert", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("Microsoft Word is installed");
|
||||
|
||||
Word.Application wordApp = new Word.Application();
|
||||
|
||||
wordApp.Visible = true;
|
||||
|
||||
Word.Document document = wordApp.Documents.OpenNoRepairDialog("https://dbsw.sharepoint.com/:w:/r/sites/PfoertnerWerkMuenche/Freigegebene%20Dokumente/DBSecurity/Parkkarte_Template_ab_2020.dotx");
|
||||
|
||||
//Word.Document document = wordApp.Documents.OpenNoRepairDialog(@"\\muenas001.wb4fv.db.de\GLW99\ZKuP\Parkkarte_Template_ab_2020.dotx");
|
||||
document.Activate();
|
||||
|
||||
Word.Table table = document.Tables[1];
|
||||
table.Cell(1, 2).Range.Text = Nr;
|
||||
table.Cell(3, 2).Range.Text = Kennzeichen;
|
||||
table.Cell(4, 2).Range.Text = Firma;
|
||||
|
||||
Word.Table table2 = document.Tables[2];
|
||||
table2.Cell(1, 1).Range.Text = Name;
|
||||
|
||||
Word.Dialog dialog = null;
|
||||
dialog = wordApp.Dialogs[Word.WdWordDialog.wdDialogFilePrint];
|
||||
var dialogResult = dialog.Show();
|
||||
if (dialogResult == 1)
|
||||
{
|
||||
document.PrintOut(false);
|
||||
}
|
||||
else if (dialogResult == -1)
|
||||
{
|
||||
document.Close(Word.WdSaveOptions.wdDoNotSaveChanges);
|
||||
wordApp.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
MessageBox.Show($"Fehlermeldung:\n\n{ex.Message}", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class ConvertToBackground : System.Windows.Data.IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
string input = value.ToString().Substring(0, 2);
|
||||
switch (input)
|
||||
{
|
||||
case "Pr"://üfen!
|
||||
return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.LightYellow);
|
||||
case "OK":
|
||||
return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.LightGreen);
|
||||
case "Fe"://hler!
|
||||
return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.LightSalmon);
|
||||
case "Nu":
|
||||
return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Orange);
|
||||
default:
|
||||
return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.LightGray);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class ConvertToBackground2 : System.Windows.Data.IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
string input = value.ToString().Split(' ')[0];
|
||||
if (input == "Besucher:")
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
//public class ConvertDateToBackground : System.Windows.Data.IValueConverter
|
||||
//{
|
||||
|
||||
// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
// {
|
||||
// string input = System.Convert.ToDateTime(value).ToShortDateString();
|
||||
// switch (input)
|
||||
// {
|
||||
// case "01.01.1902"://üfen!
|
||||
// return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
|
||||
// default:
|
||||
// return new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//}
|
||||
|
||||
public class IntToCategory : System.Windows.Data.IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
string input = value as string;
|
||||
switch (input)
|
||||
{
|
||||
case "1":
|
||||
return "Fremdfirma";
|
||||
case "2":
|
||||
return "Besucher";
|
||||
case "3":
|
||||
return "Lieferant";
|
||||
default:
|
||||
return "Fehler!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class BoolToCheckBox : System.Windows.Data.IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
|
||||
int input = value != null ? System.Convert.ToInt16(value) : 0;
|
||||
|
||||
switch (input)
|
||||
{
|
||||
case 1:
|
||||
return true;
|
||||
case 0:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
bool input = System.Convert.ToBoolean(value);
|
||||
switch (input)
|
||||
{
|
||||
case true:
|
||||
return 1;
|
||||
case false:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MultiToBackground : System.Windows.Data.IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (System.Convert.ToInt16(values[0]) <= System.Convert.ToInt16(values[1]))
|
||||
return new SolidColorBrush(Colors.LightGreen);
|
||||
else return new SolidColorBrush(Colors.LightYellow);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return new SolidColorBrush(Colors.LightYellow);
|
||||
}
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object values, Type[] targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
23
ZKuP/ImageView.xaml
Normal file
@ -0,0 +1,23 @@
|
||||
<Window x:Class="ZKuP.ImageView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Unterschriftenanzeige" Height="342" Width="419">
|
||||
<Grid>
|
||||
|
||||
<DatePicker x:Name="dPDate" Height="25" Margin="10,10,106,0" Text="" VerticalAlignment="Top" SelectedDateChanged="DatePicker_SelectedDateChanged"/>
|
||||
<Image x:Name="imageSignature" Margin="10,95,10,10" Source="Resources/NoSignature.png"/>
|
||||
<ComboBox x:Name="cBSignature" Margin="10,68,10,0" VerticalAlignment="Top" SelectionChanged="cBSignature_SelectionChanged"/>
|
||||
<Button x:Name="btnToday" Content="Heute" Margin="0,13,140,0" VerticalAlignment="Top" Height="19" Padding="1,0,1,1" Click="btnToday_Click" HorizontalAlignment="Right" Width="55"/>
|
||||
<Button x:Name="btnUp" Content="▲" Margin="0,13,201,0" VerticalAlignment="Top" Height="19" Padding="1,0,1,1" Click="btnUp_Click" HorizontalAlignment="Right" Width="20"/>
|
||||
<Button x:Name="btnDown" Content="▼" Margin="0,13,225,0" VerticalAlignment="Top" Height="19" Padding="1,0,1,1" HorizontalAlignment="Right" Width="20" Click="btnDown_Click"/>
|
||||
<TextBox x:Name="tbFilter" Height="23" Margin="10,40,106,0" TextWrapping="Wrap" VerticalAlignment="Top" PreviewGotKeyboardFocus="tbFilter_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="tbFilter_PreviewLostKeyboardFocus" PreviewKeyDown="tbFilter_PreviewKeyDown"/>
|
||||
<TextBlock x:Name="lblFilter" Height="23" Margin="10,40,106,0" Padding="2" TextWrapping="Wrap" Foreground="Gray" Text="Nach Firma/Name filtern" VerticalAlignment="Top" PreviewGotKeyboardFocus="tbFilter_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="tbFilter_PreviewLostKeyboardFocus" PreviewKeyDown="tbFilter_PreviewKeyDown" IsHitTestVisible="False"/>
|
||||
<Button x:Name="btnFiltern" Content="Filtern" HorizontalAlignment="Right" Margin="0,40,10,0" VerticalAlignment="Top" Width="91" Height="23" Click="btnFiltern_Click"/>
|
||||
<CheckBox x:Name="cbOnlyWithSignature" Content="Nur mit
Unterschrift" Margin="0,10,8,0" VerticalAlignment="Top" Height="25" FontSize="10" Checked="cbOnlyWithSignature_Checked" Unchecked="cbOnlyWithSignature_Unchecked" Width="91" HorizontalAlignment="Right"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
152
ZKuP/ImageView.xaml.cs
Normal file
@ -0,0 +1,152 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ImageView.xaml
|
||||
/// </summary>
|
||||
public partial class ImageView : Window
|
||||
{
|
||||
|
||||
public ImageView(BitmapImage image, bool showComboBox = false)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (!showComboBox) { cBSignature.Visibility = Visibility.Collapsed; dPDate.Visibility = Visibility.Collapsed; }
|
||||
else { cBSignature.Visibility = Visibility.Visible; dPDate.Visibility = Visibility.Visible; }
|
||||
|
||||
if (image != null)
|
||||
imageSignature.Source = image;
|
||||
else
|
||||
{
|
||||
var list = SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM zkup.zutritteLog").Result;
|
||||
|
||||
cBSignature.ItemsSource = list.OrderByDescending(p => p);
|
||||
}
|
||||
}
|
||||
|
||||
private void cBSignature_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (cBSignature.SelectedItem != null && cBSignature.SelectedIndex != -1)
|
||||
{
|
||||
var i = SQL.ReadSingleByteArr($"SELECT signature_blob FROM zkup.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);
|
||||
}
|
||||
}
|
||||
|
||||
private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dPDate.SelectedDate.HasValue)
|
||||
{
|
||||
if (dPDate.SelectedDate.Value >= DateTime.Now.Date) btnUp.IsEnabled = false;
|
||||
else if (dPDate.SelectedDate.Value < DateTime.Now.Date) btnUp.IsEnabled = true;
|
||||
}
|
||||
|
||||
Filtern();
|
||||
}
|
||||
|
||||
private void btnToday_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
dPDate.SelectedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
private void btnDown_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dPDate.SelectedDate.HasValue) dPDate.SelectedDate = dPDate.SelectedDate.Value - TimeSpan.FromDays(1);
|
||||
else dPDate.SelectedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
private void btnUp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (dPDate.SelectedDate.HasValue && dPDate.SelectedDate.Value < DateTime.Now.Date) dPDate.SelectedDate = dPDate.SelectedDate.Value + TimeSpan.FromDays(1);
|
||||
else dPDate.SelectedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
private void btnFiltern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Filtern();
|
||||
}
|
||||
|
||||
private void tbFilter_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
lblFilter.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private void tbFilter_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tbFilter.Text)) lblFilter.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void tbFilter_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.Key == Key.Enter)
|
||||
Filtern();
|
||||
}
|
||||
|
||||
private void Filtern()
|
||||
{
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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 Zutritt,Name FROM zkup.zutritteLog{withSign}").Result;
|
||||
|
||||
cBSignature.ItemsSource = list.OrderByDescending(p => p);
|
||||
}
|
||||
|
||||
if (cBSignature.Items.Count == 0) cBSignature.ItemsSource = new List<string>() { "Keine Einträge gefunden..." };
|
||||
|
||||
cBSignature.IsDropDownOpen = false;
|
||||
cBSignature.IsDropDownOpen = true;
|
||||
}
|
||||
|
||||
private void cbOnlyWithSignature_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Filtern();
|
||||
}
|
||||
|
||||
private void cbOnlyWithSignature_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Filtern();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
ZKuP/Log.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
class Log
|
||||
{
|
||||
static string path = @"\\muenas001.wb4fv.db.de\GLW99\ZKuP\Log\log.log";
|
||||
|
||||
public static void WriteLog(string Message)
|
||||
{
|
||||
File.AppendAllText(path, $"\n--------------------------------\n{DateTime.Now.ToString("dd.MM.yy HH:mm:ss")} | {Environment.UserName} | {Environment.MachineName}: Message:\n{Message}\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
94
ZKuP/MainWindow - Kopieren.xaml
Normal file
@ -0,0 +1,94 @@
|
||||
<Window x:Class="ZKuP.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Zutrittskontrolle" Height="450" Width="800">
|
||||
|
||||
|
||||
<Window.Resources>
|
||||
<local:ConvertToBackground x:Key="ConvertToBack"></local:ConvertToBackground>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<DataGrid x:Name="dgOverview" ItemsSource="{Binding Path=., Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,95,10,10" AutoGenerateColumns="False" BeginningEdit="DgOverview_BeginningEdit" SelectionChanged="DgOverview_SelectionChanged" RowEditEnding="DgOverview_RowEditEnding"> <!---->
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="ID" Binding="{Binding idzutritte, Mode=TwoWay}"/>
|
||||
<DataGridTemplateColumn Header="Kategorie" Width="*">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox x:Name="cbKategorie" DropDownClosed="ComboBox_DropDownClosed_1" ItemsSource="{Binding Kategorien, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" SelectedItem="{Binding Kategorie, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> <!---->
|
||||
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn x:Name="Firmenname" Width="*" Header="Firma" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding FirmenList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" SelectedItem="{Binding NameFirma, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" DropDownOpened="ComboBox_DropDownOpened" DropDownClosed="ComboBox_DropDownClosed"> <!--ItemsSource="{Binding FirmenList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}"-->
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" TextAlignment="Center" Margin="-5,2,0,0"/>
|
||||
<!-- Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}-->
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn x:Name="Besuchername" Width="*" Header="Besucher" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding BesucherList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" SelectedItem="{Binding NameBesucher, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" DropDownOpened="ComboBox_Besucher_DropDownOpened_1" DropDownClosed="ComboBox_Besucher_DropDownClosed_2">
|
||||
<!--ItemsSource="{Binding FirmenList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}"-->
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" TextAlignment="Center" Margin="-5,2,0,0"/>
|
||||
<!-- Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}-->
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn x:Name="Ankunft" Width="*" Header="Ankunft">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="Ankunft jetzt" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="150" Height="NaN" Click="Button_Click">
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding Zutritt, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Ankunft Zeitstempel" Width="*"/> <!---->
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Pruefung_Zutritt}" ClipboardContentBinding="{x:Null}" Header="Prüfung (Zutritt)" Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Background" Value="{Binding Pruefung_Zutritt, Converter={StaticResource ConvertToBack}}"/>
|
||||
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Pruefung_Einweisung}" ClipboardContentBinding="{x:Null}" Header="Prüfung (Einweisung)" Width="*"><!---->
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Background" Value="{Binding Pruefung_Einweisung, Converter={StaticResource ConvertToBack}}"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBox HorizontalAlignment="Left" Height="23" Margin="10,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<Button x:Name="btnSearch" Content="Suchen" HorizontalAlignment="Left" Margin="135,60,0,0" VerticalAlignment="Top" Width="75" Height="23" Padding="1,0,1,1"/>
|
||||
<Button x:Name="btnManageUsers" Content="Manage Users" Margin="0,10,10,0" VerticalAlignment="Top" Click="BtnManageUsers_Click" HorizontalAlignment="Right" Width="87" Visibility="Collapsed"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,44,0,0" TextWrapping="Wrap" Text="Suche:" VerticalAlignment="Top"/>
|
||||
<Button x:Name="btnCreateFirma" Content="Firmen verwalten" Margin="0,38,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="157" Visibility="Collapsed" Click="BtnCreateFirma_Click"/>
|
||||
<Button x:Name="btnCreateVisitor" Content="Besucher verwalten" Margin="0,63,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="157" Visibility="Collapsed" Click="BtnCreateVisitor_Click"/>
|
||||
<Button x:Name="btnNew" Content="Firma/Besucher kommt an" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="200" Click="BtnNew_Click"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
625
ZKuP/MainWindow - Kopieren.xaml.cs
Normal file
@ -0,0 +1,625 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
private List<string> firmenList;
|
||||
public List<string> FirmenList
|
||||
{
|
||||
get { return firmenList; }
|
||||
set { firmenList = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
DataTable firmen = new DataTable("firmen");
|
||||
|
||||
private List<string> besucherList;
|
||||
public List<string> BesucherList
|
||||
{
|
||||
get { return besucherList; }
|
||||
set { besucherList = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
DataTable besucher = new DataTable("besucher");
|
||||
|
||||
|
||||
private List<Overview> overview = new List<Overview>();
|
||||
public List<Overview> Overviews
|
||||
{
|
||||
get { return overview; }
|
||||
set { overview = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
DataTable overv = new DataTable("Overview");
|
||||
|
||||
public List<string> Kategorien { get; set; } = new List<string>();
|
||||
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
|
||||
|
||||
AuthenticateUser();
|
||||
}
|
||||
|
||||
private async void AuthenticateUser()
|
||||
{
|
||||
if (AuthenticateDomain())
|
||||
{
|
||||
if (!Thread.CurrentPrincipal.Identity.IsAuthenticated)
|
||||
{
|
||||
MessageBox.Show($"Ihr User {Thread.CurrentPrincipal.Identity.Name} ist nicht zum Zugriff berechtigt", "Zugriff verweigert");
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string auth = "";
|
||||
string role = "";
|
||||
|
||||
auth = await SQL.ReadSingleValue($"SELECT EXISTS(SELECT * FROM users WHERE `Username` = '{Environment.UserName}')");
|
||||
|
||||
if (auth == "1")
|
||||
role = await SQL.ReadSingleValue($"SELECT Role FROM users WHERE `Username` = '{Environment.UserName}'");
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"Ihr User {Thread.CurrentPrincipal.Identity.Name} ist nicht zum Zugriff berechtigt", "Zugriff verweigert");
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (role)
|
||||
{
|
||||
case "0":
|
||||
PfoertnerStart();
|
||||
break;
|
||||
case "1":
|
||||
EditorStart();
|
||||
break;
|
||||
case "2":
|
||||
AdminStart();
|
||||
break;
|
||||
default:
|
||||
PfoertnerStart();
|
||||
break;
|
||||
}
|
||||
|
||||
Kategorien.Add("Fremdfirma");
|
||||
Kategorien.Add("Besucher");
|
||||
|
||||
firmen = await SQL.ReadSQL($"SELECT Name FROM firmen", firmen);
|
||||
besucher = await SQL.ReadSQL($"SELECT Name From besucher", besucher);
|
||||
|
||||
FirmenList = DataTableToFirmenList(firmen);
|
||||
BesucherList = DataTableToFirmenList(besucher);
|
||||
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zutritte", overv);
|
||||
|
||||
//Overviews = DataTableToOverview(overv);
|
||||
dgOverview.DataContext = overv;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("User nicht in der Domäne aktiviert");
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private bool AuthenticateDomain()
|
||||
{
|
||||
using (var domainContext = new PrincipalContext(ContextType.Domain, Environment.UserDomainName))
|
||||
{
|
||||
using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, Environment.UserName))
|
||||
{
|
||||
if (foundUser.Enabled.HasValue)
|
||||
{
|
||||
return (bool)foundUser.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; //or false depending what result you want in the case of Enabled being NULL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AdminStart()
|
||||
{
|
||||
btnManageUsers.Visibility = Visibility.Visible;
|
||||
btnCreateVisitor.Visibility = Visibility.Visible;
|
||||
btnCreateFirma.Visibility = Visibility.Visible;
|
||||
|
||||
//MessageBox.Show("Sie sind Admin");
|
||||
// something that only an admin user should be able to do
|
||||
}
|
||||
|
||||
private void EditorStart()
|
||||
{
|
||||
btnCreateVisitor.Visibility = Visibility.Visible;
|
||||
btnCreateFirma.Visibility = Visibility.Visible;
|
||||
btnManageUsers.Visibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
//MessageBox.Show("Sie sind Editor");
|
||||
// something that only an admin user should be able to do
|
||||
}
|
||||
|
||||
private void PfoertnerStart()
|
||||
{
|
||||
btnCreateVisitor.Visibility = Visibility.Collapsed;
|
||||
btnManageUsers.Visibility = Visibility.Collapsed;
|
||||
btnCreateFirma.Visibility = Visibility.Collapsed;
|
||||
//MessageBox.Show("Sie sind Pförtner");
|
||||
// something that only an admin user should be able to do
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void ComboBox_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
var box = sender as ComboBox;
|
||||
DataGridRow dataGridRow = FindParent<DataGridRow>(box);
|
||||
int index = dataGridRow.GetIndex();
|
||||
|
||||
//TextBlock persnummer = null;
|
||||
var KatFramework = dgOverview.Columns[1].GetCellContent(dgOverview.Items[index]);
|
||||
var Kat = FindVisualChild<ComboBox>(KatFramework);
|
||||
|
||||
|
||||
if (Kat.Text == "Fremdfirma")
|
||||
firmen = await SQL.ReadSQL($"SELECT Name FROM firmen", firmen);
|
||||
|
||||
//firmen = await SQL.ReadSQL($"SELECT Name FROM firmen", firmen);
|
||||
//FirmenList = DataTableToFirmenList(firmen);
|
||||
if (Kat.SelectedIndex == -1)
|
||||
FirmenList.Add("Zuerst Kategorie wählen");
|
||||
//if (t.Count >= 1)
|
||||
if (Kat.Text == "Fremdfirma")
|
||||
{
|
||||
FirmenList = DataTableToFirmenList(firmen);
|
||||
if (Kat.SelectedIndex == -1)
|
||||
FirmenList.Add("Zuerst Kategorie wählen");
|
||||
|
||||
box.ItemsSource = FirmenList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void ComboBox_Besucher_DropDownOpened_1(object sender, EventArgs e)
|
||||
{
|
||||
var box = sender as ComboBox;
|
||||
DataGridRow dataGridRow = FindParent<DataGridRow>(box);
|
||||
int index = dataGridRow.GetIndex();
|
||||
|
||||
//TextBlock persnummer = null;
|
||||
var KatFramework = dgOverview.Columns[1].GetCellContent(dgOverview.Items[index]);
|
||||
var Kat = FindVisualChild<ComboBox>(KatFramework);
|
||||
|
||||
|
||||
if (Kat.Text == "Besucher")
|
||||
besucher = await SQL.ReadSQL($"SELECT Name From besucher", besucher);
|
||||
|
||||
if (Kat.Text == "Besucher")
|
||||
{
|
||||
BesucherList = DataTableToFirmenList(besucher);
|
||||
if (Kat.SelectedIndex == -1)
|
||||
BesucherList.Add("Zuerst Kategorie wählen");
|
||||
|
||||
box.ItemsSource = BesucherList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
string selectedKategorie = "";
|
||||
private void ComboBox_DropDownClosed_1(object sender, EventArgs e)
|
||||
{
|
||||
selectedKategorie = (sender as ComboBox).Text;
|
||||
}
|
||||
string selectedFirma = "";
|
||||
private void ComboBox_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
selectedFirma = (sender as ComboBox).Text;
|
||||
}
|
||||
string selectedBesucher = "";
|
||||
private void ComboBox_Besucher_DropDownClosed_2(object sender, EventArgs e)
|
||||
{
|
||||
selectedBesucher = (sender as ComboBox).Text;
|
||||
}
|
||||
|
||||
private async void CheckBox_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//var box = sender as CheckBox;
|
||||
//DataGridRow dataGridRow = FindParent<DataGridRow>(box);
|
||||
//int index = dataGridRow.GetIndex();
|
||||
|
||||
//var stamp = dgOverview.Columns[4].GetCellContent(dgOverview.Items[index]) as TextBlock;
|
||||
//var time = DateTime.Now.ToString("dd.MM.yyyy HH:mm");
|
||||
//stamp.Text = time;
|
||||
|
||||
|
||||
//var checkEinweisung = await SQL.ReadSingleValue($"SELECT Örtliche_Einweisung_bis FROM firmen WHERE Name = '{selectedFirma}'");
|
||||
|
||||
|
||||
//var einweis = dgOverview.Columns[6].GetCellContent(dgOverview.Items[index]) as TextBlock;
|
||||
//var zutritt = dgOverview.Columns[5].GetCellContent(dgOverview.Items[index]) as TextBlock;
|
||||
|
||||
//if (Convert.ToDateTime(time) > Convert.ToDateTime(checkEinweisung))
|
||||
//{
|
||||
// einweis.Text = "Prüfen!";
|
||||
// einweis.Background = new SolidColorBrush(Colors.Red);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// einweis.Text = "OK!";
|
||||
// einweis.Background = new SolidColorBrush(Colors.Green);
|
||||
//}
|
||||
|
||||
//var checkZutritt = await SQL.ReadSingleValue($"SELECT Arbeitsende FROM firmen WHERE Name = '{selectedFirma}'");
|
||||
|
||||
|
||||
//if (Convert.ToDateTime(time) > Convert.ToDateTime(checkZutritt))
|
||||
//{
|
||||
// zutritt.Text = "Prüfen!";
|
||||
// zutritt.Background = new SolidColorBrush(Colors.Red);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// zutritt.Text = "OK!";
|
||||
// zutritt.Background = new SolidColorBrush(Colors.Green);
|
||||
//}
|
||||
|
||||
|
||||
//await SQL.WriteSQL($"INSERT INTO zutritte (Kategorie,Firma_Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung) VALUES ('{selectedKategorie}','{selectedFirma}','{Convert.ToDateTime(time).ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt.Text}','{einweis.Text}')");
|
||||
//overv = await SQL.ReadSQL("SELECT * FROM zutritte", overv);
|
||||
//dgOverview.DataContext = overv;
|
||||
////overv.NewRow();
|
||||
////Overviews = DataTableToOverview(overv);
|
||||
|
||||
//dgOverview.CommitEdit(DataGridEditingUnit.Row,true);
|
||||
}
|
||||
|
||||
private void DgOverview_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void BtnManageUsers_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ManageUsers mU = new ManageUsers();
|
||||
mU.ShowDialog();
|
||||
}
|
||||
|
||||
private void BtnCreateVisitor_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CreateVisitor cV = new CreateVisitor();
|
||||
cV.ShowDialog();
|
||||
}
|
||||
|
||||
private void BtnCreateFirma_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CreateFirma cF = new CreateFirma();
|
||||
cF.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<string> DataTableToFirmenList(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<string> x = new List<string>();
|
||||
|
||||
foreach (DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(dr[0].ToString());
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
public static List<Overview> DataTableToOverview(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Overview> x = new List<Overview>();
|
||||
|
||||
foreach (DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Overview()
|
||||
{
|
||||
Kategorie = dr[1].ToString(),
|
||||
NameFirma = dr[2].ToString(),
|
||||
NameBesucher = dr[3].ToString(),
|
||||
Zutritt = dr[4].ToString(),
|
||||
Pruefung_Zutritt = dr[5].ToString(),
|
||||
Pruefung_Einweisung = dr[6].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
public static Parent FindParent<Parent>(DependencyObject child)
|
||||
where Parent : DependencyObject
|
||||
{
|
||||
DependencyObject parentObject = child;
|
||||
|
||||
//We are not dealing with Visual, so either we need to fnd parent or
|
||||
//get Visual to get parent from Parent Heirarchy.
|
||||
while (!((parentObject is System.Windows.Media.Visual)
|
||||
|| (parentObject is System.Windows.Media.Media3D.Visual3D)))
|
||||
{
|
||||
if (parentObject is Parent || parentObject == null)
|
||||
{
|
||||
return parentObject as Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
parentObject = (parentObject as FrameworkContentElement).Parent;
|
||||
}
|
||||
}
|
||||
|
||||
//We have not found parent yet , and we have now visual to work with.
|
||||
parentObject = VisualTreeHelper.GetParent(parentObject);
|
||||
|
||||
//check if the parent matches the type we're looking for
|
||||
if (parentObject is Parent || parentObject == null)
|
||||
{
|
||||
return parentObject as Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
//use recursion to proceed with next level
|
||||
return FindParent<Parent>(parentObject);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj)
|
||||
where T : DependencyObject
|
||||
{
|
||||
if (depObj != null)
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
|
||||
{
|
||||
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
|
||||
if (child != null && child is T)
|
||||
{
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindVisualChildren<T>(child))
|
||||
{
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static childItem FindVisualChild<childItem>(DependencyObject obj)
|
||||
where childItem : DependencyObject
|
||||
{
|
||||
foreach (childItem child in FindVisualChildren<childItem>(obj))
|
||||
{
|
||||
return child;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void DgOverview_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
//foreach (var cell in dgOverview.Items)
|
||||
//{
|
||||
// if (cell is DataRowView)
|
||||
// {
|
||||
// //DataRowView view = cell as DataRowView;
|
||||
// //if (view.Row.ItemArray[5].ToString() == "Prüfen!")
|
||||
// // (view.Row.ItemArray[5] as DataGridCell).Background = new SolidColorBrush(Colors.Red);
|
||||
// //else if (view.Row.ItemArray[5].ToString() == "OK!")
|
||||
// // (view.Row..ItemArray[5] as DataGridCell).Background = new SolidColorBrush(Colors.Red);
|
||||
|
||||
// //if (cell.Content.ToString() == "OK!") cell.Background = new SolidColorBrush(Colors.Green);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private void DgOverview_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
|
||||
{
|
||||
foreach (DataGridCell cell in dgOverview.Items)
|
||||
{
|
||||
if (cell.Content.ToString() == "Prüfen!") cell.Background = new SolidColorBrush(Colors.Red);
|
||||
|
||||
if (cell.Content.ToString() == "OK!") cell.Background = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
}
|
||||
|
||||
private async void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var box = sender as Button;
|
||||
DataGridRow dataGridRow = FindParent<DataGridRow>(box);
|
||||
|
||||
|
||||
int index = dataGridRow.GetIndex();
|
||||
|
||||
if (dgOverview.Items.Count - 1 == index)
|
||||
{
|
||||
var KatFramework = dgOverview.Columns[1].GetCellContent(dgOverview.Items[index]);
|
||||
var FirmFramework = dgOverview.Columns[2].GetCellContent(dgOverview.Items[index]);
|
||||
var BesuchFramework = dgOverview.Columns[3].GetCellContent(dgOverview.Items[index]);
|
||||
|
||||
var Kat = FindVisualChild<ComboBox>(KatFramework);
|
||||
var Firm = FindVisualChild<ComboBox>(FirmFramework);
|
||||
var Besuch = FindVisualChild<ComboBox>(BesuchFramework);
|
||||
|
||||
|
||||
|
||||
if (Kat.SelectedIndex == -1)
|
||||
MessageBox.Show("Bitte Kategorie wählen", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
else if (Firm.SelectedIndex == -1 && Besuch.SelectedIndex == -1)
|
||||
MessageBox.Show("Bitte Firma/Besucher wählen", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
else
|
||||
{
|
||||
var stamp = dgOverview.Columns[5].GetCellContent(dgOverview.Items[index]) as TextBlock;
|
||||
var time = DateTime.Now.ToString("dd.MM.yyyy HH:mm");
|
||||
stamp.Text = time;
|
||||
|
||||
var checkEinweisung = "";
|
||||
var checkZutritt = "";
|
||||
|
||||
if (Kat.Text == "Fremdfirma")
|
||||
checkEinweisung = await SQL.ReadSingleValue($"SELECT Örtliche_Einweisung_bis FROM firmen WHERE Name = '{selectedFirma}'");
|
||||
else if (Kat.Text == "Besucher")
|
||||
checkEinweisung = await SQL.ReadSingleValue($"SELECT Unterwiesen_Bis FROM besucher WHERE Name = '{selectedBesucher}'");
|
||||
|
||||
var einweis = dgOverview.Columns[6].GetCellContent(dgOverview.Items[index]) as TextBlock;
|
||||
var zutritt = dgOverview.Columns[5].GetCellContent(dgOverview.Items[index]) as TextBlock;
|
||||
|
||||
if (Convert.ToDateTime(time) > Convert.ToDateTime(checkEinweisung))
|
||||
{
|
||||
einweis.Text = "Prüfen!";
|
||||
einweis.Background = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
einweis.Text = "OK!";
|
||||
einweis.Background = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
if (Kat.Text == "Fremdfirma")
|
||||
{
|
||||
checkZutritt = await SQL.ReadSingleValue($"SELECT Arbeitsende FROM firmen WHERE Name = '{selectedFirma}'");
|
||||
|
||||
if (Convert.ToDateTime(time) > Convert.ToDateTime(checkZutritt))
|
||||
{
|
||||
zutritt.Text = "Prüfen!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
zutritt.Text = "OK!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
if (Convert.ToDateTime(time) > Convert.ToDateTime(checkZutritt))
|
||||
{
|
||||
zutritt.Text = "Prüfen!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
zutritt.Text = "OK!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
await SQL.WriteSQL($"INSERT INTO zutritte (Kategorie,NameFirma,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung) VALUES ('{selectedKategorie}','{selectedFirma}','{Convert.ToDateTime(time).ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt.Text}','{einweis.Text}')");
|
||||
}
|
||||
else if (Kat.Text == "Besucher")
|
||||
{
|
||||
checkZutritt = await SQL.ReadSingleValue($"SELECT Besuchstag FROM besucher WHERE Name = '{selectedBesucher}'");
|
||||
|
||||
if (Convert.ToDateTime(time).Date != Convert.ToDateTime(checkZutritt).Date)
|
||||
{
|
||||
zutritt.Text = "Prüfen!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
zutritt.Text = "OK!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
if (Convert.ToDateTime(time).Date != Convert.ToDateTime(checkZutritt).Date)
|
||||
{
|
||||
zutritt.Text = "Prüfen!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
zutritt.Text = "OK!";
|
||||
zutritt.Background = new SolidColorBrush(Colors.Green);
|
||||
}
|
||||
|
||||
await SQL.WriteSQL($"INSERT INTO zutritte (Kategorie,NameBesucher,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung) VALUES ('{selectedKategorie}','{selectedBesucher}','{Convert.ToDateTime(time).ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt.Text}','{einweis.Text}')");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//await SQL.WriteSQL($"INSERT INTO zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung) VALUES ('{selectedKategorie}','{selectedFirma}','{Convert.ToDateTime(time).ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt.Text}','{einweis.Text}')");
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zutritte", overv);
|
||||
dgOverview.DataContext = overv;
|
||||
//overv.NewRow();
|
||||
//Overviews = DataTableToOverview(overv);
|
||||
|
||||
dgOverview.CommitEdit(DataGridEditingUnit.Row, true);
|
||||
dgOverview.IsHitTestVisible = false;
|
||||
dgOverview.CanUserAddRows = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Editieren ist nicht möglich", "Achtung");
|
||||
}
|
||||
|
||||
private void BtnNew_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
dgOverview.IsHitTestVisible = true;
|
||||
dgOverview.CanUserAddRows = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Overview
|
||||
{
|
||||
public string Kategorie;
|
||||
public string NameFirma;
|
||||
public string NameBesucher;
|
||||
public string Zutritt;
|
||||
public string Pruefung_Zutritt;
|
||||
public string Pruefung_Einweisung;
|
||||
}
|
||||
}
|
||||
385
ZKuP/MainWindow.xaml
Normal file
@ -0,0 +1,385 @@
|
||||
<Window x:Class="ZKuP.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
xmlns:p="clr-namespace:ZKuP.Properties"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="Zutrittskontrolle"
|
||||
Height="{Binding Source={x:Static p:Settings.Default}, Path=Height, Mode=TwoWay, FallbackValue=747}"
|
||||
Width="{Binding Source={x:Static p:Settings.Default}, Path=Width, Mode=TwoWay, FallbackValue=1624}"
|
||||
Left="{Binding Source={x:Static p:Settings.Default}, Path=Left, Mode=TwoWay}"
|
||||
Top="{Binding Source={x:Static p:Settings.Default}, Path=Top, Mode=TwoWay}"
|
||||
|
||||
MinHeight="610"
|
||||
MinWidth="835"
|
||||
Closing="Window_Closing"
|
||||
PreviewKeyDown="Window_PreviewKeyDown" Loaded="Window_Loaded" ContentRendered="Window_ContentRendered" SizeChanged="Window_SizeChanged">
|
||||
<!--{Binding Source={x:Static p:Settings.Default}, Path=Height, Mode=TwoWay, FallbackValue=600}-->
|
||||
<!--{Binding Source={x:Static p:Settings.Default}, Path=Width, Mode=TwoWay, FallbackValue=1420}WindowStartupLocation="CenterScreen"-->
|
||||
<!--WindowState="{Binding Source={x:Static p:Settings.Default}, Path=State, Mode=TwoWay}"-->
|
||||
|
||||
<Window.Resources>
|
||||
<local:IntToCategory x:Key="IntToCategory"></local:IntToCategory>
|
||||
<local:ConvertToBackground x:Key="ConvertToBackground"></local:ConvertToBackground>
|
||||
<local:ConvertToBackground2 x:Key="ConvertToBackground2"></local:ConvertToBackground2>
|
||||
<local:BoolToCheckBox x:Key="BoolToCheckBox"></local:BoolToCheckBox>
|
||||
<local:MultiToBackground x:Key="MultiToBackground"></local:MultiToBackground>
|
||||
|
||||
<local:ReturnToolTip x:Key="ReturnToolTip"></local:ReturnToolTip>
|
||||
|
||||
</Window.Resources>
|
||||
|
||||
|
||||
<Grid x:Name="gridBackground">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="120"/>
|
||||
<RowDefinition Height="{Binding gridOverviewHeight, Source={x:Static p:Settings.Default}, Mode=TwoWay}" MinHeight="300"/>
|
||||
<RowDefinition Height="10" MinHeight="10"/>
|
||||
<RowDefinition Height="1*" MinHeight="100"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<Button x:Name="btnHelp" Content="Hilfe" Margin="0,63,182,0" VerticalAlignment="Top" Click="BtnHelp_Click" HorizontalAlignment="Right" Width="87" Visibility="Visible" Grid.RowSpan="3"/>
|
||||
|
||||
<Grid x:Name="Main" Visibility="Collapsed" Margin="10,0" Height="120" VerticalAlignment="Top" Grid.Row="0">
|
||||
<TextBox x:Name="tbSearch" HorizontalAlignment="Left" Height="23" Margin="0,97,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="180" Visibility="Collapsed" Padding="0,2,0,0" TextChanged="TextBox_TextChanged" PreviewGotKeyboardFocus="TbSearch_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="TbSearch_PreviewLostKeyboardFocus"/>
|
||||
|
||||
<TextBlock x:Name="lblSearch" Text="Ankunft heute durchsuchen..." Foreground="#99000000" IsHitTestVisible="False" Margin="0,97,0,0" Padding="3" Visibility="Collapsed" HorizontalAlignment="Left" Width="180"/>
|
||||
<Button x:Name="btnManageUsers" Content="Manage Users" Margin="0,13,172,0" VerticalAlignment="Top" Click="BtnManageUsers_Click" HorizontalAlignment="Right" Width="87" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnCreateFirma" Content="Firmen verwalten" Margin="0,38,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="157" Click="BtnCreateFirma_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnManageAsp" Content="Ansprechpartner verwalten" Margin="0,13,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="157" Click="BtnManageAsp_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnKarten" Content="Karten" Margin="0,38,172,0" VerticalAlignment="Top" Click="btnKarten_Click" HorizontalAlignment="Right" Width="87" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnSignatures" Content="Unterschriften" HorizontalAlignment="Right" Margin="0,88,172,0" VerticalAlignment="Top" Width="87" Click="btnSignatures_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnCreateVisitor" Content="Besucher verwalten" Margin="0,63,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="157" Click="BtnCreateVisitor_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnCreateDeliveries" Content="Lieferanten verwalten" Height="20" VerticalAlignment="Top" Margin="0,88,10,0" HorizontalAlignment="Right" Width="157" Visibility="Collapsed" Click="btnCreateDeliveries_Click"/>
|
||||
<Button x:Name="btnArrivalsOverview" Content="Ankunftsübersicht" Height="25" VerticalAlignment="Bottom" Margin="0,0,40,-20" HorizontalAlignment="Right" Width="127" Visibility="Collapsed" Click="btnArrivalsOverview_Click"/>
|
||||
|
||||
<Button x:Name="btnCreateParkausweis" Content="Parkausweis beantragen" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,13,280,0" Width="150" Click="btnCreateParkausweis_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnCreateSpecialParkausweis" Content="Sonderparkausweis" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,13,440,0" Width="150" Click="btnCreateSpecialParkausweis_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnGrantParkausweis" Content="Parkausweise genehmigen" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,38,280,0" Width="150" Click="btnGrantParkausweis_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnListParkausweis" Content="Parkausweise verwalten" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,63,280,0" Width="150" Click="btnListParkausweis_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnCheckParkausweis" Content="Parkausweise prüfen" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,88,280,0" Width="150" Click="btnCheckParkausweis_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnPrintParkausweis" Content="Parkausweise drucken" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,88,440,0" Width="150" Click="btnPrintParkausweis_Click" Visibility="Collapsed"/>
|
||||
|
||||
|
||||
<Button x:Name="btnNew" Content="Firma/Besucher kommt an" HorizontalAlignment="Left" Margin="0,13,0,0" VerticalAlignment="Top" Width="200" Click="BtnNew_Click" Visibility="Collapsed"/>
|
||||
<Button x:Name="btnDelivery" Content="Lieferant kommt an" HorizontalAlignment="Left" Margin="0,38,0,0" VerticalAlignment="Top" Width="200" Click="btnDelivery_Click" Visibility="Collapsed"/>
|
||||
|
||||
<Button x:Name="btnSettings" Content="⚙" Click="btnSettings_Click" Visibility="Collapsed" HorizontalAlignment="Right" Width="25" Height="25" VerticalAlignment="Bottom" Margin="0,0,10,-20"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid x:Name="gridToday" Grid.Row="1" Visibility="Collapsed" VerticalAlignment="Stretch" MinHeight="100">
|
||||
<!--<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>-->
|
||||
|
||||
<TextBlock Grid.Row="0" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Ankunft heute: (Firmen: Rot, Besucher: Grün)" VerticalAlignment="Top" Margin="10,10,0,0"/>
|
||||
<!--<Button x:Name="btnResetListsMain" Content="Listengröße zurücksetzen" Margin="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Top" Width="150" Height="22" Click="btnResetLists_Click" Visibility="Visible"/>-->
|
||||
|
||||
<DataGrid Grid.Row="0" x:Name="dgToday" RowHeaderWidth="0" KeyboardNavigation.TabNavigation="None" ItemsSource="{Binding ., UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" CanUserDeleteRows="False" AutoGenerateColumns="False" Margin="10,31,10,10" IsReadOnly="True">
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<EventSetter Event="Control.MouseDoubleClick" Handler="DataGridRow_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<EventSetter Event="Control.MouseDoubleClick" Handler="DataGridRow_MouseDoubleClick"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Name, Converter={StaticResource ConvertToBackground2}}" Value="1">
|
||||
<Setter Property="Background" Value="#3000FF00"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Name, Converter={StaticResource ConvertToBackground2}}" Value="0">
|
||||
<Setter Property="Background" Value="#30FF0000"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*" SortDirection="Ascending">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="ToolTip" Value="{Binding NoToolTip, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}, Converter={StaticResource ReturnToolTip}}"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Verantwortlicher Firma / Besucher" Binding="{Binding Verantwortlicher_MA_Firma}" Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="ToolTip" Value="{Binding NoToolTip, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}, Converter={StaticResource ReturnToolTip}}"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Tel. Verantwortlicher Firma / Tel. Besucher" Binding="{Binding Tel_Nr_Verantwortlicher_Firma}" Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="ToolTip" Value="{Binding NoToolTip, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}, Converter={StaticResource ReturnToolTip}}"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Ansprechpartner Intern" Binding="{Binding Ansprechpartner_Intern}" Width="*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="ToolTip" Value="{Binding NoToolTip, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}, Converter={StaticResource ReturnToolTip}}"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTemplateColumn Header="Asp-Info">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button x:Name="btnInfo" Click="BtnInfo_Click" Content="Info"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn MinWidth="0.1" MaxWidth="0.5" CanUserResize="False" CanUserSort="False" CanUserReorder="False"/>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
<TextBlock x:Name="gridSplitterArrows" Text="↔" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="-8,-10,0,0" FontSize="20" Foreground="Gray" RenderTransformOrigin="0.5,0.5" FontWeight="Bold" Visibility="Collapsed">
|
||||
<TextBlock.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
<SkewTransform/>
|
||||
<RotateTransform Angle="90"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="gridSplitterLine" Text="↔" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="8,-10,0,0" FontSize="20" Foreground="Gray" RenderTransformOrigin="0.5,0.5" FontWeight="Bold" Visibility="Collapsed">
|
||||
<TextBlock.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
<SkewTransform/>
|
||||
<RotateTransform Angle="90"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<GridSplitter x:Name="gridSplitter" Cursor="SizeNS" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="300,2,300,0" Height="3" Background="LightGray" Grid.IsSharedSizeScope="True" Visibility="Collapsed" DragDelta="gridSplitter_DragDelta"/> <!---->
|
||||
|
||||
<Grid x:Name="gridArrived" Margin="0,0,0,10" Grid.Row="3" VerticalAlignment="Stretch" Visibility="Collapsed" MinHeight="100">
|
||||
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Width="300" Margin="10,10,0,0"><Run Text="Ankunft bereits bestätigt: (letzte 10 Tage)"/></TextBlock>
|
||||
|
||||
<DataGrid x:Name="dgOverview" MinHeight="90" RowHeaderWidth="0" KeyboardNavigation.TabNavigation="None" ItemsSource="{Binding ., UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" CanUserDeleteRows="False" AutoGenerateColumns="False" Margin="10,31,10,0" CellEditEnding="dgOverview_CellEditEnding">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Kategorie" Binding="{Binding Kategorie, Converter={StaticResource IntToCategory}}" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="Zutritt" Binding="{Binding Zutritt, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" CanUserReorder="False" SortDirection="Descending" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="Prüfung Zutritt" Binding="{Binding Pruefung_Zutritt}" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Padding" Value="3"/>
|
||||
<Setter Property="Background" Value="{Binding Pruefung_Zutritt, Converter={StaticResource ConvertToBackground}}"/>
|
||||
<Setter Property="TextAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="Prüfung Einweisung" Binding="{Binding Pruefung_Einweisung}" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Padding" Value="3"/>
|
||||
<Setter Property="Background" Value="{Binding Pruefung_Einweisung, Converter={StaticResource ConvertToBackground}}"/>
|
||||
<Setter Property="TextAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="Anzahl Personen" Binding="{Binding AnzahlPers}" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn x:Name="anzFzg" Header="Anzahl Fzg" IsReadOnly="True">
|
||||
<DataGridTextColumn.Binding>
|
||||
<MultiBinding StringFormat="{}{0} / {1}">
|
||||
<Binding Path="AnzahlFzg" />
|
||||
<Binding Path="Fzg_gemeldet" />
|
||||
</MultiBinding>
|
||||
</DataGridTextColumn.Binding>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Padding" Value="4"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource MultiToBackground}">
|
||||
<Binding Path="AnzahlFzg"/>
|
||||
<Binding Path="Fzg_gemeldet"/>
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Kennzeichen" Binding="{Binding Kennzeichen}">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="ToolTip" Value="Doppelklicken um Kennzeichen nachträglich zu ändern"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Ansprechpartner / Tel. bei Lieferant" Binding="{Binding Ansprechpartner}" Width="*" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="4"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTemplateColumn Header="kl. Unterweisung">
|
||||
<DataGridTemplateColumn.CellStyle>
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTemplateColumn.CellStyle>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox x:Name="cBKleine_Unterweis" IsChecked="{Binding Kl_Unterweisung, Converter={StaticResource BoolToCheckBox}}" Click="CBKleine_Unterweis_Click"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Karte" MinWidth="40">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button x:Name="btnCard" Click="btnCard_Click" Content="Karte"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Asp-Info" MinWidth="40">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button x:Name="btnInfoArrived" Click="BtnInfoArrived_Click" Content="Info"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn MaxWidth="0.1" CanUserResize="False" CanUserSort="False" CanUserReorder="False"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="UserCreate" Visibility="Collapsed" Grid.RowSpan="3">
|
||||
<Button x:Name="btnUserCreate" Content="Besucher erstellen" Click="btnUserCreate_Click" Margin="0" Width="500" Height="50" FontSize="20" Background="#FF85F7A4" BorderBrush="#FFCDCDCD" Foreground="Blue" FontWeight="Bold">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type ButtonBase}">
|
||||
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="10" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFBEE6FD"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFC4E5F6"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFBCDDEE"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFF4F4F4"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
|
||||
<Setter Property="Foreground" Value="#FF838383"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
<Button x:Name="btnCreatePark" Content="Parkausweis beantragen" Click="btnCreateParkausweis_Click" Margin="100, 100, 100,350" Width="500" Height="50" FontSize="20" Background="#FF85F7A4" BorderBrush="#FFCDCDCD" Foreground="Blue" FontWeight="Bold">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type ButtonBase}">
|
||||
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="10" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFBEE6FD"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFC4E5F6"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFBCDDEE"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="border" Value="#FFF4F4F4"/>
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
|
||||
<Setter Property="Foreground" Value="#FF838383"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<Canvas x:Name="canvasHelp" Margin="0" Background="#DDE2E2E2" Visibility="Collapsed" Width="400" Height="364" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.RowSpan="3">
|
||||
<Border BorderBrush="Gray" BorderThickness="2" Width="400" Height="364"/>
|
||||
<TextBlock Canvas.Left="10" TextWrapping="Wrap" Canvas.Top="10" Height="81" Width="380" TextAlignment="Center"><Run FontWeight="Bold" Text="Hilfe" TextDecorations="Underline"/><LineBreak/><Run/><LineBreak/><Run/><LineBreak/><Run Text="Bei Problemen bitte an Marcus Bachler wenden."/><LineBreak/><Run/><LineBreak/><Run/></TextBlock>
|
||||
<TextBlock Canvas.Left="10" TextWrapping="Wrap" Text="marcus.bachler@deutschebahn.com" Canvas.Top="91" Width="380" TextDecorations="Underline" Foreground="#FF002AE6" TextAlignment="Center" Cursor="Hand" PreviewMouseLeftButtonUp="TextBlock_PreviewMouseLeftButtonUp"/>
|
||||
<TextBlock Canvas.Left="10" TextWrapping="Wrap" Canvas.Top="140" Height="150" Width="380" TextAlignment="Center"><Run Text="ZKuP"/><LineBreak/><Run x:Name="lblVersion" Text="Version 2.7.1"/><LineBreak/><Run/><LineBreak/><Run FontSize="12" FontFamily="Segoe UI"/><LineBreak/><Run FontSize="12" FontFamily="Segoe UI" Text="© Marcus Bachler"/></TextBlock>
|
||||
<Button x:Name="btnCloseHelp" Content="Schließen" Canvas.Left="10" Canvas.Top="325" Width="380" Height="29" Click="BtnCloseHelp_Click"/>
|
||||
<Button x:Name="btnDebug" Content="Schließen" Canvas.Left="10" Canvas.Top="300" Width="380" Height="29" Click="btnDebug_Click" Visibility="Collapsed"/>
|
||||
<TextBlock x:Name="lblResetLists" Text="Untere Liste(Ankunft heute) nicht mehr sichtbar?
 -> Listengröße zurücksetzen" Canvas.Left="10" Canvas.Top="263" Width="380" Height="40"/>
|
||||
<Button x:Name="btnResetLists" Content="Listengröße zurücksetzen" Canvas.Left="10" Canvas.Top="300" Width="380" Height="29" Click="btnResetLists_Click" Visibility="Visible"/>
|
||||
</Canvas>
|
||||
|
||||
<Canvas x:Name="canvasSettings" Margin="0" Background="#DDE2E2E2" Visibility="Collapsed" Width="400" Height="364" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.RowSpan="3">
|
||||
<Border BorderBrush="Gray" BorderThickness="2" Width="400" Height="364"/>
|
||||
<CheckBox x:Name="cbShowParkcardToAccept" Content="Meldung 'Es sind Parkkarten zu Genehmigen vorhanden' anzeigen?" Margin="10,20,0,0" Checked="cbShowParkcardToAccept_Checked" Unchecked="cbShowParkcardToAccept_Unchecked"/>
|
||||
<Button x:Name="btnCloseSettings" Content="Schließen" Canvas.Right="10" Canvas.Bottom="10" Width="100" Height="29" Click="btnCloseSettings_Click" HorizontalAlignment="Right"/>
|
||||
|
||||
</Canvas>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
944
ZKuP/MainWindow.xaml.cs
Normal file
@ -0,0 +1,944 @@
|
||||
using Renci.SshNet.Messages;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
public static Roles LoggedInRole { get; private set; }
|
||||
public string NoToolTip { get; } = "Doppelklick um Ankunft zu Bestätigen";
|
||||
|
||||
private List<Overview> overview = new List<Overview>();
|
||||
public List<Overview> Overviews
|
||||
{
|
||||
get { return overview; }
|
||||
set { overview = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
DataTable overv = new DataTable("Overview");
|
||||
DataTable todayFirm = new DataTable("TodayFirm");
|
||||
DataTable todayBesuch = new DataTable("TodayBesuch");
|
||||
|
||||
|
||||
DispatcherTimer reloadTimer = new DispatcherTimer();
|
||||
|
||||
|
||||
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
|
||||
|
||||
//this.WindowState = WindowState.Normal;
|
||||
|
||||
cbShowParkcardToAccept.IsChecked = Properties.Settings.Default.ShowParkcardAccept;
|
||||
|
||||
if ((Properties.Settings.Default.Width + Properties.Settings.Default.Left) >= System.Windows.SystemParameters.PrimaryScreenWidth) CenterWindowOnScreen(this);
|
||||
if ((Properties.Settings.Default.Height + Properties.Settings.Default.Top) >= System.Windows.SystemParameters.PrimaryScreenHeight) CenterWindowOnScreen(this);
|
||||
|
||||
if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat") || File.GetLastWriteTime(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat") != File.GetLastWriteTime(@"\\muenas001.wb4fv.db.de\GLW99\ZKuP\UpdateZKuP.bat"))
|
||||
{
|
||||
File.Copy(@"\\muenas001.wb4fv.db.de\GLW99\ZKuP\UpdateZKuP.bat", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat", true);
|
||||
}
|
||||
|
||||
CheckVersion();
|
||||
|
||||
AuthenticateUser();
|
||||
}
|
||||
|
||||
private async void AuthenticateUser()
|
||||
{
|
||||
if (!SQL.CheckDeviceConnection("10.20.98.34"))
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (AuthenticateDomain())
|
||||
{
|
||||
if (!Thread.CurrentPrincipal.Identity.IsAuthenticated)
|
||||
{
|
||||
MessageBox.Show($"Ihr User {Environment.UserName} ist nicht zum Zugriff berechtigt", "Zugriff verweigert");
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string auth = "";
|
||||
string role = "";
|
||||
|
||||
if (!SQL.TestConnection())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auth = await SQL.ReadSingleValueAsync($"SELECT EXISTS(SELECT * FROM zkup.users WHERE `Username` = '{Environment.UserName}')");
|
||||
|
||||
if (auth == "1")
|
||||
role = await SQL.ReadSingleValueAsync($"SELECT Role FROM zkup.users WHERE `Username` = '{Environment.UserName}'");
|
||||
else
|
||||
{
|
||||
//CheckVersion();
|
||||
|
||||
var res = MessageBox.Show($"Ihr User {Environment.UserName} ist nicht zum Zugriff berechtigt\n\nMöchten Sie einen Besucher erstellen oder eine Parkkarte beantragen?", "Zugriff verweigert", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
|
||||
if (res == MessageBoxResult.Yes)
|
||||
{
|
||||
BesucherCreateStart();
|
||||
return;
|
||||
}
|
||||
else if (res == MessageBoxResult.No)
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (role)
|
||||
{
|
||||
case "0":
|
||||
PfoertnerStart();
|
||||
break;
|
||||
case "1":
|
||||
EditorStart();
|
||||
break;
|
||||
case "2":
|
||||
AdminStart();
|
||||
break;
|
||||
default:
|
||||
PfoertnerStart();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
getToday();
|
||||
|
||||
|
||||
await SQL.WriteSQL("DELETE FROM zkup.zutritte WHERE Zutritt < current_date() - INTERVAL 30 DAY");
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zkup.zutritte where Zutritt >= now() + INTERVAL -10 DAY", overv);
|
||||
//Overviews = DataTableToOverview(overv);
|
||||
|
||||
dgOverview.DataContext = overv;
|
||||
|
||||
dgOverview.Items.SortDescriptions.Clear();
|
||||
dgOverview.Items.SortDescriptions.Add(new SortDescription("Zutritt", ListSortDirection.Descending));
|
||||
dgOverview.Items.Refresh();
|
||||
|
||||
|
||||
|
||||
reloadTimer.Interval = TimeSpan.FromMinutes(1);
|
||||
reloadTimer.Tick += ReloadTimer_Tick;
|
||||
reloadTimer.Start();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("User nicht in der Domäne aktiviert");
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private bool AuthenticateDomain()
|
||||
{
|
||||
using (var domainContext = new PrincipalContext(ContextType.Domain, Environment.UserDomainName))
|
||||
{
|
||||
using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, Environment.UserName))
|
||||
{
|
||||
if (foundUser.Enabled.HasValue)
|
||||
{
|
||||
return (bool)foundUser.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; //or false depending what result you want in the case of Enabled being NULL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void AdminStart()
|
||||
{
|
||||
LoggedInRole = Roles.Admin;
|
||||
|
||||
//CheckVersion();
|
||||
|
||||
|
||||
Main.Visibility = Visibility.Visible;
|
||||
gridToday.Visibility = Visibility.Visible;
|
||||
gridArrived.Visibility = Visibility.Visible;
|
||||
|
||||
lblSearch.Visibility = Visibility.Visible;
|
||||
tbSearch.Visibility = Visibility.Visible;
|
||||
|
||||
btnManageUsers.Visibility = Visibility.Visible;
|
||||
btnCreateVisitor.Visibility = Visibility.Visible;
|
||||
btnCreateFirma.Visibility = Visibility.Visible;
|
||||
btnManageAsp.Visibility = Visibility.Visible;
|
||||
btnKarten.Visibility = Visibility.Visible;
|
||||
btnSignatures.Visibility = Visibility.Visible;
|
||||
btnDelivery.Visibility = Visibility.Visible;
|
||||
btnNew.Visibility = Visibility.Visible;
|
||||
btnCreateDeliveries.Visibility = Visibility.Visible;
|
||||
|
||||
btnCheckParkausweis.Visibility = Visibility.Visible;
|
||||
btnCreateParkausweis.Visibility = Visibility.Visible;
|
||||
btnCreateSpecialParkausweis.Visibility = Visibility.Visible;
|
||||
btnGrantParkausweis.Visibility = Visibility.Visible;
|
||||
btnListParkausweis.Visibility = Visibility.Visible;
|
||||
btnPrintParkausweis.Visibility = Visibility.Visible;
|
||||
|
||||
btnSettings.Visibility = Visibility.Visible;
|
||||
btnArrivalsOverview.Visibility = Visibility.Visible;
|
||||
|
||||
gridSplitter.Visibility = Visibility.Visible;
|
||||
gridSplitterArrows.Visibility = Visibility.Visible;
|
||||
gridSplitterLine.Visibility = Visibility.Visible;
|
||||
//MessageBox.Show("Sie sind Admin");
|
||||
// something that only an admin user should be able to do
|
||||
}
|
||||
|
||||
private void EditorStart()
|
||||
{
|
||||
LoggedInRole = Roles.Editor;
|
||||
|
||||
//CheckVersion();
|
||||
|
||||
|
||||
Main.Visibility = Visibility.Visible;
|
||||
gridToday.Visibility = Visibility.Visible;
|
||||
gridArrived.Visibility = Visibility.Visible;
|
||||
|
||||
lblSearch.Visibility = Visibility.Visible;
|
||||
tbSearch.Visibility = Visibility.Visible;
|
||||
|
||||
btnCreateVisitor.Visibility = Visibility.Visible;
|
||||
btnCreateFirma.Visibility = Visibility.Visible;
|
||||
btnManageAsp.Visibility = Visibility.Visible;
|
||||
btnManageUsers.Visibility = Visibility.Collapsed;
|
||||
|
||||
btnCreateParkausweis.Visibility = Visibility.Visible;
|
||||
|
||||
btnSettings.Visibility = Visibility.Collapsed;
|
||||
btnArrivalsOverview.Visibility = Visibility.Visible;
|
||||
|
||||
gridSplitter.Visibility = Visibility.Visible;
|
||||
gridSplitterArrows.Visibility = Visibility.Visible;
|
||||
gridSplitterLine.Visibility = Visibility.Visible;
|
||||
//MessageBox.Show("Sie sind Editor");
|
||||
// something that only an editor user should be able to do
|
||||
}
|
||||
|
||||
private void PfoertnerStart()
|
||||
{
|
||||
LoggedInRole = Roles.Pförtner;
|
||||
|
||||
//CheckVersion();
|
||||
|
||||
|
||||
Main.Visibility = Visibility.Visible;
|
||||
gridToday.Visibility = Visibility.Visible;
|
||||
gridArrived.Visibility = Visibility.Visible;
|
||||
|
||||
lblSearch.Visibility = Visibility.Visible;
|
||||
tbSearch.Visibility = Visibility.Visible;
|
||||
|
||||
btnCreateVisitor.Visibility = Visibility.Visible;
|
||||
btnManageUsers.Visibility = Visibility.Collapsed;
|
||||
btnCreateFirma.Visibility = Visibility.Collapsed;
|
||||
btnManageAsp.Visibility = Visibility.Collapsed;
|
||||
btnKarten.Visibility = Visibility.Visible;
|
||||
btnNew.Visibility = Visibility.Visible;
|
||||
btnDelivery.Visibility = Visibility.Visible;
|
||||
btnCreateDeliveries.Visibility = Visibility.Visible;
|
||||
|
||||
btnCheckParkausweis.Visibility = Visibility.Visible;
|
||||
btnPrintParkausweis.Visibility = Visibility.Visible;
|
||||
|
||||
btnSettings.Visibility = Visibility.Collapsed;
|
||||
btnArrivalsOverview.Visibility = Visibility.Visible;
|
||||
|
||||
gridSplitter.Visibility = Visibility.Visible;
|
||||
gridSplitterArrows.Visibility = Visibility.Visible;
|
||||
gridSplitterLine.Visibility = Visibility.Visible;
|
||||
//MessageBox.Show("Sie sind Pförtner");
|
||||
// something that only an pförtner user should be able to do
|
||||
}
|
||||
|
||||
private void BesucherCreateStart()
|
||||
{
|
||||
LoggedInRole = Roles.None;
|
||||
|
||||
Main.Visibility = Visibility.Collapsed;
|
||||
|
||||
this.Width = 700;
|
||||
this.Height = 700;
|
||||
this.ResizeMode = ResizeMode.NoResize;
|
||||
|
||||
Main.Visibility = Visibility.Collapsed;
|
||||
gridToday.Visibility = Visibility.Collapsed;
|
||||
gridArrived.Visibility = Visibility.Collapsed;
|
||||
|
||||
UserCreate.Visibility = Visibility.Visible;
|
||||
btnResetLists.Visibility = Visibility.Collapsed;
|
||||
gridSplitter.Visibility = Visibility.Collapsed;
|
||||
gridSplitterArrows.Visibility = Visibility.Collapsed;
|
||||
gridSplitterLine.Visibility = Visibility.Collapsed;
|
||||
lblResetLists.Visibility = Visibility.Collapsed;
|
||||
btnResetLists.Visibility = Visibility.Collapsed;
|
||||
|
||||
btnSettings.Visibility = Visibility.Collapsed;
|
||||
btnArrivalsOverview.Visibility = Visibility.Collapsed;
|
||||
|
||||
gridSplitter.Visibility = Visibility.Collapsed;
|
||||
gridSplitterArrows.Visibility = Visibility.Collapsed;
|
||||
gridSplitterLine.Visibility = Visibility.Collapsed;
|
||||
//btnResetListsMain.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private async void ReloadTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
getToday();
|
||||
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zkup.zutritte where Zutritt >= now() + INTERVAL -10 DAY", overv);
|
||||
|
||||
dgOverview.Items.SortDescriptions.Clear();
|
||||
dgOverview.Items.SortDescriptions.Add(new SortDescription("Zutritt", ListSortDirection.Descending));
|
||||
dgOverview.Items.Refresh();
|
||||
}
|
||||
|
||||
|
||||
private async void getToday()
|
||||
{
|
||||
if (LoggedInRole == Roles.Admin || LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
todayFirm = await SQL.ReadSQL("Select * FROM zkup.firmen where Arbeitsbeginn <= current_date() AND Arbeitsende >= current_date()", todayFirm);
|
||||
todayBesuch = await SQL.ReadSQL("SELECT idbesucher, concat('Besucher: ', Name) AS Name, Verantwortlicher_MA AS Verantwortlicher_MA_Firma,Tel_Nr_Besucher AS Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Kleine_Unterweisung_bis,Oertlichkeit FROM zkup.besucher WHERE Besuchstag = current_date()", todayBesuch);
|
||||
}
|
||||
else
|
||||
{
|
||||
todayFirm = await SQL.ReadSQL($"Select * FROM zkup.firmen where (Arbeitsbeginn <= current_date() AND Arbeitsende >= current_date()) AND (Ersteller = '{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{Environment.UserDomainName}{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{SQL.ReadSingleValue($"SELECT Vertreter FROM zkup.ansprechpartner WHERE Name = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'")}' " +
|
||||
$"OR Ansprechpartner_Intern = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}')", todayFirm);
|
||||
todayBesuch = await SQL.ReadSQL($"SELECT idbesucher, concat('Besucher: ', Name) AS Name, Verantwortlicher_MA AS Verantwortlicher_MA_Firma,Tel_Nr_Besucher AS Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Kleine_Unterweisung_bis,Oertlichkeit FROM zkup.besucher WHERE Besuchstag = current_date() AND (Ersteller = '{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{Environment.UserDomainName}{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{SQL.ReadSingleValue($"SELECT Vertreter FROM zkup.ansprechpartner WHERE Name = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'")}' " +
|
||||
$"OR Ansprechpartner_Intern = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}')", todayBesuch);
|
||||
}
|
||||
|
||||
var firmview = todayFirm.DefaultView;
|
||||
firmview.Sort = "Name";
|
||||
todayFirm = firmview.ToTable();
|
||||
|
||||
var besuchview = todayBesuch.DefaultView;
|
||||
besuchview.Sort = "Name";
|
||||
todayBesuch = besuchview.ToTable();
|
||||
|
||||
todayFirm.Merge(todayBesuch);
|
||||
dgToday.DataContext = todayFirm;
|
||||
}
|
||||
|
||||
|
||||
private void BtnManageUsers_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ManageUsers mU = new ManageUsers();
|
||||
mU.Owner = this;
|
||||
mU.ShowDialog();
|
||||
}
|
||||
|
||||
private async void BtnCreateVisitor_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ManageVisitor mV = new ManageVisitor();
|
||||
mV.Owner = this;
|
||||
mV.ShowDialog();
|
||||
|
||||
getToday();
|
||||
}
|
||||
|
||||
private async void BtnCreateFirma_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CreateFirma cF = new CreateFirma();
|
||||
cF.Owner = this;
|
||||
cF.ShowDialog();
|
||||
|
||||
getToday();
|
||||
}
|
||||
|
||||
private void BtnManageAsp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ManageAsp mA = new ManageAsp();
|
||||
mA.Owner = this;
|
||||
mA.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private async void btnUserCreate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CreateVisitor cV = new CreateVisitor();
|
||||
cV.Owner = this;
|
||||
cV.ShowDialog();
|
||||
|
||||
getToday();
|
||||
}
|
||||
|
||||
|
||||
private void btnKarten_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Cards cards = new Cards();
|
||||
cards.Owner = this;
|
||||
cards.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void BtnNew_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (LoggedInRole == Roles.Admin || LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
if (dgToday.SelectedValue == null)
|
||||
{
|
||||
if (MessageBox.Show(this, "Möchten Sie wirklich eine Ankunft ohne vorherige Auswahl bestätigen?\n\nWenn die Firma/der Besucher in der Liste 'Ankunft heute' steht, bitte per Doppelklick auf die Zeile bestätigen", "Sicher?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
{
|
||||
Arrivals arrivals = new Arrivals(this);
|
||||
arrivals.Owner = this;
|
||||
arrivals.Show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Arrivals arrivals = new Arrivals(this, (dgToday.SelectedValue as DataRowView).Row.ItemArray[1].ToString().Replace("Besucher: ", ""));
|
||||
arrivals.Owner = this;
|
||||
arrivals.Show();
|
||||
}
|
||||
|
||||
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zkup.zutritte where Zutritt >= now() + INTERVAL -10 DAY", overv);
|
||||
|
||||
dgOverview.Items.SortDescriptions.Clear();
|
||||
dgOverview.Items.SortDescriptions.Add(new SortDescription("Zutritt", ListSortDirection.Descending));
|
||||
dgOverview.Items.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private async void btnDelivery_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Delivery delivery = new Delivery();
|
||||
delivery.Owner = this;
|
||||
delivery.ShowDialog();
|
||||
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zkup.zutritte where Zutritt >= now() + INTERVAL -10 DAY", overv);
|
||||
|
||||
dgOverview.Items.SortDescriptions.Clear();
|
||||
dgOverview.Items.SortDescriptions.Add(new SortDescription("Zutritt", ListSortDirection.Descending));
|
||||
dgOverview.Items.Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (dgOverview != null) todayFirm.DefaultView.RowFilter = $"Name like '%{(sender as TextBox).Text}%' OR Ansprechpartner_Intern like '%{(sender as TextBox).Text}%' OR Verantwortlicher_MA_Firma like '%{(sender as TextBox).Text}%'";
|
||||
}
|
||||
|
||||
private void TbSearch_PreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
lblSearch.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void CBKleine_Unterweis_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckBox box = (sender as CheckBox);
|
||||
string id = ((box.DataContext) as DataRowView).Row.ItemArray[0].ToString();
|
||||
|
||||
if (box.IsChecked == true)
|
||||
{
|
||||
if (((box.DataContext) as DataRowView).Row.ItemArray[1].ToString() == "1")
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE zkup.firmen SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
await SQL.WriteSQL($"UPDATE zkup.zutritte SET Kl_Unterweisung = 1 WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
}
|
||||
else if (((box.DataContext) as DataRowView).Row.ItemArray[1].ToString() == "2")
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE zkup.besucher SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
await SQL.WriteSQL($"UPDATE zkup.zutritte SET Kl_Unterweisung = 1 WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((box.DataContext) as DataRowView).Row.ItemArray[1].ToString() == "1")
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE zkup.firmen SET Kleine_Unterweisung_bis = '1901-01-01' WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
await SQL.WriteSQL($"UPDATE zkup.zutritte SET Kl_Unterweisung = 0 WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
}
|
||||
else if (((box.DataContext) as DataRowView).Row.ItemArray[1].ToString() == "2")
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE zkup.besucher SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
await SQL.WriteSQL($"UPDATE zkup.zutritte SET Kl_Unterweisung = 0 WHERE Name = '{((box.DataContext) as DataRowView).Row.ItemArray[2]}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void TbSearch_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
lblSearch.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private async void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (LoggedInRole == Roles.Admin || LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
if (dgToday.SelectedValue == null)
|
||||
{
|
||||
Arrivals arrivals = new Arrivals(this);
|
||||
arrivals.Owner = this;
|
||||
arrivals.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
Arrivals arrivals = new Arrivals(this, (dgToday.SelectedValue as DataRowView).Row.ItemArray[1].ToString().Replace("Besucher: ", ""));
|
||||
arrivals.Owner = this;
|
||||
arrivals.Show();
|
||||
}
|
||||
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zkup.zutritte where Zutritt >= now() + INTERVAL -10 DAY", overv);
|
||||
|
||||
dgOverview.Items.SortDescriptions.Clear();
|
||||
dgOverview.Items.SortDescriptions.Add(new SortDescription("Zutritt", ListSortDirection.Descending));
|
||||
dgOverview.Items.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnInfo_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dc = ((sender as Button).DataContext) as DataRowView;
|
||||
string id = "";
|
||||
string kat = "";
|
||||
|
||||
if ((dc).Row.ItemArray[7].ToString() != "")
|
||||
{
|
||||
id = (dc).Row.ItemArray[10].ToString();
|
||||
kat = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
id = (dc).Row.ItemArray[1].ToString().Replace("Besucher: ", "");
|
||||
kat = "2";
|
||||
}
|
||||
|
||||
AspInfo aI = new AspInfo(id, kat, 1);
|
||||
aI.Owner = this;
|
||||
aI.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnCard_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dc = ((sender as Button).DataContext) as DataRowView;
|
||||
|
||||
AddCardUser aI = new AddCardUser((dc).Row.ItemArray[2].ToString());
|
||||
aI.Owner = this;
|
||||
aI.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnArrivalsOverview_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ArrivalsOverview aOv = new ArrivalsOverview(LoggedInRole);
|
||||
aOv.Owner = this;
|
||||
aOv.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void BtnInfoArrived_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dc = ((sender as Button).DataContext) as DataRowView;
|
||||
string name = "";
|
||||
string kat = "";
|
||||
|
||||
if ((dc).Row.ItemArray[1].ToString() == "1")
|
||||
{
|
||||
name = (dc).Row.ItemArray[8].ToString();
|
||||
kat = "1";
|
||||
}
|
||||
else if ((dc).Row.ItemArray[1].ToString() == "2")
|
||||
{
|
||||
name = (dc).Row.ItemArray[2].ToString();
|
||||
kat = "2";
|
||||
}
|
||||
|
||||
AspInfo aI = new AspInfo(name, kat, 2, (dc).Row.ItemArray[0].ToString());
|
||||
aI.Owner = this;
|
||||
aI.ShowDialog();
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (Main.Visibility == Visibility.Visible)
|
||||
{
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
#if DEBUG
|
||||
if (e.Key == Key.LeftCtrl)
|
||||
BesucherCreateStart();
|
||||
|
||||
if(e.Key == Key.RightCtrl)
|
||||
Helper.SendMail("testTesttest");
|
||||
#endif
|
||||
}
|
||||
|
||||
private void TextBlock_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Helper.SendMail();
|
||||
}
|
||||
|
||||
|
||||
private void BtnHelp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
canvasHelp.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void BtnCloseHelp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
canvasHelp.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
private async void dgOverview_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
var header = e.Column.Header;
|
||||
var newValue = (e.EditingElement as TextBox).Text;
|
||||
var id = (e.Row.Item as DataRowView).Row.ItemArray[0];
|
||||
|
||||
|
||||
switch (header)
|
||||
{
|
||||
case "Kennzeichen":
|
||||
await SQL.WriteSQL($"UPDATE zutritte SET Kennzeichen = '{newValue}' WHERE idzutritte = '{id}'");
|
||||
break;
|
||||
}
|
||||
|
||||
dgOverview.RowValidationErrorTemplate = new ControlTemplate();
|
||||
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zkup.zutritte where Zutritt >= now() + INTERVAL -10 DAY", overv);
|
||||
|
||||
dgOverview.Items.SortDescriptions.Clear();
|
||||
dgOverview.Items.SortDescriptions.Add(new SortDescription("Zutritt", ListSortDirection.Descending));
|
||||
dgOverview.Items.Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void CheckVersion()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Convert.ToDouble(File.ReadAllText(@"\\muenas001.wb4fv.db.de\GLW99\ZKuP\Version.txt")) > Convert.ToDouble(lblVersion.Text.Split(' ')[1]))
|
||||
{
|
||||
if (MessageBox.Show(this, "Neue Version verfügbar!\n\n\n" +
|
||||
"Die Anwendung kann nur mit der neuen Version wieder gestartet werden\n" +
|
||||
"Die Anwendung wird auf dem Desktop abgelegt, bitte nur diese Datei starten\n" +
|
||||
"ZKuP wird nach dem Update automatisch neu gestartet\n\n" +
|
||||
"Neue Version herunterladen?", "Neue Version verfügbar!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
|
||||
{
|
||||
if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat") || File.GetLastWriteTime(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat") != File.GetLastWriteTime(@"\\muenas001.wb4fv.db.de\GLW99\ZKuP\UpdateZKuP.bat"))
|
||||
{
|
||||
File.Copy(@"\\muenas001.wb4fv.db.de\GLW99\ZKuP\UpdateZKuP.bat", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat", true);
|
||||
|
||||
System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat");
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdateZKuP.bat");
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else { Application.Current.Shutdown(); return; }
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
|
||||
if (MessageBox.Show(this, "Fehler beim Abfragen der Version\n\nDie Anwendung kann genutzt werden\nBitte in einigen Minuten die Anwendung beenden und erneut starten\n\nMöchten Sie sich die detaillierte Fehlermeldung anzeigen lassen?", "Fehler!", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes)
|
||||
MessageBox.Show(this, "Fehlermeldung:\n\n" + ex.Message, "Fehlermeldung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDebug_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckVersion();
|
||||
}
|
||||
|
||||
private void btnSignatures_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var iv = new ImageView(null, true);
|
||||
iv.Owner = this;
|
||||
iv.ShowDialog();
|
||||
}
|
||||
|
||||
private async void btnCreateDeliveries_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var deliver = new ManageDeliveries();
|
||||
deliver.Owner = this;
|
||||
deliver.ShowDialog();
|
||||
|
||||
overv = await SQL.ReadSQL("SELECT * FROM zkup.zutritte where Zutritt >= now() + INTERVAL -10 DAY", overv);
|
||||
|
||||
dgOverview.Items.SortDescriptions.Clear();
|
||||
dgOverview.Items.SortDescriptions.Add(new SortDescription("Zutritt", ListSortDirection.Descending));
|
||||
dgOverview.Items.Refresh();
|
||||
}
|
||||
|
||||
|
||||
private void btnResetLists_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
gridBackground.RowDefinitions[1].Height = new GridLength(this.Height / 2);
|
||||
gridBackground.RowDefinitions[3].Height = new GridLength(1, GridUnitType.Star);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void btnCreateParkausweis_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ParkausweisDisclaimer Pd = new ParkausweisDisclaimer();
|
||||
Pd.Owner = this;
|
||||
Pd.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnCreateSpecialParkausweis_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CreateParkausweis cPa = new CreateParkausweis(true);
|
||||
cPa.Owner = this;
|
||||
cPa.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnGrantParkausweis_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
GrantParkausweis gPa = new GrantParkausweis();
|
||||
gPa.Owner = this;
|
||||
gPa.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnListParkausweis_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ManageParkausweis mPa = new ManageParkausweis();
|
||||
mPa.Owner = this;
|
||||
mPa.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnCheckParkausweis_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckParkausweis checkPa = new CheckParkausweis();
|
||||
checkPa.Owner = this;
|
||||
checkPa.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnPrintParkausweis_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PrintParkausweis pPa = new PrintParkausweis();
|
||||
pPa.Owner = this;
|
||||
pPa.Show();
|
||||
}
|
||||
|
||||
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
double maxheight = this.ActualHeight - 120 - 191;
|
||||
double actualheight = this.ActualHeight - 120 - gridBackground.RowDefinitions[1].Height.Value;
|
||||
if (actualheight <= 191) gridBackground.RowDefinitions[1].Height = new GridLength(maxheight);
|
||||
}
|
||||
|
||||
public void CenterWindowOnScreen(Window window)
|
||||
{
|
||||
double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
|
||||
double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
|
||||
double windowWidth = window.Width;
|
||||
double windowHeight = window.Height;
|
||||
window.Left = (screenWidth / 2) - (windowWidth / 2);
|
||||
window.Top = (screenHeight / 2) - (windowHeight / 2);
|
||||
}
|
||||
|
||||
private async void Window_ContentRendered(object sender, EventArgs e)
|
||||
{
|
||||
if (LoggedInRole == Roles.Admin && Properties.Settings.Default.ShowParkcardAccept)
|
||||
{
|
||||
if (await SQL.RowExists("parkausweise", "Genehmigt", "0") == true)
|
||||
{
|
||||
if (MessageBox.Show(this, "Es liegen zu genehmigende Parkkartenanträge vor!\n\nMöchten Sie diese jetzt überprüfen?", "Neue Anträge", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
GrantParkausweis gPa = new GrantParkausweis();
|
||||
gPa.Owner = this;
|
||||
gPa.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
if (await SQL.RowExists("parkausweise", "Genehmigt = '1' AND Gedruckt", "0") == true)
|
||||
{
|
||||
if (MessageBox.Show(this, "Es liegen zu druckende Parkkarten vor!\n\nMöchten Sie diese jetzt überprüfen?", "Neue Parkkarten", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes)
|
||||
{
|
||||
PrintParkausweis pPa = new PrintParkausweis();
|
||||
pPa.Owner = this;
|
||||
pPa.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
canvasSettings.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void cbShowParkcardToAccept_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Properties.Settings.Default.ShowParkcardAccept = true;
|
||||
}
|
||||
|
||||
private void cbShowParkcardToAccept_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Properties.Settings.Default.ShowParkcardAccept = false;
|
||||
}
|
||||
|
||||
private void btnCloseSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
canvasSettings.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void gridSplitter_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
|
||||
{
|
||||
double maxheight = this.ActualHeight - 120 - 191;
|
||||
double actualheight = this.ActualHeight - 120 - gridBackground.RowDefinitions[1].Height.Value;
|
||||
if (actualheight <= 191) gridBackground.RowDefinitions[1].Height = new GridLength(maxheight);
|
||||
}
|
||||
|
||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
double maxheight = this.ActualHeight - 120 - 195;
|
||||
double actualheight = this.ActualHeight - 120 - gridBackground.RowDefinitions[1].Height.Value;
|
||||
if (actualheight <= 195)
|
||||
{
|
||||
gridBackground.RowDefinitions[1].Height = new GridLength(maxheight);
|
||||
return;
|
||||
}
|
||||
|
||||
//if(e.NewSize.Height > e.PreviousSize.Height)
|
||||
gridBackground.RowDefinitions[1].Height = new GridLength(gridBackground.RowDefinitions[1].Height.Value + (e.NewSize.Height - e.PreviousSize.Height));
|
||||
//else
|
||||
// gridBackground.RowDefinitions[1].Height = new GridLength(gridBackground.RowDefinitions[1].Height.Value + (e.PreviousSize.Height - e.NewSize.Height));
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("WindowSize: " + this.Width );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ReturnToolTip : System.Windows.Data.IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if(MainWindow.LoggedInRole == Roles.Admin || MainWindow.LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
return "Doppelklick um Ankunft zu Bestätigen";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Von Ihnen eingegebene Firmen/Besucher, die für heute angemeldet sind";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Overview
|
||||
{
|
||||
public string Kategorie;
|
||||
public string Name;
|
||||
public string Zutritt;
|
||||
public string Pruefung_Zutritt;
|
||||
public string Pruefung_Einweisung;
|
||||
public int Kl_Unterweisung;
|
||||
public string Kennzeichen;
|
||||
public string Bemerkung;
|
||||
}
|
||||
|
||||
public enum Roles
|
||||
{
|
||||
Pförtner,
|
||||
Editor,
|
||||
Admin,
|
||||
None
|
||||
}
|
||||
}
|
||||
36
ZKuP/ManageAsp.xaml
Normal file
@ -0,0 +1,36 @@
|
||||
<Window x:Class="ZKuP.ManageAsp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Ansprechpartner verwalten" Height="457" Width="1079"
|
||||
WindowStartupLocation="CenterOwner" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<DataGrid x:Name="dgAsp" Margin="305,10,7,52" ItemsSource="{Binding Path=., Mode=OneWay}" CanUserAddRows="False" AutoGenerateColumns="False" CanUserReorderColumns="False" PreviewKeyDown="DgAsp_PreviewKeyDown" CellEditEnding="DgAsp_CellEditEnding" BeginningEdit="DgAsp_BeginningEdit">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" ClipboardContentBinding="{x:Null}" Header="Ansprechpartner" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Vertreter}" ClipboardContentBinding="{x:Null}" Header="Asp-Vertreter" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Vorgesetzter}" ClipboardContentBinding="{x:Null}" Header="Asp-Vorgesetzter" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Nr}" ClipboardContentBinding="{x:Null}" Header="Asp-Tel" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Vertreter}" ClipboardContentBinding="{x:Null}" Header="Vertreter-Tel" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Vorgesetzter}" ClipboardContentBinding="{x:Null}" Header="Vorgesetzter-Tel" Width="*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBox x:Name="tbAsp" HorizontalAlignment="Left" Height="25" Margin="10,50,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="215" Padding="0,2,0,0" TabIndex="1"/>
|
||||
<TextBox x:Name="tbAspVertreter" HorizontalAlignment="Left" Height="25" Margin="10,105,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="215" Padding="0,2,0,0" TabIndex="2"/>
|
||||
<TextBox x:Name="tbAspVorgesetzter" HorizontalAlignment="Left" Height="25" Margin="10,165,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="215" Padding="0,2,0,0" TabIndex="3"/>
|
||||
<Button x:Name="btnCreateAsp" Margin="230,10,0,52" Content="Hinzufügen
 →" Click="BtnCreateAsp_Click" HorizontalAlignment="Left" Width="70" TabIndex="7"/>
|
||||
<TextBox x:Name="tbAspTel" HorizontalAlignment="Left" Height="23" Margin="10,227,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="215" TabIndex="4"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,29,0,0" TextWrapping="Wrap" Text="Ansprechpartner:" VerticalAlignment="Top" Width="110"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,84,0,0" TextWrapping="Wrap" Text="Ansprechpartner-Vertreter:" VerticalAlignment="Top" Width="155"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,144,0,0" TextWrapping="Wrap" Text="Ansprechpartner-Vorgesetzter:" VerticalAlignment="Top" Width="175"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,206,0,0" TextWrapping="Wrap" Text="Ansprechpartner-TelNr:" VerticalAlignment="Top" Width="155"/>
|
||||
<TextBox x:Name="tbVertreterTel" HorizontalAlignment="Left" Height="25" Margin="10,289,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="215" Padding="0,2,0,0" TabIndex="5"/>
|
||||
<TextBox x:Name="tbVorgesetzterTel" HorizontalAlignment="Left" Height="23" Margin="10,351,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="215" TabIndex="6"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,268,0,0" TextWrapping="Wrap" Text="Vertreter-TelNr:" VerticalAlignment="Top" Width="175"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,330,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="155"><Run Text="Vorgesetzter"/><Run Text="-TelNr:"/></TextBlock>
|
||||
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,10,10" TabIndex="8" Width="98" Height="28" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="BtnClose_Click"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
178
ZKuP/ManageAsp.xaml.cs
Normal file
@ -0,0 +1,178 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ManageAsp.xaml
|
||||
/// </summary>
|
||||
public partial class ManageAsp : Window
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private List<Asp> myVar;
|
||||
public List<Asp> aspView
|
||||
{
|
||||
get { return myVar; }
|
||||
set { myVar = value; }
|
||||
}
|
||||
|
||||
DataTable asp = new DataTable("Asp");
|
||||
|
||||
public ManageAsp()
|
||||
{
|
||||
this.DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
asp = SQL.ReadSQL("SELECT * FROM zkup.ansprechpartner", asp).Result;
|
||||
aspView = Asp.DataTableToAsp(asp);
|
||||
dgAsp.DataContext = asp;
|
||||
}
|
||||
|
||||
private async void BtnCreateAsp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tbAsp.Text))
|
||||
MessageBox.Show(this, "Ansprechpartner muss ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else if (string.IsNullOrWhiteSpace(tbAspVertreter.Text))
|
||||
MessageBox.Show(this, "Vertreter muss ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else if (string.IsNullOrWhiteSpace(tbAspVorgesetzter.Text))
|
||||
MessageBox.Show(this, "Vorgesetzter muss ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else if (string.IsNullOrWhiteSpace(tbAspTel.Text))
|
||||
MessageBox.Show(this, "Ansprechpartner-Telefonnummer muss ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else if (string.IsNullOrWhiteSpace(tbVertreterTel.Text))
|
||||
MessageBox.Show(this, "Vertreter-Telefonnummer muss ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else if (string.IsNullOrWhiteSpace(tbVorgesetzterTel.Text))
|
||||
MessageBox.Show(this, "Vorgesetzter-Telefonnummer muss ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
{
|
||||
await SQL.WriteSQL("INSERT INTO ansprechpartner (Name,Vertreter,Tel_Nr,Vorgesetzter,Tel_Vertreter,Tel_Vorgesetzter) VALUES " +
|
||||
$"('{tbAsp.Text}','{tbAspVertreter.Text}','{tbAspTel.Text}','{tbAspVorgesetzter.Text}','{tbVertreterTel.Text}','{tbVorgesetzterTel.Text}')");
|
||||
|
||||
tbAsp.Text = "";
|
||||
tbAspTel.Text = "";
|
||||
tbAspVertreter.Text = "";
|
||||
tbAspVorgesetzter.Text = "";
|
||||
tbVertreterTel.Text = "";
|
||||
tbVorgesetzterTel.Text = "";
|
||||
|
||||
asp = SQL.ReadSQL("SELECT * FROM zkup.ansprechpartner", asp).Result;
|
||||
aspView = Asp.DataTableToAsp(asp);
|
||||
}
|
||||
}
|
||||
private async void DgAsp_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var dg = sender as DataGrid;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (e.Key == Key.Delete)
|
||||
{
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.ansprechpartner WHERE `Name` = '{arr[0]}'");
|
||||
|
||||
asp = SQL.ReadSQL("Select * from zkup.ansprechpartner", asp).Result;
|
||||
aspView = Asp.DataTableToAsp(asp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DgAsp_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
dgAsp.PreviewKeyDown -= DgAsp_PreviewKeyDown;
|
||||
}
|
||||
private async void DgAsp_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
var header = e.Column.Header;
|
||||
var newValue = (e.EditingElement as TextBox).Text;
|
||||
var name = (e.Row.Item as DataRowView).Row.ItemArray[0];
|
||||
|
||||
|
||||
switch (header)
|
||||
{
|
||||
case "Ansprechpartner":
|
||||
await SQL.WriteSQL($"UPDATE ansprechpartner SET Name = '{newValue}' WHERE Name = '{name}'");
|
||||
break;
|
||||
case "Asp-Vertreter":
|
||||
await SQL.WriteSQL($"UPDATE ansprechpartner SET Vertreter = '{newValue}' WHERE Name = '{name}'");
|
||||
break;
|
||||
case "Asp-Tel":
|
||||
await SQL.WriteSQL($"UPDATE ansprechpartner SET Tel_Nr = '{newValue}' WHERE Name = '{name}'");
|
||||
break;
|
||||
case "Asp-Vorgesetzter":
|
||||
await SQL.WriteSQL($"UPDATE ansprechpartner SET Vorgesetzter = '{newValue}' WHERE Name = '{name}'");
|
||||
break;
|
||||
case "Vertreter-Tel":
|
||||
await SQL.WriteSQL($"UPDATE ansprechpartner SET Tel_Vertreter = '{newValue}' WHERE Name = '{name}'");
|
||||
break;
|
||||
case "Vorgesetzter-Tel":
|
||||
await SQL.WriteSQL($"UPDATE ansprechpartner SET Tel_Vorgesetzter = '{newValue}' WHERE Name = '{name}'");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
dgAsp.RowValidationErrorTemplate = new ControlTemplate();
|
||||
dgAsp.PreviewKeyDown += DgAsp_PreviewKeyDown;
|
||||
|
||||
asp = SQL.ReadSQL("Select * from zkup.ansprechpartner", asp).Result;
|
||||
aspView = Asp.DataTableToAsp(asp);
|
||||
}
|
||||
|
||||
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class Asp
|
||||
{
|
||||
string Name;
|
||||
string Vertreter;
|
||||
string Tel_Nr;
|
||||
string Vorgesetzter;
|
||||
string Tel_Vertreter;
|
||||
string Tel_Vorgesetzter;
|
||||
|
||||
|
||||
public static List<Asp> DataTableToAsp(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Asp> x = new List<Asp>();
|
||||
|
||||
foreach (DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Asp()
|
||||
{
|
||||
Name = dr[0].ToString(),
|
||||
Vertreter = dr[1].ToString(),
|
||||
Tel_Nr = dr[2].ToString(),
|
||||
Vorgesetzter = dr[3].ToString(),
|
||||
Tel_Vertreter = dr[4].ToString(),
|
||||
Tel_Vorgesetzter = dr[5].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
ZKuP/ManageDeliveries.xaml
Normal file
@ -0,0 +1,24 @@
|
||||
<Window x:Class="ZKuP.ManageDeliveries"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Lieferanten verwalten" Height="352" Width="800">
|
||||
<Grid>
|
||||
<DataGrid x:Name="dgLieferanten" Margin="300,40,10,50" ItemsSource="{Binding Path=., Mode=OneWay, UpdateSourceTrigger=LostFocus}" CellEditEnding="dgLieferanten_CellEditEnding" SelectionChanged="dgLieferanten_SelectionChanged" BeginningEdit="dgLieferanten_BeginningEdit" PreviewKeyDown="DgLieferanten_PreviewKeyDown" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" CanUserAddRows="False" ColumnWidth="*"/>
|
||||
<Button x:Name="btnAdd" Content="Hinzufügen
 →" HorizontalAlignment="Left" Margin="220,40,0,50" Width="75" Click="btnAdd_Click"/>
|
||||
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="98" Height="28" Click="BtnClose_Click"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,40,0,0" TextWrapping="Wrap" Text="Lieferfirma:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbFirma" HorizontalAlignment="Left" Height="23" Margin="10,61,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="205" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,89,0,0" TextWrapping="Wrap" Text="Fahrer:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbFahrer" HorizontalAlignment="Left" Height="23" Margin="10,110,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="205" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,138,0,0" TextWrapping="Wrap" Text="Handynummer:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbHandynr" HorizontalAlignment="Left" Height="23" Margin="10,159,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="205" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,187,0,0" TextWrapping="Wrap" Text="Kennzeichen:" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbKennzeichen" HorizontalAlignment="Left" Height="23" Margin="10,208,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="205" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<Button x:Name="btnDeleteDeliver" Content="Markierten Lieferanten löschen" Margin="0,15,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="182" Click="btnDeleteDeliver_Click"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
211
ZKuP/ManageDeliveries.xaml.cs
Normal file
@ -0,0 +1,211 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ManageDeliveries.xaml
|
||||
/// </summary>
|
||||
public partial class ManageDeliveries : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private List<Deliver> myVar;
|
||||
public List<Deliver> DeliveriesView
|
||||
{
|
||||
get { return myVar; }
|
||||
set { myVar = value; OnPropertyChanged(); }
|
||||
}
|
||||
System.Data.DataTable lieferanten = new System.Data.DataTable("lieferanten");
|
||||
|
||||
public ManageDeliveries()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
lieferanten = SQL.ReadSQL("Select * from zkup.lieferanten", lieferanten).Result;
|
||||
DeliveriesView = Deliver.DataTableToDeliver(lieferanten);
|
||||
dgLieferanten.DataContext = lieferanten;
|
||||
|
||||
dgLieferanten.Items.SortDescriptions.Clear();
|
||||
dgLieferanten.Items.SortDescriptions.Add(new SortDescription("Firma", ListSortDirection.Ascending));
|
||||
dgLieferanten.Items.Refresh();
|
||||
}
|
||||
|
||||
private async void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (tbFirma.Text == "")
|
||||
{
|
||||
MessageBox.Show(this, "Lieferfirma muss eingetragen werden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
await SQL.WriteSQL($"INSERT INTO lieferanten (Firma, Fahrer, Handynr, Kennzeichen) VALUES ('{tbFirma.Text}','{tbFahrer.Text}','{tbHandynr.Text}','{tbKennzeichen.Text}')");
|
||||
|
||||
lieferanten = SQL.ReadSQL("Select * from zkup.lieferanten", lieferanten).Result;
|
||||
DeliveriesView = Deliver.DataTableToDeliver(lieferanten);
|
||||
dgLieferanten.ScrollIntoView(dgLieferanten.Items[dgLieferanten.Items.Count - 1]); //scroll to last
|
||||
dgLieferanten.UpdateLayout();
|
||||
ResetInput();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ResetInput()
|
||||
{
|
||||
tbFirma.Text = "";
|
||||
tbFahrer.Text = "";
|
||||
tbHandynr.Text = "";
|
||||
tbKennzeichen.Text = "";
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
private async void dgLieferanten_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
var header = e.Column.Header;
|
||||
var newValue = (e.EditingElement as TextBox).Text;
|
||||
var id = (e.Row.Item as System.Data.DataRowView).Row.ItemArray[0];
|
||||
|
||||
string searchFahrer = "";
|
||||
|
||||
if ((e.Row.Item as System.Data.DataRowView).Row.ItemArray[1].ToString() != "")
|
||||
searchFahrer = $" AND Fahrer = '{(e.Row.Item as System.Data.DataRowView).Row.ItemArray[1].ToString()}'";
|
||||
|
||||
switch (header)
|
||||
{
|
||||
case "Firma":
|
||||
await SQL.WriteSQL($"UPDATE lieferanten SET Firma = '{newValue}' WHERE Fahrer = '{id}'" + searchFahrer);
|
||||
break;
|
||||
case "Fahrer":
|
||||
await SQL.WriteSQL($"UPDATE lieferanten SET Fahrer = '{newValue}' WHERE Firma = '{id}'" + searchFahrer);
|
||||
break;
|
||||
case "Handynr":
|
||||
await SQL.WriteSQL($"UPDATE lieferanten SET Handynr = '{newValue}' WHERE Firma = '{id}'" + searchFahrer);
|
||||
break;
|
||||
case "Kennzeichen":
|
||||
await SQL.WriteSQL($"UPDATE lieferanten SET Kennzeichen = '{newValue}' WHERE Firma = '{id}'" + searchFahrer);
|
||||
break;
|
||||
}
|
||||
|
||||
dgLieferanten.PreviewKeyDown += DgLieferanten_PreviewKeyDown;
|
||||
|
||||
lieferanten = await SQL.ReadSQL("Select * from zkup.lieferanten", lieferanten);
|
||||
DeliveriesView = Deliver.DataTableToDeliver(lieferanten);
|
||||
}
|
||||
|
||||
|
||||
private async void DgLieferanten_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)
|
||||
{
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.lieferanten WHERE `Firma` = '{arr[0]}' AND `Fahrer` = '{arr[1]}'");
|
||||
|
||||
lieferanten = SQL.ReadSQL("Select * from zkup.lieferanten", lieferanten).Result;
|
||||
DeliveriesView = Deliver.DataTableToDeliver(lieferanten);
|
||||
}
|
||||
}
|
||||
|
||||
private void dgLieferanten_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
dgLieferanten.PreviewKeyDown -= DgLieferanten_PreviewKeyDown;
|
||||
}
|
||||
|
||||
|
||||
private async void btnDeleteDeliver_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dg = dgLieferanten;
|
||||
var row = dg.SelectedItem as System.Data.DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (MessageBox.Show(this, $"Markierten Lieferanten wirklich entfernen?", "Lieferanten entfernen?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.lieferanten WHERE `Firma` = '{arr[0]}' AND `Fahrer` = '{arr[1]}'");
|
||||
|
||||
lieferanten = SQL.ReadSQL("Select * from zkup.lieferanten", lieferanten).Result;
|
||||
DeliveriesView = Deliver.DataTableToDeliver(lieferanten);
|
||||
}
|
||||
}
|
||||
|
||||
private void dgLieferanten_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dgLieferanten.SelectedIndex != -1) btnDeleteDeliver.IsEnabled = true;
|
||||
else btnDeleteDeliver.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void TextBoxes_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class Deliver
|
||||
{
|
||||
public string Firma;
|
||||
string Fahrer;
|
||||
string Handynr;
|
||||
string Kennzeichen;
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<Deliver> DataTableToDeliver(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Deliver> x = new List<Deliver>();
|
||||
|
||||
foreach (System.Data.DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Deliver()
|
||||
{
|
||||
Firma = dr[0].ToString(),
|
||||
Fahrer = dr[1].ToString(),
|
||||
Handynr = dr[2].ToString(),
|
||||
Kennzeichen = dr[3].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
44
ZKuP/ManageParkausweis.xaml
Normal file
@ -0,0 +1,44 @@
|
||||
<Window x:Class="ZKuP.ManageParkausweis"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Parkausweise verwalten" Height="450" Width="1300">
|
||||
<Grid>
|
||||
<DataGrid x:Name="dgManage" PreviewKeyDown="DgManage_PreviewKeyDown" ItemsSource="{Binding .}" RowHeaderWidth="0" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserAddRows="False" CanUserReorderColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding idparkausweise}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="ID" IsReadOnly="True" Width="40"/>
|
||||
<DataGridTextColumn Binding="{Binding MA_Vorname}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Vorname" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding MA_Name}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Nachname" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Abteilung}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Abteilung" IsReadOnly="True" Width="80"/>
|
||||
<DataGridTextColumn Binding="{Binding Firma}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Firma" IsReadOnly="True" Width="90"/>
|
||||
<DataGridTextColumn Binding="{Binding Adresse}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Adresse" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding PLZ}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Postleitzahl" IsReadOnly="True" Width="70">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Kennzeichen}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Kennzeichen" IsReadOnly="True" Width="80">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Email}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="E-Mail" IsReadOnly="True" Width="220"/>
|
||||
<DataGridTextColumn Binding="{Binding Telefon}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Telefon" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Vorgesetzter}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Vorgesetzter" IsReadOnly="True" Width="110"/>
|
||||
<DataGridCheckBoxColumn Binding="{Binding AcceptedCorrectness}" ClipboardContentBinding="{x:Null}" Header="Bestätigung" IsReadOnly="True"/>
|
||||
<DataGridCheckBoxColumn Binding="{Binding Genehmigt}" ClipboardContentBinding="{x:Null}" Header="Genehmigt" IsReadOnly="True"/>
|
||||
<DataGridCheckBoxColumn Binding="{Binding Gedruckt}" ClipboardContentBinding="{x:Null}" Header="Gedruckt" IsReadOnly="True"/>
|
||||
<DataGridCheckBoxColumn Binding="{Binding Schicht}" ClipboardContentBinding="{x:Null}" Header="Schicht" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding Bemerkung}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Bemerkung" IsReadOnly="True" Width="110"/>
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
46
ZKuP/ManageParkausweis.xaml.cs
Normal file
@ -0,0 +1,46 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ManageParkausweis.xaml
|
||||
/// </summary>
|
||||
public partial class ManageParkausweis : Window
|
||||
{
|
||||
public ManageParkausweis()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT * FROM zkup.parkausweise").Result;
|
||||
dgManage.DataContext = list;
|
||||
}
|
||||
|
||||
|
||||
private async void DgManage_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)
|
||||
{
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.parkausweise WHERE `idparkausweise` = '{arr[0]}'");
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT * FROM zkup.parkausweise").Result;
|
||||
dgManage.DataContext = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
ZKuP/ManageUsers.xaml
Normal file
@ -0,0 +1,27 @@
|
||||
<Window x:Class="ZKuP.ManageUsers"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Manage Users" Height="657" Width="409">
|
||||
<Grid>
|
||||
<Button x:Name="btnAddUser" Content="Add" Margin="10,130,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" Click="BtnAddUser_Click"/>
|
||||
<Button x:Name="btnClose" Content="Close" Margin="0,0,10,10" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" Click="BtnClose_Click"/>
|
||||
<TextBox x:Name="tbUsername" HorizontalAlignment="Left" Height="23" Margin="10,30,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||
<ComboBox x:Name="cbRole" HorizontalAlignment="Left" Margin="10,78,0,0" VerticalAlignment="Top" Width="120">
|
||||
<ComboBoxItem Content="Pförtner"/>
|
||||
<ComboBoxItem Content="Editor"/>
|
||||
<ComboBoxItem Content="Admin"/>
|
||||
</ComboBox>
|
||||
<DataGrid x:Name="dgUsers" Margin="150,10,10,46" ItemsSource="{Binding Path=., Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" AutoGenerateColumns="False" PreviewKeyDown="DgUsers_PreviewKeyDown">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Username, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Username" Width="*" SortDirection="Ascending"/>
|
||||
<DataGridTextColumn Binding="{Binding Role, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Role"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,9,0,0" TextWrapping="Wrap" Text="Username" VerticalAlignment="Top"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,57,0,0" TextWrapping="Wrap" Text="Role" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
142
ZKuP/ManageUsers.xaml.cs
Normal file
@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ManageUsers.xaml
|
||||
/// </summary>
|
||||
public partial class ManageUsers : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
private List<Users> myVar;
|
||||
public List<Users> UserView
|
||||
{
|
||||
get { return myVar; }
|
||||
set { myVar = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
DataTable userList = new DataTable("userList");
|
||||
|
||||
public ManageUsers()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
userList = SQL.ReadSQL("Select * from zkup.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)
|
||||
{
|
||||
if(tbUsername.Text == "")
|
||||
{
|
||||
MessageBox.Show("Username eintragen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
|
||||
if(cbRole.SelectedIndex == -1)
|
||||
{
|
||||
MessageBox.Show("Role auswählen!", "Fehler");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SQL.WriteSQL($"Insert into zkup.users (Username,Role) VALUES ('{tbUsername.Text}','{cbRole.SelectedIndex}')");
|
||||
|
||||
userList = SQL.ReadSQL("Select * from zkup.users", userList).Result;
|
||||
userList.DefaultView.Sort = "Username";
|
||||
userList = userList.DefaultView.ToTable();
|
||||
UserView = Users.DataTableToUserList(userList);
|
||||
dgUsers.DataContext = userList;
|
||||
|
||||
dgUsers.ScrollIntoView(UserView.Last());
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void DgUsers_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var dg = sender as DataGrid;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (e.Key == Key.Delete)
|
||||
{
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.users WHERE `Username` = '{arr[1]}'");
|
||||
|
||||
userList = SQL.ReadSQL("Select * from zkup.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);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Users
|
||||
{
|
||||
string Username;
|
||||
string Role;
|
||||
|
||||
|
||||
public static List<Users> DataTableToUserList(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Users> x = new List<Users>();
|
||||
|
||||
foreach (DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Users()
|
||||
{
|
||||
Username = dr[1].ToString(),
|
||||
Role = dr[2].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
86
ZKuP/ManageVisitor.xaml
Normal file
@ -0,0 +1,86 @@
|
||||
<Window x:Class="ZKuP.ManageVisitor"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Besucher verwalten" Height="611" Width="1378" ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Grid>
|
||||
<TextBox x:Name="tbName" HorizontalAlignment="Left" Height="23" Margin="10,57,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="1" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" Text="Name" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbVerantwortlicher_MA" HorizontalAlignment="Left" Height="23" Margin="10,106,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,85,0,0" TextWrapping="Wrap" Text="Verantwortlicher Mitarbeiter" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbTel_Besucher" HorizontalAlignment="Left" Height="23" Margin="10,155,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="3" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,134,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Telefonnummer "/><Run Text="Besucher"/></TextBlock>
|
||||
<TextBox x:Name="tbAnzahl_Begleiter" HorizontalAlignment="Left" Height="23" Margin="10,204,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="4" PreviewKeyDown="TbAnzahl_Begleiter_PreviewKeyDown" PreviewTextInput="tbAnzahl_Begleiter_PreviewTextInput" ToolTip="Nur Zahlen und max. 2 Stellen" CommandManager.PreviewExecuted="Textboxes_PreviewExecuted" ContextMenu="{x:Null}"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,183,0,0" TextWrapping="Wrap" Text="Anzahl Begleitpersonen" VerticalAlignment="Top"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,232,0,0" TextWrapping="Wrap" Text="Besuchstag" VerticalAlignment="Top"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,281,0,0" TextWrapping="Wrap" Text="Grund des Besuchs" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbAnsprechp_Intern" HorizontalAlignment="Left" Height="23" Margin="10,445,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="8" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,424,0,0" TextWrapping="Wrap" Text="Ansprechpartner intern" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbTel_Ansprechp" HorizontalAlignment="Left" Height="23" Margin="10,494,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="9" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,473,0,0" TextWrapping="Wrap" Text="Telefonnummer Ansprechpartner" VerticalAlignment="Top"/>
|
||||
<DatePicker x:Name="dpBesuchstag" HorizontalAlignment="Left" Margin="10,253,0,0" VerticalAlignment="Top" TabIndex="5" PreviewKeyDown="DpBesuchstag_PreviewKeyDown"/>
|
||||
<Button x:Name="btnAdd" Content="Hinzufügen
 →" HorizontalAlignment="Left" Margin="355,36,0,55" Width="75" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Click="BtnAdd_Click" TabIndex="10" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<DataGrid x:Name="dgVisitors" ItemsSource="{Binding Path=., Mode=OneWay}" KeyboardNavigation.TabNavigation="None" Margin="435,36,10,55" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="True" HorizontalScrollBarVisibility="Visible" PreviewKeyDown="DgVisitors_PreviewKeyDown" CellEditEnding="DgVisitors_CellEditEnding" BeginningEdit="DgVisitors_BeginningEdit" SelectionChanged="dgVisitors_SelectionChanged" PreparingCellForEdit="dgVisitors_PreparingCellForEdit" ToolTip="Daten können per Doppelklick geändert werden">
|
||||
<DataGrid.CellStyle>
|
||||
<!--Override Highlighting so that its easy to see what is selected even when the control is not focused-->
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
</Trigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="True" />
|
||||
<Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=IsKeyboardFocusWithin}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.Setters>
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||
</MultiDataTrigger.Setters>
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" ClipboardContentBinding="{x:Null}" Header="Name" Width="*" MinWidth="150" SortDirection="Ascending"/>
|
||||
<DataGridTextColumn Binding="{Binding Verantwortlicher_MA}" ClipboardContentBinding="{x:Null}" Header="Verantw. MA" MinWidth="150"/>
|
||||
<DataGridTextColumn Binding="{Binding Tel_Nr_Besucher}" ClipboardContentBinding="{x:Null}" Header="Tel. Besucher" MinWidth="150"/>
|
||||
<DataGridTextColumn Binding="{Binding Anzahl_Begleitpersonen}" ClipboardContentBinding="{x:Null}" Header="Anz. Begleitp." MinWidth="50">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Besuchstag, StringFormat=\{0:dd.MM.yyyy\}}" ClipboardContentBinding="{x:Null}" Header="Besuchstag" MinWidth="75">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Grund_des_Besuchs}" ClipboardContentBinding="{x:Null}" Header="Grund des Besuchs" MinWidth="200"/>
|
||||
<DataGridTextColumn Binding="{Binding Oertlichkeit}" ClipboardContentBinding="{x:Null}" Header="Örtlichkeit" MinWidth="150"/>
|
||||
<DataGridTextColumn Binding="{Binding Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Anspr. intern" MinWidth="150"/>
|
||||
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Tel_Nr_Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Tel. Ansprechp." MinWidth="150"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="98" Height="28" Click="BtnClose_Click" TabIndex="11"/>
|
||||
<TextBox x:Name="tbGrundDesBesuchs" HorizontalAlignment="Left" Height="23" Margin="10,302,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="6" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,330,0,0" TextWrapping="Wrap" Text="Örtlichkeit" VerticalAlignment="Top"/>
|
||||
<TextBox x:Name="tbOertlichkeit" HorizontalAlignment="Left" Height="23" Margin="10,351,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="7" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
|
||||
<Button x:Name="btnDelete" Content="Markierten Besucher löschen" Margin="0,10,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="167" Click="btnDelete_Click" IsEnabled="False"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,379,0,0" TextWrapping="Wrap" Text="Ansprechpartner wählen oder eingeben" VerticalAlignment="Top"/>
|
||||
<ComboBox x:Name="cBAsp" HorizontalAlignment="Left" Margin="10,400,0,0" VerticalAlignment="Top" Width="340" SelectionChanged="cBAsp_SelectionChanged"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
436
ZKuP/ManageVisitor.xaml.cs
Normal file
@ -0,0 +1,436 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für CreateVisitor.xaml
|
||||
/// </summary>
|
||||
public partial class ManageVisitor : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private List<Visitor> myVar;
|
||||
public List<Visitor> VisitorView
|
||||
{
|
||||
get { return myVar; }
|
||||
set { myVar = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
DataTable visitors = new DataTable("Visitors");
|
||||
|
||||
private List<string> aspVar;
|
||||
public List<string> asp
|
||||
{
|
||||
get { return aspVar; }
|
||||
set { aspVar = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
int index = 0;
|
||||
|
||||
|
||||
public ManageVisitor()
|
||||
{
|
||||
this.DataContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
asp = SQL.ReadListString("SELECT Name FROM zkup.ansprechpartner").Result;
|
||||
asp = asp.OrderBy(p => p).ToList();
|
||||
asp.Insert(0, "");
|
||||
cBAsp.ItemsSource = asp;
|
||||
//dg_cbASP.ItemsSource = asp;
|
||||
|
||||
updateList();
|
||||
|
||||
|
||||
dgVisitors.Items.SortDescriptions.Clear();
|
||||
dgVisitors.Items.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
|
||||
dgVisitors.UpdateLayout();
|
||||
}
|
||||
|
||||
private void updateList()
|
||||
{
|
||||
if (MainWindow.LoggedInRole == Roles.Admin || MainWindow.LoggedInRole == Roles.Pförtner)
|
||||
{
|
||||
requestListAdmin();
|
||||
}
|
||||
else
|
||||
{
|
||||
requestList();
|
||||
}
|
||||
}
|
||||
|
||||
private void requestList()
|
||||
{
|
||||
visitors = SQL.ReadSQL($"SELECT * FROM zkup.besucher WHERE Ersteller = '{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{Environment.UserDomainName}{Environment.UserName}' " +
|
||||
$"OR Ersteller = '{SQL.ReadSingleValue($"SELECT Vertreter FROM zkup.ansprechpartner WHERE Name = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'")}' " +
|
||||
$"OR Ansprechpartner_Intern = '{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}'"
|
||||
, visitors).Result;
|
||||
|
||||
VisitorView = Visitor.DataTableToVisitor(visitors);
|
||||
dgVisitors.DataContext = visitors;
|
||||
}
|
||||
|
||||
private void requestListAdmin()
|
||||
{
|
||||
visitors = SQL.ReadSQL("SELECT * FROM zkup.besucher", visitors).Result;
|
||||
VisitorView = Visitor.DataTableToVisitor(visitors);
|
||||
dgVisitors.DataContext = visitors;
|
||||
}
|
||||
|
||||
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private async void BtnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (tbAnzahl_Begleiter.Text == "") tbAnzahl_Begleiter.Text = "0";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(tbName.Text))
|
||||
MessageBox.Show("Name eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbVerantwortlicher_MA.Text))
|
||||
MessageBox.Show("Verantwortlichen MA eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbTel_Besucher.Text))
|
||||
MessageBox.Show("Telefonnummer Besucher eintragen!", "Fehler");
|
||||
else if (!dpBesuchstag.SelectedDate.HasValue)
|
||||
MessageBox.Show("Besuchstag eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbGrundDesBesuchs.Text))
|
||||
MessageBox.Show("'Grund des Besuchs' eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbOertlichkeit.Text))
|
||||
MessageBox.Show("'Örtlichkeit' eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbAnsprechp_Intern.Text))
|
||||
MessageBox.Show("'Ansprechpartner intern' auswählen oder eintragen!", "Fehler");
|
||||
else if (string.IsNullOrWhiteSpace(tbTel_Ansprechp.Text))
|
||||
MessageBox.Show("'Telefonnr. Ansprechpartner intern' eintragen!", "Fehler");
|
||||
else
|
||||
{
|
||||
if (VisitorView.Exists(p => p.Name.Contains(tbName.Text)))
|
||||
{
|
||||
MessageBox.Show("Besucher existiert bereits", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(tbAnzahl_Begleiter.Text, "^[0-9]*$"))
|
||||
MessageBox.Show(this, "Anzahl Begleiter darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
await SQL.WriteSQL("INSERT INTO besucher (Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Ersteller) VALUES " +
|
||||
$"('{tbName.Text}','{tbVerantwortlicher_MA.Text}','{tbTel_Besucher.Text}','{tbAnzahl_Begleiter.Text}','{dpBesuchstag.SelectedDate.Value.ToString("yyyy-MM-dd")}','{tbGrundDesBesuchs.Text}','{tbAnsprechp_Intern.Text}','{tbTel_Ansprechp.Text}','{tbOertlichkeit.Text}','{Environment.UserName}')");
|
||||
|
||||
|
||||
updateList();
|
||||
|
||||
dgVisitors.ScrollIntoView(dgVisitors.Items[dgVisitors.Items.Count - 1]); //scroll to last
|
||||
dgVisitors.UpdateLayout();
|
||||
ResetInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetInput()
|
||||
{
|
||||
tbName.Text = "";
|
||||
tbVerantwortlicher_MA.Text = "";
|
||||
tbTel_Besucher.Text = "";
|
||||
tbAnzahl_Begleiter.Text = "";
|
||||
dpBesuchstag.Text = "";
|
||||
tbGrundDesBesuchs.Text = "";
|
||||
tbOertlichkeit.Text = "";
|
||||
cBAsp.SelectedIndex = -1;
|
||||
tbAnsprechp_Intern.Text = "";
|
||||
tbTel_Ansprechp.Text = "";
|
||||
}
|
||||
|
||||
private async void DgVisitors_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var dg = sender as DataGrid;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (e.Key == Key.Delete)
|
||||
{
|
||||
deleteRow(arr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void DgVisitors_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||
{
|
||||
dgVisitors.PreviewKeyDown -= DgVisitors_PreviewKeyDown;
|
||||
}
|
||||
|
||||
|
||||
private async void DgVisitors_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
var newValue = "";
|
||||
var header = e.Column.Header;
|
||||
if (header.ToString() == "Anspr. intern")
|
||||
newValue = (e.EditingElement as ComboBox).Text;
|
||||
else
|
||||
newValue = (e.EditingElement as TextBox).Text;
|
||||
|
||||
var id = (e.Row.Item as DataRowView).Row.ItemArray[0];
|
||||
DateTime date = DateTime.Now;
|
||||
|
||||
if (DateTime.TryParseExact(newValue, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out date))
|
||||
newValue = date.ToString("yyyy-MM-dd");
|
||||
|
||||
var MessageValue = newValue;
|
||||
var MessageDate = DateTime.Now;
|
||||
if (DateTime.TryParse(newValue, out MessageDate))
|
||||
MessageValue = MessageDate.ToString("dd.MM.yyyy");
|
||||
|
||||
if (oldValue != MessageValue)
|
||||
{
|
||||
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValue}' in der Spalte '{header}' sicher zu '{MessageValue}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
{
|
||||
switch (header)
|
||||
{
|
||||
case "Name":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Name = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Verantw. MA":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Verantwortlicher_MA = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Tel. Besucher":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Tel_Nr_Besucher = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Anz. Begleitp.":
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(newValue, "^[0-9]*$"))
|
||||
MessageBox.Show(this, "Anzahl Begleiter darf nur Zahlen enthalten", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Anzahl_Begleitpersonen = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Besuchstag":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Besuchstag = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Grund des Besuchs":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Grund_des_Besuchs = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Örtlichkeit":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Oertlichkeit = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Anspr. intern":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
case "Tel. Ansprechp.":
|
||||
await SQL.WriteSQL($"UPDATE besucher SET Tel_Nr_Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index = e.Row.GetIndex();
|
||||
dgVisitors.PreviewKeyDown += DgVisitors_PreviewKeyDown;
|
||||
|
||||
updateList();
|
||||
|
||||
dgVisitors.RowValidationErrorTemplate = new ControlTemplate();
|
||||
|
||||
dgVisitors.SelectedIndex = (index);
|
||||
dgVisitors.ScrollIntoView(dgVisitors.Items[index]);
|
||||
|
||||
//ScrollTo();
|
||||
}
|
||||
|
||||
private async Task ScrollTo()
|
||||
{
|
||||
if (index != 0 && index != -1)
|
||||
{
|
||||
dgVisitors.SelectedIndex = index;
|
||||
dgVisitors.ScrollIntoView(dgVisitors.Items[index]);
|
||||
|
||||
DataGridRow row = (DataGridRow)dgVisitors.ItemContainerGenerator.ContainerFromIndex(index - 1);
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
row.Focusable = true;
|
||||
row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Right));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void TbAnzahl_Begleiter_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpBesuchstag.Focus();
|
||||
dpBesuchstag.IsDropDownOpen = true;
|
||||
}
|
||||
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private void DpBesuchstag_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab)
|
||||
{
|
||||
dpBesuchstag.IsDropDownOpen = false;
|
||||
dpBesuchstag.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void dgVisitors_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (dgVisitors.SelectedIndex != -1) btnDelete.IsEnabled = true;
|
||||
else btnDelete.IsEnabled = false;
|
||||
|
||||
ScrollTo();
|
||||
}
|
||||
private async void btnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dg = dgVisitors;
|
||||
var row = dg.SelectedItem as DataRowView;
|
||||
var arr = row.Row.ItemArray;
|
||||
|
||||
if (MessageBox.Show(this, $"Markierten Besucher wirklich entfernen?", "Besucher entfernen?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
deleteRow(arr);
|
||||
}
|
||||
}
|
||||
|
||||
private async void deleteRow(object[] arr)
|
||||
{
|
||||
await SQL.WriteSQL("INSERT INTO besucherLog (idbesucher, Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Geloescht_Von) VALUES " +
|
||||
$"('{arr[0]}','{arr[1].ToString()}','{arr[2].ToString()}','{arr[3].ToString()}','{arr[4].ToString()}','{Convert.ToDateTime(arr[5].ToString()).ToString("yyyy-MM-dd")}','{arr[6].ToString()}','{arr[7].ToString()}','{arr[8].ToString()}','{arr[10].ToString()}','{Environment.UserName}')");
|
||||
|
||||
|
||||
await SQL.WriteSQL($"DELETE FROM zkup.besucher WHERE `idBesucher` = '{arr[0]}'");
|
||||
|
||||
updateList();
|
||||
}
|
||||
|
||||
private async void cBAsp_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (cBAsp.SelectedIndex != -1 && cBAsp.SelectedItem.ToString() != "")
|
||||
{
|
||||
var list = await SQL.ReadListStringTwoColumns($"SELECT Name, Tel_Nr FROM zkup.ansprechpartner WHERE Name = '{cBAsp.SelectedItem.ToString()}'");
|
||||
tbAnsprechp_Intern.Text = list[0].Split(';')[0].ToString();
|
||||
tbTel_Ansprechp.Text = list[0].Split(';')[1].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
tbAnsprechp_Intern.Text = "";
|
||||
tbTel_Ansprechp.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBoxes_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key != Key.OemComma)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
{
|
||||
MessageBox.Show(this, "Komma (',') ist ein nicht erlaubtes Zeichen", "Achtung", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
e.Handled = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
string oldValue = "";
|
||||
private void dgVisitors_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
|
||||
{
|
||||
|
||||
oldValue = (e.EditingElement as TextBox) != null ? (e.EditingElement as TextBox).Text : "";
|
||||
}
|
||||
|
||||
private void tbAnzahl_Begleiter_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if ((sender as TextBox).Text.Length >= 2) e.Handled = true;
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(e.Text, "^[0-9]*$")) e.Handled = true;
|
||||
}
|
||||
|
||||
private void ComboBox_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Textboxes_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (e.Command == ApplicationCommands.Paste)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Visitor
|
||||
{
|
||||
public string Name;
|
||||
string Verantwortlicher_MA;
|
||||
string Tel_Nr_Besucher;
|
||||
string Anzahl_Begleitpersonen;
|
||||
string Besuchstag;
|
||||
string Grund_des_Besuchs;
|
||||
string Oertlichkeit;
|
||||
string Ansprechpartner_Intern;
|
||||
string Tel_Nr_Ansprechpartner_Intern;
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<Visitor> DataTableToVisitor(System.Data.DataTable dataTable)
|
||||
{
|
||||
List<Visitor> x = new List<Visitor>();
|
||||
|
||||
foreach (DataRow dr in dataTable.Rows)
|
||||
{
|
||||
x.Add(new Visitor()
|
||||
{
|
||||
Name = dr[1].ToString(),
|
||||
Verantwortlicher_MA = dr[2].ToString(),
|
||||
Tel_Nr_Besucher = dr[3].ToString(),
|
||||
Anzahl_Begleitpersonen = dr[4].ToString(),
|
||||
Besuchstag = dr[5].ToString(),
|
||||
Grund_des_Besuchs = dr[6].ToString(),
|
||||
Ansprechpartner_Intern = dr[7].ToString(),
|
||||
Tel_Nr_Ansprechpartner_Intern = dr[8].ToString(),
|
||||
Oertlichkeit = dr[9].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
81
ZKuP/ParkausweisDisclaimer.xaml
Normal file
@ -0,0 +1,81 @@
|
||||
<Window x:Class="ZKuP.ParkausweisDisclaimer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Parkausweis beantragen" Height="435" Width="673" WindowStyle="ToolWindow" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<RichTextBox Margin="10,10,10,0" Height="320" VerticalAlignment="Top" Focusable="False" IsTabStop="False" IsReadOnly="True" IsEnabled="False">
|
||||
<RichTextBox.Template>
|
||||
<ControlTemplate TargetType="{x:Type TextBoxBase}">
|
||||
<Border x:Name="border" BorderBrush="LightGray" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
|
||||
<ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" TargetName="border" Value="1"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</RichTextBox.Template>
|
||||
<FlowDocument>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Span>
|
||||
<Run Text="Einwilligungserklärung gemäß DSGVO in die Verarbeitung von Daten durch P.FBW-M"/>
|
||||
</Span>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left"/>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Span>
|
||||
<Run Text="Zur Erstellung der Parkkarten erfolgt die Verarbeitung folgender personenbezogener Daten: "/>
|
||||
</Span>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Span>
|
||||
<Run Text="Name, Vorname - Adresse - E-Mail-Adresse – Telefonnummer"/>
|
||||
</Span>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left"/>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Span>
|
||||
<Run Text="Die oben genannten Daten werden zum Zweck der Erteilung und Prüfung der Parkkarten erhoben und zudem auf den Servern von P.FBW-M gespeichert. Die Daten können nur von berechtigten Personen eingesehen und bearbeitet werden. Sollten weitere Daten benötigt werden, braucht es dafür separat wieder die Zustimmung des Nutzers. Eine Löschung der erhobenen Daten erfolgt mit Rückgabe oder Außerkraftsetzung der Parkkarte."/>
|
||||
</Span>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Run Text="Widerrufsrecht"/>
|
||||
<Run Text=" "/>
|
||||
<Run Text=":"/>
|
||||
<Run Text=" "/>
|
||||
<Run Text=" Der Zustimmende hat das Recht, diese Einwilligung jederzeit ohne Angabe einer Begründung mit Wirkung für die Zukunft zu widerrufen. Hierfür genügt eine E-Mail an "/>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Run/>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="120,0,0,0" TextAlignment="Left" TextIndent="20">
|
||||
<Run Text="Infrastruktur-Werk-Muenchen@deutschebahn.com "/>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Run/>
|
||||
</Paragraph>
|
||||
<Paragraph FontSize="14.6666666666667" FontFamily="Calibri" Margin="0" TextAlignment="Left">
|
||||
<Run Text="und die Rückgabe der Parkkarte an P.FBW-M2(1). Die Rechtmäßigkeit der aufgrund der Einwilligung bis zum Widerruf erfolgten Verarbeitung wird durch den Widerruf nicht berührt."/>
|
||||
</Paragraph>
|
||||
<Paragraph>
|
||||
<Run Text=""/>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
<CheckBox x:Name="cBAccept" Content="Hiermit bestätige ich die Erklärung gelesen und verstanden zu haben" Margin="10,337,10,0" VerticalAlignment="Top"/>
|
||||
<Button x:Name="btnDecline" Content="Ablehnen" HorizontalAlignment="Left" Margin="10,0,0,8" VerticalAlignment="Bottom" Width="300" Click="btnDecline_Click" Height="28" IsDefault="True"/>
|
||||
<Button x:Name="btnAccept" Content="Akzeptieren" HorizontalAlignment="Right" Margin="0,0,10,8" VerticalAlignment="Bottom" Width="300" Click="btnAccept_Click" Height="28"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
46
ZKuP/ParkausweisDisclaimer.xaml.cs
Normal file
@ -0,0 +1,46 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ParkausweisDisclaimer.xaml
|
||||
/// </summary>
|
||||
public partial class ParkausweisDisclaimer : Window
|
||||
{
|
||||
public ParkausweisDisclaimer()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnDecline_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnAccept_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (cBAccept.IsChecked.Value == true)
|
||||
{
|
||||
this.Close();
|
||||
|
||||
CreateParkausweis cPa = new CreateParkausweis();
|
||||
//cPa.Owner = this;
|
||||
cPa.ShowDialog();
|
||||
}
|
||||
else
|
||||
cBAccept.Foreground = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
35
ZKuP/PrintParkausweis.xaml
Normal file
@ -0,0 +1,35 @@
|
||||
<Window x:Class="ZKuP.PrintParkausweis"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Parkausweise drucken" Height="450" Width="800">
|
||||
<Grid>
|
||||
<DataGrid x:Name="dgPrint" AutoGenerateColumns="False" ItemsSource="{Binding .}" CanUserDeleteRows="False" CanUserAddRows="False" CanUserReorderColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding idparkausweise}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="ID" IsReadOnly="True" Width="50"/>
|
||||
<DataGridTextColumn Binding="{Binding MA_Vorname}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Vorname" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding MA_Name}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Nachname" IsReadOnly="True" Width="*"/>
|
||||
<DataGridTextColumn Binding="{Binding Firma}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Firma" IsReadOnly="True" Width="130"/>
|
||||
<DataGridTextColumn Binding="{Binding Kennzeichen}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Kennzeichen" IsReadOnly="True" Width="80">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTemplateColumn CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Drucken" Width="90">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button x:Name="btnPrint" Content="Drucken" Click="btnPrint_Click"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
56
ZKuP/PrintParkausweis.xaml.cs
Normal file
@ -0,0 +1,56 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für PrintParkausweis.xaml
|
||||
/// </summary>
|
||||
public partial class PrintParkausweis : Window
|
||||
{
|
||||
public PrintParkausweis()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT * FROM parkausweise WHERE Genehmigt = '1' AND Gedruckt = '0'").Result;
|
||||
dgPrint.DataContext = list;
|
||||
}
|
||||
|
||||
private async void btnPrint_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var arr = ((sender as Button).DataContext as System.Data.DataRowView).Row.ItemArray;
|
||||
|
||||
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 (MessageBox.Show(this, "Wurde der Parkausweis erfolgreich gedruckt?", "Erfolgreich gedruckt?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE parkausweise SET Gedruckt = '1' WHERE idparkausweise = '{(int)arr[0]}'");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MessageBox.Show(this, "Es wurde ein Fehler beim Vorgang festgestellt\nWurde der Parkausweis dennoch erfolgreich gedruckt?", "Fehler", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
await SQL.WriteSQL($"UPDATE parkausweise SET Gedruckt = '1' WHERE idparkausweise = '{(int)arr[0]}'");
|
||||
}
|
||||
}
|
||||
|
||||
var list = SQL.ReadSQL($"SELECT * FROM parkausweise WHERE Genehmigt = '1' AND Gedruckt = '0'").Result;
|
||||
dgPrint.DataContext = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
ZKuP/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
[assembly: AssemblyTitle("ZKuP")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Deutsche Bahn AG")]
|
||||
[assembly: AssemblyProduct("ZKuP")]
|
||||
[assembly: AssemblyCopyright("Copyright © Marcus Bachler 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
|
||||
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
|
||||
//<UICulture>ImCodeVerwendeteKultur</UICulture> in der .csproj-Datei
|
||||
//in einer <PropertyGroup> fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
|
||||
//(Deutschland) verwenden, legen Sie <UICulture> auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
|
||||
//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
|
||||
//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
|
||||
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
|
||||
// oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
|
||||
ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
|
||||
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
|
||||
// designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
|
||||
)]
|
||||
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
306
ZKuP/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,306 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ZKuP.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ZKuP.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Capture_Sigma
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Capture_Sigma", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LED_Green
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("LED_Green", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LED_Green_Delta
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("LED_Green_Delta", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LED_Green_Gamma
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("LED_Green_Gamma", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LED_Yellow
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("LED_Yellow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LED_Yellow_Delta
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("LED_Yellow_Delta", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LED_Yellow_Gamma
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("LED_Yellow_Gamma", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap OK_BW
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("OK_BW", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap OK_RGB
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("OK_RGB", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Pad_Alpha
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Pad_Alpha", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Pad_Delta
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Pad_Delta", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Pad_Gamma
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Pad_Gamma", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Pad_Omega
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Pad_Omega", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Pad_Sigma
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Pad_Sigma", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Pad_Zeta
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Pad_Zeta", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Scroll_RGB
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Scroll_RGB", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon STPadLibNet_Demo_App
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("STPadLibNet_Demo_App", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Welcome
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Welcome", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Cancel_BW
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Cancel_BW", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Cancel_RGB
|
||||
{
|
||||
get
|
||||
{
|
||||
object obj = ResourceManager.GetObject("Cancel_RGB", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
ZKuP/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
122
ZKuP/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,122 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ZKuP.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("747")]
|
||||
public double Height {
|
||||
get {
|
||||
return ((double)(this["Height"]));
|
||||
}
|
||||
set {
|
||||
this["Height"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("1624")]
|
||||
public double Width {
|
||||
get {
|
||||
return ((double)(this["Width"]));
|
||||
}
|
||||
set {
|
||||
this["Width"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double Top {
|
||||
get {
|
||||
return ((double)(this["Top"]));
|
||||
}
|
||||
set {
|
||||
this["Top"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double Left {
|
||||
get {
|
||||
return ((double)(this["Left"]));
|
||||
}
|
||||
set {
|
||||
this["Left"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("300")]
|
||||
public global::System.Windows.GridLength gridOverviewHeight {
|
||||
get {
|
||||
return ((global::System.Windows.GridLength)(this["gridOverviewHeight"]));
|
||||
}
|
||||
set {
|
||||
this["gridOverviewHeight"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
|
||||
public global::System.Windows.WindowState State {
|
||||
get {
|
||||
return ((global::System.Windows.WindowState)(this["State"]));
|
||||
}
|
||||
set {
|
||||
this["State"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool ShowParkcardAccept {
|
||||
get {
|
||||
return ((bool)(this["ShowParkcardAccept"]));
|
||||
}
|
||||
set {
|
||||
this["ShowParkcardAccept"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public global::System.Windows.GridLength gridTodayHeight {
|
||||
get {
|
||||
return ((global::System.Windows.GridLength)(this["gridTodayHeight"]));
|
||||
}
|
||||
set {
|
||||
this["gridTodayHeight"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
ZKuP/Properties/Settings.settings
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ZKuP.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="Height" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">747</Value>
|
||||
</Setting>
|
||||
<Setting Name="Width" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">1624</Value>
|
||||
</Setting>
|
||||
<Setting Name="Top" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="Left" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="gridOverviewHeight" Type="System.Windows.GridLength" Scope="User">
|
||||
<Value Profile="(Default)">300</Value>
|
||||
</Setting>
|
||||
<Setting Name="State" Type="System.Windows.WindowState" Scope="User">
|
||||
<Value Profile="(Default)">Normal</Value>
|
||||
</Setting>
|
||||
<Setting Name="ShowParkcardAccept" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="gridTodayHeight" Type="System.Windows.GridLength" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
70
ZKuP/Properties/app.manifest
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC-Manifestoptionen
|
||||
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
|
||||
Knoten "requestedExecutionLevel" wie folgt.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
|
||||
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
|
||||
für die Anwendung erforderlich ist.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
|
||||
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
|
||||
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
|
||||
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel und müssen sich nicht
|
||||
anmelden. Für Windows Forms-Anwendungen für .NET Framework 4.6, die sich für diese Einstellung anmelden, muss
|
||||
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der "app.config" auf "true" festgelegt werden. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
||||
BIN
ZKuP/Resources/Cancel BW.png
Normal file
|
After Width: | Height: | Size: 556 B |
BIN
ZKuP/Resources/Capture Sigma.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
ZKuP/Resources/NoSignature.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
ZKuP/Resources/OK BW.png
Normal file
|
After Width: | Height: | Size: 523 B |
152
ZKuP/Resources/PLZ_MUC.txt
Normal file
@ -0,0 +1,152 @@
|
||||
80995
|
||||
80997
|
||||
80999
|
||||
81247
|
||||
81249
|
||||
80331
|
||||
80333
|
||||
80335
|
||||
80336
|
||||
80469
|
||||
80538
|
||||
80539
|
||||
81541
|
||||
81543
|
||||
81667
|
||||
81669
|
||||
81671
|
||||
81675
|
||||
81677
|
||||
81241
|
||||
81243
|
||||
81245
|
||||
81249
|
||||
81671
|
||||
81673
|
||||
81677
|
||||
81735
|
||||
81825
|
||||
81829
|
||||
81675
|
||||
81677
|
||||
81679
|
||||
81925
|
||||
81927
|
||||
81929
|
||||
80933
|
||||
80935
|
||||
80995
|
||||
80689
|
||||
81375
|
||||
81377
|
||||
80639
|
||||
80686
|
||||
80687
|
||||
80689
|
||||
80331
|
||||
80335
|
||||
80336
|
||||
80337
|
||||
80339
|
||||
80469
|
||||
80538
|
||||
80333
|
||||
80335
|
||||
80539
|
||||
80636
|
||||
80797
|
||||
80798
|
||||
80799
|
||||
80802
|
||||
80797
|
||||
80807
|
||||
80809
|
||||
80933
|
||||
80935
|
||||
80937
|
||||
80939
|
||||
80637
|
||||
80638
|
||||
80992
|
||||
80993
|
||||
80995
|
||||
80997
|
||||
80335
|
||||
80634
|
||||
80636
|
||||
80637
|
||||
80638
|
||||
80639
|
||||
80797
|
||||
80809
|
||||
80992
|
||||
81539
|
||||
81541
|
||||
81547
|
||||
81549
|
||||
80687
|
||||
80689
|
||||
80992
|
||||
80997
|
||||
81241
|
||||
81243
|
||||
81245
|
||||
81247
|
||||
81249
|
||||
81539
|
||||
81541
|
||||
81549
|
||||
81669
|
||||
81671
|
||||
81735
|
||||
81737
|
||||
81739
|
||||
81827
|
||||
80538
|
||||
80539
|
||||
80799
|
||||
80801
|
||||
80802
|
||||
80803
|
||||
80804
|
||||
80805
|
||||
80807
|
||||
80939
|
||||
80796
|
||||
80797
|
||||
80798
|
||||
80799
|
||||
80801
|
||||
80803
|
||||
80804
|
||||
80809
|
||||
80335
|
||||
80339
|
||||
80336
|
||||
80337
|
||||
81369
|
||||
81371
|
||||
81373
|
||||
81379
|
||||
80686
|
||||
81369
|
||||
81373
|
||||
81377
|
||||
81379
|
||||
81369
|
||||
81371
|
||||
81379
|
||||
81475
|
||||
81476
|
||||
81477
|
||||
81479
|
||||
81735
|
||||
81825
|
||||
81827
|
||||
81829
|
||||
85540
|
||||
81539
|
||||
81543
|
||||
81545
|
||||
81547
|
||||
81549
|
||||
BIN
ZKuP/Resources/Pad Sigma.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
ZKuP/Resources/db-logo.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
447
ZKuP/SQL.cs
Normal file
@ -0,0 +1,447 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
public static class SQL
|
||||
{
|
||||
static string connstr = "Server=10.20.98.34;Uid=ZK;Pwd=ZKUser#2001;database=zkup";
|
||||
static MySqlConnection conn = new MySqlConnection(connstr);
|
||||
static MySqlDataAdapter adp = new MySqlDataAdapter();
|
||||
|
||||
|
||||
public static bool CheckDeviceConnection(string ip)
|
||||
{
|
||||
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(ip);
|
||||
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
|
||||
{
|
||||
System.Windows.MessageBox.Show($"Server ist nicht erreichbar\nNetzwerkverbindung überprüfen", "Fehler", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
|
||||
System.Windows.Application.Current.Shutdown();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static MySqlDataAdapter GetAdapter()
|
||||
{
|
||||
return adp;
|
||||
}
|
||||
|
||||
public static MySqlConnection GetConnection()
|
||||
{
|
||||
return conn;
|
||||
}
|
||||
|
||||
public static bool TestConnection()
|
||||
{
|
||||
if (!CheckDeviceConnection("10.20.98.34")) return false;
|
||||
|
||||
using (conn)
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
conn.Close();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
|
||||
System.Windows.MessageBox.Show($"Verbindung zum Server konnte nicht hergestellt werden\n\nInterne Meldung: {ex.Message}", "Fehler", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<DataTable> WriteSQL(string SQLQuery, DataTable list)
|
||||
{
|
||||
var filter = list.DefaultView.RowFilter;
|
||||
|
||||
try
|
||||
{
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
adp.UpdateCommand = new MySqlCommand(SQLQuery, conn);
|
||||
|
||||
adp.Update(list);
|
||||
|
||||
list.AcceptChanges();
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
list.DefaultView.RowFilter = filter;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
return list;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static async Task WriteSQL(string SQLQuery)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(SQLQuery, conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task WriteSQL(string SQLQuery, byte[] data)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(SQLQuery, conn);
|
||||
cmd.Parameters.Add("@signature", MySqlDbType.LongBlob).Value = data;
|
||||
cmd.ExecuteNonQuery();
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static async Task<DataTable> ReadSQL(string SQLCommand, DataTable list)
|
||||
{
|
||||
var filter = list.DefaultView.RowFilter;
|
||||
try
|
||||
{
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
adp.SelectCommand = new MySqlCommand(SQLCommand, conn);
|
||||
|
||||
list.Clear();
|
||||
adp.Fill(list);
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
list.DefaultView.RowFilter = filter;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
return list;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static async Task<DataTable> ReadSQL(string SQLCommand)
|
||||
{
|
||||
DataTable list = new DataTable();
|
||||
|
||||
try
|
||||
{
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
adp.SelectCommand = new MySqlCommand(SQLCommand, conn);
|
||||
|
||||
list.Clear();
|
||||
adp.Fill(list);
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
return list;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public static async Task<string> ReadSingleValueAsync(string SQLCommand)
|
||||
{
|
||||
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(SQLCommand, conn);
|
||||
object queryResult;
|
||||
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
queryResult = cmd.ExecuteScalar();//Return an object so first check for null
|
||||
}
|
||||
|
||||
|
||||
if (queryResult != null)
|
||||
return queryResult.ToString();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string ReadSingleValue(string SQLCommand)
|
||||
{
|
||||
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(SQLCommand, conn);
|
||||
object queryResult;
|
||||
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
queryResult = cmd.ExecuteScalar();//Return an object so first check for null
|
||||
}
|
||||
|
||||
|
||||
if (queryResult != null)
|
||||
return queryResult.ToString();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public static System.Drawing.Bitmap ReadSingleByteArr(string SQLCommand)
|
||||
{
|
||||
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(SQLCommand, conn);
|
||||
UInt32 FileSize;
|
||||
byte[] rawData;
|
||||
System.Drawing.Bitmap image = null;
|
||||
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
|
||||
MySql.Data.MySqlClient.MySqlDataReader myData = cmd.ExecuteReader();
|
||||
while (myData.Read())
|
||||
{
|
||||
if (myData[0] == DBNull.Value)
|
||||
return null;
|
||||
|
||||
byte[] data = (byte[])myData[0]; // 0 is okay if you only selecting one column
|
||||
//And use:
|
||||
//using (System.IO.MemoryStream ms = new System.IO.MemoryStream(data))
|
||||
//{
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
|
||||
image = new System.Drawing.Bitmap(ms);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
//if (rawData != null)
|
||||
// return (byte[])rawData;
|
||||
//else
|
||||
return image;
|
||||
}
|
||||
|
||||
public static async Task<List<string>> ReadListString(string SQLCommand, int ColumnID = 0)
|
||||
{
|
||||
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(SQLCommand, conn);
|
||||
List<string> queryResult = new List<string>();
|
||||
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
queryResult.Add(reader.GetString(ColumnID));
|
||||
}
|
||||
}
|
||||
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
return queryResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read two Columns, separated by ';'
|
||||
/// </summary>
|
||||
/// <param name="SQLCommand"></param>
|
||||
/// <param name="ColumnID"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<List<string>> ReadDateTimeAndStringList(string SQLCommand, int ColumnID = 0)
|
||||
{
|
||||
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(SQLCommand, conn);
|
||||
List<string> queryResult = new List<string>();
|
||||
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
queryResult.Add(reader.GetDateTime(ColumnID).ToString("yyyy-MM-dd HH:mm:ss") + ";" + reader.GetString(ColumnID + 1));
|
||||
}
|
||||
}
|
||||
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
return queryResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read two Columns, separated by ';' or choose Seperator
|
||||
/// </summary>
|
||||
/// <param name="SQLCommand"></param>
|
||||
/// <param name="Seperator"></param>
|
||||
/// <param name="ColumnID"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<List<string>> ReadListStringTwoColumns(string SQLCommand, string Seperator = ";", int ColumnID = 0)
|
||||
{
|
||||
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(SQLCommand, conn);
|
||||
List<string> queryResult = new List<string>();
|
||||
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
queryResult.Add(reader.GetString(ColumnID) + $"{Seperator}" + reader.GetString(ColumnID + 1));
|
||||
}
|
||||
}
|
||||
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
return queryResult;
|
||||
}
|
||||
|
||||
|
||||
public static async Task<bool> RowExists(string Table, string Column, string Value)
|
||||
{
|
||||
MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand($"SELECT EXISTS(SELECT * FROM {Table} WHERE {Column} = '{Value}')", conn);
|
||||
object queryResult;
|
||||
var res = 0;
|
||||
|
||||
using (conn)
|
||||
{
|
||||
if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
conn.Open();
|
||||
queryResult = cmd.ExecuteScalar();//Return an object so first check for null
|
||||
}
|
||||
|
||||
if (queryResult != null)
|
||||
res = Convert.ToInt16(queryResult);
|
||||
|
||||
if (res == 1)
|
||||
return true;
|
||||
else if (res == 0)
|
||||
return false;
|
||||
else return false;
|
||||
}
|
||||
|
||||
//public static async Task<DataTable> ReadAllData(DataTable list)
|
||||
//{
|
||||
// var filter = list.DefaultView.RowFilter;
|
||||
|
||||
// using (conn)
|
||||
// {
|
||||
// if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
// conn.Open();
|
||||
// adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn);
|
||||
// list.Clear();
|
||||
// adp.Fill(list);
|
||||
// conn.Close();
|
||||
// }
|
||||
|
||||
// list.DefaultView.RowFilter = filter;
|
||||
// return list;
|
||||
//}
|
||||
|
||||
//public static async Task<DataTable> ReadAllData(string filter = "")
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// DataTable list = new DataTable("UserList");
|
||||
|
||||
// using (conn)
|
||||
// {
|
||||
// if (conn.State == ConnectionState.Open) conn.Close();
|
||||
|
||||
// conn.Open();
|
||||
// adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn);
|
||||
// list.Columns.Clear();
|
||||
// adp.Fill(list);
|
||||
// conn.Close();
|
||||
// }
|
||||
|
||||
// list.DefaultView.RowFilter = filter;
|
||||
// return list;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// System.Diagnostics.Debug.WriteLine(ex);
|
||||
// return await ReadAllData();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
20
ZKuP/Signature.xaml
Normal file
@ -0,0 +1,20 @@
|
||||
<Window x:Class="ZKuP.Signature"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ZKuP"
|
||||
mc:Ignorable="d"
|
||||
Title="Unterschrift" Height="232" Width="444" ResizeMode="NoResize" Closing="Window_Closing" Topmost="True">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="btnCancel" Content="Abbrechen" Margin="10,10,10,0" VerticalAlignment="Top" Click="btnCancel_Click"/>
|
||||
<Button x:Name="btnConfirm" Content="Bestätigen" Grid.Column="1" Margin="10,10,10,0" VerticalAlignment="Top" Click="btnConfirm_Click"/>
|
||||
<WindowsFormsHost HorizontalAlignment="Stretch" Margin="10,44,10,10" Name="STPadLibControlHost" Width="Auto" Grid.ColumnSpan="2" />
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
114
ZKuP/Signature.xaml.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using signotec.STPadLibNet;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Signature.xaml
|
||||
/// </summary>
|
||||
public partial class Signature : Window
|
||||
{
|
||||
public System.Drawing.Bitmap Result { get; set; }
|
||||
public byte[] ResultByte { get; set; }
|
||||
//private STPadLibControl _stPad = new STPadLibControl();
|
||||
|
||||
public Signature(string Name = "", string Firma = "", string Kennzeichen = "", bool showDisclaimer = true)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
try
|
||||
{
|
||||
if (signoPad._stPad.DeviceGetCount() <= 0)
|
||||
{
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
signoPad._stPad = new STPadLibControl();
|
||||
STPadLibControlHost.Child = signoPad._stPad;
|
||||
signoPad._stPad.ControlMirrorDisplay = MirrorMode.Signature;
|
||||
|
||||
signoPad.ShowDisclaimer(Name, Firma, Kennzeichen, showDisclaimer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.ToString());
|
||||
MessageBox.Show($"Es ist ein Fehler aufgetreten\n\nInterne Meldung: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnConfirm_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
System.Drawing.Imaging.ImageFormat format;
|
||||
SignatureImageFlag options = SignatureImageFlag.None;
|
||||
|
||||
format = System.Drawing.Imaging.ImageFormat.Tiff;
|
||||
|
||||
int resolution = 300;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int penWidth = 0;
|
||||
System.Drawing.Color penColor = System.Drawing.Color.FromArgb(255,0,0,0);
|
||||
|
||||
options = signotec.STPadLibNet.SignatureImageFlag.Timestamp | signotec.STPadLibNet.SignatureImageFlag.TimestampRelToImage | signotec.STPadLibNet.SignatureImageFlag.DontSmooth;
|
||||
|
||||
try
|
||||
{
|
||||
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\temp.tif";
|
||||
// save as file
|
||||
//Result = signoPad._stPad.SignatureSaveAsStreamEx(resolution, width, height, 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);
|
||||
|
||||
//signoPad.CloseConnection();
|
||||
this.Close();
|
||||
}
|
||||
catch (STPadException exc)
|
||||
{
|
||||
Log.WriteLog(exc.ToString());
|
||||
MessageBox.Show(exc.Message);
|
||||
//signoPad.CloseConnection();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async void GetSignatureImage()
|
||||
{
|
||||
//System.Drawing.Bitmap bitmap = SQL.ReadSingleBitmap("");
|
||||
|
||||
//// display image
|
||||
//ImageView imageView = new ImageView();
|
||||
//imageView.BackgroundImage = Helper.ConvertBitmapToImage(bitmap);
|
||||
//imageView.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
signoPad.CloseConnection();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//signoPad.CloseConnection();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
444
ZKuP/ZKuP.csproj
Normal file
@ -0,0 +1,444 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B4348CE1-446F-46A5-BD8A-62C071D4AD10}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>ZKuP</RootNamespace>
|
||||
<AssemblyName>ZKuP</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<AutorunEnabled>true</AutorunEnabled>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>ZKuP.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>none</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>3C16B2C32C7121098E02D5B8C9B97FB987E781D1</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>ZKuP_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Office.Interop.Word.15.0.4797.1003\lib\net20\Microsoft.Office.Interop.Word.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.0.18.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.18\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="STPadLibNet">
|
||||
<HintPath>..\..\..\..\..\..\Program Files\signotec\signoPAD-API\STPadLibNet\STPadLibNet.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net45\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.DirectoryServices.AccountManagement" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard1.1\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="AddCardUser.xaml.cs">
|
||||
<DependentUpon>AddCardUser.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Arrivals.xaml.cs">
|
||||
<DependentUpon>Arrivals.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ArrivalsOverview.xaml.cs">
|
||||
<DependentUpon>ArrivalsOverview.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AspInfo.xaml.cs">
|
||||
<DependentUpon>AspInfo.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Cards.xaml.cs">
|
||||
<DependentUpon>Cards.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CheckParkausweis.xaml.cs">
|
||||
<DependentUpon>CheckParkausweis.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CreateFirma.xaml.cs">
|
||||
<DependentUpon>CreateFirma.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CreateParkausweis.xaml.cs">
|
||||
<DependentUpon>CreateParkausweis.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CreateVisitor.xaml.cs">
|
||||
<DependentUpon>CreateVisitor.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CreateVisitor_List.xaml.cs">
|
||||
<DependentUpon>CreateVisitor_List.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DBImageManager.cs" />
|
||||
<Compile Include="Delivery.xaml.cs">
|
||||
<DependentUpon>Delivery.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GrantParkausweis.xaml.cs">
|
||||
<DependentUpon>GrantParkausweis.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ImageView.xaml.cs">
|
||||
<DependentUpon>ImageView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Log.cs" />
|
||||
<Compile Include="ManageDeliveries.xaml.cs">
|
||||
<DependentUpon>ManageDeliveries.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ManageParkausweis.xaml.cs">
|
||||
<DependentUpon>ManageParkausweis.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ManageVisitor.xaml.cs">
|
||||
<DependentUpon>ManageVisitor.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helper.cs" />
|
||||
<Compile Include="ManageAsp.xaml.cs">
|
||||
<DependentUpon>ManageAsp.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ManageUsers.xaml.cs">
|
||||
<DependentUpon>ManageUsers.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ParkausweisDisclaimer.xaml.cs">
|
||||
<DependentUpon>ParkausweisDisclaimer.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PrintParkausweis.xaml.cs">
|
||||
<DependentUpon>PrintParkausweis.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Signature.xaml.cs">
|
||||
<DependentUpon>Signature.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="signoPad.cs" />
|
||||
<Compile Include="SQL.cs" />
|
||||
<Page Include="AddCardUser.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Arrivals.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ArrivalsOverview.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="AspInfo.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Cards.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CheckParkausweis.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CreateFirma.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CreateParkausweis.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CreateVisitor.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CreateVisitor_List.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Delivery.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="GrantParkausweis.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ImageView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ManageDeliveries.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ManageParkausweis.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ManageVisitor.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="ManageAsp.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ManageUsers.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ParkausweisDisclaimer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="PrintParkausweis.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Signature.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<EmbeddedResource Include="Resources\PLZ_MUC.txt" />
|
||||
<None Include="ZKuP_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="ZKuP.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="FodyWeavers.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 und x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Cancel BW.png" />
|
||||
<Resource Include="Resources\Capture Sigma.png" />
|
||||
<Resource Include="Resources\OK BW.png" />
|
||||
<Resource Include="Resources\Pad Sigma.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\db-logo.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="VBIDE">
|
||||
<Guid>{0002E157-0000-0000-C000-000000000046}</Guid>
|
||||
<VersionMajor>5</VersionMajor>
|
||||
<VersionMinor>3</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>primary</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\NoSignature.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Fody.6.0.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.0.0\build\Fody.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Fody.6.0.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.0.0\build\Fody.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
BIN
ZKuP/ZKuP.ico
Normal file
|
After Width: | Height: | Size: 142 KiB |
15
ZKuP/packages.config
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle" version="1.8.3.1" targetFramework="net452" />
|
||||
<package id="Costura.Fody" version="4.1.0" targetFramework="net452" />
|
||||
<package id="Fody" version="6.0.0" targetFramework="net452" developmentDependency="true" />
|
||||
<package id="Google.Protobuf" version="3.6.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Office.Interop.Word" version="15.0.4797.1003" targetFramework="net452" />
|
||||
<package id="MySql.Data" version="8.0.18" targetFramework="net452" />
|
||||
<package id="SSH.NET" version="2016.1.0" targetFramework="net452" />
|
||||
<package id="System.Buffers" version="4.4.0" targetFramework="net452" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.6.0" targetFramework="net452" />
|
||||
<package id="System.Memory" version="4.5.3" targetFramework="net452" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net452" />
|
||||
<package id="System.ValueTuple" version="4.3.0" targetFramework="net452" />
|
||||
</packages>
|
||||
868
ZKuP/signoPad.cs
Normal file
@ -0,0 +1,868 @@
|
||||
using signotec.STPadLibNet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Imaging;
|
||||
using static ZKuP.signoPad;
|
||||
|
||||
namespace ZKuP
|
||||
{
|
||||
public class signoPad
|
||||
{
|
||||
public enum PadModel
|
||||
{
|
||||
Sigma,
|
||||
Zeta,
|
||||
Omega,
|
||||
Gamma,
|
||||
Delta,
|
||||
Alpha
|
||||
}
|
||||
|
||||
|
||||
//private static STPadLibControl _stPad = new STPadLibControl();
|
||||
private static STPadLibControl sTPad = new STPadLibControl();
|
||||
public static STPadLibControl _stPad
|
||||
{
|
||||
get { return sTPad; }
|
||||
set { sTPad = value; }
|
||||
}
|
||||
|
||||
|
||||
private static SignPad[] _signPads = null;
|
||||
private static DisplayTarget _storeIdSigning = DisplayTarget.NewStandardStore;
|
||||
private static DisplayTarget _storeIdOverlay = DisplayTarget.NewStandardStore;
|
||||
|
||||
private static int _buttonCancelId = -1;
|
||||
private static int _buttonRetryId = -1;
|
||||
private static int _buttonConfirmId = -1;
|
||||
|
||||
static string _disclaimer = "";
|
||||
|
||||
|
||||
private static void GetDevices()
|
||||
{
|
||||
try
|
||||
{
|
||||
//sTPad = new STPadLibControl();
|
||||
// get number of connected devices
|
||||
int deviceCount = _stPad.DeviceGetCount();
|
||||
|
||||
// erase all entries
|
||||
//ListOfDevices.Items.Clear();
|
||||
|
||||
// build list
|
||||
if (deviceCount <= 0)
|
||||
{ // no devices detected
|
||||
_signPads = null;
|
||||
System.Windows.MessageBox.Show("Kein Unterschriftenpad gefunden!", "Fehler", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
|
||||
//ListOfDevices.Items.Add("No Devices");
|
||||
//ListOfDevices.Items.Add("detected");
|
||||
//ListOfDevices.IsEnabled = false;
|
||||
//ButtonOpenClose.Content = "Open";
|
||||
//ButtonOpenClose.IsEnabled = false;
|
||||
//ButtonStartCancel.IsEnabled = false;
|
||||
//ButtonRetry.IsEnabled = false;
|
||||
//ButtonConfirm.IsEnabled = false;
|
||||
//ImagePad.Source = GetBitmapFromResource(STPadLibNet_Demo_App.Properties.Resources.Welcome, System.Drawing.Imaging.ImageFormat.Png);
|
||||
//ImagePad.Visibility = Visibility.Visible;
|
||||
//ImageLed.Visibility = Visibility.Hidden;
|
||||
//STPadLibControlHost.Visibility = Visibility.Hidden;
|
||||
//LabelType.Content = "Type: -";
|
||||
//LabelPort.Content = "Port: -";
|
||||
//LabelFirmware.Content = "Firmware: -";
|
||||
//LabelSerial.Content = "Serial: -";
|
||||
//LabelDisplay.Content = "Display: -";
|
||||
}
|
||||
else
|
||||
{ // build device list
|
||||
_signPads = new SignPad[deviceCount];
|
||||
for (int i = 0; i < deviceCount; i++)
|
||||
{
|
||||
_signPads[i] = new SignPad(_stPad, i);
|
||||
//ListOfDevices.Items.Add(String.Format("Device {0}", i + 1));
|
||||
}
|
||||
//ListOfDevices.IsEnabled = true;
|
||||
|
||||
// select first element of list
|
||||
//if (deviceCount > 0)
|
||||
// 0 = 0;
|
||||
_stPad.SensorHotSpotPressed += new SensorHotSpotPressedEventHandler(STPad_SensorHotSpotPressed);
|
||||
_stPad.ControlMirrorDisplay = MirrorMode.Signature;
|
||||
|
||||
}
|
||||
}
|
||||
catch (STPadException exc)
|
||||
{
|
||||
Log.WriteLog(exc.ToString());
|
||||
MessageBox.Show(exc.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool ShowDisclaimer(string Name = "", string Firma = "", string Kennzeichen = "", bool showDisclaimer = true)
|
||||
{
|
||||
// display disclaimer and two buttons "Cancel" and "Confirm"
|
||||
GetDevices();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
_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();
|
||||
|
||||
// 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 (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}");
|
||||
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}");
|
||||
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}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Firma != "" && Name != "" && Kennzeichen != "")
|
||||
_stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Firma / 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, $"Firma / Besucher: {Firma}\nVerantwortlicher: {Name}");
|
||||
else
|
||||
_stPad.DisplaySetTextInRect(10, 10, _stPad.DisplayWidth - 20, _stPad.DisplayHeight - 60, signotec.STPadLibNet.TextAlignment.Left, $"Firma / Besucher: {Firma}");
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void CancelProcess()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_stPad.SignatureState)
|
||||
// cancel capturing (this clears the LCD, too)
|
||||
_stPad.SignatureCancel();
|
||||
else
|
||||
{
|
||||
// disable pen scrolling
|
||||
_stPad.SensorSetPenScrollingEnabled(false);
|
||||
|
||||
// erase LCD
|
||||
_stPad.DisplayErase();
|
||||
}
|
||||
|
||||
// clear all hot spots
|
||||
ClearHotSpots();
|
||||
}
|
||||
catch (STPadException exc)
|
||||
{
|
||||
Log.WriteLog(exc.ToString());
|
||||
MessageBox.Show(exc.Message);
|
||||
//throw;
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
//this.Cursor = Cursors.Arrow;
|
||||
}
|
||||
|
||||
//ButtonStartCancel.Content = "Start";
|
||||
//ButtonStartCancel.IsEnabled = true;
|
||||
//ButtonRetry.IsEnabled = false;
|
||||
//ButtonConfirm.IsEnabled = false;
|
||||
try
|
||||
{
|
||||
// ImageLed.Source = GetBitmapFromResource(STPadLibNet_Demo_App.Properties.Resources.LED_Yellow, System.Drawing.Imaging.ImageFormat.Png);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void STPad_SensorHotSpotPressed(object sender, SensorHotSpotPressedEventArgs e)
|
||||
{
|
||||
SensorHotSpotPressedEventHandler handler = new SensorHotSpotPressedEventHandler(SensorHotSpotPressed);
|
||||
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(handler, new object[] { sender, e });
|
||||
}
|
||||
|
||||
private static void SensorHotSpotPressed(object sender, SensorHotSpotPressedEventArgs e)
|
||||
{
|
||||
if (e.hotSpotId == _buttonCancelId) System.Diagnostics.Debug.WriteLine("test");
|
||||
//ButtonStartCancel_Click(this, new System.Windows.RoutedEventArgs());
|
||||
else if (e.hotSpotId == _buttonRetryId)
|
||||
ButtonRetry_Click(sender, new System.Windows.RoutedEventArgs());
|
||||
else if (e.hotSpotId == _buttonConfirmId)
|
||||
ButtonConfirm_Click(sender, new System.Windows.RoutedEventArgs());
|
||||
else
|
||||
MessageBox.Show(String.Format("Hot Spot {0} clicked.", e.hotSpotId + 1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void CloseConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
// erase display
|
||||
_stPad.DisplayErase();
|
||||
|
||||
// clear hot spots
|
||||
ClearHotSpots();
|
||||
|
||||
_stPad.DeviceClose(0);
|
||||
|
||||
//_signPads = null;
|
||||
//_stPad = null;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static void ButtonRetry_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_stPad.SignatureState == true)
|
||||
_stPad.SignatureRetry();
|
||||
else
|
||||
StartDefaultCapturing();
|
||||
}
|
||||
catch (STPadException exc)
|
||||
{
|
||||
Log.WriteLog(exc.ToString());
|
||||
MessageBox.Show(exc.Message);
|
||||
//throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ButtonConfirm_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (_stPad.SignatureState == false)
|
||||
// accept disclaimer and start capturing
|
||||
StartDefaultCapturing();
|
||||
else
|
||||
ConfirmCapturing();
|
||||
}
|
||||
|
||||
private static bool StartDefaultCapturing()
|
||||
{
|
||||
try
|
||||
{
|
||||
// disable pen scrolling
|
||||
_stPad.SensorSetPenScrollingEnabled(false);
|
||||
|
||||
// erase display
|
||||
_stPad.DisplayErase();
|
||||
|
||||
// clear hot spots
|
||||
ClearHotSpots();
|
||||
|
||||
if (_signPads[0].HasDisplay)
|
||||
{
|
||||
if (_signPads[0].FastConnection)
|
||||
{ // "fast" pad or connection
|
||||
// do all drawing operations in the background buffer
|
||||
_stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
|
||||
}
|
||||
else
|
||||
{ // "slow" pad or connection: do all drawing operations in the permanent memory
|
||||
// make sure that always the second permanent memory is used
|
||||
if (_storeIdOverlay < 0)
|
||||
_storeIdOverlay = _stPad.DisplaySetTarget(_storeIdOverlay);
|
||||
// set permanent memory as target
|
||||
_storeIdSigning = _stPad.DisplaySetTarget(_storeIdSigning);
|
||||
}
|
||||
|
||||
// draw the bitmaps
|
||||
System.Drawing.Bitmap bitmap = null;
|
||||
switch (_signPads[0].PadModel)
|
||||
{
|
||||
case PadModel.Sigma:
|
||||
bitmap = Helper.LoadBitmapFromResource("Resources/Capture Sigma.png");
|
||||
break;
|
||||
}
|
||||
_stPad.DisplaySetImage(0, 0, bitmap);
|
||||
|
||||
if (!_signPads[0].FastConnection)
|
||||
{
|
||||
// do all drawing operations in the background buffer
|
||||
_stPad.DisplaySetTarget(DisplayTarget.BackgroundBuffer);
|
||||
|
||||
// draw stored image
|
||||
_stPad.DisplaySetImageFromStore(_storeIdSigning);
|
||||
}
|
||||
|
||||
if (_signPads[0].PadModel == PadModel.Alpha)
|
||||
// draw disclaimer
|
||||
_stPad.DisplaySetTextInRect(50, 250, _stPad.DisplayWidth - 100, 300, signotec.STPadLibNet.TextAlignment.Left, "With my signature, I certify that I'm excited about the signotec LCD Signature Pad and the signotec Pad Capture Control. This demo application has blown me away and I can't wait to integrate all these great features in my own application.");
|
||||
|
||||
// do all drawing operations on the LCD directly
|
||||
_stPad.DisplaySetTarget(DisplayTarget.ForegroundBuffer);
|
||||
|
||||
// draw buffered image
|
||||
_stPad.DisplaySetImageFromStore(DisplayTarget.BackgroundBuffer);
|
||||
|
||||
// set default signature window
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
switch (_signPads[0].PadModel)
|
||||
{
|
||||
case PadModel.Sigma:
|
||||
case PadModel.Zeta:
|
||||
y = 50;
|
||||
break;
|
||||
case PadModel.Omega:
|
||||
case PadModel.Gamma:
|
||||
case PadModel.Delta:
|
||||
y = 100;
|
||||
break;
|
||||
case PadModel.Alpha:
|
||||
x = 90;
|
||||
y = 600;
|
||||
width = 590;
|
||||
height = 370;
|
||||
break;
|
||||
}
|
||||
_stPad.SensorSetSignRect(x, y, width, height);
|
||||
|
||||
// add default hotspots
|
||||
switch (_signPads[0].PadModel)
|
||||
{
|
||||
case PadModel.Sigma:
|
||||
case PadModel.Zeta:
|
||||
x = 12;
|
||||
y = 9;
|
||||
width = 85;
|
||||
height = 33;
|
||||
break;
|
||||
case PadModel.Omega:
|
||||
case PadModel.Gamma:
|
||||
x = 24;
|
||||
y = 18;
|
||||
width = 170;
|
||||
height = 66;
|
||||
break;
|
||||
case PadModel.Delta:
|
||||
x = 150;
|
||||
y = 18;
|
||||
width = 170;
|
||||
height = 66;
|
||||
break;
|
||||
case PadModel.Alpha:
|
||||
x = 30;
|
||||
y = 30;
|
||||
width = 80;
|
||||
height = 80;
|
||||
break;
|
||||
}
|
||||
_buttonCancelId = _stPad.SensorAddHotSpot(x, y, width, height);
|
||||
|
||||
switch (_signPads[0].PadModel)
|
||||
{
|
||||
case PadModel.Sigma:
|
||||
case PadModel.Zeta:
|
||||
x = 117;
|
||||
break;
|
||||
case PadModel.Omega:
|
||||
x = 234;
|
||||
break;
|
||||
case PadModel.Gamma:
|
||||
x = 315;
|
||||
break;
|
||||
case PadModel.Delta:
|
||||
x = 555;
|
||||
break;
|
||||
case PadModel.Alpha:
|
||||
x = 344;
|
||||
break;
|
||||
}
|
||||
_buttonRetryId = _stPad.SensorAddHotSpot(x, y, width, height);
|
||||
|
||||
switch (_signPads[0].PadModel)
|
||||
{
|
||||
case PadModel.Sigma:
|
||||
case PadModel.Zeta:
|
||||
x = 222;
|
||||
break;
|
||||
case PadModel.Omega:
|
||||
x = 444;
|
||||
break;
|
||||
case PadModel.Gamma:
|
||||
x = 605;
|
||||
break;
|
||||
case PadModel.Delta:
|
||||
x = 960;
|
||||
break;
|
||||
case PadModel.Alpha:
|
||||
x = 658;
|
||||
break;
|
||||
}
|
||||
_buttonConfirmId = _stPad.SensorAddHotSpot(x, y, width, height);
|
||||
}
|
||||
|
||||
// start capturing
|
||||
_stPad.SignatureStart();
|
||||
|
||||
}
|
||||
catch (STPadException exc)
|
||||
{
|
||||
Log.WriteLog(exc.ToString());
|
||||
MessageBox.Show(exc.Message);
|
||||
//throw;
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void ConfirmCapturing()
|
||||
{
|
||||
try
|
||||
{
|
||||
// confirm capturing
|
||||
_stPad.SignatureConfirm();
|
||||
|
||||
// clear hot spots
|
||||
ClearHotSpots();
|
||||
}
|
||||
catch (STPadException exc)
|
||||
{
|
||||
Log.WriteLog(exc.ToString());
|
||||
MessageBox.Show(exc.Message);
|
||||
//throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region helper methods
|
||||
|
||||
private static void ClearHotSpots()
|
||||
{
|
||||
try
|
||||
{
|
||||
_stPad.SensorClearHotSpots();
|
||||
}
|
||||
catch (STPadException exc)
|
||||
{
|
||||
Log.WriteLog(exc.ToString());
|
||||
if (exc.ErrorCode != -22)
|
||||
throw exc;
|
||||
}
|
||||
//_buttonCancelId = -1;
|
||||
//_buttonRetryId = -1;
|
||||
//_buttonConfirmId = -1;
|
||||
}
|
||||
|
||||
private System.Windows.Media.Imaging.BitmapImage GetBitmapFromResource(System.Drawing.Bitmap bitmap, System.Drawing.Imaging.ImageFormat imageFormat)
|
||||
{
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
bitmap.Save(ms, imageFormat);
|
||||
System.Windows.Media.Imaging.BitmapImage bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.StreamSource = ms;
|
||||
bitmapImage.EndInit();
|
||||
return bitmapImage;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class SignPad
|
||||
{
|
||||
private STPadLibControl _stPad = null;
|
||||
private int _index = -1;
|
||||
private int _padType = 0;
|
||||
private int _connectionType = 0;
|
||||
private string _serial = "";
|
||||
private int _fwMajor = 0;
|
||||
private int _fwMinor = 0;
|
||||
|
||||
public SignPad()
|
||||
{
|
||||
}
|
||||
|
||||
public SignPad(STPadLibControl stPad, int index)
|
||||
{
|
||||
_stPad = stPad;
|
||||
_index = index;
|
||||
|
||||
// get serial and type of selected device
|
||||
_stPad.DeviceGetInfo(out _serial, out _padType, index);
|
||||
|
||||
// get connection type
|
||||
_connectionType = _stPad.DeviceGetConnectionType(index);
|
||||
|
||||
// get firmware version
|
||||
string version = _stPad.DeviceGetVersion(index);
|
||||
string[] versionArray = version.Split('.');
|
||||
if ((versionArray != null) && (versionArray.Length > 1))
|
||||
{
|
||||
_fwMajor = Int32.Parse(versionArray[0]);
|
||||
_fwMinor = Int32.Parse(versionArray[1]);
|
||||
}
|
||||
}
|
||||
|
||||
public int PadType
|
||||
{
|
||||
get { return _padType; }
|
||||
}
|
||||
|
||||
public PadModel PadModel
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (PadType)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
return PadModel.Sigma;
|
||||
case 5:
|
||||
case 6:
|
||||
return PadModel.Zeta;
|
||||
case 11:
|
||||
case 12:
|
||||
return PadModel.Omega;
|
||||
case 15:
|
||||
case 16:
|
||||
return PadModel.Gamma;
|
||||
case 21:
|
||||
case 22:
|
||||
case 23:
|
||||
return PadModel.Delta;
|
||||
case 31:
|
||||
case 32:
|
||||
case 33:
|
||||
return PadModel.Alpha;
|
||||
default:
|
||||
throw new Exception("This pad type is not supported by this demo application!");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public string PadName
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (_padType)
|
||||
{
|
||||
case 1:
|
||||
return "Sigma USB";
|
||||
case 2:
|
||||
return "Sigma Serial";
|
||||
case 5:
|
||||
return "Zeta USB";
|
||||
case 6:
|
||||
return "Zeta Serial";
|
||||
case 11:
|
||||
return "Omega USB";
|
||||
case 12:
|
||||
return "Omega Serial";
|
||||
case 15:
|
||||
return "Gamma USB";
|
||||
case 16:
|
||||
return "Gamma Serial";
|
||||
case 21:
|
||||
return "Delta USB";
|
||||
case 22:
|
||||
return "Delta Serial";
|
||||
case 23:
|
||||
return "Delta IP";
|
||||
case 31:
|
||||
return "Alpha USB";
|
||||
case 32:
|
||||
return "Alpha Serial";
|
||||
case 33:
|
||||
return "Alpha IP";
|
||||
default:
|
||||
return "Unkown pad type " + _padType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ConnectionName
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (_connectionType)
|
||||
{
|
||||
case 0:
|
||||
return "HID";
|
||||
case 1:
|
||||
return "USB";
|
||||
case 2:
|
||||
return String.Format("COM{0}", _stPad.DeviceGetComPort(_index));
|
||||
case 3:
|
||||
return _stPad.DeviceGetIPAddress(_index);
|
||||
default:
|
||||
return "Unkown connection type " + _connectionType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool USB
|
||||
{
|
||||
get { return (_connectionType == 1); }
|
||||
}
|
||||
|
||||
public string Serial
|
||||
{
|
||||
get { return _serial; }
|
||||
}
|
||||
|
||||
public bool FastConnection
|
||||
{
|
||||
get { return (USB || (PadModel == PadModel.Sigma)); }
|
||||
}
|
||||
|
||||
public string Firmware
|
||||
{
|
||||
get { return String.Format("{0}.{1}", _fwMajor, _fwMinor); }
|
||||
}
|
||||
|
||||
public bool HasDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_stPad == null)
|
||||
return false;
|
||||
else
|
||||
return _stPad.DeviceGetCapabilities(_index).HasDisplay;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SupportsPenScrolling
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_stPad == null)
|
||||
return false;
|
||||
else
|
||||
return _stPad.DeviceGetCapabilities(_index).SupportsPenScrolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
ZKuPProject.sln
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30320.27
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZKuP", "ZKuP\ZKuP.csproj", "{B4348CE1-446F-46A5-BD8A-62C071D4AD10}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Debug|x64.Build.0 = Debug|x64
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Debug|x86.Build.0 = Debug|x86
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Release|x64.ActiveCfg = Release|x64
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Release|x64.Build.0 = Release|x64
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Release|x86.ActiveCfg = Release|x86
|
||||
{B4348CE1-446F-46A5-BD8A-62C071D4AD10}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FBD172F2-AE5F-46FB-A93D-2296F8CD63E4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||