Neues Gitea

This commit is contained in:
Marcus 2025-07-28 08:20:11 +02:00
parent 8e137afec8
commit 12474f99be
122 changed files with 9523 additions and 3263 deletions

View File

@ -1,27 +1,35 @@
<Window x:Class="ZKuP.AddCardUser"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Kartenbenutzer" Height="392" Width="594">
Title="Kartenbenutzer" MinHeight="450" Height="450" Width="594" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="0.5*"/>
<RowDefinition/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.7*"/>
</Grid.RowDefinitions>
<TextBlock Margin="10,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Kartennummer" VerticalAlignment="Top"/>
<TextBlock Margin="10,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Grid.Row="1" TextWrapping="Wrap" Text="Farbe" VerticalAlignment="Top"/>
<TextBlock Margin="10,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" SelectedIndex="0"/>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="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" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" Padding="-2" Height="25" VerticalAlignment="Bottom" Click="btnAdd_Click"/>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Person*" VerticalAlignment="Top" Width="226"/>
<ComboBox x:Name="tbUser" Margin="10,0,10,10" Grid.Row="2" Height="23" VerticalAlignment="Bottom" IsEditable="True"/>
<TextBlock x:Name="lblFirma" HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Firma*" VerticalAlignment="Top" Width="226"/>
<TextBox x:Name="tbFirma" Margin="10,0,10,10" Grid.Row="3" TextWrapping="Wrap" Height="23" VerticalAlignment="Bottom" MaxLength="254"/>
<TextBlock x:Name="lblTelnr" Margin="10,10,10,0" Grid.Row="4" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Telefonnummer*" VerticalAlignment="Top"/>
<ComboBox x:Name="tbTelnr" Height="23" Margin="10,0,10,10" Grid.Row="4" IsEditable="True" VerticalAlignment="Bottom"/>
<TextBlock Text="* Pflichtfelder" Grid.Row="5" Margin="20,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Button x:Name="btnAdd" Content="Hinzufügen" Margin="10,0,10,10" Grid.Row="6" Padding="-2" Height="25" VerticalAlignment="Bottom" Click="btnAdd_Click"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -18,37 +19,69 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für AddCardUser.xaml
/// </summary>
public partial class AddCardUser : Window
public partial class AddCardUser : MetroWindow
{
string _user = "";
string _ansprechpartnerFirma = "";
bool _isBesucher = false;
List<string> comboList = new List<string>() { "Grün", "Rot", "Gerätewagen" };
List<string> comboListNurRot = new List<string>() { "Rot" };
List<string> mitarbeiterList = new List<string>();
List<string> telList = new List<string>();
byte[] _signature = null;
string _ap = "";
bool _needTel = true;
public AddCardUser(string user = "", bool isBesucher = false, string nr = "", string ap = "", bool needTel = true)
public AddCardUser(string user = "", bool isBesucher = false, string count = "", string ap = "", bool needTel = true, bool hasEinweisung = false, string firma = "", string telnr = "", string idFirma = "")
{
_user = user;
_ap = ap;
_needTel = needTel;
_isBesucher = isBesucher;
InitializeComponent();
this.Title = "Karten ausgeben - " + nr;
Helper.InitSerial();
Helper.DataReceived += Helper_DataReceived;
//cbColor.ItemsSource = isBesucher ? comboListNurRot : comboList;
cbColor.ItemsSource = comboListNurRot;
this.Title = "Karten ausgeben - " + count;
lblFirma.Text = isBesucher ? "Firma" : "Firma*";
lblTelnr.Text = needTel ? "Telefonnummer*" : "Telefonnummer";
cbColor.ItemsSource = isBesucher ? comboListNurRot : comboList;
cbColor.ItemsSource = hasEinweisung ? comboList : comboListNurRot;
//cbColor.ItemsSource = comboListNurRot;
if (!isBesucher)
{
tbFirma.Text = firma;
mitarbeiterList = SQL.ReadSingleValue($"SELECT Personen FROM {MainWindow.table}.firmenPeople WHERE idFirmen = '{idFirma}'").Split(';').ToList();
telList = SQL.ReadSingleValue($"SELECT TelNr FROM {MainWindow.table}.firmenPeople WHERE idFirmen = '{idFirma}'").Split(';').ToList();
if (!mitarbeiterList.Contains(user)) mitarbeiterList.Add(user);
if (!telList.Contains(telnr)) telList.Add(telnr);
tbUser.ItemsSource = mitarbeiterList;
tbTelnr.ItemsSource = telList;
if (!string.IsNullOrWhiteSpace(count))
{
var selection = Convert.ToInt16(count.Split('/')[0]) - 2;
tbUser.SelectedIndex = selection;
tbTelnr.SelectedIndex = selection;
}
}
if (!user.Contains("["))
{
tbUser.Text = user;
if(tbUser.SelectedIndex == -1) tbUser.Text = user;
try
{
if (user != "")
tbTelnr.Text = SQL.ReadSingleValue($"SELECT Tel_Nr_Verantwortlicher_Firma FROM {MainWindow.table}.firmen WHERE Name='{user}'");
tbTelnr.Text = telnr;
//tbTelnr.Text = SQL.ReadSingleValue($"SELECT Tel_Nr_Verantwortlicher_Firma FROM {MainWindow.table}.firmen WHERE Name='{user}'");
}
catch (Exception)
{
@ -63,15 +96,41 @@ namespace ZKuP
}
}
private void Helper_DataReceived(object sender, string e)
{
var text = "";
Dispatcher.Invoke(() => text = tbNummer.Text = e.Split('=')[0]);
if (!string.IsNullOrWhiteSpace(text))
{
var farbe = SQL.ReadSingleValue($"SELECT Farbe FROM {MainWindow.table}.kartennummern WHERE Kartennummer='{text}'");
Dispatcher.Invoke(() =>
{
switch (farbe)
{
case "1":
cbColor.SelectedValue = "Rot";
break;
case "2":
cbColor.SelectedValue = "Grün";
break;
}
});
}
}
private async void btnAdd_Click(object sender, RoutedEventArgs e)
{
if (tbNummer.Text == "")
if (string.IsNullOrWhiteSpace(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, "Benutzer angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (_needTel && tbTelnr.Text == "")
else if (string.IsNullOrWhiteSpace(tbUser.Text))
MessageBox.Show(this, "Person angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (!_isBesucher && string.IsNullOrWhiteSpace(tbFirma.Text))
MessageBox.Show(this, "Firma angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (_needTel && string.IsNullOrWhiteSpace(tbTelnr.Text))
MessageBox.Show(this, "Telefonnummer angeben!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else
{
@ -85,7 +144,7 @@ namespace ZKuP
if (_signature != null)
{
await SQL.WriteSQL($"REPLACE INTO karten (kartennr,farbe,benutzer,telnr,AusgegebenDurch,AusgegebenTimestamp,Signature,Ansprechpartner) VALUES ('{tbNummer.Text}','{cbColor.SelectedValue.ToString()}','{tbUser.Text}','{tbTelnr.Text}','{Environment.UserName}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', @signature, '{_ap}')", _signature);
await SQL.WriteSQL($"REPLACE INTO karten (kartennr,farbe,benutzer,telnr,AusgegebenDurch,AusgegebenTimestamp,Ansprechpartner,Signature) VALUES ('{tbNummer.Text}','{cbColor.SelectedValue.ToString()}','{tbUser.Text}','{tbTelnr.Text}','{Environment.UserName}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','{_ap}',@signature)", _signature);
MessageBox.Show(this, "Karte erfolgreich verknüpft", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
@ -112,9 +171,16 @@ namespace ZKuP
}
private void tbUser_PreviewTextInput(object sender, TextCompositionEventArgs e)
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if (tbUser.Text.Length >= 254) e.Handled = true;
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

24
ZKuP/AddFirmenList.xaml Normal file
View File

@ -0,0 +1,24 @@
<mah:MetroWindow x:Class="ZKuP.AddFirmenList"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Begleitpersonen angeben" MinHeight="70" MinWidth="630" Width="630" Loaded="Window_Loaded" Closing="Window_Closing" LocationChanged="Window_LocationChanged">
<Grid>
<!--<StackPanel Orientation="Horizontal">-->
<StackPanel x:Name="spGroupPers" Orientation="Horizontal" Margin="0,0,0,0" >
</StackPanel>
<!--<StackPanel x:Name="spGroupTel" Orientation="Horizontal" Margin="0,0,0,50" >
</StackPanel>
</StackPanel>-->
<Button x:Name="btnAdd" Content="" ToolTip="Begleitperson hinzufügen" ToolTipService.InitialShowDelay="200" FontFamily="Segoe UI Symbol" FontSize="12" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,0,0,10" Click="btnAdd_Click" Width="30" Height="30"/>
<Button x:Name="btnRemove" Content="" ToolTip="Letzte Zeile entfernen" ToolTipService.InitialShowDelay="200" FontFamily="Segoe UI Symbol" FontSize="12" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="50,0,0,10" Click="btnRemove_Click" Width="30" Height="30"/>
<Button x:Name="btnSend" Content="Eintragen" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Click="btnSend_Click"/>
</Grid>
</mah:MetroWindow>

287
ZKuP/AddFirmenList.xaml.cs Normal file
View File

@ -0,0 +1,287 @@
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.RightsManagement;
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 AddVisitorsList.xaml
/// </summary>
public partial class AddFirmenList : MetroWindow
{
public int GroupID { get; private set; }
int width = 0;
bool _isEdit = false;
int _idFirmen = 0;
public string Personen { get; set; }
public string TelNr { get; set; }
public AddFirmenList(bool isEdit = false, int idFirmen = 0, int PeopleCount = 0)
{
InitializeComponent();
if (isEdit)
{
_isEdit = isEdit;
_idFirmen = idFirmen;
btnAdd.Visibility = Visibility.Visible;
BuildWindow(PeopleCount);
var list = SQL.ReadSingleValue($"SELECT Personen FROM {MainWindow.table}.firmenPeople WHERE idFirmen = '{_idFirmen}'").Split(';');
if (list.Length > 0)
{
var boxes = Helper.FindVisualChildren<TextBox>(spGroupPers).Where(p => p.Tag.ToString() == "Name").ToList();
for (var i = 0; i < boxes.Count(); i++)
{
if (list.Length > i && !string.IsNullOrWhiteSpace(list[i]))
{
if (boxes[i].Tag == "Name")
boxes[i].Text = list[i];
}
}
boxes = Helper.FindVisualChildren<TextBox>(spGroupPers).Where(p => p.Tag.ToString() == "Tel").ToList();
list = SQL.ReadSingleValue($"SELECT TelNr FROM {MainWindow.table}.firmenPeople WHERE idFirmen = '{_idFirmen}'").Split(';');
for (var i = 0; i < boxes.Count(); i++)
{
if (list.Length > i && !string.IsNullOrWhiteSpace(list[i]))
{
if (boxes[i].Tag == "Tel")
boxes[i].Text = list[i];
}
}
}
}
else
{
if(PeopleCount > 0)
{
for (var i = 0; i < PeopleCount; i++)
Add();
}
}
}
private void BuildWindow(int besucherAnzahl)
{
int maxProSpalte = 10; // Maximale Anzahl an Textfeldern pro Spalte
// PanelsContainer soll die WrapPanels halten
spGroupPers.Children.Clear(); // Vorherige Panels entfernen (falls schon welche existieren)
// Erstelle die WrapPanels und füge sie dem StackPanel hinzu
int columnCount = 2;// (int)Math.Ceiling((double)besucherAnzahl / maxProSpalte);
//for (int i = 0; i < columnCount; i++)
//{
WrapPanel wrapPanel = new WrapPanel()
{
//Orientation = Orientation.Vertical, // Jedes WrapPanel wird vertikal sein
Margin = new Thickness(10),
Width = 600
};
// Für jedes WrapPanel Textfelder hinzufügen
for (int j = 0; j < besucherAnzahl; j++)
{
var mainPanel = new StackPanel();
mainPanel.Orientation = Orientation.Horizontal;
var sp = new StackPanel();
var lbl = new TextBlock() { Text = $"Begleitperson Nr. {j + 1}:", Margin = new Thickness(5), Height = 20 };
lbl.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
sp.Children.Add(lbl);
var tb = new TextBox() { Tag = "Name", Margin = new Thickness(10, 0, 10, 0), Height = 30, Width = 280, ToolTip = "Um eine Person zu entfernen, Feld leer lassen" };
ToolTipService.SetInitialShowDelay(tb, 200);
MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb, "Vorname Nachname");
sp.Children.Add(tb);
var sp2 = new StackPanel();
var lbl2 = new TextBlock() { Text = $"", Margin = new Thickness(5), Height = 20 };
lbl2.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
sp2.Children.Add(lbl2);
var tb2 = new TextBox() { Tag = "Tel", Margin = new Thickness(10, 0, 10, 0), Height = 30, Width = 280, ToolTip = "Um eine Person zu entfernen, Feld leer lassen" };
ToolTipService.SetInitialShowDelay(tb2, 200);
MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb2, "Telefonnummer");
sp2.Children.Add(tb2);
mainPanel.Children.Add(sp);
mainPanel.Children.Add(sp2);
wrapPanel.Children.Add(mainPanel);
}
// Das WrapPanel zum StackPanel hinzufügen
spGroupPers.Children.Add(wrapPanel);
//}
width = (columnCount * 320) + 10;
//this.Height = this.MinHeight + (besucherAnzahl * 80);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.Height = spGroupPers.DesiredSize.Height + 80;
this.Width = width;
Helper.CheckWindowIsInScreenSpace(this);
}
private async void btnSend_Click(object sender, RoutedEventArgs e)
{
//await SendIt();
this.Close();
}
private async Task SendIt()
{
var textBoxes = Helper.FindVisualChildren<TextBox>(spGroupPers);
var person = "";
foreach (var textBox in textBoxes)
{
if (textBox.Tag != null && (!string.IsNullOrWhiteSpace(textBox.Text) && textBox.Tag.ToString() == "Name")) person = textBox.Text;
else if (textBox.Tag == null) return;
//else if (string.IsNullOrWhiteSpace(textBox.Text))
//{
// MessageBox.Show("Namensfeld muss ausgefüllt werden", "Fehlende Daten", MessageBoxButton.OK, MessageBoxImage.Error);
// return;
//}
if (textBox.Tag != null && textBox.Tag.ToString() == "Tel")
{
//if(!string.IsNullOrWhiteSpace(textBox.Text))
//{
// MessageBox.Show("Telefonnummer muss ausgefüllt werden", "Fehlende Daten", MessageBoxButton.OK, MessageBoxImage.Error);
// return;
//}
Personen += person + ";";
TelNr += textBox.Text + ";";
}
}
if (Personen != null) Personen = Personen.TrimEnd(';');
if (TelNr != null) TelNr = TelNr.TrimEnd(';');
if (Personen != null)
{
await SQL.CreateAndWriteSQL($"DELETE FROM {MainWindow.table}.firmenPeople WHERE idFirmen = @id", new List<MySqlParameter>()
{
new MySqlParameter("@id", _idFirmen)
});
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.firmenPeople (idFirmen, Personen, TelNr) VALUES (@id, @personen, @tel)", new List<MySqlParameter>()
{
new MySqlParameter("@id", _idFirmen),
new MySqlParameter("@personen", Personen),
new MySqlParameter("@tel", TelNr)
});
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.firmen SET Anzahl_Begleiter = @anzahl WHERE idFirmen = @id", new List<MySqlParameter>()
{
new MySqlParameter("@id", _idFirmen),
new MySqlParameter("@anzahl", Personen.Split(';').Length)
});
}
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
Add();
}
private void Add()
{
bool zeroPanels = false;
WrapPanel wrapPanel = new WrapPanel
{
Orientation = Orientation.Vertical, // Jedes WrapPanel wird vertikal sein
Margin = new Thickness(10),
Width = 600
};
if (Helper.FindVisualChildren<WrapPanel>(spGroupPers).Count() > 0)
{
wrapPanel = Helper.FindVisualChildren<WrapPanel>(spGroupPers).Last();
}
else
zeroPanels = true;
var nr = Helper.FindVisualChildren<TextBlock>(spGroupPers).Where(p => p.Text.StartsWith("Begleitperson")).Count();
var mainSp = new StackPanel() { Tag = "Count" };
mainSp.Orientation = Orientation.Horizontal;
var sp = new StackPanel();
var lbl = new TextBlock() { Text = $"Begleitperson Nr. {nr + 1}:", Margin = new Thickness(5), Height = 20 };
lbl.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
sp.Children.Add(lbl);
var tb = new TextBox() { Margin = new Thickness(10, 0, 10, 0), Height = 30, Width = 280, ToolTip = "Um eine Person zu entfernen, Feld leer lassen", Tag = "Name" };
ToolTipService.SetInitialShowDelay(tb, 200);
MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb, "Vorname Nachname");
sp.Children.Add(tb);
mainSp.Children.Add(sp);
var tbTel = new TextBox() { Margin = new Thickness(10, 30, 10, 0), Height = 30, Width = 280, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, ToolTip = "Um eine Person zu entfernen, Feld leer lassen", Tag = "Tel" };
ToolTipService.SetInitialShowDelay(tbTel, 200);
MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tbTel, "Telefonnummer");
mainSp.Children.Add(tbTel);
wrapPanel.Children.Add(mainSp);
this.Height = this.Height + 60;
// Das WrapPanel zum StackPanel hinzufügen
if (zeroPanels)
{
spGroupPers.Children.Add(wrapPanel);
this.Height = this.Height + 20;
zeroPanels = false;
}
//width = (columnCount * 320) + 10;
}
private void btnRemove_Click(object sender, RoutedEventArgs e)
{
var wrapPanel = Helper.FindVisualChildren<WrapPanel>(spGroupPers).Last();
wrapPanel.Children.RemoveAt(wrapPanel.Children.Count - 1);
this.Height = this.Height - 60;
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
await SendIt();
this.DialogResult = true;
}
}
}

View File

@ -1,15 +1,17 @@
<Window x:Class="ZKuP.AddVisitorsList"
<mah:MetroWindow x:Class="ZKuP.AddVisitorsList"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Besuchergruppe hinzufügen" MinHeight="70" MinWidth="330" Width="330" Loaded="Window_Loaded">
Title="Besuchergruppe hinzufügen" MinHeight="70" MinWidth="330" Width="330" Loaded="Window_Loaded" Closing="Window_Closing" LocationChanged="Window_LocationChanged">
<Grid>
<StackPanel x:Name="spGroup" Orientation="Horizontal" Margin="0,0,0,50" >
</StackPanel>
<Button x:Name="btnAdd" Content="Eintragen" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Click="btnAdd_Click"/>
<Button x:Name="btnAdd" Content="" ToolTip="Begleitperson hinzufügen" ToolTipService.InitialShowDelay="200" FontFamily="Segoe UI Symbol" FontSize="12" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,0,0,10" Click="btnAdd_Click" Width="30" Height="30"/>
<Button x:Name="btnSend" Content="Eintragen" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Click="btnSend_Click"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,7 +1,9 @@
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.RightsManagement;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -18,34 +20,38 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für AddVisitorsList.xaml
/// </summary>
public partial class AddVisitorsList : Window
public partial class AddVisitorsList : MetroWindow
{
public int GroupID { get; private set; }
int width = 0;
bool _isEdit = false;
int _idBesucher = 0;
public AddVisitorsList(int VisitorCount)
public AddVisitorsList(int VisitorCount, bool isEdit = false, int idBesucher = 0)
{
InitializeComponent();
BuildWindow(VisitorCount);
//var col = (VisitorCount / 10) + 1;
//for (int j = 0; j < col; j++)
//{
// var spGroup = new StackPanel() { Orientation = Orientation.Vertical, Margin = new Thickness(0, 0, 0, 50) };
if (isEdit)
{
_isEdit = isEdit;
_idBesucher = idBesucher;
btnAdd.Visibility = Visibility.Visible;
// for (int i = 0; i < VisitorCount; i++)
// {
// var sp = new StackPanel();
// var tb = new TextBlock() { Text = $"Besucher Nr. {i + 1}:", Margin = new Thickness(5), Height = 20 };
// tb.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
// MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb, "Vorname Nachname");
// sp.Children.Add(tb);
// sp.Children.Add(new TextBox() { Margin = new Thickness(10, 0, 10, 0), Height = 30 });
var list = SQL.ReadSingleValue($"SELECT besucherList FROM {MainWindow.table}.besucherGroups WHERE idbesucher = '{idBesucher}'").Split(';');
// spGroup.Children.Add(sp);
// }
//}
if (list.Length > 0)
{
var boxes = Helper.FindVisualChildren<TextBox>(spGroup).ToList();
for (var i = 0; i < Helper.FindVisualChildren<TextBox>(spGroup).Count(); i++)
{
if (list.Length > i && !string.IsNullOrWhiteSpace(list[i]))
boxes[i].Text = list[i];
}
}
}
}
private void BuildWindow(int besucherAnzahl)
@ -71,11 +77,13 @@ namespace ZKuP
for (int j = 0; j < maxProSpalte && (i * maxProSpalte + j) < besucherAnzahl; j++)
{
var sp = new StackPanel();
var tb = new TextBlock() { Text = $"Besucher Nr. {i * maxProSpalte + j + 1}:", Margin = new Thickness(5), Height = 20 };
tb.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
var lbl = new TextBlock() { Text = $"Begleitperson Nr. {i * maxProSpalte + j + 1}:", Margin = new Thickness(5), Height = 20 };
lbl.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
sp.Children.Add(lbl);
var tb = new TextBox() { Margin = new Thickness(10, 0, 10, 0), Height = 30, Width = 280, ToolTip = "Um eine Person zu entfernen, Feld leer lassen" };
ToolTipService.SetInitialShowDelay(tb, 200);
MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb, "Vorname Nachname");
sp.Children.Add(tb);
sp.Children.Add(new TextBox() { Margin = new Thickness(10, 0, 10, 0), Height = 30, Width = 280 });
wrapPanel.Children.Add(sp);
@ -92,29 +100,144 @@ namespace ZKuP
{
this.Height = spGroup.DesiredSize.Height + 40;
this.Width = width;
Helper.CheckWindowIsInScreenSpace(this);
}
private async void btnAdd_Click(object sender, RoutedEventArgs e)
private async void btnSend_Click(object sender, RoutedEventArgs e)
{
await SendIt();
this.Close();
}
private async Task SendIt()
{
var visitors = "";
foreach (var t in this.FindChildren<TextBox>())
{
if(string.IsNullOrWhiteSpace(t.Text))
if (!string.IsNullOrWhiteSpace(t.Text))
{
MessageBox.Show("Alle Besucher müssen eingetragen werden!", "Unzureichende Eingabe", MessageBoxButton.OK, MessageBoxImage.Error);
return;
if (t.Text.ToList<char>().Distinct().Count() < 4)
{
MessageBox.Show("Personen müssen qualifiziert angegeben werden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation);
return;
}
else
visitors += t.Text + ";";
//MessageBox.Show("Alle Besucher müssen eingetragen werden!", "Unzureichende Eingabe", MessageBoxButton.OK, MessageBoxImage.Error);
//return;
}
visitors += t.Text + ";";
}
try
{
await SQL.WriteSQL($"Insert INTO {MainWindow.table}.besucherGroups (besucherList) VALUES ('{visitors}')");
GroupID = Convert.ToInt32(SQL.ReadSingleValue($"SELECT LAST_INSERT_ID()"));
var count = visitors.Split(';').Count() - 1;
if (count > 0)
{
if (_isEdit)
{
if (Helper.FindVisualChildren<TextBox>(spGroup).Count() > count)
if (MessageBoxResult.OK == MessageBox.Show("Es müssen alle Besucher namentlich angegeben werden\n\nEs wird nur die Anzahl der ausgefüllten Felder als 'Anzahl Begleitpersonen' hinterlegt", "Unzureichende Angaben", MessageBoxButton.OKCancel, MessageBoxImage.Warning))
{
if (SQL.RowExists(MainWindow.table.ToString() + ".besucherGroups", "idbesucher", _idBesucher.ToString()).Result)
{
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucherGroups SET besucherList = '{visitors}' WHERE idbesucher = '{_idBesucher}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucherGroups SET besucherList = @visitors WHERE idbesucher = @idbesucher", new List<MySqlParameter>()
{
new MySqlParameter("@visitors", visitors),
new MySqlParameter("@idbesucher", _idBesucher)
});
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = '{count}' WHERE idbesucher = '{_idBesucher}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = @count WHERE idbesucher = @idbesucher", new List<MySqlParameter>()
{
new MySqlParameter("@count", count),
new MySqlParameter("@idbesucher", _idBesucher)
});
}
else
{
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.besucherGroups (besucherList, idbesucher) VALUES ('{visitors}','{_idBesucher}')");
GroupID = await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.besucherGroups (besucherList, idbesucher) VALUES (@visitors,@idbesucher)", new List<MySqlParameter>()
{
new MySqlParameter("@visitors", visitors),
new MySqlParameter("@idbesucher", _idBesucher)
});
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = '{count}' WHERE idbesucher = '{_idBesucher}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = @count WHERE idbesucher = @idbesucher", new List<MySqlParameter>()
{
new MySqlParameter("@count", count),
new MySqlParameter("@idbesucher", _idBesucher)
});
}
}
else return;
else
{
if (SQL.RowExists(MainWindow.table.ToString() + ".besucherGroups", "idbesucher", _idBesucher.ToString()).Result)
{
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucherGroups SET besucherList = '{visitors}' WHERE idbesucher = '{_idBesucher}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucherGroups SET besucherList = @visitors WHERE idbesucher = @idbesucher", new List<MySqlParameter>()
{
new MySqlParameter("@visitors", visitors),
new MySqlParameter("@idbesucher", _idBesucher)
});
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = '{count}' WHERE idbesucher = '{_idBesucher}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = @count WHERE idbesucher = @idbesucher", new List<MySqlParameter>()
{
new MySqlParameter("@count", count),
new MySqlParameter("@idbesucher", _idBesucher)
});
}
else
{
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.besucherGroups (besucherList, idbesucher) VALUES ('{visitors}','{_idBesucher}')");
GroupID = await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.besucherGroups (besucherList, idbesucher) VALUES (@visitors,@idbesucher)", new List<MySqlParameter>()
{
new MySqlParameter("@visitors", visitors),
new MySqlParameter("@idbesucher", _idBesucher)
});
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = '{count}' WHERE idbesucher = '{_idBesucher}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = @count WHERE idbesucher = @idbesucher", new List<MySqlParameter>()
{
new MySqlParameter("@count", count),
new MySqlParameter("@idbesucher", _idBesucher)
});
}
}
}
else
//await SQL.WriteSQL($"Insert INTO {MainWindow.table}.besucherGroups (besucherList) VALUES ('{visitors}')");
GroupID = await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.besucherGroups (besucherList, idbesucher) VALUES (@visitors,@idbesucher)", new List<MySqlParameter>()
{
new MySqlParameter("@visitors", visitors),
new MySqlParameter("@idbesucher", _idBesucher)
});
}
else
{
if (MessageBoxResult.OK == MessageBox.Show("Es wurden keine Personen angegeben!\nDie Anzahl der Personen wird somit auf 0 gesetzt", "Keine Angaben", MessageBoxButton.OKCancel, MessageBoxImage.Error))
{
if (SQL.RowExists(MainWindow.table.ToString() + ".besucherGroups", "idbesucher", _idBesucher.ToString()).Result)
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.besucherGroups WHERE idbesucher = '{_idBesucher}'");
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = '0' WHERE idbesucher = '{_idBesucher}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucher SET Anzahl_Begleitpersonen = 0 WHERE idbesucher = @_idBesucher", new List<MySqlParameter>()
{
new MySqlParameter("@_idBesucher", _idBesucher)
});
}
}
}
//GroupID = Convert.ToInt32(SQL.ReadSingleValue($"SELECT LAST_INSERT_ID()"));
this.DialogResult = true;
this.Close();
}
catch (Exception ex)
{
@ -122,5 +245,59 @@ namespace ZKuP
MessageBox.Show("Es ist ein Fehler beim hinzufügen der Besucher aufgetreten, bitte erneut versuchen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
bool zeroPanels = false;
WrapPanel wrapPanel = new WrapPanel
{
Orientation = Orientation.Vertical, // Jedes WrapPanel wird vertikal sein
Margin = new Thickness(10),
Width = 300
};
if (Helper.FindVisualChildren<WrapPanel>(spGroup).Count() > 0)
{
wrapPanel = Helper.FindVisualChildren<WrapPanel>(spGroup).Last();
}
else
zeroPanels = true;
var nr = Helper.FindVisualChildren<TextBox>(spGroup).Count();
var sp = new StackPanel();
var lbl = new TextBlock() { Text = $"Begleitperson Nr. {nr + 1}:", Margin = new Thickness(5), Height = 20 };
lbl.SetResourceReference(Control.ForegroundProperty, SystemColors.ControlTextBrushKey);
sp.Children.Add(lbl);
var tb = new TextBox() { Margin = new Thickness(10, 0, 10, 0), Height = 30, Width = 280, ToolTip = "Um eine Person zu entfernen, Feld leer lassen" };
ToolTipService.SetInitialShowDelay(tb, 200);
MahApps.Metro.Controls.TextBoxHelper.SetWatermark(tb, "Vorname Nachname");
sp.Children.Add(tb);
wrapPanel.Children.Add(sp);
this.Height = this.Height + 60;
// Das WrapPanel zum StackPanel hinzufügen
if (zeroPanels)
{
spGroup.Children.Add(wrapPanel);
this.Height = this.Height + 20;
zeroPanels = false;
}
//width = (columnCount * 320) + 10;
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
await SendIt();
}
}
}

View File

@ -1,6 +1,7 @@
<Application x:Class="ZKuP.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
StartupUri="MainWindow.xaml">
<Application.Resources>
@ -11,6 +12,14 @@
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MahApps.Styles.DataGridColumnHeader}">
<Setter Property="mah:ControlsHelper.ContentCharacterCasing" Value="Normal"/>
</Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MahApps.Styles.Button.Flat}">
<Setter Property="mah:ControlsHelper.CornerRadius" Value="4"/>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -2,9 +2,14 @@
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
namespace ZKuP
{
@ -18,14 +23,19 @@ namespace ZKuP
public App()
{
//AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
#if !DEBUG
//#if !DEBUG
AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; // Example 1
DispatcherUnhandledException += App_DispatcherUnhandledException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // Example 3
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
#endif
//#endif
}
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
if (!e.Exception.ToString().Contains("System.Windows.Automation.ElementNotAvailableException:")
@ -50,9 +60,12 @@ namespace ZKuP
void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
{
if (!e.Exception.ToString().Contains("System.Windows.Automation.ElementNotAvailableException:")
&& !e.Exception.ToString().Contains("signotec.STPadLibNet.STPadException: Zu dem ausgewählten Signierpad wurde keine Verbindung geöffnet."))
Log.WriteLog("2: " + e.Exception.ToString());
if (SQL.isOnline && !e.Exception.ToString().Contains("System.Windows.Automation.ElementNotAvailableException:")
&& !e.Exception.ToString().Contains("System.OperationCanceledException")
&& !e.Exception.ToString().Contains("System.ObjectDisposedException")
&& !e.Exception.ToString().Contains("signotec.STPadLibNet.STPadException: Zu dem ausgewählten Signierpad wurde keine Verbindung geöffnet.")
&& !e.Exception.ToString().Contains("Derzeit ist kein Layout"))
Log.WriteLog("2: " + e.Exception.ToString() + "\n" + e.ToString() + "\n" + (sender.GetType().ToString()));
//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)
//{
@ -115,6 +128,52 @@ namespace ZKuP
//}
e.SetObserved();
}
//#endif
//private static Mutex _mutex;
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int SW_RESTORE = 9;
//protected override void OnStartup(StartupEventArgs e)
//{
// const string mutexName = "ZKuPMutex";
// bool createdNew;
// _mutex = new Mutex(true, mutexName, out createdNew);
// if (!createdNew)
// {
// // Another instance is already running
// BringOtherInstanceToFront();
// Environment.Exit(0); // Exit this instance
// return;
// }
// base.OnStartup(e);
//}
public static void BringOtherInstanceToFront()
{
var current = Process.GetCurrentProcess();
var other = Process.GetProcessesByName(current.ProcessName)
.FirstOrDefault(p => p.Id != current.Id);
if (other != null)
{
IntPtr hWnd = other.MainWindowHandle;
if (hWnd != IntPtr.Zero)
{
ShowWindow(hWnd, SW_RESTORE);
SetForegroundWindow(hWnd);
}
}
}
//#endif
}
}

124
ZKuP/ApproveFzg.xaml Normal file
View File

@ -0,0 +1,124 @@
<mah:MetroWindow x:Class="ZKuP.ApproveFzg"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Fahrzeuge genehmigen" Height="450" Width="900" Closing="MetroWindow_Closing" Loaded="MetroWindow_Loaded" LocationChanged="Window_LocationChanged">
<mah:MetroWindow.Resources>
<local:IntToGenehmigungsstatus x:Key="IntToGenehmigungsstatus"></local:IntToGenehmigungsstatus>
<Storyboard x:Key="popDeleted" RepeatBehavior="1x" Completed="Storyboard_Completed">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="popDeleted" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:03" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:04" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:06" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:07" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</mah:MetroWindow.Resources>
<Grid>
<DataGrid x:Name="dgFzg" DataContext="{Binding}" ItemsSource="{Binding ., Mode=OneWay}" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" CanUserReorderColumns="False" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding idfzgAnmeldung}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="ID Firma" Binding="{Binding idFirmen}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Wunschanz. Fzg" Binding="{Binding AnzahlFzg}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="User" Binding="{Binding User}" Width="*"/>
<DataGridTextColumn Header="Email" Binding="{Binding Email}" Width="*"/>
<DataGridTextColumn Header="Status" Binding="{Binding Genehmigung, Converter={StaticResource IntToGenehmigungsstatus}}" MinWidth="110" Width="*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTemplateColumn MinWidth="130" Width="130">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Genehmigen" Foreground="Green" FontWeight="Bold" Width="130" Click="ApproveButton_Click"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn MinWidth="130" Width="130">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Ablehnen" Foreground="Red" FontWeight="Bold" Width="130" Click="DeclineButton_Click"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn MinWidth="29" Width="31">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="ⓘ" Padding="0,-3,0,0" ToolTip="Firmenbuchung anzeigen" FontSize="20" FontWeight="Bold" Width="29" Height="29" Click="InfoButton_Click"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Popup x:Name="pop" AllowsTransparency="True" Closed="pop_Closed">
<Border BorderThickness="1" BorderBrush="Gray" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}">
<StackPanel Orientation="Vertical" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Margin="5">
<DataGrid x:Name="dgFirmen" Visibility="Visible" ItemsSource="{Binding .}" Height="60" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Verantwortl. MA" Binding="{Binding Verantwortlicher_MA_Firma}"/>
<DataGridTextColumn Header="Tel. Firma" Binding="{Binding Tel_Nr_Verantwortlicher_Firma}"/>
<DataGridTextColumn Header="Anz. Begleiter" Binding="{Binding Anzahl_Begleiter}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Beauftragte Leistung" Binding="{Binding Beauftragte_Leistung}"/>
<DataGridTextColumn Header="Arbeitsbeginn" Binding="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Arbeitsende" Binding="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Ansprechpartner intern" Binding="{Binding Ansprechpartner_Intern}"/>
<DataGridTextColumn Header="Tel. Ansprechpartner" Binding="{Binding Tel_Nr_Ansprechpartner_Intern}"/>
<DataGridTextColumn Header="BE" Binding="{Binding BE}"/>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</Border>
</Popup>
<Border x:Name="popDeleted" Visibility="Collapsed" CornerRadius="10" VerticalAlignment="Bottom" Margin="10" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Height="40">
<TextBlock x:Name="tbDeleted" VerticalAlignment="Center" FontSize="16" Foreground="White" Text="xx alte Einträge (älter als 30 Tage) wurden gelöscht" TextAlignment="Center"/>
</Border>
</Grid>
</mah:MetroWindow>

156
ZKuP/ApproveFzg.xaml.cs Normal file
View File

@ -0,0 +1,156 @@
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
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.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 ApproveFzg.xaml
/// </summary>
public partial class ApproveFzg : MetroWindow
{
DataTable Fzg = new DataTable("Fzg");
public ApproveFzg()
{
this.DataContext = this;
InitializeComponent();
Fzg = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.fzgAnmeldung").Result;
dgFzg.DataContext = Fzg;
}
private async void InfoButton_Click(object sender, RoutedEventArgs e)
{
var buttons = Helper.FindVisualChildren<Button>(dgFzg).Where(p => p.Content != null && p.Content.ToString() == "✕");
foreach (var b in buttons)
{
b.ClearValue(Button.BackgroundProperty);
b.Content = "ⓘ";
}
if (!pop.IsOpen)
{
var id = ((sender as Button).DataContext as DataRowView).Row.ItemArray[1].ToString();
var Firmen = await SQL.ReadSQL($"SELECT Name,Verantwortlicher_MA_Firma,Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleiter,Beauftragte_Leistung,Arbeitsbeginn,Arbeitsende,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,BE FROM {MainWindow.table}.firmen WHERE idFirmen = '{id}'");
dgFirmen.DataContext = Firmen;
(sender as Button).Content = "✕";
(sender as Button).Background = new SolidColorBrush(Colors.PaleVioletRed);
//var pop = new Popup();
pop.PopupAnimation = PopupAnimation.Slide;
pop.PlacementTarget = (sender as Button);
pop.HorizontalOffset = 50;
pop.IsOpen = true;
}
else
{
(sender as Button).ClearValue(Button.BackgroundProperty);
(sender as Button).Content = "ⓘ";
pop.IsOpen = false;
}
}
private void MetroWindow_Closing(object sender, CancelEventArgs e)
{
pop.IsOpen = false;
}
private async void ApproveButton_Click(object sender, RoutedEventArgs e)
{
var arr = ((sender as Button).DataContext as DataRowView).Row.ItemArray;
var id = arr[0].ToString();
var anzFzg = arr[2].ToString();
var user = Helper.InsertSpaceBeforeUpperCase(arr[3].ToString());
if (MessageBoxResult.Yes == MessageBox.Show($"Antrag\t{id}\nvon:\t{user}\nmit:\t{anzFzg} Fahrzeugen\n\nsicher genehmigen?", "Sicher genehmigen?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
{
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.fzgAnmeldung SET Genehmigung = '1' WHERE idfzgAnmeldung = '{id}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.fzgAnmeldung SET Genehmigung = '1' WHERE idfzgAnmeldung = @id", new List<MySqlParameter>()
{
new MySqlParameter("@id", id)
});
Fzg = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.fzgAnmeldung").Result;
dgFzg.DataContext = Fzg;
}
}
private async void DeclineButton_Click(object sender, RoutedEventArgs e)
{
var arr = ((sender as Button).DataContext as DataRowView).Row.ItemArray;
var id = arr[0].ToString();
var anzFzg = arr[2].ToString();
var user = Helper.InsertSpaceBeforeUpperCase(arr[3].ToString());
if (MessageBoxResult.Yes == MessageBox.Show($"Antrag\t{id}\nvon:\t{user}\nmit:\t{anzFzg} Fahrzeugen\n\nsicher ablehnen?", "Sicher ablehnen?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
{
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.fzgAnmeldung SET Genehmigung = '2' WHERE idfzgAnmeldung = '{id}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.fzgAnmeldung SET Genehmigung = '2' WHERE idfzgAnmeldung = @id", new List<MySqlParameter>()
{
new MySqlParameter("@id", id)
});
Fzg = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.fzgAnmeldung").Result;
dgFzg.DataContext = Fzg;
}
}
private void pop_Closed(object sender, EventArgs e)
{
}
private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
{
var count = SQL.ReadSingleValue($"SELECT count(idfzgAnmeldung) FROM {MainWindow.table}.fzgAnmeldung WHERE Timestamp < now() - INTERVAL 30 DAY");
if (Convert.ToInt16(count) > 0)
{
SQL.WriteSQL($"DELETE FROM {MainWindow.table}.fzgAnmeldung WHERE Timestamp < now() - INTERVAL 30 DAY AND Genehmigung <> 0");
popDeleted.Opacity = 0;
popDeleted.Visibility = Visibility.Visible;
tbDeleted.Text = $"{count} Einträge (älter als 30 Tage) wurden gelöscht";
(this.Resources["popDeleted"] as System.Windows.Media.Animation.Storyboard).Begin();
}
}
private void Storyboard_Completed(object sender, EventArgs e)
{
popDeleted.Visibility = Visibility.Collapsed;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,4 +1,4 @@
<Window
<mah:MetroWindow x:Name="metroWindow" BorderThickness="1" BorderBrush="Red"
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"
@ -7,13 +7,24 @@
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" x:Class="ZKuP.Arrivals"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
Title="Ankunft bestätigen" Height="720" Width="479" ResizeMode="NoResize" Topmost="True" PreviewGotKeyboardFocus="Window_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="Window_PreviewLostKeyboardFocus" WindowStyle="None" AllowsTransparency="True" Loaded="Window_Loaded">
Title="Ankunft bestätigen" MinHeight="650" MinWidth="800" Width="{Binding MinWidth, ElementName=metroWindow}" Height="{Binding MinHeight, ElementName=metroWindow}"
ResizeMode="NoResize" PreviewGotKeyboardFocus="Window_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="Window_PreviewLostKeyboardFocus"
mah:UseNoneWindowStyle="True" AllowsTransparency="True" Loaded="Window_Loaded">
<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.ColumnDefinitions>
<ColumnDefinition Width="480"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="260"/>
</Grid.RowDefinitions>
<Grid x:Name="WindowBar" VerticalAlignment="Top" Grid.ColumnSpan="2" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Height="30" PreviewMouseDown="Window_PreviewMouseDown">
<TextBlock Text="Ankunft bestätigen" Margin="10,5,0,0" HorizontalAlignment="Left" Padding="0" Foreground="White"/>
</Grid>
<Button x:Name="btnClose_Copy" Content="✕" Grid.Column="1" Padding="0,0,0,0" Margin="0,6,6,0" Height="18" BorderBrush="{x:Null}" Background="PaleVioletRed" Click="CloseWithX_Click" VerticalAlignment="Top" TabIndex="6" IsEnabled="True" HorizontalAlignment="Right" Width="20"/>
<Grid x:Name="spinnerCanvas" Margin="0,25,0,0" Background="White" Panel.ZIndex="99" Visibility="Collapsed">
<Grid x:Name="spinnerCanvas" Grid.ColumnSpan="2" Grid.RowSpan="2" Margin="0,30,0,0" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Panel.ZIndex="99" Visibility="Visible">
<local:ucSpinnerPiston Canvas.Left="74" Canvas.Top="230" RenderTransformOrigin="0.5,0.5" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="25" Height="27" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">
<local:ucSpinnerPiston.RenderTransform>
<TransformGroup>
@ -26,135 +37,261 @@
</local:ucSpinnerPiston>
</Grid>
<Grid Margin="0,30,0,0">
<Grid x:Name="gridLeft" Margin="0,30,0,0" Grid.Column="0" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition x:Name="GParkTop" Height="480"/>
<RowDefinition Height="200"/>
<RowDefinition x:Name="kennzeichenRow" Height="40"/>
<RowDefinition Height="95"/>
<!--<RowDefinition x:Name="GParkRow" Height="0*"/>
<RowDefinition Height="220"/>
<RowDefinition Height="30"/>-->
<!--x:Name="GParkTop" Height="280"-->
</Grid.RowDefinitions>
<ComboBox x:Name="cbName" Grid.Row="0" Margin="45,38,46,0" VerticalAlignment="Top" TabIndex="7" DisplayMemberPath="Value" SelectedValuePath="Key" SelectionChanged="CbName_SelectionChanged"/>
<TextBlock HorizontalAlignment="Left" Grid.Row="0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Height="23" Margin="30,15,0,0" TextWrapping="Wrap" Text="Firma/Besucher:" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="tbVerantwortlPerson" Grid.Row="0" Height="23" Margin="45,83,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="1" mah:TextBoxHelper.Watermark="Verantwortliche Person"/>
<!--<TextBlock Margin="45,86,46,0" Grid.Row="0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0" Text="Verantwortlicher MA" IsHitTestVisible="False"/>-->
<Grid x:Name="gridArrival" Grid.Row="0">
<ComboBox x:Name="cbName" Grid.Row="0" Margin="45,38,46,0" VerticalAlignment="Top" Padding="15,2,0,0" HorizontalContentAlignment="Center" TabIndex="7" DisplayMemberPath="Value" SelectedValuePath="Key" SelectionChanged="CbName_SelectionChanged"/>
<TextBlock HorizontalAlignment="Left" Grid.Row="0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Height="23" Margin="30,15,0,0" TextWrapping="Wrap" Text="Firma/Besucher:" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="tbNrVerantwortlPerson" Grid.Row="0" Height="23" Margin="45,108,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="2" mah:TextBoxHelper.Watermark="Telefonnummer"/>
<!--<TextBlock Margin="45,111,311,0" Grid.Row="0" TextWrapping="Wrap" Text="Tel. Nr. des MA" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0" IsHitTestVisible="False"/>-->
<ComboBox x:Name="tbVerantwortlPerson" IsEditable="True" Grid.Row="0" Height="23" Margin="45,83,46,0" VerticalAlignment="Top" HorizontalContentAlignment="Center" Padding="15,2,0,0" TabIndex="1" mah:TextBoxHelper.Watermark="Verantwortliche Person"/>
<!--<TextBlock Margin="45,86,46,0" Grid.Row="0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0" Text="Verantwortlicher MA" IsHitTestVisible="False"/>-->
<TextBox x:Name="tbAnzahlPersonen" Height="23" Grid.Row="0" Margin="45,142,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="3" PreviewTextInput="tbAnzahlPersonen_PreviewTextInput"/>
<TextBox x:Name="tbAnzahlFzg" Height="23" Grid.Row="0" Margin="45,167,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="4" PreviewTextInput="tbAnzahlFzg_PreviewTextInput"/>
<TextBlock Margin="45,145,311,0" Grid.Row="0" TextWrapping="Wrap" Text="Anzahl Personen" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>
<TextBlock Margin="45,171,311,0" Grid.Row="0" TextWrapping="Wrap" Text="Anzahl Fahrzeuge" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>
<TextBlock x:Name="lblAngemeldeteBesucher" Grid.Row="0" Margin="290,145,46,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#CCFF0000" Padding="0,0,5,0" TextAlignment="Right"/>
<TextBlock x:Name="lblAngemeldeteFzg" Grid.Row="0" Margin="290,171,46,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#CCFF0000" Padding="0,0,5,0" TextAlignment="Right"/>
<TextBlock x:Name="tbMultiplePeople" Text="↪" Visibility="Collapsed" Foreground="Red" FontSize="20" HorizontalAlignment="Right" Margin="0,0,20,90" ToolTip="Mehrere Personen stehen zur Auswahl" ToolTipService.InitialShowDelay="100">
<TextBlock.LayoutTransform>
<RotateTransform Angle="180"/>
</TextBlock.LayoutTransform>
</TextBlock>
<ComboBox x:Name="tbNrVerantwortlPerson" IsEditable="True" Grid.Row="0" Height="23" Margin="45,108,46,0" VerticalAlignment="Top" HorizontalContentAlignment="Center" Padding="15,2,0,0" TabIndex="2" mah:TextBoxHelper.Watermark="Telefonnummer"/>
<!--<TextBlock Margin="45,111,311,0" Grid.Row="0" TextWrapping="Wrap" Text="Tel. Nr. des MA" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0" IsHitTestVisible="False"/>-->
<TextBox x:Name="tbAnzahlPersonen" Height="23" Grid.Row="0" Margin="45,142,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="3" PreviewTextInput="tbAnzahlPersonen_PreviewTextInput"/>
<TextBox x:Name="tbAnzahlFzg" Height="23" Grid.Row="0" Margin="45,167,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="4" PreviewTextInput="tbAnzahlFzg_PreviewTextInput"/>
<TextBlock Margin="45,145,311,0" Grid.Row="0" TextWrapping="Wrap" Text="Anzahl Personen" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>
<TextBlock Margin="45,171,311,0" Grid.Row="0" TextWrapping="Wrap" Text="Anzahl Fahrzeuge" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>
<TextBlock x:Name="lblAngemeldeteBesucher" Grid.Row="0" Margin="290,145,46,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#CCFF0000" Padding="0,0,5,0" TextAlignment="Right"/>
<TextBlock x:Name="lblAngemeldeteFzg" Grid.Row="0" Margin="290,171,46,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#CCFF0000" Padding="0,0,5,0" TextAlignment="Right"/>
</Grid>
<!--<TextBox x:Name="tbKennzeichen" Height="23" Margin="45,130,46,0" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Padding="0,2,0,0" TabIndex="3"/>-->
<StackPanel x:Name="spKennzeichen" Margin="45,200,46,0" Grid.Row="0"/>
<StackPanel x:Name="spKennzeichen" Margin="45,0" Grid.Row="1"/>
<Grid Margin="10,0,10,35" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="1.5*"/>
<RowDefinition x:Name="GParkRow" Height="0*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="0.6*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="2" Margin="0,10,0,0">
<TextBlock Text="Bemerkung:" Margin="30,0" TextWrapping="Wrap" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Padding="0" Height="22"/>
<TextBox x:Name="tbBemerkung" Height="60" Margin="45,0" TextWrapping="Wrap" Padding="0,2,0,0" TabIndex="4" VerticalScrollBarVisibility="Auto" AcceptsReturn="True"/>
</StackPanel>
<Grid x:Name="gridBesucherPark" Visibility="Collapsed" Grid.Row="1">
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Gästeparkplatz zuweisen:" VerticalAlignment="Top" Width="170"/>
<Grid x:Name="BesuchP" Margin="0, 25, 0, 0" HorizontalAlignment="Center" VerticalAlignment="Top">
<Rectangle x:Name="G1" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="1" Margin="0, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G2" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="2" Margin="50, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G3" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="3" Margin="100, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G4" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="150, 00, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="4" Margin="150, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G5" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="200, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="5" Margin="200, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
</Grid>
<Border x:Name="borderParkkarteAusgeben" Visibility="Collapsed" BorderThickness="2" BorderBrush="Red" Height="40" VerticalAlignment="Bottom" Margin="60,0" CornerRadius="10">
<TextBlock x:Name="lblParkkarteAusgeben" Text="" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</Border>
</Grid>
<StackPanel Grid.Row="2">
<TextBlock Text="Ankunft bestätigen:" HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Width="170"/>
<Button x:Name="btnCheck" HorizontalContentAlignment="Center" Padding="0" VerticalAlignment="Top" Height="70" 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"><Run Text="Ankunft jetzt"/><LineBreak/><Run Text="↓↓"/><LineBreak/><Run Text="Einweisung und Anmeldung"/><LineBreak/><Run Text="werden überprüft"/></TextBlock>
</Button>
</StackPanel>
<StackPanel Grid.Row="3">
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Anmeldung:" Width="190"/>
<Label x:Name="lblAnmeldung" Height="24" Foreground="Black" HorizontalContentAlignment="Center" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1"/>
</StackPanel>
<StackPanel Grid.Row="4">
<TextBlock Grid.Row="4" HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Einweisung:" Width="190"/>
<Label x:Name="lblEinweisung" Grid.Row="4" Height="24" Foreground="Black" HorizontalContentAlignment="Center" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1" />
</StackPanel>
<StackPanel Grid.Row="5">
<TextBlock HorizontalAlignment="Left" Grid.Row="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap"><Run Text="Kleine Unterweisung"/><Run Text=":"/></TextBlock>
<Label x:Name="lblKleineUnterweisung" Grid.Row="5" Foreground="Black" HorizontalContentAlignment="Center" VerticalAlignment="Top" Height="24" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1" />
</StackPanel>
<StackPanel Grid.Row="6">
<TextBlock HorizontalAlignment="Left" Grid.Row="6" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Fahrzeuge:" Width="190"/>
<Label x:Name="lblFahrzeuge" Grid.Row="6" Height="24" Foreground="Black" HorizontalContentAlignment="Center" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1"/>
</StackPanel>
<StackPanel Grid.Row="0" Margin="10,0">
<TextBlock Text="Bemerkung:" TextWrapping="Wrap" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Padding="0" Height="22"/>
<TextBox x:Name="tbBemerkung" Height="40" TextWrapping="Wrap" Padding="0,2,0,0" TabIndex="4" VerticalScrollBarVisibility="Auto" AcceptsReturn="True"/>
</StackPanel>
<Button x:Name="btnSignature" Grid.Row="7" Padding="-2" Content="Unterschrift für Einfahrt" Height="25" Click="btnSignature_Click" ToolTipService.ShowOnDisabled="True" IsEnabled="True"/>
<Button x:Name="btnKlEinweisung_durchgeführt" Grid.Row="8" Padding="-2" Content="Hier bestätigen wenn die kleine Einweisung durchgeführt wurde" IsEnabled="False" Click="btnKlEinweisung_durchgeführt_Click" Height="25"/>
<Button x:Name="btnKarte" Content="Karte(n) ausgeben" Grid.Row="9" Padding="-2" Height="25" Click="btnKarte_Click" IsEnabled="False"/>
</Grid>
<!--<TextBlock Margin="45,134,311,0" TextWrapping="Wrap" Text="Kennzeichen" VerticalAlignment="Top" Foreground="Gray" Padding="5,0,0,0"/>-->
<Button x:Name="btnClose_Copy" Grid.Row="0" Content="✕" Padding="0,0,0,0" Margin="0,-25,5,0" Height="18" BorderBrush="{x:Null}" Background="PaleVioletRed" Click="CloseWithX_Click" VerticalAlignment="Top" TabIndex="6" IsEnabled="True" HorizontalAlignment="Right" Width="20"/>
<Button x:Name="btnClose" Content="Schließen" Grid.Row="1" Margin="-2,0,1,1" Height="28" BorderBrush="{x:Null}" Click="Close_Click" VerticalAlignment="Bottom" TabIndex="6" IsEnabled="False"/>
</Grid>
<Popup x:Name="popBE" IsOpen="False" Width="700" Height="500" AllowsTransparency="True" Placement="Right" HorizontalOffset="20" VerticalOffset="200" PlacementTarget="{Binding DataContext, ElementName=popBE}">
<Grid x:Name="gridRight" Grid.Column="1" Margin="0,45,30,0" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="125*"/>
<RowDefinition Height="50*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Anmeldung:" Width="190"/>
<Label x:Name="lblAnmeldung" Height="30" Margin="0, 5" Foreground="Black" HorizontalContentAlignment="Center" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1"/>
</StackPanel>
<StackPanel Grid.Row="1">
<TextBlock Grid.Row="4" HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Einweisung:" Width="190"/>
<Label x:Name="lblEinweisung" Grid.Row="4" Margin="0, 5" Height="30" Foreground="Black" HorizontalContentAlignment="Center" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1" />
</StackPanel>
<StackPanel Grid.Row="2">
<TextBlock HorizontalAlignment="Left" Grid.Row="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap"><Run Text="Kleine Unterweisung:"/></TextBlock>
<Label x:Name="lblKleineUnterweisung" Grid.Row="5" Margin="0, 5" Foreground="Black" HorizontalContentAlignment="Center" VerticalAlignment="Top" Height="30" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1" />
</StackPanel>
<StackPanel Grid.Row="3">
<TextBlock HorizontalAlignment="Left" Grid.Row="6" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Fahrzeuge:" Width="190"/>
<Label x:Name="lblFahrzeuge" Grid.Row="6" Height="30" Margin="0, 5" Foreground="Black" HorizontalContentAlignment="Center" Background="#33808080" BorderBrush="#99000000" BorderThickness="1" Padding="1"/>
</StackPanel>
<Grid x:Name="gridBesucherPark" Visibility="Collapsed" Grid.Row="4" Margin="0, 30, 0, 0">
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Gästeparkplatz zuweisen:" VerticalAlignment="Top" Width="170"/>
<Grid x:Name="BesuchP" Margin="0, 25, 0, 0" HorizontalAlignment="Center" VerticalAlignment="Top">
<Rectangle x:Name="G1" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="1" Margin="0, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G2" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="2" Margin="50, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G3" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="3" Margin="100, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G4" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="150, 00, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="4" Margin="150, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
<Rectangle x:Name="G5" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="200, 0, 0, 0" StrokeThickness="1" Fill="Green"/>
<TextBlock Text="5" Margin="200, 0, 0, 0" Width="40" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="G_ParkPreviewMouseLeftButtonDown"/>
</Grid>
<Border x:Name="borderParkkarteAusgeben" Visibility="Collapsed" BorderThickness="2" BorderBrush="Red" Height="40" VerticalAlignment="Bottom" Margin="0,0" CornerRadius="10">
<TextBlock x:Name="lblParkkarteAusgeben" Text="" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</Border>
</Grid>
<Grid x:Name="gridFirmenPark" Visibility="Collapsed" Grid.Row="4" HorizontalAlignment="Center" Margin="0, 30, 0, 0" VerticalAlignment="Top" ToolTip="Rote Parkplätze sind belegt, Grüne frei">
<TextBlock Text="Parkplätze im Werk:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="0, -20, 0, 0" Height="20" Width="150" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Rectangle x:Name="P1" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0, 0, 0, 0" StrokeThickness="0" Fill="Green" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown"/>
<TextBlock Text="1" Margin="0, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P2" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0, 20, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="2" Margin="0, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P3" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0, 40, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="3" Margin="0, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P4" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0, 60, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="4" Margin="0, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="10" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P5" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="25, 0, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="5" Margin="25, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P6" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="25, 20, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="6" Margin="25, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P7" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="25, 40, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="7" Margin="25, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="1" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P8" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="25, 60, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="8" Margin="25, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="1" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P9" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50, 0, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="9" Margin="50, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P10" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50, 20, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="10" Margin="50, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P11" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50, 40, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="11" Margin="50, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P12" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50, 60, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="12" Margin="50, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P13" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="75, 0, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="13" Margin="75, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P14" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="75, 20, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="14" Margin="75, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P15" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="75, 40, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="15" Margin="75, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P16" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="75, 60, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="16" Margin="75, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P17" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100, 0, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="17" Margin="100, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P18" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100, 20, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="18" Margin="100, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P19" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100, 40, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="19" Margin="100, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P20" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="100, 60, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="20" Margin="100, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="4" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P21" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="125, 0, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="21" Margin="125, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="4" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P22" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="125, 20, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="22" Margin="125, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="4" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P23" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="125, 40, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="23" Margin="125, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" Tag="2" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P24" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="125, 60, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="24" Margin="125, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P25" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="150, 0, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="25" Margin="150, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P26" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="150, 20, 0, 0" StrokeThickness="0" Fill="Green"/>
<TextBlock Text="26" Margin="150, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P27" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="150, 40, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="27" Margin="150, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P28" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="150, 60, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="28" Margin="150, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P29" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="175, 0, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="29" Margin="175, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P30" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="175, 20, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="30" Margin="175, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P31" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="175, 40, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="31" Margin="175, 40, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P32" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="175, 60, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="32" Margin="175, 60, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P33" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="200, 0, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="33" Margin="200, 0, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<Rectangle x:Name="P34" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="200, 20, 0, 0" StrokeThickness="0" Fill="Green" Stroke="Aqua"/>
<TextBlock Text="34" Margin="200, 20, 0, 0" Width="20" Height="15" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" Padding="0" FontWeight="SemiBold" PreviewMouseLeftButtonDown="ParkSetPreviewMouseLeftButtonDown" ToolTip="Klicken um Parkplatz zu belegen/freizugeben"/>
<TextBlock x:Name="lblSelectAParkplatz" Visibility="Visible" Foreground="Red" Text="Parkplatz zuweisen!" FontWeight="Bold" FontSize="14" Margin="0, 85, 0, 0" VerticalAlignment="Top" HorizontalAlignment="Center"/>
</Grid>
</Grid>
<Grid Grid.Row="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Margin="20,0,20,15">
<Border x:Name="borderParkkarteFirmaAusgeben" Visibility="Collapsed" Height="40" BorderThickness="2" BorderBrush="Red" VerticalAlignment="Top" Margin="0,25,0,0" CornerRadius="10">
<TextBlock x:Name="lblParkkarteFirmaAusgeben" Text="" TextAlignment="Center" Width="320" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</Border>
</Grid>
<Grid x:Name="gridButtons" Grid.Row="2" Grid.ColumnSpan="2" Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="25"/>
<RowDefinition Height="27"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock Text="Ankunft bestätigen:" HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Width="170"/>
<Button x:Name="btnCheck" HorizontalContentAlignment="Center" Padding="0" VerticalAlignment="Top" Height="70" 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"><Run Text="Ankunft jetzt"/><LineBreak/><Run Text="↓↓"/><LineBreak/><Run Text="Einweisung und Anmeldung"/><LineBreak/><Run Text="werden überprüft"/></TextBlock>
</Button>
</StackPanel>
<Button x:Name="btnSignature" Grid.Row="1" Padding="-2" Content="Unterschrift für Einfahrt" Height="25" Click="btnSignature_Click" ToolTipService.ShowOnDisabled="True" IsEnabled="True"/>
<Button x:Name="btnKlEinweisung_durchgeführt" Grid.Row="2" Padding="-2" Content="Hier bestätigen wenn die kleine Einweisung durchgeführt wurde" IsEnabled="False" Click="btnKlEinweisung_durchgeführt_Click" Height="25"/>
<Button x:Name="btnKarte" Content="Karte(n) ausgeben" Grid.Row="3" Padding="-5" Height="60" Click="btnKarte_Click" IsEnabled="False"/>
</Grid>
<Button x:Name="btnClose" Content="Schließen" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Margin="0,0,1,1" Height="28" BorderBrush="{x:Null}" Click="Close_Click" VerticalAlignment="Bottom" TabIndex="6" IsEnabled="False"/>
<local:PopupNonTopmost x:Name="popBE" Topmost="False" IsOpen="False" AllowsTransparency="True" Placement="Right" HorizontalOffset="20" VerticalOffset="200">
<Grid>
<Image x:Name="imgBE" Source="{Binding BE}" Width="700" Height="500" Stretch="Fill"/>
<TextBlock Text="Gebuchte BE-Fläche der Firma:" FontSize="16" Background="White" Width="230" Padding="5,0" Height="20" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Image x:Name="imgBE" Source="{Binding BE}" Stretch="Uniform"/> <!--MaxWidth="600" MaxHeight="400"-->
<StackPanel Margin="5">
<TextBlock Text="Gebuchte BE-Fläche der Firma:" FontSize="16" Foreground="Black" Background="White" Width="230" Padding="5,0" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBlock x:Name="lblParkNumbers" Text="Nur diese Parkplätze vergeben!" FontSize="16" Foreground="Red" Background="White" Padding="5,0" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBlock Text="Diese Parkplätze sind bereits für die Firma blockiert (rot)" FontSize="16" Foreground="Black" Background="White" Width="405" Padding="5,0" Height="22" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</StackPanel>
<Button x:Name="btnCloseBE" Background="Salmon" Content="✕" BorderThickness="2" BorderBrush="Black" Padding="0,-2,0,0" Width="30" Height="30" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,20,20,0" Click="btnCloseBE_Click"/>
</Grid>
</Popup>
<Popup x:Name="popBesucher" IsOpen="False" Width="400" AllowsTransparency="True" Placement="Right" HorizontalOffset="20" VerticalOffset="200" PlacementTarget="{Binding DataContext, ElementName=popBE}">
</local:PopupNonTopmost>
<local:PopupNonTopmost x:Name="popBesucher" Topmost="False" IsOpen="False" Width="400" AllowsTransparency="True" Placement="Right" HorizontalOffset="20" VerticalOffset="200">
<!--PlacementTarget="{Binding DataContext, ElementName=popBE}"-->
<Border BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
<Grid Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<TextBlock Text="Angemeldete Personen:" FontSize="16" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Width="180" Height="30" Margin="10,15,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
@ -163,6 +300,6 @@
<StackPanel x:Name="spBesucher" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="15,50,0,0"/>
</Grid>
</Border>
</Popup>
</local:PopupNonTopmost>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -14,6 +15,8 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
@ -23,21 +26,25 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für Arrivals.xaml
/// </summary>
public partial class Arrivals : Window
public partial class Arrivals : MetroWindow
{
Dictionary<int, string> NamesList = new Dictionary<int, string>();
int firmenCount = 0;
int besucherCount = 0;
bool arrivalClicked = false;
bool kl_EinweisungClicked = false;
string query = "";
//string query = "";
MySqlCommand query = new MySqlCommand();
byte[] _signature = null;
Window mainWindow = null;
string selectedID = "-1";
int isBesucher = 0;
string Name = "";
int belegteParkplaetze = 0;
int fzgCount = 0;
int beID = -1;
int kennzeichenHeight = 28;
/// <summary>
@ -57,31 +64,52 @@ namespace ZKuP
isBesucher = IsBesucher;
Name = name;
#if !DEBUG
this.Topmost = true;
#endif
if(isBesucher == 1)
{
TextBoxHelper.SetWatermark(tbVerantwortlPerson, "Verantwortlicher Besucher");
TextBoxHelper.SetWatermark(tbNrVerantwortlPerson, "Telefonnummer Besucher");
TextBoxHelper.SetWatermark(tbVerantwortlPerson, "Name des Besuchers");
TextBoxHelper.SetWatermark(tbNrVerantwortlPerson, "Telefonnummer des Besuchers");
btnSignature.Visibility = Visibility.Collapsed;
}
var park = SQL.ReadListString($"SELECT parkplatznr FROM {MainWindow.table}.`parkplaetze` WHERE parkplatznr LIKE 'G%'").Result;
var rectsG = BesuchP.Children.OfType<Rectangle>();
//var park = SQL.ReadListString($"SELECT parkplatznr FROM {MainWindow.table}.`parkplaetze`").Result;
//var parkG = park.Where(p => p.StartsWith("G"));
//var parkF = park.Where(p => !p.StartsWith("G"));
foreach (Rectangle s in rectsG)
{
if (park.Contains(s.Name))
{
//var x = Helper.FindVisualChildren<Rectangle>(BE, s.Name).First();
s.Fill = new SolidColorBrush(Colors.Red);
}
else if (!s.Name.StartsWith("Red"))
{
s.Fill = new SolidColorBrush(Colors.Green);
}
}
//if (isBesucher == 1)
//{
// var rectsG = BesuchP.Children.OfType<Rectangle>();
// foreach (Rectangle s in rectsG)
// {
// if (parkG.Contains(s.Name))
// {
// //var x = Helper.FindVisualChildren<Rectangle>(BE, s.Name).First();
// s.Fill = new SolidColorBrush(Colors.Red);
// }
// else if (!s.Name.StartsWith("Red"))
// {
// s.Fill = new SolidColorBrush(Colors.Green);
// }
// }
//}
tbAnzahlFzg.TextChanged += tbAnzahlFzg_TextChanged;
}
private async Task initialize()
{
var screen = WpfScreenHelper.Screen.FromHandle(new WindowInteropHelper(this).Handle);
var workingArea = screen.WorkingArea;
imgBE.MaxWidth = 1200;
imgBE.Width = workingArea.Right - (this.Left + this.Width) - 40;
var list = await SQL.ReadDictionary($"Select idFirmen, Name FROM {MainWindow.table}.firmen ORDER BY Name", 0, 1);
//list = list.OrderBy(p => p.Value).ToDictionary();
@ -127,7 +155,7 @@ namespace ZKuP
await Dispatcher.BeginInvoke(new Action(async() =>
await Dispatcher.BeginInvoke(new Action(async () =>
{
cbName.ItemsSource = NamesList;
@ -153,34 +181,94 @@ namespace ZKuP
if (isBesucher == 0)
{
tbVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA_Firma FROM {MainWindow.table}.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1");
tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Tel_Nr_Verantwortlicher_Firma FROM {MainWindow.table}.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1");
gridFirmenPark.Visibility = Visibility.Visible;
List<string> source = new List<string>();
bool exists = await SQL.RowExists(MainWindow.table + ".firmenPeople", "idFirmen", selectedID.ToString());
if (exists)
{
source = SQL.ReadListStringTwoColumns($"SELECT Personen, TelNr FROM {MainWindow.table}.firmenPeople WHERE idFirmen = '{selectedID}'", "|").Result.First().Split('|').ToList();
source = source.Where(p => !string.IsNullOrWhiteSpace(p)).ToList();
}
if (exists && source.Count > 1)
{
source[0] = source[0] + ";";
source[1] = source[1] + ";";
var res = SQL.ReadListStringMultipleColumns($"SELECT Verantwortlicher_MA_Firma,Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleiter FROM {MainWindow.table}.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1").Result.First().Split(';');
if (!source[0].Contains(res[0]))
{
source[0] += res[0];
source[1] += res[1];
}
tbVerantwortlPerson.ItemsSource = source[0].TrimEnd(';').Split(';');
tbNrVerantwortlPerson.ItemsSource = source[1].TrimEnd(';').Split(';');
tbVerantwortlPerson.SelectedValue = res[0];
tbNrVerantwortlPerson.Text = res[1];
tbAnzahlPersonen.Text = Regex.IsMatch(res[2].ToString(), "[0-9]") ? (Convert.ToInt16(res[2]) + 1).ToString() : "";
if ((tbVerantwortlPerson.ItemsSource as string[]).Count() > 1)
{
tbMultiplePeople.Visibility = Visibility.Visible;
var tt = new ToolTip();
tt.Content = "Mehrere Personen stehen zur Auswahl";
tt.PlacementTarget = tbMultiplePeople;
tt.Placement = System.Windows.Controls.Primitives.PlacementMode.Right;
tt.HorizontalOffset = -20;
tt.VerticalOffset = 30;
tbMultiplePeople.ToolTip = tt;
tt.IsOpen = true;
System.Windows.Threading.DispatcherTimer t = new System.Windows.Threading.DispatcherTimer();
t.Interval = TimeSpan.FromSeconds(5);
t.Tick += (s, e) => { Dispatcher.Invoke(() => tt.IsOpen = false); t.Stop(); };
t.Start();
}
}
else
{
var res = SQL.ReadListStringMultipleColumns($"SELECT Verantwortlicher_MA_Firma,Tel_Nr_Verantwortlicher_Firma,Anzahl_Begleiter FROM {MainWindow.table}.firmen WHERE `idFirmen` = '{selectedID}' LIMIT 1").Result.First().Split(';');
tbVerantwortlPerson.ItemsSource = new List<string>() { res[0] };
tbNrVerantwortlPerson.ItemsSource = new List<string>() { res[1] };
tbVerantwortlPerson.SelectedValue = res[0];
tbNrVerantwortlPerson.SelectedValue = res[1];
tbAnzahlPersonen.Text = Regex.IsMatch(res[2].ToString(), "[0-9]") ? (Convert.ToInt16(res[2]) + 1).ToString() : "";
}
}
else if (isBesucher == 1)
{
tbVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Verantwortlicher_MA FROM {MainWindow.table}.besucher WHERE `idbesucher` = '{selectedID}' LIMIT 1");
tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT Tel_Nr_Besucher FROM {MainWindow.table}.besucher WHERE `idbesucher` = '{selectedID}' LIMIT 1");
var res = SQL.ReadListStringMultipleColumns($"SELECT Name,Tel_Nr_Besucher,Anzahl_Begleitpersonen FROM {MainWindow.table}.besucher WHERE `idbesucher` = '{selectedID}' LIMIT 1").Result.First().Split(';');
tbVerantwortlPerson.ItemsSource = new List<string>() { res[0] };
tbNrVerantwortlPerson.ItemsSource = new List<string>() { res[1] };
tbVerantwortlPerson.Text = res[0];
tbNrVerantwortlPerson.Text = res[1];
tbAnzahlPersonen.Text = (Convert.ToInt16(res[2]) + 1).ToString();
}
else if (isBesucher == 2)
{
var res = SQL.ReadListStringTwoColumns($"SELECT TelNr AS Tel_Nr_Besucher,AnzBegleiter FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1").Result.First().Split(';');
tbVerantwortlPerson.ItemsSource = new List<string>() { Name };
tbNrVerantwortlPerson.ItemsSource = new List<string>() { res[0] };
tbVerantwortlPerson.Text = Name;
tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT TelNr AS Tel_Nr_Besucher FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
tbAnzahlPersonen.Text = await SQL.ReadSingleValueAsync($"SELECT AnzBegleiter FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
tbNrVerantwortlPerson.Text = res[0];
tbAnzahlPersonen.Text = res[1];
}
}
//else if (isBesucher == 2)
//{
// var dict = new Dictionary<int, string>();
// dict.Add(Convert.ToInt32("1111" + selectedID), Name);
// var x = dict.First();
// cbName.SelectedIndex = (cbName.Items.IndexOf(x));
// //cbName.SelectedItem = cbName.Items.IndexOf(cbName.ItemsSource as )
// //cbName.SelectedValue = Name;
// tbVerantwortlPerson.Text = Name;
// tbNrVerantwortlPerson.Text = await SQL.ReadSingleValueAsync($"SELECT TelNr AS Tel_Nr_Besucher FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
// tbAnzahlPersonen.Text = await SQL.ReadSingleValueAsync($"SELECT AnzBegleiter FROM {MainWindow.table}.family WHERE `Name` = '{Name}' AND `Date` = '{DateTime.Now.Date.ToString("yyyy-MM-dd")}' LIMIT 1");
//}
else
{
cbName.SelectionChanged += CbName_SelectionChanged;
@ -194,25 +282,57 @@ namespace ZKuP
btnSignature.ToolTip = "Kein Unterschriftenpad gefunden";
}
}));
string x = SQL.ReadSingleValue($"SELECT BEint FROM {MainWindow.table}.firmen WHERE idFirmen = '{selectedID}'");
int beID = Convert.ToInt16(x != "" ? x : "-1");
if (isBesucher == 0 && (beID != -1))
if (isBesucher == 0)
{
imgBE.Source = new BitmapImage(new Uri(@"pack://application:,,,/"
+ System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
+ ";component/"
+ $"Assets/BE{beID.ToString()}.png", UriKind.Absolute));
popBE.IsOpen = true;
foreach (TextBlock tb in Helper.FindVisualChildren<TextBlock>(gridFirmenPark))//.Where(p => p.Tag == null))
{
if (Regex.IsMatch(tb.Text, @"\d+"))
{
StackPanel sp = new StackPanel();
string parkplatz = tb.Text.PadLeft(2, '0');
var img = new BitmapImage(new Uri(@"pack://application:,,,/"
+ System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
+ ";component/"
+ $"Assets/Parkplatz/{parkplatz}.png", UriKind.Absolute));
sp.Children.Add(new TextBlock() { Text = $"Parkplatz {tb.Text.PadLeft(2, '0')}", FontWeight = FontWeights.Bold });
sp.Children.Add(new Image() { Source = img, Width = img.Width, Height = img.Height });
tb.ToolTip = sp;
ToolTipService.SetInitialShowDelay(tb, 100);
ToolTipService.SetBetweenShowDelay(tb, 100);
}
}
string x = SQL.ReadSingleValue($"SELECT BEint FROM {MainWindow.table}.firmen WHERE idFirmen = '{selectedID}'");
string y = SQL.ReadSingleValue($"SELECT Parkplatz FROM {MainWindow.table}.beParkplaetze WHERE beNr = '{x}'").TrimEnd(',');
beID = Convert.ToInt16(x != "" ? x : "-1");
if (beID != -1)
{
var be = Helper.GetBEFileNames(beID.ToString());
imgBE.Source = new BitmapImage(new Uri(@"pack://application:,,,/"
+ System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
+ ";component/"
+ $"{be}", UriKind.Absolute));
imgBE.Stretch = Stretch.UniformToFill;
lblParkNumbers.Text = $"Nur folgende Parkplätze vergeben: {y}";
popBE.IsOpen = true;
}
}
if (isBesucher == 1)
{
gridBesucherPark.Visibility = Visibility.Visible;
GParkRow.Height = new GridLength(1.8, GridUnitType.Star);
this.Height = this.Height + 100;
GParkTop.Height = new GridLength(GParkTop.Height.Value + 100, GridUnitType.Pixel);
//GParkRow.Height = new GridLength(1.8, GridUnitType.Star);
//this.Height = this.Height + 100;
//GParkTop.Height = new GridLength(GParkTop.Height.Value + 100, GridUnitType.Pixel);
var besucher = SQL.ReadSingleValue($"SELECT besucherList FROM {MainWindow.table}.besucherGroups WHERE idBesucher = '{selectedID}'");
@ -233,6 +353,137 @@ namespace ZKuP
popBesucher.IsOpen = true;
}
}
usePark(await Task.Run(() => getPark()));
checkPark();
this.SizeChanged += MainWindow_SizeChanged;
}
private async Task<Tuple<List<string>, List<string>>> getPark()
{
//if (LoggedInRole == Roles.Admin || LoggedInRole == Roles.Pförtner)
//{
var park = await SQL.ReadListString($"SELECT Parkplatz FROM {MainWindow.table}.`beParkplaetze` LEFT JOIN {MainWindow.table}.`beBelegung` ON beParkplaetze.beNr = beBelegung.beNr WHERE Parkplatz IS NOT null AND CURDATE() BETWEEN beBelegung.von AND beBelegung.bis");
var singlePark = await SQL.ReadDictionary2($"SELECT p.parkplatznr, f.Name FROM {MainWindow.table}.parkplaetze p LEFT JOIN {MainWindow.table}.firmen f ON f.idFirmen = p.firma", 0, 1);
string list = "";
list = string.Join("", park);
park = list.Split(',').ToList();
park = park.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
for (var p = 0; p < park.Count; p++) park[p] = park[p].PadLeft(2, '0');
var justPark = park.ToList();
park.AddRange(singlePark.Keys);
return new Tuple<List<string>, List<string>> (justPark, park);
}
private void usePark(Tuple<List<string>, List<string>> parkLists)
{
var justPark = parkLists.Item1;
var park = parkLists.Item2;
var rects = gridFirmenPark.Children.OfType<Rectangle>();
foreach (Rectangle s in rects)
{
if (park.Contains(s.Name.TrimStart('P').PadLeft(2, '0')))
{
//var x = Helper.FindVisualChildren<Rectangle>(BE, s.Name).First();
s.Fill = new SolidColorBrush(Colors.Red);
}
else if (!s.Name.StartsWith("Red"))
{
s.Fill = new SolidColorBrush(Colors.Green);
}
}
if (BesuchP.Children.OfType<Grid>().Count() > 0)
{
var rectsG = BesuchP.Children.OfType<Grid>().First().Children.OfType<Rectangle>();
foreach (Rectangle s in rectsG)
{
if (park.Contains(s.Name))
{
//var x = Helper.FindVisualChildren<Rectangle>(BE, s.Name).First();
s.Fill = new SolidColorBrush(Colors.Red);
}
else if (!s.Name.StartsWith("Red"))
{
s.Fill = new SolidColorBrush(Colors.Green);
}
}
}
if (isBesucher == 0)
{
Dictionary<string, string> dict = new Dictionary<string, string>();
dict = SQL.ReadDictionary2($"SELECT beNr, Parkplatz FROM {MainWindow.table}.beParkplaetze", 0, 1).Result;
foreach (Rectangle rect in Helper.FindVisualChildren<Rectangle>(gridFirmenPark).Where(p => p.Fill.ToString() == Brushes.Red.ToString()))
{
StackPanel sp = new StackPanel();
var nr = rect.Name.TrimStart('P').PadLeft(2, '0');
if (justPark.Contains(nr))
{
//var be = SQL.ReadSingleValue($"SELECT beNr FROM {MainWindow.table}.beParkplaetze WHERE Parkplatz LIKE '%{nr},%'");
var x = dict.Where(kv => kv.Value.Contains(nr)).Select(kv => kv.Key);
var be = x.Count() > 0 ? x.First() : "";
//Helper.FindVisualChildren<TextBlock>(BE, nr).First();
if (!string.IsNullOrWhiteSpace(be))
{
var img = new BitmapImage(new Uri(@"pack://application:,,,/"
+ System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
+ ";component/"
+ $"{Helper.GetBEFileNames(Convert.ToInt16(be))}", UriKind.Absolute));
sp.Children.Add(new TextBlock() { Text = $"{Helper.GetBEDescription(Convert.ToInt16(be))}", FontWeight = FontWeights.Bold });
sp.Children.Add(new Image() { Source = img, Width = img.Width / 1.5, Height = img.Height / 1.5 });
//rect.ToolTip = sp;
var tb = gridFirmenPark.FindChildren<TextBlock>().Where(p => p.Text == nr.TrimStart('0')).First();
tb.ToolTip = sp;
tb.PreviewMouseLeftButtonDown -= ParkSetPreviewMouseLeftButtonDown;
rect.Fill = new SolidColorBrush(Colors.Orange);
}
}
}
}
belegteParkplaetze = rects.Where(p => p.Fill.ToString() == Brushes.Red.ToString()).Count();
}
private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
{
var screen = WpfScreenHelper.Screen.FromHandle(new WindowInteropHelper(this).Handle);
var workingArea = screen.WorkingArea;
// Maximale Top-Position, sodass das Fenster unten nicht rausgeht
if (this.Top + this.ActualHeight > workingArea.Bottom)
{
this.Top = workingArea.Bottom - this.ActualHeight;
}
// Optionale obere Begrenzung
if (this.Top < workingArea.Top)
{
this.Top = workingArea.Top;
}
}
private async void BtnCheck_Click(object sender, RoutedEventArgs e)
@ -429,7 +680,7 @@ namespace ZKuP
else if (kl_einweis == "Kleine Unterweisung durchführen!")
{
lblKleineUnterweisung.Background = new SolidColorBrush(Colors.LightYellow);
lblKleineUnterweisung.Content = "↓ " + kl_einweis + " ↓";
lblKleineUnterweisung.Content = kl_einweis;
}
else lblKleineUnterweisung.Background = new SolidColorBrush(Colors.LightSalmon);
@ -447,10 +698,12 @@ namespace ZKuP
if (zutritt == "") zutritt = "Fehlerhaft";
arrivalClicked = true;
btnClose_Copy.Visibility = Visibility.Collapsed;
var kennzeichenTextboxes = spKennzeichen.Children.OfType<TextBox>().ToList();
string kennzeichen = "";
fzgCount = string.IsNullOrWhiteSpace(tbAnzahlFzg.Text) ? 0 : Convert.ToInt32(tbAnzahlFzg.Text);
for (var i = 0; i < fzgCount; i++)
{
if (kennzeichenTextboxes.Count >= i)
@ -466,13 +719,48 @@ namespace ZKuP
if (int.TryParse(selectedID, out int result))
{
var idFirma_Besucher = selectedID.StartsWith("9999") ? Convert.ToInt32(selectedID.ToString().Substring(3)) : Convert.ToInt32(selectedID);
query = $"INSERT INTO zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung,signature_blob,idFirma_Besucher) VALUES ('{kat}','{cbName.Text.ToString().Replace(",", ";")}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt}','{einweis}','{AnzPers.Replace(",", ";")}','{AnzFzg.Replace(",", ";")}','{asp.Replace(",", ";")}','{klUnterweis}','{anzFzgGemeldet}','{kennzeichen}','{tbBemerkung.Text}',@signature,'{idFirma_Besucher}')";
//query = $"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung,signature_blob,idFirma_Besucher) VALUES ('{kat}','{cbName.Text.ToString().Replace(",", ";")}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt}','{einweis}','{AnzPers.Replace(",", ";")}','{AnzFzg.Replace(",", ";")}','{asp.Replace(",", ";")}','{klUnterweis}','{anzFzgGemeldet}','{kennzeichen}','{tbBemerkung.Text}',@signature,'{idFirma_Besucher}')";
//query = $"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung,signature_blob,idFirma_Besucher) VALUES (@kat,@name,@time,@zutritt,@einweis,@anzPers,@anzFzg,@asp,@klUnterweis,@anzFzgGemeldet,@kennzeichen,@bemerkung,@idFirma_Besucher)";
query = SQL.CreateAndReturnSQLCommand($"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung,signature_blob,idFirma_Besucher) VALUES (@kat,@name,@time,@zutritt,@einweis,@anzPers,@anzFzg,@asp,@klUnterweis,@anzFzgGemeldet,@kennzeichen,@bemerkung,@signature,@idFirma_Besucher)", new List<MySqlParameter>()
{
new MySqlParameter("@kat",kat),
new MySqlParameter("@name", cbName.Text.ToString().Replace(",", ";")),
new MySqlParameter("@time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
new MySqlParameter("@zutritt", zutritt),
new MySqlParameter("@einweis", einweis),
new MySqlParameter("@anzPers", AnzPers.Replace(",", ";")),
new MySqlParameter("@anzFzg", AnzFzg.Replace(",", ";")),
new MySqlParameter("@asp", asp.Replace(",", ";")),
new MySqlParameter("@klUnterweis", klUnterweis),
new MySqlParameter("@anzFzgGemeldet", anzFzgGemeldet),
new MySqlParameter("@kennzeichen", kennzeichen),
new MySqlParameter("@bemerkung", tbBemerkung.Text),
new MySqlParameter("@idFirma_Besucher", idFirma_Besucher)
});
btnSignature.IsEnabled = true;
}
else
{
query = $"INSERT INTO zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung) VALUES ('{kat}','{cbName.Text.ToString().Replace(",", ";")}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt}','{einweis}','{AnzPers.Replace(",", ";")}','{AnzFzg.Replace(",", ";")}','{asp.Replace(",", ";")}','{klUnterweis}','{anzFzgGemeldet}','{kennzeichen}','{tbBemerkung.Text}')";
//query = $"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung) VALUES ('{kat}','{cbName.Text.ToString().Replace(",", ";")}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}','{zutritt}','{einweis}','{AnzPers.Replace(",", ";")}','{AnzFzg.Replace(",", ";")}','{asp.Replace(",", ";")}','{klUnterweis}','{anzFzgGemeldet}','{kennzeichen}','{tbBemerkung.Text}')";
query = SQL.CreateAndReturnSQLCommand($"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung) VALUES (@kat,@name,@time,@zutritt,@einweis,@anzPers,@anzFzg,@asp,@klUnterweis,@anzFzgGemeldet,@kennzeichen,@bemerkung)", new List<MySqlParameter>()
{
new MySqlParameter("@kat",kat),
new MySqlParameter("@name", cbName.Text.ToString().Replace(",", ";")),
new MySqlParameter("@time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
new MySqlParameter("@zutritt", zutritt),
new MySqlParameter("@einweis", einweis),
new MySqlParameter("@anzPers", AnzPers.Replace(",", ";")),
new MySqlParameter("@anzFzg", AnzFzg.Replace(",", ";")),
new MySqlParameter("@asp", asp.Replace(",", ";")),
new MySqlParameter("@klUnterweis", klUnterweis),
new MySqlParameter("@anzFzgGemeldet", anzFzgGemeldet),
new MySqlParameter("@kennzeichen", kennzeichen),
new MySqlParameter("@bemerkung", tbBemerkung.Text),
});
btnSignature.IsEnabled = false;
}
@ -486,14 +774,50 @@ namespace ZKuP
btnSignature.Content = "Unterschrift bereits vorhanden";
}
if (arrivalClicked) btnKarte.IsEnabled = true;
if (arrivalClicked)
{
btnKarte.IsEnabled = true;
if (SQL.ReadSingleValue($"SELECT EXISTS (SELECT * FROM {MainWindow.table}.karten WHERE benutzer = '{tbVerantwortlPerson.Text}' AND farbe = 'Grün')") == "1")
{
btnKarte.Content = $"{tbVerantwortlPerson.Text} hat bereits eine grüne Karte\nZusätzliche Personen können hier eingetragen werden";
btnClose.IsEnabled = true;
}
}
if (kat == "2")
{
Helper.PrintPDF("\\\\mhb00swfs003v.fv-werke.db.de\\GLW99\\ZKuP\\Einweisungsflyer.pdf");
btnCheck.Content = "Einweisungflyer wird gedruckt...";
#if !DEBUG
// Vorerst deaktiviert, da ich beim Pförtner überprüfen muss ob das alles so funktioniert
//
//
//if (MainWindow.LoggedInRole == Roles.Pförtner)
//{
// Helper.PrintPDF("\\\\mhb00swfs003v.fv-werke.db.de\\GLW99\\ZKuP\\Einweisungsflyer.pdf");
// btnCheck.Content = "Einweisungflyer wird gedruckt...";
//}
#endif
}
}
private void checkPark()
{
var rects = gridFirmenPark.Children.OfType<Rectangle>();
if (int.TryParse(tbAnzahlFzg.Text, out int anz))
if (anz > 0 && beID == -1)
if ((rects.Where(p => p.Fill.ToString() == Brushes.Red.ToString()).Count() - belegteParkplaetze) >= anz)
{
lblSelectAParkplatz.Visibility = Visibility.Collapsed;
}
else
{
lblSelectAParkplatz.Visibility = Visibility.Visible;
}
else if (anz > 0 && beID != -1)
lblSelectAParkplatz.Visibility = Visibility.Collapsed;
}
protected override void OnClosing(CancelEventArgs e)
{
@ -523,9 +847,24 @@ namespace ZKuP
{
if (arrivalClicked)
{
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.changes SET timestamp = @time WHERE `table` = 'arrivals'", new List<MySqlParameter>()
{
new MySqlParameter("@time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
});
try
{
await SQL.WriteSQL(query, _signature);
if (_signature != null)
{
await SQL.CreateAndWriteSQLwithSignature(query, _signature);
}
else
{
query.CommandText = query.CommandText.Replace(",@signature", "");
query.CommandText = query.CommandText.Replace(",signature_blob", "");
await SQL.CreateAndWriteSQL(query);
}
arrivalClicked = false;
@ -541,6 +880,7 @@ namespace ZKuP
}
signoPad.CloseConnection();
signoPad.CloseConnection();
}
private async void CbName_SelectionChanged(object sender, SelectionChangedEventArgs e)
@ -559,47 +899,49 @@ namespace ZKuP
{
a_Fzg = await SQL.ReadSingleValueAsync($"SELECT Anzahl_Fzg FROM {MainWindow.table}.firmen WHERE `idFirmen`='{selectedID}' AND `Arbeitsbeginn` <= current_date() AND `Arbeitsende` >= current_date()");
lblAngemeldeteFzg.Text = !string.IsNullOrWhiteSpace(a_Fzg) ? a_Fzg + " Fzg. angemeldet" : "keine Fzg. angemeldet";
tbAnzahlFzg.Text = !string.IsNullOrWhiteSpace(a_Fzg) ? a_Fzg : "";
}
else
{
lblAngemeldeteFzg.Text = "Besucher nur ohne Fzg.";
tbAnzahlFzg.Text = "0";
}
spKennzeichen.Children.Clear();
//spKennzeichen.Children.Clear();
if (!string.IsNullOrWhiteSpace(a_Fzg))
{
fzgCount = Convert.ToInt16(a_Fzg);
//if (!string.IsNullOrWhiteSpace(a_Fzg))
//{
// fzgCount = Convert.ToInt16(a_Fzg);
for (var i = 0; i < fzgCount; ++i)
{
spKennzeichen.Children.Add(new TextBox()
{
Name = $"tbKennzeichen{i + 1}",
Height = 23,
Margin = new Thickness(0, 2, 0, 0),
TextWrapping = TextWrapping.Wrap,
VerticalAlignment = VerticalAlignment.Top,
TextAlignment = TextAlignment.Center,
Padding = new Thickness(0, 2, 0, 0),
TabIndex = 5 + i
});
// for (var i = 0; i < fzgCount; ++i)
// {
// spKennzeichen.Children.Add(new TextBox()
// {
// Name = $"tbKennzeichen{i + 1}",
// Height = 23,
// Margin = new Thickness(0, 2, 0, 0),
// TextWrapping = TextWrapping.Wrap,
// VerticalAlignment = VerticalAlignment.Top,
// TextAlignment = TextAlignment.Center,
// Padding = new Thickness(0, 2, 0, 0),
// TabIndex = 5 + i
// });
spKennzeichen.Children.Add(new TextBlock()
{
Margin = new Thickness(0, -21, 0, 0),
Width = 100,
TextWrapping = TextWrapping.Wrap,
Text = $"{i+1}. Kennzeichen",
VerticalAlignment = VerticalAlignment.Top,
HorizontalAlignment = HorizontalAlignment.Left,
Foreground = new SolidColorBrush(Colors.Gray),
Padding = new Thickness(5, 0, 0, 0)
});
// spKennzeichen.Children.Add(new TextBlock()
// {
// Margin = new Thickness(0, -21, 0, 0),
// Width = 100,
// TextWrapping = TextWrapping.Wrap,
// Text = $"{i+1}. Kennzeichen",
// VerticalAlignment = VerticalAlignment.Top,
// HorizontalAlignment = HorizontalAlignment.Left,
// Foreground = new SolidColorBrush(Colors.Gray),
// Padding = new Thickness(5, 0, 0, 0)
// });
this.Height = this.Height + 15;
}
}
// this.Height = this.Height + kennzeichenHeight;
// }
//}
btnCheck.IsEnabled = true;
btnKarte.IsEnabled = true;
@ -609,7 +951,77 @@ namespace ZKuP
List<string> selectedPark = new List<string>();
string time = "";
private async void ParkSetPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (MainWindow.LoggedInRole == Roles.Pförtner || MainWindow.LoggedInRole == Roles.Admin)
{
if (time == "") time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var parkplatz = (sender as TextBlock).Text;
if ((parkplatz == "7" && gridFirmenPark.Children.OfType<Rectangle>().Where(p => p.Name == $"P7").First().Fill.ToString() == Colors.Green.ToString()))
MessageBox.Show("Dieser Parkplatz darf nur an DB Energie vergeben werden!", "DB Energie Parkplatz", MessageBoxButton.OK, MessageBoxImage.Information);
if ((parkplatz == "34" && gridFirmenPark.Children.OfType<Rectangle>().Where(p => p.Name == $"P34").First().Fill.ToString() == Colors.Green.ToString()))
MessageBox.Show("Dieser Parkplatz darf nur an DB Energie vergeben werden!", "DB Energie Parkplatz", MessageBoxButton.OK, MessageBoxImage.Information);
if (parkplatz == "6" && gridFirmenPark.Children.OfType<Rectangle>().Where(p => p.Name == $"P6").First().Fill.ToString() == Colors.Green.ToString())
MessageBox.Show("Dieser Parkplatz darf nur an DB InfraGO vergeben werden!", "DB InfraGO Parkplatz", MessageBoxButton.OK, MessageBoxImage.Information);
foreach (var rect in gridFirmenPark.Children.OfType<Rectangle>())
{
if (rect.Name == "P" + parkplatz)
{
if (rect.Fill.ToString() == Colors.Red.ToString())
{
rect.Fill = new SolidColorBrush(Colors.Green);
//await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.parkplaetze WHERE parkplatznr={parkplatz}");
var command = new MySqlCommand($"DELETE FROM {MainWindow.table}.parkplaetze WHERE parkplatznr = @pParkplatz");
command.Parameters.Add(new MySqlParameter("pParkplatz", parkplatz));
await SQL.WriteSQL(command);
selectedPark.Remove(parkplatz);
}
else if (rect.Fill.ToString() == Colors.Green.ToString())
{
rect.Fill = new SolidColorBrush(Colors.Red);
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.parkplaetze (parkplatznr) VALUES ({parkplatz})");
var command = new MySqlCommand($"INSERT INTO {MainWindow.table}.parkplaetze (parkplatznr, firma, AusgegebenDurch, AusgegebenTimestamp, TelVerantwortlicherFirma) VALUES (@pParkplatz, @pFirma, @pAusgeber, @pTime, @pTel)");
command.Parameters.Add(new MySqlParameter("pParkplatz", parkplatz));
command.Parameters.Add(new MySqlParameter("pFirma", cbName.SelectedValue.ToString()));
command.Parameters.Add(new MySqlParameter("pAusgeber", Helper.InsertSpaceBeforeUpperCase(Environment.UserName)));
command.Parameters.Add(new MySqlParameter("pTime", time));
command.Parameters.Add(new MySqlParameter("pTel", tbNrVerantwortlPerson.Text));
await SQL.WriteSQL(command);
selectedPark.Add(parkplatz);
}
}
}
if (selectedPark.Count > 0)
{
string s = "";
s = String.Join(", ", selectedPark.OrderBy(p => p));
//s = s.TrimEnd(',');
borderParkkarteFirmaAusgeben.Visibility = Visibility.Visible;
lblParkkarteFirmaAusgeben.Text = $"Parkkarte Nr. {s}\nan Firma {cbName.Text} ausgeben";
}
else
{
lblParkkarteFirmaAusgeben.Text = "";
borderParkkarteFirmaAusgeben.Visibility = Visibility.Collapsed;
}
checkPark();
}
}
List<string> selectedGPark = new List<string>();
@ -631,7 +1043,13 @@ namespace ZKuP
else if (rect.Fill.ToString() == Colors.Green.ToString())
{
rect.Fill = new SolidColorBrush(Colors.Red);
await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.parkplaetze (parkplatznr) VALUES ('G{parkplatz}')");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.parkplaetze (parkplatznr) VALUES ('G{parkplatz}')");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.parkplaetze (parkplatznr, AusgegebenDurch) VALUES (@parkplatznr, @ausgegeben)", new List<MySqlParameter>()
{
new MySqlParameter("@parkplatznr", $"G{parkplatz}"),
new MySqlParameter("@ausgegeben", Helper.InsertSpaceBeforeUpperCase(Environment.UserName))
});
selectedGPark.Add(parkplatz);
}
}
@ -686,14 +1104,27 @@ namespace ZKuP
name = tbVerantwortlPerson.Text;
Sign(name, kennzeichen);
}
private void Sign(string name, string kennzeichen)
{
if (signoPad._stPad.DeviceGetCount() > 0)
{
var sig = new Signature(Signature.DisclaimerType.Parken,name, cbName.SelectedItem.ToString(), kennzeichen);
var sig = new Signature(Signature.DisclaimerType.Parken, name, cbName.SelectedItem.ToString(), kennzeichen);
if (sig.ShowDialog() == false)
{
_signature = sig.ResultByte;
if (sig.ResultByte != null)
{
_signature = sig.ResultByte;
btnCheck.IsEnabled = true;
btnCheck.IsEnabled = true;
}
else
{
MessageBox.Show("Keine Unterschrift, erneut versuchen", "Keine Unterschrift", MessageBoxButton.OK, MessageBoxImage.Error);
Sign(name, kennzeichen);
}
}
}
else
@ -710,18 +1141,32 @@ namespace ZKuP
else { btnSignature.IsEnabled = true; btnSignature.Content = "Unterschrift einholen!"; }
if (!cbName.SelectedValue.ToString().StartsWith("9999"))
await SQL.WriteSQL($"UPDATE {MainWindow.table}.firmen SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idFirmen` = '{selectedID}'");
{
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.firmen SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idFirmen` = '{selectedID}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.firmen SET Kleine_Unterweisung_bis = @DateTime WHERE `idFirmen` = @selectedID", new List<MySqlParameter>()
{
new MySqlParameter("@DateTime", (DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")),
new MySqlParameter("@selectedID", selectedID)
});
}
else
await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idBesucher` = '{selectedID}'");
{
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Kleine_Unterweisung_bis = '{(DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")}' WHERE `idBesucher` = '{selectedID}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.besucher SET Kleine_Unterweisung_bis = @DateTime WHERE `idBesucher` = @selectedID", new List<MySqlParameter>()
{
new MySqlParameter("@DateTime", (DateTime.Now.Date.AddYears(1)).ToString("yyyy-MM-dd")),
new MySqlParameter("@selectedID", selectedID)
});
}
//
// Fehler s[20] beheben, Spalte 20 vermutlich falsch
// Tritt nur mit Button kleine Einweisung aus
//
var s = query.Split(',');
var qText = query.CommandText;
var s = qText.Split(',');
s[21] = "1";
query = string.Join(",", s);
query.CommandText = string.Join(",", s);
btnKlEinweisung_durchgeführt.Background = new SolidColorBrush(Colors.GreenYellow);
}
@ -741,18 +1186,41 @@ namespace ZKuP
{
if (i == 0)
{
AddCardUser aI = new AddCardUser(cbName.SelectedItem.ToString(), isBesucher == 1 ? true : false, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap);
aI.Owner = this;
aI.ShowDialog();
var hasEinweisung = lblEinweisung.Background.ToString() == Brushes.LightGreen.ToString() ? true : false;
if (isBesucher == 1)
{
AddCardUser aI = new AddCardUser(tbVerantwortlPerson.Text, true, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap, true, hasEinweisung, "", tbNrVerantwortlPerson.Text);
aI.Owner = this;
aI.ShowDialog();
}
else
{
AddCardUser aI = new AddCardUser(tbVerantwortlPerson.Text, false, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap, true, hasEinweisung, cbName.Text, tbNrVerantwortlPerson.Text, selectedID);
aI.Owner = this;
aI.ShowDialog();
}
}
else
{
var hasEinweisung = lblEinweisung.Background.ToString() == Brushes.LightGreen.ToString() ? true : false;
var u = "";
if (user.Contains(';')) u = user.Split(';')[i - 1];
AddCardUser aI = new AddCardUser(u, isBesucher == 1 ? true : false, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap, false);
aI.Owner = this;
aI.ShowDialog();
if (isBesucher == 1)
{
AddCardUser aI = new AddCardUser(u, true, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap, false, hasEinweisung, "");
aI.Owner = this;
aI.ShowDialog();
}
else
{
AddCardUser aI = new AddCardUser(u, false, (i + 1).ToString() + " / " + tbAnzahlPersonen.Text, ap, false, hasEinweisung, cbName.Text, "", selectedID);
aI.Owner = this;
aI.ShowDialog();
}
}
}
@ -787,6 +1255,13 @@ namespace ZKuP
await initialize();
spinnerCanvas.Visibility = Visibility.Collapsed;
//tbAnzahlFzg.Text = "0";
Helper.CheckWindowIsInScreenSpace(this);
}
private void tbAnzahlPersonen_PreviewTextInput(object sender, TextCompositionEventArgs e)
@ -804,12 +1279,6 @@ namespace ZKuP
private void tbAnzahlFzg_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
if(isBesucher == 1)
{
MessageBox.Show("Besucher dürfen nicht mit einem Fahrzeug einfahren!\nDem Besucher einen Besucherparkplatz zuweisen!", "Einfahrt verboten!", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
}
if (!Regex.IsMatch(e.Text, "[0-9]"))
{
e.Handled = true;
@ -821,6 +1290,82 @@ namespace ZKuP
}
}
bool alreadyWarned = false;
bool secondRun = false;
private void tbAnzahlFzg_TextChanged(object sender, TextChangedEventArgs e)
{
var tb = (sender as TextBox).Text;
if (isBesucher == 1 && tb != "0" && !string.IsNullOrWhiteSpace(tb) && !alreadyWarned)
{
MessageBox.Show("Besucher dürfen nicht mit einem Fahrzeug einfahren!\nDem Besucher einen Besucherparkplatz zuweisen!", "Einfahrt verboten!", MessageBoxButton.OK, MessageBoxImage.Error);
alreadyWarned = true;
//e.Handled = true;
}
if (Regex.IsMatch(tb, "^0.") || string.IsNullOrWhiteSpace(tb))
{
//this.Height = this.Height - (spKennzeichen.Children.Count / 2) * kennzeichenHeight;
if (isBesucher == 0)
{
this.Height = this.MinHeight;
lblSelectAParkplatz.Visibility = Visibility.Collapsed;
}
}
else
{
fzgCount = Convert.ToInt16(tb);
spKennzeichen.Children.Clear();
//spKennzeichen.Height = 0;
if (isBesucher == 0)
this.Height = this.MinHeight;
//else if (isBesucher == 1)
// this.Height = this.MinHeight + 100;
for (var i = 0; i < fzgCount; ++i)
{
spKennzeichen.Children.Add(new TextBox()
{
Name = $"tbKennzeichen{i + 1}",
Height = 23,
Margin = new Thickness(0, 2, 0, 0),
TextWrapping = TextWrapping.Wrap,
VerticalAlignment = VerticalAlignment.Top,
TextAlignment = TextAlignment.Center,
Padding = new Thickness(0, 2, 0, 0),
TabIndex = 5 + i
});
TextBoxHelper.SetWatermark((spKennzeichen.Children[spKennzeichen.Children.Count - 1] as TextBox), $"{i + 1}. Kennzeichen");
(spKennzeichen.Children[spKennzeichen.Children.Count - 1] as TextBox).CharacterCasing = CharacterCasing.Upper;
//spKennzeichen.Children.Add(new TextBlock()
//{
// Margin = new Thickness(0, -21, 0, 0),
// Width = 100,
// TextWrapping = TextWrapping.Wrap,
// Text = $"{i + 1}. Kennzeichen",
// VerticalAlignment = VerticalAlignment.Top,
// HorizontalAlignment = HorizontalAlignment.Left,
// Foreground = new SolidColorBrush(Colors.Gray),
// Padding = new Thickness(5, 0, 0, 0)
//});
//this.Height = this.Height + kennzeichenHeight;
}
this.Height = this.Height + (spKennzeichen.Children.Count) * kennzeichenHeight;
spKennzeichen.Height = (spKennzeichen.Children.Count) * kennzeichenHeight;
kennzeichenRow.Height = new GridLength(spKennzeichen.Height);
}
if(secondRun) checkPark();
secondRun = true;
}
private void btnCloseBE_Click(object sender, RoutedEventArgs e)
{
popBE.IsOpen = false;
@ -830,5 +1375,12 @@ namespace ZKuP
{
popBesucher.IsOpen = false;
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,14 +1,15 @@
<Window x:Class="ZKuP.ArrivalsOverview"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Ankunftsübersicht" Height="750" Width="1300">
<Window.Resources>
Title="Ankunftsübersicht" Height="750" Width="1300" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<mah:MetroWindow.Resources>
<local:ConvertToBackground2 x:Key="ConvertToBackground2"></local:ConvertToBackground2>
</Window.Resources>
</mah:MetroWindow.Resources>
<Grid>
<DataGrid x:Name="dgArrivalsOverview" Margin="10,65,10,10" AutoGenerateColumns="False" ItemsSource="{Binding .}" CanUserDeleteRows="False" CanUserAddRows="False" RowHeaderWidth="0">
@ -109,4 +110,4 @@
<!--<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" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="Anwesende Firmen/Besucher zwischen dem '' und '':" HorizontalAlignment="Left" Margin="10,45,0,0" VerticalAlignment="Top"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@ -18,7 +19,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für ArrivalsOverview.xaml
/// </summary>
public partial class ArrivalsOverview : Window
public partial class ArrivalsOverview : MetroWindow
{
Roles LoggedInRole = Roles.None;
@ -42,7 +43,7 @@ namespace ZKuP
private async void FillDataGrid(DateTime von, DateTime bis)
{
if (LoggedInRole == Roles.Admin || LoggedInRole == Roles.Pförtner)
if (LoggedInRole == Roles.Admin || LoggedInRole == Roles.Pförtner || LoggedInRole == Roles.M2_AM)
{
todayFirm = await SQL.ReadSQL($"Select * From {MainWindow.table}.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 {MainWindow.table}.besucher WHERE (Besuchstag >= '{von.ToString("yyyy-MM-dd")}' AND Besuchstag <= '{bis.ToString("yyyy-MM-dd")}')", todayBesuch);
@ -115,5 +116,16 @@ namespace ZKuP
{
MessageBox.Show("Kein gültiges Datumsformat in Feld 'bis'", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,12 +1,13 @@
<Window x:Class="ZKuP.AspInfo"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Info zu Ansprechpartnern" Height="591" Width="354" ResizeMode="NoResize"
WindowStartupLocation="CenterOwner" Visibility="Collapsed">
WindowStartupLocation="CenterOwner" Visibility="Collapsed" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid x:Name="gridInfo">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@ -21,6 +22,7 @@
<RowDefinition Height="2*"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock x:Name="lblAsp" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Ansprechpartner:" VerticalAlignment="Top"/>
<TextBox x:Name="tbAsp" Margin="10,0,10,0" TextWrapping="Wrap" VerticalAlignment="Bottom" IsReadOnly="True"/>
@ -36,8 +38,14 @@
<TextBox x:Name="tbTelVorgesetzter" Margin="10,0,10,0" TextWrapping="Wrap" ToolTip="Klicken zum Anrufen" Cursor="Hand" VerticalAlignment="Bottom" Grid.Row="5" IsReadOnly="True" PreviewMouseLeftButtonDown="TelNrs_PreviewMouseLeftButtonDown" Foreground="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" TextDecorations="Underline"/>
<TextBlock x:Name="lblBemerkung" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,10,0" TextWrapping="Wrap" Text="Bemerkung" VerticalAlignment="Top" Grid.Row="6" Height="20"/>
<TextBox x:Name="tbBemerkung" Margin="10,35,10,0" 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"/>
<StackPanel Grid.Row="7" Margin="10,0,10,0">
<TextBlock Text="Ausgegebene Parkkarten:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<TextBlock x:Name="lblParkkarten" HorizontalAlignment="Center" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</StackPanel>
<Button x:Name="btnSignature" Content="Unterschrift" Margin="10" Click="btnSignature_Click" Grid.Row="8"/>
<Button x:Name="btnClose" Content="Schließen" Margin="10" Click="BtnClose_Click" Grid.Row="9"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,8 +18,8 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für AspInfo.xaml
/// </summary>
public partial class AspInfo : Window
{
public partial class AspInfo : MetroWindow
{
public int id { get; set; }
//info = Welcher InfoButton wurde gedrückt? 1 = Ankunft heute; 2 = bereits bestätigt
@ -77,6 +78,9 @@ namespace ZKuP
tbBemerkung.Text = SQL.ReadSingleValue($"SELECT Bemerkung FROM {MainWindow.table}.zutritte WHERE idzutritte='{idzutritte}'");
lblParkkarten.Text = SQL.ReadSingleValue($"SELECT GROUP_CONCAT(parkplatznr SEPARATOR ';') FROM {MainWindow.table}.parkplaetze WHERE firma = '{idFirma_Besucher}'").Replace(";", ", ");
this.Visibility = Visibility.Visible;
}
else
@ -154,5 +158,17 @@ namespace ZKuP
{
System.Diagnostics.Process.Start($"tel:{(sender as TextBox).Text.Replace(" ", "")}");
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 921 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 931 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 909 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 987 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 804 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 KiB

After

Width:  |  Height:  |  Size: 375 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 455 KiB

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 KiB

After

Width:  |  Height:  |  Size: 403 KiB

View File

@ -0,0 +1,36 @@
<mah:MetroWindow x:Class="ZKuP.AusgegebeneParkausweise"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Ausgegebene Parkausweise" Height="400" Width="850">
<Grid>
<DataGrid x:Name="dgAusgegebeneParkkarten" ItemsSource="{Binding Path=., Mode=OneWay}" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Firma" Binding="{Binding Name}" Width="*"/>
<DataGridTextColumn Header="Parkkarten" Binding="{Binding Parkplaetze}" Width="80">
<DataGridTextColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Tel. Firma" Binding="{Binding TelVerantwortlicherFirma}" Width="150"/>
<DataGridTextColumn Header="Ausgegeben durch" Binding="{Binding AusgegebenDurch}" Width="140"/>
<DataGridTextColumn Header="Ausgegeben am" Binding="{Binding AusgegebenTimestamp, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" Width="120"/>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Zurücknehmen" Click="Zuruecknehmen_Click"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</mah:MetroWindow>

View File

@ -0,0 +1,89 @@
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
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 AusgegebeneParkausweise.xaml
/// </summary>
public partial class AusgegebeneParkausweise : MetroWindow
{
public AusgegebeneParkausweise()
{
InitializeComponent();
this.DataContext = this;
Query();
}
private async void Query()
{
await Task.Run(() =>
{
var list = SQL.ReadSQL($"SELECT f.Name, GROUP_CONCAT(p.parkplatznr ORDER BY p.parkplatznr SEPARATOR ', ') AS Parkplaetze, p.AusgegebenDurch, p.AusgegebenTimestamp, p.TelVerantwortlicherFirma FROM {MainWindow.table}.firmen f LEFT JOIN {MainWindow.table}.parkplaetze p ON f.idFirmen = p.firma WHERE p.parkplatznr IS NOT NULL GROUP BY f.idFirmen, f.Name, p.AusgegebenDurch, p.AusgegebenTimestamp, p.TelVerantwortlicherFirma").Result;
Dispatcher.Invoke(() => dgAusgegebeneParkkarten.DataContext = list);
});
}
private void Zuruecknehmen_Click(object sender, RoutedEventArgs e)
{
var parkplaetze = (dgAusgegebeneParkkarten.SelectedItem as DataRowView).Row.ItemArray[1].ToString().Replace(" ", "").Split(',');
ContextMenu c = new ContextMenu();
c.Items.Add(new MenuItem() { Header = "Alle" });
(c.Items[0] as MenuItem).Click += ZuruecknehmenMenuItem_Click;
foreach (var parkplatz in parkplaetze)
{
c.Items.Add(new MenuItem() { Header = $"Parkplatz Nr. {parkplatz}" });
var x = c.Items[c.Items.Count - 1];
(x as MenuItem).Click += ZuruecknehmenMenuItem_Click;
}
c.IsOpen = true;
}
private async void ZuruecknehmenMenuItem_Click(object sender, RoutedEventArgs e)
{
if ((sender as MenuItem).Header.ToString() == "Alle")
{
if (MessageBoxResult.Yes == MessageBox.Show($"Möchten Sie alle Parkkarten der Firma {(dgAusgegebeneParkkarten.SelectedItem as DataRowView).Row.ItemArray[0].ToString()} sicher zurücknehmen?", "Sicher zurücknehmen?", MessageBoxButton.YesNo, MessageBoxImage.Question))
{
string orString = "";
foreach (var parkpl in (dgAusgegebeneParkkarten.SelectedItem as DataRowView).Row.ItemArray[1].ToString().Replace(" ", "").Split(','))
{
orString += $"parkplatznr = '{parkpl}' OR ";
}
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.parkplaetze WHERE {Helper.RemoveStringAtEndOfString(orString, " OR ")}");
Query();
}
}
else
{
if (MessageBoxResult.Yes == MessageBox.Show($"Möchten Sie die Parkkarte Nr. {(sender as MenuItem).Header.ToString().Split(' ').Last()} sicher zurücknehmen?", "Sicher zurücknehmen?", MessageBoxButton.YesNo, MessageBoxImage.Question))
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.parkplaetze WHERE parkplatznr = '{(sender as MenuItem).Header.ToString().Split(' ').Last()}'");
Query();
}
}
}
}
}

View File

@ -1,27 +1,22 @@
<Window x:Class="ZKuP.BEImage"
<mah:MetroWindow x:Class="ZKuP.BEImage"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="BE-Flächenansicht" Height="450" Width="800">
Title="BE-Flächenansicht" Height="650" Width="1100" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Image x:Name="imgBE" Margin="10,46,10,10"/>
<ComboBox x:Name="cbBE" HorizontalAlignment="Left" Margin="144,10,0,0" VerticalAlignment="Top" Width="266" SelectionChanged="cbBE_SelectionChanged" SelectedIndex="0">
<ComboBoxItem Content="BE-Fläche wählen..."/>
<ComboBoxItem Content="BE-Fläche 1 (ICE-West/Containerburg)"/>
<ComboBoxItem Content="BE-Fläche 2 (ICE-West/MaWi/Gleisabstellung)"/>
<ComboBoxItem Content="BE-Fläche 4 (Aufgang Friedenheimer-Brücke)"/>
<ComboBoxItem Content="BE-Fläche 6 (Lokhalle Gleisbereich Süd-Ost)"/>
<ComboBoxItem Content="BE-Fläche 8 (Schichtparkplatz)"/>
<ComboBoxItem Content="BE-Fläche 9 (Kantine)"/>
<ComboBoxItem Content="BE-Fläche 10 (Gebäude G)"/>
<ComboBoxItem Content="BE-Fläche 11 (Gaslager)"/>
<ComboBoxItem Content="BE-Fläche 12 (Feuerwehrzufahrt Süd)"/>
<ComboBoxItem Content="BE-Fläche 13 (Feuerwehrzufahrt Süd)"/>
</ComboBox>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="35,10,0,0" TextWrapping="Wrap" Text="BE-Fläche:" VerticalAlignment="Top" Height="22" Width="104" Padding="0,2,0,0"/>
<UniformGrid x:Name="imgBE" Columns="4" Margin="10,50,10,10" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
<Border x:Name="imgBorder" Visibility="Collapsed" Margin="10,46,10,10" BorderBrush="Red" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="2" >
<Image x:Name="imgBESingle" Visibility="Visible" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip="Klicken zum schließen" PreviewMouseLeftButtonUp="imgBESingle_PreviewMouseLeftButtonUp" LostMouseCapture="imgBESingle_LostMouseCapture"/>
</Border>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,6 +1,10 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -17,25 +21,95 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für BEImage.xaml
/// </summary>
public partial class BEImage : Window
public partial class BEImage : MetroWindow
{
public BEImage(int imageIndex = 13)
ObservableCollection<ComboBoxItem> list = new ObservableCollection<ComboBoxItem>();
public BEImage(int imageIndex = 99)
{
InitializeComponent();
if (imageIndex != 13)
FillBEList();
if (imageIndex != 99)
cbBE.SelectedIndex = imageIndex;
}
private void FillBEList()
{
var desc = Helper.GetBEDescription();
var numbers = Helper.GetBENumbers();
var be = new List<string>();
var beNameForPics = new List<string>();
be.Add("");
for (int i = 0; i < numbers.Count; i++)
{
be.Add($"BE-Fläche {numbers[i]} ({desc[i]})");
beNameForPics.Add($"BE-Fläche {numbers[i]}\n({desc[i]})");
var sp = new StackPanel();
var img = new Image();
//img.Width = 220;
//img.Height = 150;
img.Margin = new Thickness(5,10,5,10);
img.Source = new BitmapImage(new Uri($"{Helper.GetBEFileNames(be.Last().Split(' ')[1])}", UriKind.Relative));
img.MouseLeftButtonUp += Image_Click;
img.ToolTip = "Klicken zum vergrößern";
ToolTipService.SetInitialShowDelay(img, 200);
sp.Children.Add(img);
sp.Children.Add(new TextBlock() { Text = beNameForPics.Last(), TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Top });
imgBE.Children.Add(sp);
}
cbBE.ItemsSource = be;
}
private void Image_Click(object sender, MouseButtonEventArgs e)
{
imgBESingle.Source = new BitmapImage(new Uri((sender as Image).Source.ToString()));
imgBorder.Visibility = Visibility.Visible;
}
private void imgBESingle_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
imgBorder.Visibility = Visibility.Collapsed;
}
private void imgBESingle_LostMouseCapture(object sender, MouseEventArgs e)
{
imgBorder.Visibility = Visibility.Collapsed;
}
private void cbBE_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if ((sender as ComboBox).SelectedIndex != 0 && (sender as ComboBox).SelectedIndex != -1)
imgBE.Source = new BitmapImage(new Uri($"Assets\\BE{cbBE.SelectedIndex}.png", UriKind.Relative));
var combo = (sender as ComboBox).SelectedItem.ToString();
if (combo.Contains(' '))
{
if ((sender as ComboBox).SelectedIndex != 0 && (sender as ComboBox).SelectedIndex != -1)
{
imgBESingle.Source = new BitmapImage(new Uri($"{Helper.GetBEFileNames(combo.Split(' ')[1])}", UriKind.Relative));
imgBorder.Visibility = Visibility.Visible;
}
}
}
public void changePicture(int selectedPicture)
{
cbBE.SelectedIndex = selectedPicture;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,373 +1,167 @@
<Window x:Class="ZKuP.Belegung"
<mah:MetroWindow x:Class="ZKuP.Belegung"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="BE-Flächenbelegung" Width="1500" Height="670" Loaded="Window_Loaded" Closing="Window_Closing" MouseMove="Window_MouseMove">
Title="BE-Flächenbelegung" MinHeight="385" Height="600" MinWidth="750" Width="1100" Loaded="MetroWindow_Loaded" Closing="MetroWindow_Closing" LocationChanged="Window_LocationChanged">
<mah:MetroWindow.Resources>
<local:ComboBoxDisplayConverter x:Key="ComboBoxDisplayConverter"></local:ComboBoxDisplayConverter>
</mah:MetroWindow.Resources>
<Window.Resources>
<Style TargetType="{x:Type DatePickerTextBox}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DatePickerTextBox">
<Grid>
<Grid.Resources>
<SolidColorBrush x:Key="WatermarkBrush" Color="#FFAAAAAA"/>
</Grid.Resources>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
<VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
</VisualStateGroup.Transitions>
<VisualState Name="Normal" />
<VisualState Name="MouseOver">
<Storyboard>
<ColorAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF99C1E2" Duration="0"/>
<ColorAnimation Storyboard.TargetName="watermark_decorator" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF99C1E2" Duration="0"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="WatermarkStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState Name="Unwatermarked" />
<VisualState Name="Watermarked">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
<DoubleAnimation Storyboard.TargetName="PART_Watermark" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="FocusStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState Name="Unfocused" />
<VisualState Name="Focused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="gridBelegung">
<Grid.RowDefinitions>
<RowDefinition Height="1.8*" MaxHeight="270"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Margin="10,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch">
<TextBlock Text="BE Fläche:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="5"/>
<ComboBox x:Name="cbBE" Margin="5" SelectionChanged="cbBE_SelectionChanged">
<ComboBox.ToolTip>
<StackPanel>
<TextBlock Text="Bei Auswahl einer BE-Fläche wird die Liste auf die angegebene BE-Fläche gefiltert"/>
<TextBlock Text="Wird der leere Eintrag gewählt, werden alle angezeigt"/>
</StackPanel>
</ComboBox.ToolTip>
</ComboBox>
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
CornerRadius="1"
Opacity="1">
<Grid x:Name="WatermarkContent"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Border x:Name="ContentElement" BorderThickness="1">
<Border.BorderBrush>
<SolidColorBrush Color="#FFFFFFFF"/>
</Border.BorderBrush>
</Border>
<Border x:Name="watermark_decorator" BorderThickness="1">
<Border.BorderBrush>
<SolidColorBrush Color="#FFFFFFFF"/>
</Border.BorderBrush>
<ContentControl x:Name="PART_Watermark"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Opacity="0"
Focusable="False"
IsHitTestVisible="False"
Padding="2">
<ContentControl.Template>
<ControlTemplate>
<TextBlock Text="auswählen" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gray"/>
</ControlTemplate>
</ContentControl.Template>
</ContentControl>
</Border>
<ScrollViewer x:Name="PART_ContentHost"
Margin="0"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border x:Name="FocusVisual" BorderBrush="#FF45D6FA" CornerRadius="1" Opacity="0" IsHitTestVisible="False"/>
</Grid>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<TextBlock Text="Maßnahme/Bemerkung:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="5"/>
<TextBox x:Name="tbBemerkung" IsEnabled="False" Margin="5" Height="87" AcceptsReturn="True"/>
<!--<TextBlock Text="Projektleiter:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="5"/>-->
<!--<ComboBox x:Name="cbPL" Margin="5" SelectionChanged="cbPL_SelectionChanged"/>-->
</StackPanel>
<Grid x:Name="BEGrid">
<Popup Name="floatingTip" AllowsTransparency="True" Placement="Relative" VerticalOffset="5">
<TextBlock Text="" Background="LightSalmon" Foreground="Black" FontSize="14" Height="25" Padding="0,2"/>
</Popup>
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0,10,10,0" Grid.Column="2">
<TextBlock Text="Start der Buchung:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="5"/>
<DatePicker x:Name="dpVon" Margin="5" IsEnabled="False" local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" />
<TextBlock Text="Ende der Buchung:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="5"/>
<DatePicker x:Name="dpBis" Margin="5" IsEnabled="False" local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" LostFocus="dpBis_LostFocus"/>
<TextBlock Text="Buchung für Firma:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="5"/>
<ComboBox x:Name="cbFirma" ItemsSource="{Binding}" IsEnabled="False" SelectedValuePath="idFirmen" Margin="5" IsEditable="True" PreviewTextInput="cbFirma_TextInput" SelectionChanged="cbFirma_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ActualWidth, ElementName=cbFirma, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<DataGrid x:Name="dgBelegung" Margin="10" ItemsSource="{Binding Path=., Mode=OneWay}" HorizontalGridLinesBrush="Gray" VerticalGridLinesBrush="Gray" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserAddRows="False" RowHeaderWidth="0" CellEditEnding="dgBelegung_CellEditEnding" RowHeight="NaN">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<TextBlock Grid.Column="0" Text="{Binding idFirmen}" Padding="5,2" FontWeight="Normal" Foreground="LightGray"/>
<TextBlock Grid.Column="1" Text="{Binding Name}" Padding="5,2" FontWeight="Bold"/>
<TextBlock Grid.Column="2" Text="{Binding Beauftragte_Leistung}" Padding="5,2" Foreground="Gray"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<Button x:Name="btnBookBE" Content="BE Fläche buchen" Height="40" IsEnabled="True" Grid.ColumnSpan="3" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="10,0,10,20" Click="btnBookBE_Click"/>
</Grid>
<!--<StackPanel Grid.Row="1" VerticalAlignment="Stretch">-->
<TextBlock x:Name="lblBE" Text="Alle aktuell gebuchten BE-Flächen:" FontSize="14" Grid.Row="1" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,0,0,5"/>
<DataGrid x:Name="dgBelegung" EnableRowVirtualization="False" DataContext="{Binding}" ItemsSource="{Binding ., Mode=OneWay}" Grid.Row="1" Margin="10,30,10,50" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CellEditEnding="dgBelegung_CellEditEnding" DataContextChanged="dgBelegung_DataContextChanged">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding flaeche}" ClipboardContentBinding="{x:Null}" Header="BE-Fläche" Width="35" IsReadOnly="True">
<DataGridTextColumn Header="#" Binding="{Binding beNr}" IsReadOnly="True" MinWidth="30" MaxWidth="30">
<DataGridTextColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource MahApps.Styles.DataGridColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.HeaderStyle>
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Style TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="ToolTip" Value="Anklicken um die BE-Fläche zu zeigen"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="OpenImage_Click"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding bereich}" ClipboardContentBinding="{x:Null}" Header="Bereich" Width="120" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="ToolTip" Value="Anklicken um die BE-Fläche zu zeigen"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="OpenImage_Click"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<!--<DataGridTextColumn Binding="{Binding b1von, StringFormat=\{0:dd.MM.yyyy\}}" Width="70" ClipboardContentBinding="{x:Null}" Header="B1 von">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>-->
<DataGridTemplateColumn Width="120" ClipboardContentBinding="{x:Null}" Header="B1 von" IsReadOnly="True">
<DataGridTextColumn Header="BE Name" Binding="{Binding beFlaeche}" MinWidth="140" Width="*" IsReadOnly="True"/>
<DataGridTemplateColumn Header="von" IsReadOnly="False" MinWidth="100" MaxWidth="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Tag="pan" Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding b1von}" Height="35" Width="100" IsEnabled="False" DateValidationError="DatePicker_DateValidationError"/>
<Button Width="20" Height="35" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" ClipboardContentBinding="{x:Null}" Header="B1 bis" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Tag="pan" Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding b1bis}" Height="35" Width="100" IsEnabled="False" DateValidationError="DatePicker_DateValidationError"/>
<Button Width="20" Height="35" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding b1Projekt}" ClipboardContentBinding="{x:Null}" Header="B1 Projekt" Width="180">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Height" Value="55"/>
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="10,10,10,0"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTextColumn.CellStyle>
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="AcceptsReturn" Value="true" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding b1Projektleiter}" ClipboardContentBinding="{x:Null}" Header="B1 Projektleiter" Width="150">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="10,0,10,0"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTemplateColumn Width="120" ClipboardContentBinding="{x:Null}" Header="B2 von" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Tag="pan" Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding b2von}" Height="35" Width="100" IsEnabled="False" DateValidationError="DatePicker_DateValidationError"/>
<Button Width="20" Height="35" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" ClipboardContentBinding="{x:Null}" Header="B2 bis" IsReadOnly="True">
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTemplateColumn.CellStyle>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Tag="pan" Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding b2bis}" Height="35" Width="100" IsEnabled="False" DateValidationError="DatePicker_DateValidationError"/>
<Button Width="20" Height="35" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
</StackPanel>
<DatePicker x:Name="dpVonDG" IsEnabled="False" Loaded="dpVonDG_Loaded" local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding von, StringFormat=\{0:dd.MM.yyyy\}, ValidatesOnDataErrors=False, ValidatesOnExceptions=False, ValidatesOnNotifyDataErrors=False}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding b2Projekt}" ClipboardContentBinding="{x:Null}" Header="B2 Projekt" Width="180">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="10,0,10,0"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="AcceptsReturn" Value="true" />
</Style>
</DataGridTextColumn.EditingElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding b2Projektleiter}" ClipboardContentBinding="{x:Null}" Header="B2 Projektleiter" Width="150">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="10,0,10,0"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTemplateColumn Width="120" ClipboardContentBinding="{x:Null}" Header="B3 von" IsReadOnly="True">
<DataGridTemplateColumn Header="bis" MinWidth="100" MaxWidth="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Tag="pan" Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding b3von}" Height="35" Width="100" IsEnabled="False" DateValidationError="DatePicker_DateValidationError"/>
<Button Width="20" Height="35" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
</StackPanel>
<DatePicker x:Name="dpBisDG" IsEnabled="False" Loaded="dpBisDG_Loaded" local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding bis, StringFormat=\{0:dd.MM.yyyy\}, ValidatesOnDataErrors=False, ValidatesOnExceptions=False, ValidatesOnNotifyDataErrors=False}" LostFocus="dpBisDG_LostFocus"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120" ClipboardContentBinding="{x:Null}" Header="B3 bis" IsReadOnly="True">
<DataGridTemplateColumn Header="Maßnahme/Bemerkung" MinWidth="150">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Tag="pan" Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" SelectedDate="{Binding b3bis}" Width="100" Height="35" IsEnabled="False" DateValidationError="DatePicker_DateValidationError"/>
<Button Width="20" Height="35" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
</StackPanel>
<TextBox x:Name="tbDGBemerkung" AcceptsReturn="True" Text="{Binding Bemerkung, Mode=OneWay}" Loaded="tbDGBemerkung_Loaded" IsEnabled="False" LostKeyboardFocus="tbDGBemerkung_LostKeyboardFocus" LostFocus="tbDGBemerkung_LostFocus"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="PL" Binding="{Binding Projektleiter}" MinWidth="100" Width="150" IsReadOnly="True"/>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="ⓘ" MinWidth="20" MaxWidth="20" Height="20" ToolTip="Zugewiesene Firmen anzeigen" Padding="0,-5,0,0" FontSize="20" Click="InfoButton_Click"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="3" MinWidth="20" MaxWidth="20" Height="20" Padding="0,2,0,0" Foreground="Red" ToolTip="Buchung stornieren" ToolTipService.ShowOnDisabled="True" FontFamily="Wingdings 2" FontSize="18" Click="DeleteButton_Click" Loaded="DelButton_Loaded"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding b3Projekt}" ClipboardContentBinding="{x:Null}" Header="B3 Projekt" Width="180">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="10,0,10,0"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="AcceptsReturn" Value="true" />
</Style>
</DataGridTextColumn.EditingElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding b3Projektleiter}" ClipboardContentBinding="{x:Null}" Header="B3 Projektleiter" Width="150">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="10,0,10,0"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="0 0 0 1"/>
</Style>
</DataGridTextColumn.CellStyle> </DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="btnCurrentlyBooked" Content="Aktuell belegte Flächen anzeigen" Grid.Row="1" Grid.ColumnSpan="3" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="10,0,10,5" Click="btnCurrentlyBooked_Click"/>
<!--</StackPanel>-->
<Popup x:Name="pop" AllowsTransparency="True" Closed="Pop_Closed">
<StackPanel Orientation="Vertical" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Margin="5">
<TextBlock Text="Firmen, denen aktuell diese Fläche zugewiesen ist:" Margin="5"/>
<DataGrid x:Name="dgFirmen" Visibility="Visible" ItemsSource="{Binding .}" Height="200" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Verantwortl. MA" Binding="{Binding Verantwortlicher_MA_Firma}"/>
<DataGridTextColumn Header="Tel. Firma" Binding="{Binding Tel_Nr_Verantwortlicher_Firma}"/>
<DataGridTextColumn Header="Anz. Fzg." Binding="{Binding Anzahl_Fzg}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Beauftragte Leistung" Binding="{Binding Beauftragte_Leistung}"/>
<DataGridTextColumn Header="Arbeitsbeginn" Binding="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Arbeitsende" Binding="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Ansprechpartner intern" Binding="{Binding Ansprechpartner_Intern}"/>
<DataGridTextColumn Header="Tel. Ansprechpartner" Binding="{Binding Tel_Nr_Ansprechpartner_Intern}"/>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</Popup>
</Grid>
</Window>
</mah:MetroWindow>

File diff suppressed because it is too large Load Diff

View File

@ -1,331 +0,0 @@
<Window x:Class="ZKuP.Belegung2"
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="BE-Flächenbelegung" Height="450" Width="1077.69" MaxWidth="1900" MaxHeight="620" Loaded="Window_Loaded" Cursor="Wait">
<Grid>
<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<StackPanel x:Name="grid" Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="0,5">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="BE" Width="35" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="Bereich" Width="120" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B1 von" Width="120" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B1 bis" Width="120" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B1 Projekt" Width="180" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B1 Projektleiter" Width="150" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B2 von" Width="120" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B2 bis" Width="120" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B2 Projekt" Width="180" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B2 Projektleiter" Width="150" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B3 von" Width="120" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B3 bis" Width="120" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B3 Projekt" Width="180" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="B3 Projektleiter" Width="150" TextAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="1">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="1" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="ICE (West)" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="2">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="2" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="ICE (West)" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="3">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="3" TextDecorations="Strikethrough" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="ICE (West)" TextDecorations="Strikethrough" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="4">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="4" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="ICE (West)" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="5">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="5" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="ICE (West)" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="6">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="6" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="Lokhalle (Ost)" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="7">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="7" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="Lokhalle (Ost)" TextDecorations="Strikethrough" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="8">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="8" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="Schichtparkplatz" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="9">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="9" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="Kantine" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="10">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="10" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="Gebäude G" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="11">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="11" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="Gaslager" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Tag="12">
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="12" Width="35" Height="45" Padding="0,8" TextAlignment="Center"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" MouseLeftButtonDown="OpenImage_Click" Text="Feuerwehrzufahrt Süd" Width="120" Padding="0,8" Height="45" TextAlignment="Center"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" Padding="1,12" Height="45" Width="100" IsEnabled="False"/>
<Button Width="20" Height="45" Content="✕" FontSize="12" Padding="3" HorizontalContentAlignment="Left" FontWeight="Bold" Foreground="Red" Click="ButtonDelDate_Click" IsEnabled="False"/>
<TextBox Width="180" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
<TextBox Width="150" Height="45" TextWrapping="Wrap" LostKeyboardFocus="TextBox_LostKeyboardFocus" IsEnabled="False"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</Window>

View File

@ -1,357 +0,0 @@
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 Belegung2.xaml
/// </summary>
public partial class Belegung2 : Window
{
DataTable belegung = new DataTable("Belegung");
DataTable ersteller = new DataTable("Ersteller");
public Belegung2()
{
InitializeComponent();
Init();
}
private async void Init()
{
belegung = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.`be-belegung`", belegung);
FillRows();
DisableFields();
}
private void FillRows()
{
var Children = Helper.FindVisualChildren<StackPanel>(grid).ToList();
DataTable dates = new DataTable();
dates = new System.Data.DataView(belegung).ToTable(false, new string[] { "b1von", "b1bis", "b2von", "b2bis", "b3von", "b3bis" });
DataTable textboxes = new DataTable();
textboxes = new System.Data.DataView(belegung).ToTable(false, new string[] { "b1Projekt", "b1Projektleiter", "b2Projekt", "b2Projektleiter", "b3Projekt", "b3Projektleiter" });
DataTable users = new DataTable();
users = new DataView(belegung).ToTable(false, new string[] { "b1Ersteller", "b2Ersteller", "b3Ersteller" });
var count = 0;
foreach (StackPanel sp in Children)
{
var count2 = 0;
if (sp.Tag != null)
{
foreach (DatePicker child in sp.Children.OfType<DatePicker>())
{
DateTime date;
DateTime.TryParse(dates.Rows[count].ItemArray[count2].ToString(), out date);
if (date.Date.Year != 1)
child.SelectedDate = date.Date;
else child.SelectedDate = null;
count2++;
}
count2 = 0;
foreach (TextBox child in sp.Children.OfType<TextBox>())
{
child.Text = textboxes.Rows[count].ItemArray[count2].ToString();
count2++;
}
count++;
}
}
}
private async void DisableFields()
{
Dictionary<string, string> dict = new Dictionary<string, string>();
ersteller = await SQL.ReadSQL($"SELECT b1Ersteller, b2Ersteller, b3Ersteller FROM {MainWindow.table}.`be-belegung`", ersteller);
for (var j = 1; j <= 12; j++)
{
for (var i = 1; i <= 3; i++)
{
dict.Add($"b{i}Ersteller{j}", ersteller.Rows[j - 1][$"b{i}Ersteller"].ToString());
}
}
foreach (var sp in Helper.FindVisualChildren<StackPanel>(grid).Where(p => p.Tag != null))
{
var x = sp.Children;
for (var i = 1; i < x.Count - 1; i++)
{
var z = $"b{Math.Ceiling((float)i / 6)}Ersteller{sp.Tag}";
var y = dict[z];
if (y == "" || y == Environment.UserName)
{
x[i + 1].IsEnabled = true;
}
else
{
var creator = Helper.InsertSpaceBeforeUpperCase(y);
x[i + 1].SetValue(ToolTipService.ShowOnDisabledProperty, true);
switch (x[i + 1].GetType().Name)
{
case nameof(DatePicker):
(x[i + 1] as DatePicker).ToolTip = $"Gesperrt durch {creator}";
break;
case nameof(TextBox):
(x[i + 1] as TextBox).ToolTip = $"Gesperrt durch {creator}";
break;
case nameof(Button):
(x[i + 1] as Button).ToolTip = $"Gesperrt durch {creator}";
break;
}
}
}
}
}
private async void TextBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
TextChanged(e.OldFocus);
}
private async void TextChanged(IInputElement e)
{
var box = (e as TextBox);
var SP = (box.Parent as StackPanel);
var SPindex = Convert.ToInt32(SP.Tag);
var boxIndex = SP.Children.IndexOf(box) / 6;
var boxOneTwo = Math.Ceiling(Math.Ceiling(SP.Children.IndexOf(box) / 6f) / boxIndex);
string ProjektOderLeiter;
ProjektOderLeiter = boxOneTwo == 1 ? "Projekt" : "Projektleiter";
if (!string.IsNullOrWhiteSpace(box.Text))
await SQL.WriteSQL($"UPDATE {MainWindow.table}.`be-belegung` SET b{boxIndex}{ProjektOderLeiter} = '{box.Text}', `b{boxIndex}Ersteller` = '{Environment.UserName}' WHERE `idbe-belegung` = '{SPindex}'");
else
await SQL.WriteSQL($"UPDATE {MainWindow.table}.`be-belegung` SET b{boxIndex}{ProjektOderLeiter} = '{box.Text}', `b{boxIndex}Ersteller` = '' WHERE `idbe-belegung` = '{SPindex}'");
}
private async void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
var box = (sender as DatePicker);
var SP = (box.Parent as StackPanel);
var SPindex = Convert.ToInt32(SP.Tag);
var boxIndex = (SP.Children.IndexOf(box) + 4) / 6;
var boxOneTwo = Math.Ceiling(Math.Ceiling((SP.Children.IndexOf(box) + 4f) / 6f) / boxIndex);
string vonOderBis;
vonOderBis = boxOneTwo == 1 ? "von" : "bis";
if (vonOderBis == "bis")
{
if ((SP.Children[SP.Children.IndexOf(box) - 2] as DatePicker).SelectedDate > box.SelectedDate)
{
e.Handled = true;
MessageBox.Show("Datum 'bis' muss größer als Datum 'von' sein!", "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Warning);
box.SelectedDate = null;
return;
}
}
else if (vonOderBis == "von")
{
if ((SP.Children[SP.Children.IndexOf(box) + 2] as DatePicker).SelectedDate < box.SelectedDate)
{
e.Handled = true;
MessageBox.Show("Datum 'von' muss kleiner als Datum 'bis' sein!", "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Warning);
box.SelectedDate = null;
return;
}
}
if (box.SelectedDate != null)
await SQL.WriteSQL($"UPDATE `be-belegung` SET `b{boxIndex}{vonOderBis}` = '{box.SelectedDate.Value.ToString("yyyy-MM-dd")}', `b{boxIndex}Ersteller` = '{Environment.UserName}' WHERE `idbe-belegung` = {SPindex}");
else
await SQL.WriteSQL($"UPDATE `be-belegung` SET `b{boxIndex}{vonOderBis}` = null, `b{boxIndex}Ersteller` = '' WHERE `idbe-belegung` = {SPindex}");
LockUsedDates();
}
private void ClearHistoricDates()
{
bool hasChanged = false;
foreach(var tb in Helper.FindVisualChildren<TextBox>(grid))
{
if (tb.Name != "PART_TextBox")
tb.TextChanged += Tb_TextChanged;
}
foreach (var childSPs in grid.Children)
{
foreach (var child in (childSPs as StackPanel).Children.OfType<DatePicker>())
{
var box = child;
var SP = (box.Parent as StackPanel);
var SPindex = Convert.ToInt32(SP.Tag);
var boxIndex = (SP.Children.IndexOf(box) + 4) / 6;
var boxOneTwo = Math.Ceiling(Math.Ceiling((SP.Children.IndexOf(box) + 4f) / 6f) / boxIndex);
if (boxOneTwo != 1)
{
if (child.SelectedDate.HasValue && child.SelectedDate.Value < DateTime.Now.Date)
{
child.SelectedDate = null;
var childIndex = (SP.Children.IndexOf(child));
(SP.Children[(childIndex - 2)] as DatePicker).SelectedDate = null;
(SP.Children[childIndex + 2] as TextBox).Text = null;
(SP.Children[childIndex + 3] as TextBox).Text = null;
hasChanged = true;
}
}
}
}
foreach (var tb in Helper.FindVisualChildren<TextBox>(grid))
{
if (tb.Name != "PART_TextBox")
tb.TextChanged -= Tb_TextChanged;
}
if (hasChanged)
{
belegung = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.`be-belegung`", belegung).Result;
FillRows();
DisableFields();
}
}
private void LockUsedDates()
{
foreach (var childSPs in grid.Children)
{
DateTime? firstDate = null;
DateTime? secondDate = null;
CalendarDateRange range = new CalendarDateRange();
(childSPs as StackPanel).Children.OfType<DatePicker>().ToList().ForEach(p => p.BlackoutDates.Clear());
foreach (var child in (childSPs as StackPanel).Children.OfType<DatePicker>())
{
var box = child;
var SP = (box.Parent as StackPanel);
var boxIndex = (SP.Children.IndexOf(box) + 4) / 6;
var boxOneTwo = Math.Ceiling(Math.Ceiling((SP.Children.IndexOf(box) + 4f) / 6f) / boxIndex);
if (box.SelectedDate.HasValue && boxOneTwo == 1)
{
firstDate = box.SelectedDate.Value;
}
else if (box.SelectedDate.HasValue && boxOneTwo != 1)
{
secondDate = box.SelectedDate.Value;
if (firstDate.HasValue && secondDate.HasValue)
range = new CalendarDateRange(firstDate.Value, secondDate.Value);
}
foreach (var picker in (childSPs as StackPanel).Children.OfType<DatePicker>())
{
var year = range.Start.Year;
var hasValue = picker.SelectedDate.HasValue;
if (year != 1 && year != 0 && (!hasValue || !(range.Start <= picker.SelectedDate.Value & range.End >= picker.SelectedDate.Value)))
{
picker.BlackoutDates.Add(range);
}
}
}
}
}
private void Tb_TextChanged(object sender, TextChangedEventArgs e)
{
TextChanged(e.Source as IInputElement);
}
private void ButtonDelDate_Click(object sender, RoutedEventArgs e)
{
int index = ((sender as Button).Parent as StackPanel).Children.IndexOf(sender as Button);
DatePicker previousDP = VisualTreeHelper.GetChild((sender as Button).Parent, index - 1) as DatePicker;
if ((sender as Button).IsEnabled == true)
{
previousDP.SelectedDate = null;
}
else
e.Handled = true;
}
BEImage BeI;
private void OpenImage_Click(object sender, MouseButtonEventArgs e)
{
if (BeI != null && BeI.IsLoaded)
{
BeI.changePicture(Convert.ToInt32((((sender as TextBlock).Parent as StackPanel).Children[0] as TextBlock).Text));
}
else
{
BeI = new BEImage(Convert.ToInt32((((sender as TextBlock).Parent as StackPanel).Children[0] as TextBlock).Text));
BeI.Owner = this;
BeI.Show();
}
}
private void DatePicker_DateValidationError(object sender, DatePickerDateValidationErrorEventArgs e)
{
MessageBox.Show("Bereits belegtes oder ungültiges Datum eingegeben", "Ungültiges Datum", MessageBoxButton.OK, MessageBoxImage.Warning);
}
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
foreach (var child in Helper.FindVisualChildren<DatePicker>(this))
{
child.SelectedDateChanged += DatePicker_SelectedDateChanged;
child.DateValidationError += DatePicker_DateValidationError;
}
ClearHistoricDates();
LockUsedDates();
this.Cursor = Cursors.Arrow;
}
}
}

17
ZKuP/COMSelector.xaml Normal file
View File

@ -0,0 +1,17 @@
<mah:MetroWindow x:Class="ZKuP.COMSelector"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Leser auswählen" Height="185" Width="280">
<Grid>
<StackPanel Orientation="Vertical">
<TextBlock Text="COM Port des Lesers wählen:" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10"/>
<ComboBox x:Name="cbCOMList" Height="30" Margin="10" SelectionChanged="cbCOMList_SelectionChanged"/>
<Button x:Name="btnSave" Content="Speichern" VerticalAlignment="Bottom" Margin="10,25,10,10" Click="btnSave_Click"/>
</StackPanel>
</Grid>
</mah:MetroWindow>

60
ZKuP/COMSelector.xaml.cs Normal file
View File

@ -0,0 +1,60 @@
using ControlzEx.Standard;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
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 COMSelector.xaml
/// </summary>
public partial class COMSelector : MetroWindow
{
private List<string> COMList = new List<string>();
public COMSelector()
{
InitializeComponent();
COMList = Helper.GetCOMPorts();
cbCOMList.ItemsSource = COMList;
}
private void btnSave_Click(object sender, RoutedEventArgs e)
{
var match = Regex.Match(cbCOMList.SelectedValue.ToString(), @"COM\d+(?=\))");
Settings.WriteSetting("COMPort", match.Value);
this.Close();
}
private void cbCOMList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Helper.DataReceived += Helper_DataReceived;
MessageBox.Show("Bitte jetzt den Leser testen:\n\nSchließen Sie diese Meldung und legen Sie anschließend eine Karte auf!\n\nWird nach dem Auflegen keine Meldung angezeigt, bitte anderen Port wählen", "Kartenleser testen", MessageBoxButton.OK, MessageBoxImage.Information);
Helper.InitSerial(cbCOMList.SelectedValue.ToString());
}
private void Helper_DataReceived(object sender, string e)
{
if (e.Split('=')[0].Length == 19)
{
MessageBox.Show("Test des Kartenlesers erfolgreich!", "Erfolg", MessageBoxButton.OK, MessageBoxImage.Information);
Helper.DataReceived -= Helper_DataReceived;
}
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.Cards"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Karten" Height="530" Width="943.5">
Title="Karten" Height="530" Width="943.5" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
@ -16,7 +17,7 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" FontFamily="Segoe UI" Padding="0" FontSize="28" Foreground="Green" BorderBrush="Beige" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#252F3B" Click="GruenRot_Click">
<Button x:Name="btnGreenRed" Grid.Column="0" FontFamily="Segoe UI" Padding="0" FontSize="28" Foreground="YellowGreen" BorderBrush="Beige" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#252F3B" Click="GruenRot_Click">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/AusweisGruen_small.png" Height="30" Margin="0,0,20,0">
@ -33,13 +34,13 @@
</StackPanel>
</Button.Content>
</Button>
<Button BorderBrush="Beige" BorderThickness="1" Grid.Column="1" Padding="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#252F3B" Click="McFit_Click">
<Button x:Name="btnMcFit" BorderBrush="Beige" BorderThickness="1" Grid.Column="1" Padding="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#252F3B" Click="McFit_Click">
<Button.Content>
<Image Source="/Resources/mcfit.png" Height="39" Width="265"/>
</Button.Content>
</Button>
</Grid>
<TabControl x:Name="tabcontrol" TabStripPlacement="Top" Grid.Row="1">
<TabControl x:Name="tabcontrol" TabStripPlacement="Top" Grid.Row="1" SelectionChanged="tabcontrol_SelectionChanged">
<TabItem>
<TabItem.Style>
<Style TargetType="TabItem" BasedOn="{StaticResource MahApps.Styles.TabItem}">
@ -57,7 +58,7 @@
</Grid.RowDefinitions>
<DataGrid x:Name="dgCards" Grid.Row="1" Grid.ColumnSpan="2" Margin="0,10" EnableRowVirtualization="False" ItemsSource="{Binding Path=., Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" AutoGenerateColumns="False" CanUserDeleteRows="False" PreviewKeyDown="dgCards_PreviewKeyDown" SelectionChanged="dgCards_SelectionChanged">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="☑">
<DataGridCheckBoxColumn Binding="{Binding Path=[IsChecked], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" CanUserSort="False">
<DataGridCheckBoxColumn.CellStyle>
<Style TargetType="DataGridCell">
<Style.Triggers>
@ -67,6 +68,14 @@
</Style.Triggers>
</Style>
</DataGridCheckBoxColumn.CellStyle>
<DataGridCheckBoxColumn.Header>
<TextBlock Text="☑" Background="Transparent" MouseLeftButtonDown="CheckBoxHeader_MouseLeftButtonDown"/>
</DataGridCheckBoxColumn.Header>
<!--<DataGridCheckBoxColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=[IsChecked], Mode=TwoWay}" HorizontalAlignment="Center" Click="CheckBox_Click"/>
</DataTemplate>
</DataGridCheckBoxColumn.CellTemplate>-->
</DataGridCheckBoxColumn>
<DataGridTextColumn Binding="{Binding kartennr}" ClipboardContentBinding="{x:Null}" Header="Kartennummer" Width="*"/>
<DataGridTextColumn Binding="{Binding farbe}" ClipboardContentBinding="{x:Null}" Header="Farbe" Width="80">
@ -84,7 +93,7 @@
<DataGridTextColumn Binding="{Binding benutzer}" ClipboardContentBinding="{x:Null}" Header="Firma / Benutzer" Width="*"/>
<DataGridTextColumn Binding="{Binding telnr}" ClipboardContentBinding="{x:Null}" Header="Telefonnummer" Width="*"/>
<DataGridTextColumn Binding="{Binding AusgegebenDurch}" ClipboardContentBinding="{x:Null}" Header="Ausgegeben durch" Width="*"/>
<DataGridTextColumn Binding="{Binding AusgegebenTimestamp}" ClipboardContentBinding="{x:Null}" Header="Ausgegeben am" Width="*"/>
<DataGridTextColumn Binding="{Binding AusgegebenTimestamp, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" SortDirection="Descending" ClipboardContentBinding="{x:Null}" Header="Ausgegeben am" Width="*"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="btnAdd" Grid.Row="0" Grid.Column="0" Margin="0,10,10,0" VerticalAlignment="Stretch" Click="btnAdd_Click" HorizontalAlignment="Stretch">
@ -190,9 +199,9 @@
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridCheckBoxColumn Binding="{Binding AktuellAusgegeben}" ClipboardContentBinding="{x:Null}" Width="40">
<DataGridCheckBoxColumn Binding="{Binding AktuellAusgegeben}" ToolTipService.InitialShowDelay="20" ClipboardContentBinding="{x:Null}" Width="40">
<DataGridCheckBoxColumn.Header>
<TextBlock Text="AA" ToolTip="Aktuell Ausgegeben?"/>
<TextBlock Text="AA" ToolTip="Aktuell Ausgegeben?" ToolTipService.InitialShowDelay="20"/>
</DataGridCheckBoxColumn.Header>
</DataGridCheckBoxColumn>
<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Unterschrift" Width="110">
@ -207,5 +216,13 @@
</Grid>
</TabItem>
</TabControl>
<Grid x:Name="gridSpinner" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" Grid.RowSpan="2">
<local:ucSpinnerPiston HorizontalAlignment="Center" VerticalAlignment="Center">
<local:ucSpinnerPiston.LayoutTransform>
<ScaleTransform ScaleX="2" ScaleY="2"/>
</local:ucSpinnerPiston.LayoutTransform>
</local:ucSpinnerPiston>
</Grid>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,8 +1,12 @@
using ControlzEx.Standard;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
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;
@ -20,12 +24,22 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für Cards.xaml
/// </summary>
public partial class Cards : Window
public partial class Cards : MetroWindow, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
System.Data.DataTable karten = new System.Data.DataTable("karten");
System.Data.DataTable mcFit = new System.Data.DataTable("mcFit");
DispatcherTimer textInputTimer = new DispatcherTimer();
byte[] _signature = null;
@ -35,11 +49,6 @@ namespace ZKuP
{
InitializeComponent();
karten = SQL.ReadSQL($"Select * from {MainWindow.table}.karten", karten).Result;
dgCards.DataContext = karten;
mcFit = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.mcFit", mcFit).Result;
dgMcFit.DataContext = mcFit;
textInputTimer.Interval = TimeSpan.FromSeconds(0.5);
textInputTimer.Tick += TextInputTimer_Tick;
@ -50,19 +59,54 @@ namespace ZKuP
if (e.Key == Key.Delete) await DeleteCard();
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
private async void btnAdd_Click(object sender, RoutedEventArgs e)
{
AddCardUser addCardUser = new AddCardUser();
addCardUser.Owner = this;
addCardUser.ShowDialog();
karten = SQL.ReadSQL($"Select * from {MainWindow.table}.karten", karten).Result;
dgCards.DataContext = karten;
await Query(CardType.DB);
}
private void CheckBoxHeader_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
CheckAllBoxes();
}
//private void CheckBox_Click(object sender, RoutedEventArgs e)
//{
// var x = (sender as CheckBox).Parent;
// //((sender as CheckBox).Parent as DataRowView).Row.ItemArray[7] = !(bool)((sender as CheckBox).Parent as DataRowView).Row.ItemArray[7];
//}
private void CheckAllBoxes(bool init = false)
{
bool anyChecked = false;
if (init)
{
anyChecked = true;
}
else
{
foreach (var row in dgCards.Items.Cast<DataRowView>())
if (row.Row.Field<bool?>("IsChecked") == true)
{
anyChecked = true;
break;
}
}
//anyChecked = dgCards.Items.Cast<DataRowView>().Any(row => row.Row.Field<bool?>("IsChecked") == true);
foreach (DataRowView row in dgCards.Items)
{
row["IsChecked"] = !anyChecked;
}
}
private void dgCards_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
@ -90,14 +134,18 @@ namespace ZKuP
var r = dg.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow;
if (r != null)
{
var mycheckbox = dg.Columns[0].GetCellContent(r) as CheckBox;
if ((bool)mycheckbox.IsChecked)
var content = dg.Columns[0].GetCellContent(r);
if ((content as CheckBox).IsChecked != null)
{
cardsQuery += (item as DataRowView).Row.ItemArray[1].ToString() + ";";
cardsQueryTimestamp += (item as DataRowView).Row.ItemArray[6].ToString() + ";";
var mycheckbox = content as CheckBox;
if ((bool)mycheckbox.IsChecked)
{
cardsQuery += (item as DataRowView).Row.ItemArray[0].ToString() + ";";
cardsQueryTimestamp += (item as DataRowView).Row.ItemArray[5].ToString() + ";";
if (!string.IsNullOrWhiteSpace((item as DataRowView).Row.ItemArray[7].ToString()))
rueckgeber = (item as DataRowView).Row.ItemArray[7].ToString();
if (!string.IsNullOrWhiteSpace((item as DataRowView).Row.ItemArray[7].ToString()))
rueckgeber = (item as DataRowView).Row.ItemArray[7].ToString();
}
}
}
}
@ -116,10 +164,17 @@ namespace ZKuP
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.karten WHERE `kartennr` = '{arr[1]}'");
karten = await SQL.ReadSQL($"Select * FROM {MainWindow.table}.karten", karten);
dgCards.DataContext = karten;
await SQL.WriteSQL($"UPDATE {MainWindow.table}.kartenLog SET RueckgabeSignature = @signature, Ansprechpartner = '{arr[7]}' WHERE idkarten = '{arr[0]}' AND Ausgebucht = 1 AND `timestamp` > (now() - INTERVAL 2 MINUTE)", _signature);
await Query(CardType.DB);
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.kartenLog SET RueckgabeSignature = @signature, Ansprechpartner = '{arr[7]}' WHERE idkarten = '{arr[0]}' AND Ausgebucht = 1 AND `timestamp` > (now() - INTERVAL 2 MINUTE)", _signature);
var cmd = SQL.CreateAndReturnSQLCommand($"UPDATE {MainWindow.table}.kartenLog SET RueckgabeSignature = @signature, Ansprechpartner = @arr7 WHERE idkarten = @arr0 AND Ausgebucht = '1' AND `timestamp` > (now() - INTERVAL 2 MINUTE)", new List<MySqlParameter>()
{
new MySqlParameter("@arr7", arr[7]),
new MySqlParameter("@arr0", arr[0])
});
await SQL.CreateAndWriteSQLwithSignature(cmd, _signature);
this.Close();
}
@ -156,10 +211,16 @@ namespace ZKuP
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.karten WHERE {delCards}");
karten = await SQL.ReadSQL($"Select * FROM {MainWindow.table}.karten", karten);
dgCards.DataContext = karten;
await Query(CardType.DB);
await SQL.WriteSQL($"UPDATE {MainWindow.table}.kartenLog SET RueckgabeSignature = @signature WHERE {delCardsLog}", _signature);
//var cmd = SQL.CreateAndReturnSQLCommand($"UPDATE {MainWindow.table}.kartenLog SET RueckgabeSignature = @signature WHERE @delCardsLog", new List<MySqlParameter>()
// {
// new MySqlParameter("@delCardsLog", delCardsLog)
// });
//await SQL.CreateAndWriteSQLwithSignature(cmd, _signature);
this.Close();
}
@ -193,11 +254,13 @@ namespace ZKuP
List<string> temp = new List<string>();
foreach (var line in cBItemSource)
temp.Add(line.Replace(";", " "));
temp.Add(line.Replace(";", " "));
cBNameAusgabe.ItemsSource = temp;
cBNameAusgabe.IsDropDownOpen = true;
Dispatcher.Invoke(() =>
{
cBNameAusgabe.ItemsSource = temp;
cBNameAusgabe.IsDropDownOpen = true;
});
}
private void tbAusNachname_TextChanged(object sender, TextChangedEventArgs e)
@ -262,10 +325,23 @@ namespace ZKuP
int Kartennr = Convert.ToInt32(cBAusKarte.SelectedValue.ToString().Split(' ')[2]);
await SQL.WriteSQL($"UPDATE {MainWindow.table}.mcFit SET Vorname = '{tbAusVorname.Text}', Nachname = '{tbAusNachname.Text}', Abteilung = '{tbAusAbteilung.Text}', Handynr = '{tbAusHandy.Text}', Email = '{tbAusEmail.Text}', AusgabeTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', ZurueckTimestamp = null, AktuellAusgegeben = '1', Signature = @signature, AusgegebenDruch = '{Environment.UserName}' WHERE Kartennr = '{Kartennr}'", _signature);
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.mcFit SET Vorname = '{tbAusVorname.Text}', Nachname = '{tbAusNachname.Text}', Abteilung = '{tbAusAbteilung.Text}', Handynr = '{tbAusHandy.Text}', Email = '{tbAusEmail.Text}', AusgabeTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', ZurueckTimestamp = null, AktuellAusgegeben = '1', Signature = @signature, AusgegebenDruch = '{Environment.UserName}' WHERE Kartennr = '{Kartennr}'", _signature);
var cmd = SQL.CreateAndReturnSQLCommand($"UPDATE {MainWindow.table}.mcFit SET Vorname = @tbAusVorname, Nachname = @tbAusNachname, Abteilung = @tbAusAbteilung, Handynr = @tbAusHandy, Email = @tbAusEmail, AusgabeTimestamp = @DateTime, ZurueckTimestamp = null, AktuellAusgegeben = '1', Signature = @signature, AusgegebenDurch = @UserName WHERE Kartennr = @Kartennr", new List<MySqlParameter>()
{
new MySqlParameter("@tbAusVorname", tbAusVorname.Text),
new MySqlParameter("@tbAusNachname", tbAusNachname.Text),
new MySqlParameter("@tbAusAbteilung", tbAusAbteilung.Text),
new MySqlParameter("@tbAusHandy", tbAusHandy.Text),
new MySqlParameter("@tbAusEmail", tbAusEmail.Text),
new MySqlParameter("@DateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
new MySqlParameter("@UserName", Environment.UserName),
new MySqlParameter("@Kartennr", Kartennr)
});
mcFit = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.mcFit", mcFit).Result;
dgMcFit.DataContext = mcFit;
await SQL.CreateAndWriteSQLwithSignature(cmd, _signature);
await Query(CardType.McFit);
}
}
}
@ -284,10 +360,17 @@ namespace ZKuP
{
int Kartennr = Convert.ToInt32(cBZurKarte.SelectedValue.ToString().Split(' ')[2]);
await SQL.WriteSQL($"UPDATE {MainWindow.table}.mcFit SET ZurueckTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', AktuellAusgegeben = '0' WHERE Kartennr = '{Kartennr}'");
//await SQL.WriteSQL($"UPDATE {MainWindow.table}.mcFit SET ZurueckTimestamp = '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', AktuellAusgegeben = '0' WHERE Kartennr = '{Kartennr}'");
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.mcFit SET ZurueckTimestamp = @DateTime, AktuellAusgegeben = '0' WHERE Kartennr = @Kartennr", new List<MySqlParameter>()
{
new MySqlParameter("@DateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
new MySqlParameter("@Kartennr", Kartennr)
});
mcFit = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.mcFit", mcFit).Result;
dgMcFit.DataContext = mcFit;
await Query(CardType.McFit);
}
private void btnSignature_Click(object sender, RoutedEventArgs e)
@ -316,5 +399,64 @@ namespace ZKuP
{
tabcontrol.SelectedIndex = 1;
}
private void tabcontrol_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
switch(tabcontrol.SelectedIndex)
{
case 0:
btnMcFit.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x25, 0x2F, 0x3B));
btnGreenRed.Background = new LinearGradientBrush(Color.FromArgb(0xFF, 0x25, 0x2F, 0x3B), Color.FromArgb(0xFF, 0x1B, 0x55, 0x7B), 90);
break;
case 1:
btnGreenRed.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x25, 0x2F, 0x3B));
btnMcFit.Background = new LinearGradientBrush(Color.FromArgb(0xFF, 0x25, 0x2F, 0x3B), Color.FromArgb(0xFF, 0x1B, 0x55, 0x7B), 90);
break;
}
}
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
await Query(CardType.All);
CheckAllBoxes(true);
gridSpinner.Visibility = Visibility.Collapsed;
}
private async Task Query(CardType type)
{
await Task.Run(() =>
{
if (type == CardType.DB || type == CardType.All) karten = SQL.ReadSQL($"SELECT `kartennr`,`farbe`,`benutzer`,`telnr`,`AusgegebenDurch`,`AusgegebenTimestamp`,`AusgegebenAnFirma`,`AusgegebenAnPerson` FROM {MainWindow.table}.karten ORDER BY AusgegebenTimestamp DESC", karten).Result;
if (type == CardType.McFit || type == CardType.All) mcFit = SQL.ReadSQL($"SELECT `Kartennr`,`Vorname`,`Nachname`,`Abteilung`,`Handynr`,`Email`,`AusgabeTimestamp`,`ZurueckTimestamp`,`AktuellAusgegeben` FROM {MainWindow.table}.mcFit ORDER BY AusgabeTimestamp", mcFit).Result;
});
if (type == CardType.DB || type == CardType.All)
{
if (!karten.Columns.Contains("IsChecked"))
karten.Columns.Add("IsChecked", typeof(bool));
dgCards.DataContext = karten;
}
if (type == CardType.McFit || type == CardType.All) dgMcFit.DataContext = mcFit;
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
public enum CardType
{
All,
DB,
McFit
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.CheckKennzeichen"
<mah:MetroWindow x:Class="ZKuP.CheckKennzeichen"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title=" Kennzeichen überprüfen" Height="450" Width="600" WindowStyle="ToolWindow" ResizeMode="NoResize">
Title=" Kennzeichen überprüfen" Height="450" Width="600" WindowStyle="ToolWindow" ResizeMode="NoResize" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Button x:Name="btnSearch" Content="Suchen" HorizontalAlignment="Left" Margin="176,10,0,0" VerticalAlignment="Top" Width="75" Height="25" Padding="-2" Click="btnSearch_Click"/>
<TextBox x:Name="tbKennzeichen" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="160" PreviewKeyDown="tbKennzeichen_PreviewKeyDown"/>
@ -18,4 +19,4 @@
</DataGrid>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,7 +18,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CheckKennzeichen.xaml
/// </summary>
public partial class CheckKennzeichen : Window
public partial class CheckKennzeichen : MetroWindow
{
public CheckKennzeichen()
{
@ -48,5 +49,17 @@ namespace ZKuP
dgKennzeichen.DataContext = list;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.CheckParkausweis"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Parkausweise überprüfen" Height="450" MinHeight="300" Width="800" MinWidth="320">
Title="Parkausweise überprüfen" Height="450" MinHeight="300" Width="800" MinWidth="320" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<TextBox x:Name="tbSearch" Margin="10,10,250,0" Height="25" Padding="2" VerticalAlignment="Top" PreviewGotKeyboardFocus="tbSearch_PreviewGotKeyboardFocus" PreviewLostKeyboardFocus="tbSearch_PreviewLostKeyboardFocus"/>
<TextBlock x:Name="lblSearch" Text="Kennzeichen suchen..." Margin="15,12,260,0" Height="25" VerticalAlignment="Top" Foreground="Gray" IsHitTestVisible="False" PreviewKeyDown="lblSearch_PreviewKeyDown"/>
@ -37,4 +38,4 @@
</Grid>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,20 +18,20 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CheckParkausweis.xaml
/// </summary>
public partial class CheckParkausweis : Window
public partial class CheckParkausweis : MetroWindow
{
public CheckParkausweis()
{
InitializeComponent();
var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM {MainWindow.table}.parkausweise WHERE Genehmigt = '1'").Result;
var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter, isKrad FROM {MainWindow.table}.parkausweise WHERE Genehmigt = '1'").Result;
dgCheck.DataContext = list;
}
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter FROM {MainWindow.table}.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
var list = SQL.ReadSQL($"SELECT Kennzeichen, MA_Vorname AS Vorname, MA_Name AS Nachname, Telefon, Abteilung, Vorgesetzter, isKrad FROM {MainWindow.table}.parkausweise WHERE Genehmigt = '1' AND Kennzeichen LIKE '%{tbSearch.Text}%'").Result;
dgCheck.DataContext = list;
}
@ -67,5 +68,17 @@ namespace ZKuP
gridSpinner.Visibility = Visibility.Collapsed;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,4 +1,4 @@
<Window
<mah:MetroWindow
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"
@ -7,9 +7,9 @@
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" x:Class="ZKuP.CreateFirma"
mc:Ignorable="d"
Title="Firmen verwalten" Height="682" Width="1378"
WindowStartupLocation="CenterOwner" Closing="Window_Closing">
WindowStartupLocation="CenterOwner" Closing="Window_Closing" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Window.Resources>
<mah:MetroWindow.Resources>
<ResourceDictionary>
<ControlTemplate x:Key="ComboBoxControlTemplate1" TargetType="{x:Type ComboBox}">
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
@ -186,18 +186,25 @@
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<local:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
</ResourceDictionary>
</Window.Resources>
</mah:MetroWindow.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" TextChanged="tbName_TextChanged" LostFocus="tbName_LostFocus"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Name der Firma"/></TextBlock>
<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" TextChanged="tbName_TextChanged" LostKeyboardFocus="tbName_LostFocus" LostFocus="tbName_LostFocus"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Name der Firma (Nur Firmenname, ohne Fa., Firma, etc...)"/></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 Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" PreviewTextInput="tbTel_Firma_PreviewTextInput"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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}"/>
<StackPanel Margin="10,204,0,0" Width="340" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal">
<TextBox x:Name="tbAnzahl_Begleiter" HorizontalAlignment="Left" Width="170" Height="23" TextWrapping="Wrap" Text="" VerticalAlignment="Top" TabIndex="4" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewTextInput="tbAnzahl_Begleiter_PreviewTextInput" ToolTip="Nur Zahlen und max. 2 Stellen" CommandManager.PreviewExecuted="Textboxes_PreviewExecuted" ContextMenu="{x:Null}"/>
<Button x:Name="btnBegleiter" Content="Begleitpersonen angeben" Width="165" FontSize="12" Margin="5,0,0,0" HorizontalAlignment="Right" Click="btnBegleiter_Click"/>
</StackPanel>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,183,0,0" TextWrapping="Wrap" Text="Anzahl Begleitpersonen" VerticalAlignment="Top"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,379,0,0" TextWrapping="Wrap" Text="Arbeitsbeginn ab" VerticalAlignment="Top"/>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" x:Name="lbl1" HorizontalAlignment="Left" Margin="10,429,0,0" TextWrapping="Wrap" Text="Personen in Baumaßnahme eingewiesen bis" VerticalAlignment="Top"/>
@ -215,8 +222,9 @@
</DatePicker.Resources>
</DatePicker>
<ComboBox x:Name="cbBE" HorizontalAlignment="Left" Height="23" Margin="10,349,0,0" Text="" VerticalAlignment="Top" Width="340" TabIndex="7">
<ComboBoxItem Content=""/>
<ContentControl x:Name="ccBE" MouseEnter="cbBE_MouseEnter">
<ComboBox x:Name="cbBE" IsEnabled="{Binding BEColumnIsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" HorizontalAlignment="Left" Height="23" Margin="10,349,0,0" Text="" VerticalAlignment="Top" Width="340" TabIndex="7">
<!--<ComboBoxItem Content="" />
<ComboBoxItem Content="BE-Fläche 1 (ICE-West/Containerburg)"/>
<ComboBoxItem Content="BE-Fläche 2 (ICE-West/MaWi/Gleisabstellung)"/>
<ComboBoxItem Content="BE-Fläche 4 (Aufgang Friedenheimer-Brücke)"/>
@ -226,14 +234,15 @@
<ComboBoxItem Content="BE-Fläche 10 (Gebäude G)"/>
<ComboBoxItem Content="BE-Fläche 11 (Gaslager)"/>
<ComboBoxItem Content="BE-Fläche 12 (Feuerwehrzufahrt Süd)"/>
<ComboBoxItem Content="BE-Fläche 13 (Feuerwehrzufahrt Süd)"/>
</ComboBox>
<ComboBoxItem Content="BE-Fläche 13 (Feuerwehrzufahrt Süd)"/>-->
</ComboBox>
</ContentControl>
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,328,0,0" TextWrapping="Wrap" Text="Gebuchte BE-Fläche" VerticalAlignment="Top"/>
<Button x:Name="btnAdd" Content="Hinzufügen&#xA; →" HorizontalAlignment="Left" FontSize="12" Padding="-2" Margin="355,36,0,0" VerticalAlignment="Top" Width="75" Height="580" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Click="btnAdd_Click" TabIndex="15"/>
<DataGrid x:Name="dgFirmen" Margin="435,36,10,43" KeyboardNavigation.TabNavigation="None" ItemsSource="{Binding ., 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 x:Name="dgFirmen" Margin="435,36,10,43" KeyboardNavigation.TabNavigation="None" ItemsSource="{Binding ., Mode=OneWay}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserReorderColumns="False" IsTabStop="False" HorizontalScrollBarVisibility="Visible" CellEditEnding="DgFirmen_CellEditEnding" CanUserDeleteRows="False" PreviewKeyDown="DgFirmen_PreviewKeyDown" BeginningEdit="dgFirmen_BeginningEdit" SelectionMode="Single" PreparingCellForEdit="dgFirmen_PreparingCellForEdit">
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
@ -269,43 +278,70 @@
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" ClipboardContentBinding="{x:Null}" Header="Name" SortDirection="Ascending">
<DataGridTextColumn Binding="{Binding Name}" Width="200" 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"/>
<Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Verantwortlicher_MA_Firma}" ClipboardContentBinding="{x:Null}" Header="Verantw. MA">
<DataGridTextColumn Binding="{Binding Verantwortlicher_MA_Firma}" Width="200" 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"/>
<Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Tel. Firma"><!--Binding="{Binding Tel_Nr_Verantwortlicher_Firma}"-->
<DataGridTextColumn Binding="{Binding Tel_Nr_Verantwortlicher_Firma}" Header="Tel. Firma">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="5,0,0,0"/>
<Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<!--<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Tel. Firma">--><!--Binding="{Binding Tel_Nr_Verantwortlicher_Firma}"--><!--
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Tel_Nr_Verantwortlicher_Firma}" Background="Transparent" BorderThickness="0" VerticalAlignment="Center" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Padding="5" PreviewTextInput="tbTel_Firma_PreviewTextInput"/>
<TextBox Text="{Binding Tel_Nr_Verantwortlicher_Firma}" Background="Transparent" BorderThickness="0" VerticalAlignment="Center" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Padding="5" PreviewTextInput="tbTel_Firma_PreviewTextInput" LostKeyboardFocus="TelNrVerantwortlicher_LostKeyboardFocus">
</TextBox>
</DataTemplate>
<!--<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="5,0,0,0"/>
<EventSetter Event="PreviewTextInput" Handler="tbTel_Firma_PreviewTextInput"/>
</Style>-->
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding Anzahl_Begleiter}" ClipboardContentBinding="{x:Null}" Header="Anz. Begleitp.">
</DataGridTemplateColumn>-->
<!--<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>-->
<DataGridTemplateColumn Header="Anz. Begleitp.">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<TextBox x:Name="tbdgAnzBegleit" Text="{Binding Anzahl_Begleiter}" BorderThickness="0" Background="Transparent" Width="50" TextAlignment="Center" VerticalAlignment="Center" LostKeyboardFocus="TextBox_LostKeyboardFocus" GotKeyboardFocus="TextBox_GotKeyboardFocus"/>
<Button x:Name="btnEdit" Width="25" Height="25" ToolTip="Begleitpersonen bearbeiten/hinzufügen/entfernen" HorizontalAlignment="Right" Padding="0" Click="btnEdit_Click">
<Button.Content>
<Image Source="/Resources/Edit.png" Height="23"/>
</Button.Content>
<!--<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="Anzahl ändern" Tag="1" Click="MenuItem_Click"/>
<MenuItem Header="Personen anzeigen/bearbeiten" Tag="2" Click="MenuItem_Click"/>
</ContextMenu>
</Button.ContextMenu>-->
</Button>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding Anzahl_Fzg}" ClipboardContentBinding="{x:Null}" Header="Anz. Fzg.">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
@ -319,6 +355,7 @@
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Padding" Value="5,0,0,0"/>
<Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
@ -375,9 +412,17 @@
</Style>
</DatePicker.Resources>
</DatePicker>
<Button x:Name="btnDpDgEinweisungWoche" Width="15" Content="W" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Woche" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
<Button x:Name="btnDpDgEinweisungMonat" Width="15" Content="M" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Monat" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
<Button x:Name="btnDpDgEinweisungJahr" Width="15" Content="J" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Jahr" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button x:Name="btnDpDgEinweisungWoche" Width="20" Height="17" Content="W" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Woche" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
<Button x:Name="btnDpDgEinweisungMonat" Width="20" Height="17" Content="M" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Monat" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
<Button x:Name="btnDpDgEinweisungJahr" Width="20" Height="17" Content="J" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Jahr" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button x:Name="btnDpDgEinweisungFolgt" Width="30" Height="17" Content="Folgt" FontSize="12" Padding="-2" Foreground="Black" Background="#FFFF9191" ToolTip="Einweisung folgt" Click="btnDpDgEinweisung_Click"/>
<Button x:Name="btnDpDgEinweisungBegleitung" Width="30" Height="17" Content="Begl." FontSize="12" Padding="-2" Foreground="Black" Background="#CCFFA200" ToolTip="Nur in Begleitung" Click="btnDpDgEinweisung_Click"/>
</StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
@ -385,13 +430,17 @@
<DataGridTemplateColumn Header="BE-Fläche" MinWidth="150">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="dg_cbBE" Template="{StaticResource ComboBoxControlTemplate1}" ItemsSource="{Binding BEItems, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" SelectedItem="{Binding BE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" DropDownClosed="dg_cbBE_DropDownClosed" DropDownOpened="dg_cbBE_DropDownOpened">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Grid x:Name="grid_dgBE" MouseEnter="cbBE_MouseEnter">
<TextBlock Text="{Binding BE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding BE, Converter={StaticResource NullToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4,0,0,0"/>
<ComboBox x:Name="dg_cbBE" IsEnabled="{Binding BEColumnIsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" Template="{StaticResource ComboBoxControlTemplate1}" ItemsSource="{Binding BEItems, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" SelectedItem="{Binding BE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" DropDownClosed="dg_cbBE_DropDownClosed" DropDownOpened="dg_cbBE_DropDownOpened">
<!--SelectedItem="{Binding BE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" -->
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
@ -434,6 +483,38 @@
<Button x:Name="btnDelete" Content="Markierte Firma löschen" FontSize="12" Padding="-2" Margin="0,10,10,0" Height="23" VerticalAlignment="Top" HorizontalAlignment="Right" Width="187" Click="btnDelete_Click" IsEnabled="False"/>
<Button x:Name="btnBegleitung" Content="↑ Nur in Begleitung" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="180,503,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" TabIndex="15"/>
<Button x:Name="btnHelp" Content="Hilfe zur Tabelle" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="435,11,0,0" Height="23" VerticalAlignment="Top" Width="160" Click="btnHelp_Click"/>
<Popup PopupAnimation="Fade" AllowsTransparency="True" Width="250" StaysOpen="False" x:Name="M2WithGebuchterBETooltipPopup" Closed="TooltipPopup_Closed">
<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="LightGray" CornerRadius="3" BorderThickness="1">
<StackPanel Margin="0" Orientation="Vertical" >
<TextBlock Text="Gebuchte BE-Fläche wählen" Margin="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Center"/>
<TextBlock Text="oder" HorizontalAlignment="Center" Margin="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Border BorderBrush="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderThickness="1" CornerRadius="3">
<Button Content="Zur Buchung" HorizontalAlignment="Stretch" Margin="0,5,0,0" Click="GoToBEBuchung_Click" VerticalAlignment="Bottom" />
</Border>
</StackPanel>
</Border>
</Popup>
<Popup PopupAnimation="Fade" AllowsTransparency="True" StaysOpen="False" x:Name="M2WithoutGebuchterBETooltipPopup" Closed="TooltipPopup_Closed">
<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="LightGray" CornerRadius="3" BorderThickness="1">
<StackPanel Margin="0" Orientation="Vertical" >
<TextBlock Text="Keine gebuchten BE-Flächen vorhanden" Margin="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Center"/>
<Border BorderBrush="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderThickness="1" CornerRadius="3">
<Button Content="Zur Buchung" HorizontalAlignment="Stretch" Margin="0,5,0,0" Click="GoToBEBuchung_Click" VerticalAlignment="Bottom" />
</Border>
</StackPanel>
</Border>
</Popup>
<Popup PopupAnimation="Fade" AllowsTransparency="True" StaysOpen="False" x:Name="NotM2TooltipPopup" Closed="TooltipPopup_Closed">
<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="LightGray" CornerRadius="3" BorderThickness="1">
<StackPanel Margin="10" Orientation="Vertical" >
<TextBlock Text="BE-Flächen können nur von M2 gebucht werden" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</StackPanel>
</Border>
</Popup>
<Canvas x:Name="canvasHelp" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" HorizontalAlignment="Center" Height="370" Margin="0" VerticalAlignment="Center" Width="600" Visibility="Collapsed">
<RichTextBox Height="350" Canvas.Left="10" Canvas.Top="10" Width="580" Background="{x:Null}" IsReadOnlyCaretVisible="True" Focusable="False" AllowDrop="False">
<FlowDocument>
@ -501,4 +582,4 @@
</Grid>
</Window>
</mah:MetroWindow>

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.CreateMcFitUser"
<mah:MetroWindow x:Class="ZKuP.CreateMcFitUser"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="McFit User erstellen" Height="599.907" Width="438" ResizeMode="NoResize">
Title="McFit User erstellen" Height="599.907" Width="438" ResizeMode="NoResize" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Grid>
<TextBlock HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="Vorname" VerticalAlignment="Top" Width="402" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
@ -72,4 +73,4 @@
<Button x:Name="btnDecline" Content="Ablehnen" Height="35" Margin="0,0,10,14" Width="175" Click="btnDecline_Click" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
</Grid>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,6 @@
using System;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,8 +19,8 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CreateMcFitUser.xaml
/// </summary>
public partial class CreateMcFitUser : Window
{
public partial class CreateMcFitUser : MetroWindow
{
public CreateMcFitUser()
{
InitializeComponent();
@ -37,13 +39,21 @@ namespace ZKuP
private async void btnAddUser_Click(object sender, RoutedEventArgs e)
{
if(tbVorname.Text != "" &&
if (tbVorname.Text != "" &&
tbNachname.Text != "" &&
tbAbteilung.Text != "" &&
tbHandynr.Text != "" &&
tbEmail.Text != "")
{
await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.mcFitUsers (Vorname, Name, Abteilung, Handynr, Email) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbAbteilung.Text}','{tbHandynr.Text}','{tbEmail.Text}')");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.mcFitUsers (Vorname, Name, Abteilung, Handynr, Email) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbAbteilung.Text}','{tbHandynr.Text}','{tbEmail.Text}')");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.mcFitUsers (Vorname, Name, Abteilung, Handynr, Email) VALUES (@tbVorname,@tbNachname,@tbAbteilung,@tbHandynr,@tbEmail)", new List<MySqlParameter>()
{
new MySqlParameter("@tbVorname", tbVorname.Text),
new MySqlParameter("@tbNachname", tbNachname.Text),
new MySqlParameter("@tbAbteilung", tbAbteilung.Text),
new MySqlParameter("@tbHandynr", tbHandynr.Text),
new MySqlParameter("@tbEmail", tbEmail.Text)
});
var exist = await SQL.RowExists("mcFitUsers", "Email", tbEmail.Text);
@ -68,5 +78,16 @@ namespace ZKuP
{
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,12 +1,13 @@
<Window x:Class="ZKuP.CreateParkEmailUser"
<mah:MetroWindow x:Class="ZKuP.CreateParkEmailUser"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="CreateParkEmailUser" Height="450" Width="800">
Title="CreateParkEmailUser" Height="450" Width="800" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,11 +18,23 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CreateParkEmailUser.xaml
/// </summary>
public partial class CreateParkEmailUser : Window
public partial class CreateParkEmailUser : MetroWindow
{
public CreateParkEmailUser()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.CreateParkausweis"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Parkausweis beantragen" Height="850" Width="360" MinWidth="360" MinHeight="850">
Title="Parkausweis beantragen" Height="850" Width="360" MinWidth="360" MinHeight="850" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
@ -35,7 +36,7 @@
<TextBlock Margin="10,5,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Telefon*" VerticalAlignment="Top" Grid.Row="3"/>
<TextBox x:Name="tbTelefon" Margin="10,26,10,0" Height="25" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="3" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewLostKeyboardFocus="tbTelefon_PreviewLostKeyboardFocus"/>
<TextBlock Margin="10,5,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Abteilung*" VerticalAlignment="Top" Grid.Row="4"/>
<TextBlock Margin="10,5,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Abteilungskürzel (zB. P.FBW-M2)*" VerticalAlignment="Top" Grid.Row="4"/>
<TextBox x:Name="tbAbteilung" Margin="10,26,10,0" Height="25" Padding="0,4,0,0" TextWrapping="Wrap" Grid.Row="4" TextChanged="Textboxes_Changed" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
<TextBlock Margin="10,5,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Firma*" VerticalAlignment="Top" Grid.Row="5"/>
@ -94,4 +95,4 @@
<Button x:Name="btnCreate" Content="Beantragen" Margin="10" Grid.Row="13" Click="btnCreate_Click" IsEnabled="False"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,6 @@
using System;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,8 +19,8 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CreateParkausweis.xaml
/// </summary>
public partial class CreateParkausweis : Window
{
public partial class CreateParkausweis : MetroWindow
{
List<string> plz = new List<string>();
public bool special { get; private set; }
@ -255,7 +257,26 @@ namespace ZKuP
if (rbOtherKennzeichen.IsChecked.Value)
{
await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.`parkausweise` (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbOtherKennzeichen.Text}','{tbEmail.Text}','{tbTelefon.Text}','{tbAbteilung.Text}','{cbFirma.Text}','{tbAdresse.Text}','{tbPLZ.Text}','{tbVorgesetzter.Text}','{_correctness}','{_schicht}','{_bemerkung}',{isKrad})");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.`parkausweise` (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbOtherKennzeichen.Text}','{tbEmail.Text}','{tbTelefon.Text}','{tbAbteilung.Text}','{cbFirma.Text}','{tbAdresse.Text}','{tbPLZ.Text}','{tbVorgesetzter.Text}','{_correctness}','{_schicht}','{_bemerkung}',{isKrad})");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.`parkausweise` (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) VALUES (@tbVorname,@tbNachname,@tbOtherKennzeichen,@tbEmail,@tbTelefon,@tbAbteilung,@cbFirma,@tbAdresse,@tbPLZ,@tbVorgesetzter,@_correctness,@_schicht,@_bemerkung,@isKrad)", new List<MySqlParameter>()
{
new MySqlParameter("@tbVorname", tbVorname.Text),
new MySqlParameter("@tbNachname", tbNachname.Text),
new MySqlParameter("@tbOtherKennzeichen", tbOtherKennzeichen.Text),
new MySqlParameter("@tbEmail", tbEmail.Text),
new MySqlParameter("@tbTelefon", tbTelefon.Text),
new MySqlParameter("@tbAbteilung", tbAbteilung.Text),
new MySqlParameter("@cbFirma", cbFirma.Text),
new MySqlParameter("@tbAdresse", tbAdresse.Text),
new MySqlParameter("@tbPLZ", tbPLZ.Text),
new MySqlParameter("@tbVorgesetzter", tbVorgesetzter.Text),
new MySqlParameter("@_correctness", _correctness),
new MySqlParameter("@_schicht", _schicht),
new MySqlParameter("@_bemerkung", _bemerkung),
new MySqlParameter("@isKrad", isKrad)
});
var id = SQL.ReadSingleValue($"SELECT idparkausweise FROM {MainWindow.table}.parkausweise ORDER BY idparkausweise DESC LIMIT 1");
var name = SQL.ReadSingleValue($"SELECT MA_Name FROM {MainWindow.table}.parkausweise WHERE idparkausweise={id}");
@ -273,7 +294,25 @@ namespace ZKuP
}
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,isKrad) 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}',{isKrad})");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.parkausweise (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) 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}',{isKrad})");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.parkausweise (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) VALUES (@tbVorname,@tbNachname,@Kennzeichen,@tbEmail,@tbTelefon,@tbAbteilung,@cbFirma,@tbAdresse,@tbPLZ,@tbVorgesetzter,@_correctness,@_schicht,@_bemerkung,@isKrad)", new List<MySqlParameter>()
{
new MySqlParameter("@tbVorname", tbVorname.Text),
new MySqlParameter("@tbNachname", tbNachname.Text),
new MySqlParameter("@Kennzeichen", $"{tbDTownKennzeichen.Text}-{tbDCharsKennzeichen.Text} {tbDDigitsKennzeichen.Text}"),
new MySqlParameter("@tbEmail", tbEmail.Text),
new MySqlParameter("@tbTelefon", tbTelefon.Text),
new MySqlParameter("@tbAbteilung", tbAbteilung.Text),
new MySqlParameter("@cbFirma", cbFirma.Text),
new MySqlParameter("@tbAdresse", tbAdresse.Text),
new MySqlParameter("@tbPLZ", tbPLZ.Text),
new MySqlParameter("@tbVorgesetzter", tbVorgesetzter.Text),
new MySqlParameter("@_correctness", _correctness),
new MySqlParameter("@_schicht", _schicht),
new MySqlParameter("@_bemerkung", _bemerkung),
new MySqlParameter("@isKrad", isKrad)
});
var id = SQL.ReadSingleValue($"SELECT idparkausweise FROM {MainWindow.table}.parkausweise ORDER BY idparkausweise DESC LIMIT 1");
var name = SQL.ReadSingleValue($"SELECT MA_Name FROM {MainWindow.table}.parkausweise WHERE idparkausweise={id}");
@ -291,7 +330,26 @@ namespace ZKuP
}
else if (rbVersKennzeichen.IsChecked.Value)
{
await SQL.WriteSQL($"INSERT INTO parkausweise (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbVersKennzeichen1.Text} {tbVersKennzeichen2.Text}','{tbEmail.Text}','{tbTelefon.Text}','{tbAbteilung.Text}','{cbFirma.Text}','{tbAdresse.Text}','{tbPLZ.Text}','{tbVorgesetzter.Text}','{_correctness}','{_schicht}','{_bemerkung}',{isKrad})");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.parkausweise (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) VALUES ('{tbVorname.Text}','{tbNachname.Text}','{tbVersKennzeichen1.Text} {tbVersKennzeichen2.Text}','{tbEmail.Text}','{tbTelefon.Text}','{tbAbteilung.Text}','{cbFirma.Text}','{tbAdresse.Text}','{tbPLZ.Text}','{tbVorgesetzter.Text}','{_correctness}','{_schicht}','{_bemerkung}',{isKrad})");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.parkausweise (MA_Vorname,MA_Name,Kennzeichen,Email,Telefon,Abteilung,Firma,Adresse,PLZ,Vorgesetzter,AcceptedCorrectness,Schicht,Bemerkung,isKrad) VALUES (@tbVorname,@tbNachname,@tbVersKennzeichen,@tbEmail,@tbTelefon,@tbAbteilung,@cbFirma,@tbAdresse,@tbPLZ,@tbVorgesetzter,@_correctness,@_schicht,@_bemerkung,@isKrad)", new List<MySqlParameter>()
{
new MySqlParameter("@tbVorname", tbVorname.Text),
new MySqlParameter("@tbNachname", tbNachname.Text),
new MySqlParameter("@tbVersKennzeichen", $"{tbVersKennzeichen1.Text} {tbVersKennzeichen2.Text}"),
new MySqlParameter("@tbEmail", tbEmail.Text),
new MySqlParameter("@tbTelefon", tbTelefon.Text),
new MySqlParameter("@tbAbteilung", tbAbteilung.Text),
new MySqlParameter("@cbFirma", cbFirma.Text),
new MySqlParameter("@tbAdresse", tbAdresse.Text),
new MySqlParameter("@tbPLZ", tbPLZ.Text),
new MySqlParameter("@tbVorgesetzter", tbVorgesetzter.Text),
new MySqlParameter("@_correctness", _correctness),
new MySqlParameter("@_schicht", _schicht),
new MySqlParameter("@_bemerkung", _bemerkung),
new MySqlParameter("@isKrad", isKrad)
});
var id = SQL.ReadSingleValue($"SELECT idparkausweise FROM {MainWindow.table}.parkausweise ORDER BY idparkausweise DESC LIMIT 1");
var name = SQL.ReadSingleValue($"SELECT MA_Name FROM {MainWindow.table}.parkausweise WHERE idparkausweise={id}");
@ -527,5 +585,16 @@ namespace ZKuP
else lblBemerkung.Visibility = Visibility.Collapsed;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,12 +1,13 @@
<Window x:Class="ZKuP.CreateVisitor"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Besucher erstellen" Height="626" Width="620" ResizeMode="NoResize"
WindowStartupLocation="CenterOwner">
WindowStartupLocation="CenterOwner" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<TextBox x:Name="tbName" HorizontalAlignment="Left" Height="23" Margin="10,57,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="330" TabIndex="1" PreviewKeyDown="TextBoxes_PreviewKeyDown" Grid.ColumnSpan="2"/>
<TextBlock Margin="10,36,13,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"><Run Text="Name"/><Run Text=" des Besuchers / Firmenname des Besuchers"/></TextBlock>
@ -34,4 +35,4 @@
<TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextAlignment="Center"><Run/><LineBreak/><Run Text="Wenn Ihnen der Button 'Firmen verwalten'"/><LineBreak/><Run Text="nicht angezeigt wird, wenden Sie sich bitte"/><LineBreak/><Run Text=" an Ihren Fremdfirmenkoordinator"/></TextBlock>
</StackPanel>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,7 +18,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CreateVisitor.xaml
/// </summary>
public partial class CreateVisitor : Window
public partial class CreateVisitor : MetroWindow
{
public CreateVisitor()
{
@ -142,5 +143,17 @@ namespace ZKuP
{
MessageBox.Show("Kein gültiges Datumsformat in Feld 'Besuchstag'", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.CreateVisitor_List"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Besucherliste" Height="450" Width="800">
Title="Besucherliste" Height="450" Width="800" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Button x:Name="btnDelete" Content="Markierten Besucher löschen" FontSize="12" Padding="-2" Height="23" Margin="0,10,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="167" Click="btnDelete_Click" IsEnabled="False"/>
@ -37,4 +38,4 @@
<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>
</mah:MetroWindow>

View File

@ -1,4 +1,6 @@
using System;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -19,8 +21,8 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CreateVisitor_List.xaml
/// </summary>
public partial class CreateVisitor_List : Window
{
public partial class CreateVisitor_List : MetroWindow
{
private List<Visitor> myVar;
public List<Visitor> VisitorView
{
@ -79,31 +81,31 @@ namespace ZKuP
switch (header)
{
case "Name":
await SQL.WriteSQL($"UPDATE besucher SET Name = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Tel_Nr_Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
break;
}
}
@ -168,13 +170,41 @@ namespace ZKuP
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($"INSERT INTO {MainWindow.table}.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.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.besucherLog (idbesucher, Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Geloescht_Von) VALUES (@arr0,@arr1,arr2,@arr3,@arr4,@arr5,@arr6,@arr7,@arr8,@arr10,@UserName)", new List<MySqlParameter>()
{
new MySqlParameter("@arr0", arr[0]),
new MySqlParameter("@arr1", arr[1].ToString()),
new MySqlParameter("@arr2", arr[2].ToString()),
new MySqlParameter("@arr3", arr[3].ToString()),
new MySqlParameter("@arr4", arr[4].ToString()),
new MySqlParameter("@arr5", Convert.ToDateTime(arr[5].ToString()).ToString("yyyy-MM-dd")),
new MySqlParameter("@arr6", arr[6].ToString()),
new MySqlParameter("@arr7", arr[7].ToString()),
new MySqlParameter("@arr8", arr[8].ToString()),
new MySqlParameter("@arr10", arr[10].ToString()),
new MySqlParameter("@UserName", Environment.UserName)
});
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.besucher WHERE `idbesucher` = '{arr[0]}'");
visitors = SQL.ReadSQL($"Select * from {MainWindow.table}.besucher WHERE Ersteller = '{Environment.UserName}'", visitors).Result;
VisitorView = Visitor.DataTableToVisitor(visitors);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.Delivery"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Lieferant" Height="660" Width="500" MinHeight="620" Loaded="Window_Loaded" Visibility="Collapsed">
Title="Lieferant" Height="660" Width="500" MinHeight="620" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged" Visibility="Collapsed">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
@ -19,10 +20,56 @@
<RowDefinition Height="1.4*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="lblFiltern" Margin="10,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" KeyDown="tbFilter_KeyDown"/>
<TextBox x:Name="tbFilter" mah:TextBoxHelper.Watermark="Firma, Name, Fahrer, Kennzeichen oder ID" Margin="10,0,0,0" TextWrapping="Wrap" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="255" KeyDown="tbFilter_KeyDown"/>
<Button x:Name="btnFiltern" Content="Filtern" FontSize="12" Padding="-2" Height="26" Margin="270,35,10,0" Click="btnFiltern_Click"/>
<TextBlock x:Name="lblHinterlegt" Margin="12,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" VerticalAlignment="Top" Grid.Row="1" Text="Hinterlegte Lieferanten:"/>
<ComboBox x:Name="cBLieferfirma" Margin="10,0" Height="21" VerticalAlignment="Bottom" SelectionChanged="cBLieferfirma_SelectionChanged" Grid.Row="1"/>
<StackPanel x:Name="spLieferfirma" Grid.Row="1">
<TextBlock x:Name="lblHinterlegt" Margin="12,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" VerticalAlignment="Top" Text="Hinterlegte Lieferanten:"/>
<ComboBox x:Name="cBLieferfirma" Margin="10,0" Height="21" VerticalAlignment="Bottom" SelectionChanged="cBLieferfirma_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ActualWidth, ElementName=cBLieferfirma, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding ID}" Padding="5,2" FontWeight="Normal" Foreground="LightGray"/>
<TextBlock Grid.Column="1" Text="{Binding Firma}" Padding="5,2" FontWeight="Bold"/>
<TextBlock Grid.Column="2" Text="{Binding Fahrer}" Padding="5,2" FontWeight="Bold" Foreground="Gray"/>
<TextBlock Grid.Column="3" Text="{Binding Kennzeichen}" Padding="5,2"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<StackPanel x:Name="spEntstoerdienst" Grid.Row="1" Visibility="Collapsed">
<TextBlock x:Name="lblEntstoerdienst" Margin="12,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" VerticalAlignment="Top" Text="Hinterlegte DB Firma:"/>
<ComboBox x:Name="cBEntstoerdienste" Margin="10,0" Height="21" VerticalAlignment="Bottom" SelectionChanged="cBEntstoerdienste_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding ActualWidth, ElementName=cBLieferfirma, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding ID}" Padding="5,2" FontWeight="Normal" Foreground="LightGray"/>
<TextBlock Grid.Column="1" Text="{Binding Firma}" Padding="5,2" FontWeight="Bold"/>
<TextBlock Grid.Column="2" Text="{Binding Fahrer}" Padding="5,2" FontWeight="Bold" Foreground="Gray"/>
<TextBlock Grid.Column="3" Text="{Binding Kennzeichen}" Padding="5,2"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" TextChanged="tbFirma_TextChanged"/>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Fahrername:" VerticalAlignment="Top"/>
@ -38,7 +85,7 @@
<Button x:Name="btnSignature" Content="Unterschrift" Margin="5,5" Grid.Row="7" Click="btnSignature_Click"/>
<Grid HorizontalAlignment="Stretch" Grid.Row="8" Margin="3">
<Grid x:Name="gridButtons" HorizontalAlignment="Stretch" Grid.Row="8" Margin="3" IsEnabled="False">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
@ -49,7 +96,7 @@
<Button x:Name="btnAddLKWLang" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="0" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
<Button.Content>
<StackPanel Orientation="Vertical">
<Image x:Name="imgLKWLang" Source="/Resources/LKWLang_button.png" ToolTip="Lieferanten mit LKW &lt; 7,5t im Werk" ToolTipService.InitialShowDelay="1" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="100" Height="45"/>
<Image x:Name="imgLKWLang" Source="/Resources/LKWLang_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="100" Height="45"/>
<TextBlock Text="LKW &gt; 7,5t" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
@ -57,7 +104,7 @@
<Button x:Name="btnAddLKW" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="1" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
<Button.Content>
<StackPanel Orientation="Vertical">
<Image x:Name="imgLKW" Source="/Resources/LKW_button.png" ToolTip="Lieferanten mit LKW &lt; 7,5t im Werk" ToolTipService.InitialShowDelay="1" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
<Image x:Name="imgLKW" Source="/Resources/LKW_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
<TextBlock Text="LKW &lt; 7,5t" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
@ -65,7 +112,7 @@
<Button x:Name="btnAddSprinter" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="2" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
<Button.Content>
<StackPanel Orientation="Vertical">
<Image x:Name="imgSprinter" Source="/Resources/Sprinter_button.png" ToolTip="Lieferanten mit LKW &lt; 7,5t im Werk" ToolTipService.InitialShowDelay="1" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
<Image x:Name="imgSprinter" Source="/Resources/Sprinter_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
<TextBlock Text="Sprinter" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
@ -73,7 +120,7 @@
<Button x:Name="btnAddPKW" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="3" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
<Button.Content>
<StackPanel Orientation="Vertical">
<Image x:Name="imgPKW" Source="/Resources/PKW_button.png" ToolTip="Lieferanten mit LKW &lt; 7,5t im Werk" ToolTipService.InitialShowDelay="1" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
<Image x:Name="imgPKW" Source="/Resources/PKW_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
<TextBlock Text="PKW" HorizontalAlignment="Center"/>
</StackPanel>
</Button.Content>
@ -81,12 +128,15 @@
</Grid>
<Popup x:Name="popupParkplatz" IsOpen="False" Width="700" Height="350" AllowsTransparency="True" Placement="Right" HorizontalOffset="20" VerticalOffset="200" PlacementTarget="{Binding DataContext, ElementName=popBE}" PopupAnimation="Slide">
<local:PopupNonTopmost x:Name="popupParkplatz" Topmost="False" IsOpen="False" Width="700" Height="350" AllowsTransparency="True" Placement="Right" HorizontalOffset="20" VerticalOffset="200" PlacementTarget="{Binding DataContext, ElementName=popBE}" PopupAnimation="Slide">
<Grid Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<TextBlock x:Name="tbParkplatzHinweis" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10" FontSize="18"/>
<Image x:Name="imgParkplatz" Source="/Assets/Parkplatz/01.png" VerticalAlignment="Bottom"/>
<Image x:Name="imgParkplatz" Source="/Assets/Parkplatz/01.png" VerticalAlignment="Top" Margin="0,50,0,0"/>
<Image x:Name="imgEnergie" Source="/Assets/Parkplatz/34.png" Visibility="Collapsed" VerticalAlignment="Bottom"/>
</Grid>
</Popup>
</local:PopupNonTopmost>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,10 +1,15 @@
using FuzzySharp;
using ControlzEx.Standard;
using FuzzySharp;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -20,15 +25,21 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für Delivery.xaml
/// </summary>
public partial class Delivery : Window
public partial class Delivery : MetroWindow
{
public static int GesamtFzg = 32;
public static int GesamtFzg = 42;
public static int LKWLang = 11;
public static int LKW = 10;
public static int Sprinter = 5;
public static int PKW = 2;
public static int MaxLKWLang = 2;
public static int MaxLKW = 3;
public static int MaxSprinter = 4;
public static int MaxPKW = 4;
Dictionary<string, int> EmergencyParkList = new Dictionary<string, int>()
{
{ "Netz", 6 },
@ -57,51 +68,108 @@ namespace ZKuP
if (_emergency)
{
this.Title = "DB Intern Entstördienst";
lblFiltern.Text = "DB Interne filtern:";
lblHinterlegt.Text = "Hinterlegte DB Firmen:";
tbFilter.Visibility = Visibility.Collapsed;
btnFiltern.Visibility = Visibility.Collapsed;
lblFiltern.Visibility = Visibility.Collapsed;
lblHinterlegt.Text = "DB Firma wählen:";
tbFirma.IsEnabled = false;
Grid.SetRow(spLieferfirma, 0);
spEntstoerdienst.Visibility = Visibility.Visible;
btnAddLKW.Visibility = Visibility.Collapsed;
btnAddLKWLang.Visibility = Visibility.Collapsed;
btnAddSprinter.Visibility = Visibility.Collapsed;
btnAddPKW.HorizontalAlignment = HorizontalAlignment.Stretch;
((btnAddPKW.Content as StackPanel).Children[1] as TextBlock).Text = this.Title = "DB Entstördienst";
Grid.SetColumnSpan(btnAddPKW, 4);
Grid.SetColumn(btnAddPKW, 0);
//var list = SQL.ReadListStringTwoColumns($"SELECT Firma, Fahrer FROM {MainWindow.table}.lieferanten WHERE Firma LIKE 'DB%'", " Fahrer: ").Result;
//list = list.OrderBy(p => p).ToList();
//cBLieferfirma.ItemsSource = list;
//var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE Firma LIKE 'DB%'", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE (Firma = 'DB Energie' OR (Firma = 'DB Energie' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND ID LIKE '%{tbFilter.Text}%')) OR" +
$"(Firma = 'DB InfraGo' OR (Firma = 'DB InfraGo' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND ID LIKE '%{tbFilter.Text}%')) OR" +
$"(Firma = 'DB Notfallmanager' OR (Firma = 'DB Notfallmanager' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND ID LIKE '%{tbFilter.Text}%')) OR" +
$"(Firma = 'DB KT' OR (Firma = 'DB KT' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND ID LIKE '%{tbFilter.Text}%'))", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
//var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE Firma LIKE 'DB%'", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
list = list.OrderBy(p => p).ToList();
var list = new List<Lieferant>()
{
new Lieferant() { Firma = "DB Energie" },
new Lieferant() { Firma = "DB InfraGO" },
new Lieferant() { Firma = "DB KT" },
new Lieferant() { Firma = "DB Postservice" },
new Lieferant() { Firma = "Gerätewagen" }
};
list = list.OrderBy(p => p.Firma).ToList();
cBLieferfirma.ItemsSource = list;
}
else
{
var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE Firma NOT LIKE 'DB%'", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
list = list.OrderBy(p => p).ToList();
cBLieferfirma.ItemsSource = list;
//var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE Firma NOT LIKE 'DB%'", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
//list = list.OrderBy(p => p).ToList();
var list = SQL.ReadSQL($"SELECT Firma, Fahrer, Kennzeichen, ID, Handynr FROM {MainWindow.table}.lieferanten WHERE Firma NOT LIKE 'DB%' ORDER BY Firma ASC").Result;
var items = from DataRow row in list.Rows
select new Lieferant
{
ID = row["ID"].ToString(),
Firma = row["Firma"].ToString(),
Fahrer = row["Fahrer"].ToString(),
Kennzeichen = row["Kennzeichen"].ToString(),
Telefon = row["Handynr"].ToString()
};
cBLieferfirma.ItemsSource = items;
var imWerk = SQL.ReadListStringMultipleColumns($"SELECT * FROM {MainWindow.table}.fahrzeuge", 4).Result.First().Split(';');
var all = (Convert.ToInt16(imWerk[0]) * LKW) + (Convert.ToInt16(imWerk[1]) * Sprinter) + (Convert.ToInt16(imWerk[2]) * PKW) + (Convert.ToInt16(imWerk[3]) * LKWLang);
// Konfiguration
switch(GesamtFzg - all)
// Aktueller Stand
int AnzahlLKWLangAufGelände = Convert.ToInt16(imWerk[3]);
int AnzahlLKWAufGelände = Convert.ToInt16(imWerk[0]);
int AnzahlSprinterAufGelände = Convert.ToInt16(imWerk[1]);
int AnzahlPKWAufGelände = Convert.ToInt16(imWerk[2]);
var all = (AnzahlLKWAufGelände * LKW) + (AnzahlSprinterAufGelände * Sprinter) + (AnzahlPKWAufGelände * PKW) + (AnzahlLKWLangAufGelände * LKWLang);
// Verfügbare Punkte
int freiePunkte = GesamtFzg - all;
// Dynamische Erhöhung der erlaubten Einfahrten:
int erlaubteLKW = MaxLKW + (MaxLKWLang - AnzahlLKWLangAufGelände); // LKW darf mehr, wenn weniger LKWLang
int erlaubteSprinter = MaxSprinter + (MaxLKW - AnzahlLKWAufGelände); // Sprinter darf mehr, wenn weniger LKW < 40t
// Was darf noch einfahren?
bool kannPKW = AnzahlPKWAufGelände < MaxPKW && freiePunkte >= PKW;
bool kannSprinter = AnzahlSprinterAufGelände < erlaubteSprinter && freiePunkte >= Sprinter;
bool kannLKW = AnzahlLKWAufGelände < erlaubteLKW && freiePunkte >= LKW;
bool kannLKWLang = AnzahlLKWLangAufGelände < MaxLKWLang && freiePunkte >= LKWLang;
// Ausgabe oder Steuerung
if (!kannPKW && !kannSprinter && !kannLKW && !kannLKWLang)
{
case int n when n < PKW:
MessageBox.Show("Es können keine Lieferanten mehr eingelassen werden, da sich bereits zu viele Fahrzeuge im Werk befinden", "Kein Einlass!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
noMoreDeliveries = true;
MessageBox.Show("Es können keine Lieferanten mehr eingelassen werden, da sich bereits zu viele Fahrzeuge im Werk befinden", "Kein Einlass!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
noMoreDeliveries = true;
btnAddLKWLang.IsEnabled = false;
btnAddLKWLang.ToolTip = zuViele;
btnAddLKWLang.IsEnabled = false;
btnAddLKWLang.ToolTip = zuViele;
btnAddLKW.IsEnabled = false;
btnAddLKW.ToolTip = zuViele;
btnAddLKW.IsEnabled = false;
btnAddLKW.ToolTip = zuViele;
btnAddSprinter.IsEnabled = false;
btnAddSprinter.ToolTip = zuViele;
btnAddSprinter.IsEnabled = false;
btnAddSprinter.ToolTip = zuViele;
btnAddPKW.IsEnabled = false;
btnAddPKW.ToolTip = zuViele;
break;
case int n when n >= PKW && n < Sprinter:
btnAddPKW.IsEnabled = false;
btnAddPKW.ToolTip = zuViele;
}
else
{
if (kannPKW)
{
btnAddLKWLang.IsEnabled = false;
btnAddLKWLang.ToolTip = zuViele;
@ -113,8 +181,9 @@ namespace ZKuP
btnAddPKW.IsEnabled = true;
btnAddPKW.ToolTip = null;
break;
case int n when n >= Sprinter && n < LKW:
}
if (kannSprinter)
{
btnAddLKWLang.IsEnabled = false;
btnAddLKWLang.ToolTip = zuViele;
@ -126,8 +195,10 @@ namespace ZKuP
btnAddPKW.IsEnabled = true;
btnAddPKW.ToolTip = null;
break;
case int n when n >= LKW && n < LKWLang:
}
if (kannLKW)
{
btnAddLKWLang.IsEnabled = false;
btnAddLKWLang.ToolTip = zuViele;
@ -139,8 +210,10 @@ namespace ZKuP
btnAddPKW.IsEnabled = true;
btnAddPKW.ToolTip = null;
break;
case int n when n >= LKWLang:
}
if (kannLKWLang)
{
btnAddLKWLang.IsEnabled = true;
btnAddLKWLang.ToolTip = null;
@ -152,8 +225,80 @@ namespace ZKuP
btnAddPKW.IsEnabled = true;
btnAddPKW.ToolTip = null;
break;
}
}
//switch(GesamtFzg - all)
//{
// case int n when n < PKW:
// MessageBox.Show("Es können keine Lieferanten mehr eingelassen werden, da sich bereits zu viele Fahrzeuge im Werk befinden", "Kein Einlass!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
// noMoreDeliveries = true;
// btnAddLKWLang.IsEnabled = false;
// btnAddLKWLang.ToolTip = zuViele;
// btnAddLKW.IsEnabled = false;
// btnAddLKW.ToolTip = zuViele;
// btnAddSprinter.IsEnabled = false;
// btnAddSprinter.ToolTip = zuViele;
// btnAddPKW.IsEnabled = false;
// btnAddPKW.ToolTip = zuViele;
// break;
// case int n when n >= PKW && n < Sprinter:
// btnAddLKWLang.IsEnabled = false;
// btnAddLKWLang.ToolTip = zuViele;
// btnAddLKW.IsEnabled = false;
// btnAddLKW.ToolTip = zuViele;
// btnAddSprinter.IsEnabled = false;
// btnAddSprinter.ToolTip = zuViele;
// btnAddPKW.IsEnabled = true;
// btnAddPKW.ToolTip = null;
// break;
// case int n when n >= Sprinter && n < LKW:
// btnAddLKWLang.IsEnabled = false;
// btnAddLKWLang.ToolTip = zuViele;
// btnAddLKW.IsEnabled = false;
// btnAddLKW.ToolTip = zuViele;
// btnAddSprinter.IsEnabled = true;
// btnAddSprinter.ToolTip = null;
// btnAddPKW.IsEnabled = true;
// btnAddPKW.ToolTip = null;
// break;
// case int n when n >= LKW && n < LKWLang:
// btnAddLKWLang.IsEnabled = false;
// btnAddLKWLang.ToolTip = zuViele;
// btnAddLKW.IsEnabled = true;
// btnAddLKW.ToolTip = null;
// btnAddSprinter.IsEnabled = true;
// btnAddSprinter.ToolTip = null;
// btnAddPKW.IsEnabled = true;
// btnAddPKW.ToolTip = null;
// break;
// case int n when n >= LKWLang:
// btnAddLKWLang.IsEnabled = true;
// btnAddLKWLang.ToolTip = null;
// btnAddLKW.IsEnabled = true;
// btnAddLKW.ToolTip = null;
// btnAddSprinter.IsEnabled = true;
// btnAddSprinter.ToolTip = null;
// btnAddPKW.IsEnabled = true;
// btnAddPKW.ToolTip = null;
// break;
//}
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
@ -162,6 +307,9 @@ namespace ZKuP
this.Close();
else
this.Visibility = Visibility.Visible;
Helper.CheckWindowIsInScreenSpace(this);
}
@ -187,19 +335,33 @@ namespace ZKuP
{
if (_emergency)
{
var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE (Firma = 'DB Energie' OR (Firma = 'DB Energie' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND ID LIKE '%{tbFilter.Text}%')) OR" +
$"(Firma = 'DB InfraGo' OR (Firma = 'DB InfraGo' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND ID LIKE '%{tbFilter.Text}%')) OR" +
$"(Firma = 'DB Notfallmanager' OR (Firma = 'DB Notfallmanager' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND ID LIKE '%{tbFilter.Text}%')) OR" +
$"(Firma = 'DB KT' OR (Firma = 'DB KT' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND ID LIKE '%{tbFilter.Text}%'))", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
//var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE ((Firma = 'DB Energie' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND ID LIKE '%{tbFilter.Text}%')) OR" +
// $"((Firma = 'DB InfraGo' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND ID LIKE '%{tbFilter.Text}%')) OR" +
// $"((Firma = 'DB Notfallmanager' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND ID LIKE '%{tbFilter.Text}%')) OR" +
// $"((Firma = 'DB KT' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND ID LIKE '%{tbFilter.Text}%') OR (Firma LIKE 'DB%' AND Firma LIKE '%{tbFilter.Text}%'))", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
list = list.OrderBy(p => p).ToList();
cBLieferfirma.ItemsSource = list;
////var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE (Firma = 'DB Energie' OR (Firma = 'DB Energie' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Energie' AND ID LIKE '%{tbFilter.Text}%')) OR" +
//// $"(Firma = 'DB InfraGo' OR (Firma = 'DB InfraGo' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB InfraGo' AND ID LIKE '%{tbFilter.Text}%')) OR" +
//// $"(Firma = 'DB Notfallmanager' OR (Firma = 'DB Notfallmanager' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB Notfallmanager' AND ID LIKE '%{tbFilter.Text}%')) OR" +
//// $"(Firma = 'DB KT' OR (Firma = 'DB KT' AND Fahrer LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND Kennzeichen LIKE '%{tbFilter.Text}%') OR (Firma = 'DB KT' AND ID LIKE '%{tbFilter.Text}%'))", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
//list = list.OrderBy(p => p).ToList();
//cBLieferfirma.ItemsSource = list; // Gehört hier nicht eigentlich cBEntstördienste hin????
}
else
{
var list = SQL.ReadListStringMultipleColumns($"SELECT Firma, Fahrer, Kennzeichen, ID FROM {MainWindow.table}.lieferanten WHERE Firma NOT LIKE 'DB%' AND (Fahrer LIKE '%{tbFilter.Text}%' OR Firma LIKE '%{tbFilter.Text}%' OR Kennzeichen LIKE '%{tbFilter.Text}%' OR ID LIKE '%{tbFilter.Text}%')", 4, " Fahrer: ", " Kennz.: ", " ID: ").Result;
list = list.OrderBy(p => p).ToList();
cBLieferfirma.ItemsSource = list;
var list = SQL.ReadSQL($"SELECT Firma, Fahrer, Kennzeichen, ID, Handynr FROM {MainWindow.table}.lieferanten WHERE Firma NOT LIKE 'DB%' AND (Fahrer LIKE '%{tbFilter.Text}%' OR Firma LIKE '%{tbFilter.Text}%' OR Kennzeichen LIKE '%{tbFilter.Text}%' OR ID LIKE '%{tbFilter.Text}%') ORDER BY Firma ASC").Result;
var items = from DataRow row in list.Rows
select new Lieferant
{
ID = row["ID"].ToString(),
Firma = row["Firma"].ToString(),
Fahrer = row["Fahrer"].ToString(),
Kennzeichen = row["Kennzeichen"].ToString(),
Telefon = row["Handynr"].ToString()
};
cBLieferfirma.ItemsSource = items;
}
cBLieferfirma.IsDropDownOpen = true;
@ -214,14 +376,41 @@ namespace ZKuP
{
if (signoPad._stPad.DeviceGetCount() > 0)
{
var sig = new Signature(Signature.DisclaimerType.Parken,tbFahrer.Text, tbFirma.Text, tbKennzeichen.Text, false);
var sig = new Signature(Signature.DisclaimerType.Parken, tbFahrer.Text, tbFirma.Text, tbKennzeichen.Text, false, "", this);
if (sig.ShowDialog() == false)
{
_signature = sig.ResultByte;
if (_signature != null)
{
gridButtons.IsEnabled = true;
imgLKWLang.ToolTip = "Einfahrt Lieferant mit LKW > 7,5t";
imgLKW.ToolTip = "Einfahrt Lieferant mit LKW < 7,5t";
imgSprinter.ToolTip = "Einfahrt Lieferant mit Sprinter";
imgPKW.ToolTip = "Einfahrt Lieferant mit PKW";
}
else
{
MessageBox.Show("Keine Unterschrift erfasst\nOhne Unterschrift kann der Lieferant nicht eingelassen werden\n\nBitte erneut versuchen!", "Keine Unterschrift!", MessageBoxButton.OK, MessageBoxImage.Error);
sig.Close();
return;
}
}
}
else
{
MessageBox.Show("Kein Unterschriftenpad gefunden\nMeldung 0x03", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
#if DEBUG
gridButtons.IsEnabled = true;
imgLKWLang.ToolTip = "Einfahrt Lieferant mit LKW > 7,5t";
imgLKW.ToolTip = "Einfahrt Lieferant mit LKW < 7,5t";
imgSprinter.ToolTip = "Einfahrt Lieferant mit Sprinter";
imgPKW.ToolTip = "Einfahrt Lieferant mit PKW";
#endif
}
}
else MessageBox.Show(this, "Firma und Fahrer müssen ausgefüllt werden", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
@ -247,7 +436,7 @@ namespace ZKuP
if (!string.IsNullOrWhiteSpace(tbFirma.Text) && !string.IsNullOrWhiteSpace(tbFahrer.Text) && !string.IsNullOrWhiteSpace(tbHandy.Text) && !string.IsNullOrWhiteSpace(tbKennzeichen.Text))
{
if (SQL.RowExists($"{MainWindow.table}.firmen", "Name", tbFirma.Text, true).Result == true)
if (tbFirma.Text != "DB InfraGO" && tbFirma.Text != "DB Energie" && tbFirma.Text != "DB KT" && SQL.RowExists($"{MainWindow.table}.firmen", "Name", tbFirma.Text, true, " AND Arbeitsbeginn <= now() AND Arbeitsende >= now()").Result == true)
{
if (MessageBoxResult.No == MessageBox.Show($"{tbFirma.Text} existiert schon als Firma!\nFirmen dürfen nicht als Lieferant eingetragen werden!\n\nFirma in der \"Ankuft heute\" Liste bestätigen und falls diese nicht angezeigt wird, Firma abweisen!\n\nLieferant trotzdem anlegen?", "Firma nicht als Lieferant!", MessageBoxButton.YesNo, MessageBoxImage.Error))
{
@ -263,37 +452,61 @@ namespace ZKuP
int i = 0;
string fzgQuery = "";
string fzgTime = "";
switch ((sender as Button).Name.ToString().Replace("btnAdd", ""))
{
case "LKWLang":
i = Convert.ToInt16(SQL.ReadSingleValue($"SELECT lkwlang FROM {MainWindow.table}.fahrzeuge"));
fzgQuery = ($"UPDATE {MainWindow.table}.fahrzeuge SET `lkwlang`='{i + 1}'");
fzgTime = ($"REPLACE INTO {MainWindow.table}.fzgTime (arrivalTime, fzgType, firma, fahrer, kennzeichen, telFahrer) VALUES ('{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', 'LKWLang', '{tbFirma.Text}', '{tbFahrer.Text}', '{tbKennzeichen.Text}', '{tbHandy.Text}')");
StartTimer(1, tbFirma.Text);
break;
case "LKW":
i = Convert.ToInt16(SQL.ReadSingleValue($"SELECT lkw FROM {MainWindow.table}.fahrzeuge"));
fzgQuery = ($"UPDATE {MainWindow.table}.fahrzeuge SET `lkw`='{i + 1}'");
fzgTime = ($"REPLACE INTO {MainWindow.table}.fzgTime (arrivalTime, fzgType, firma, fahrer, kennzeichen, telFahrer) VALUES ('{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', 'LKW', '{tbFirma.Text}', '{tbFahrer.Text}', '{tbKennzeichen.Text}', '{tbHandy.Text}')");
StartTimer(2, tbFirma.Text);
break;
case "Sprinter":
i = Convert.ToInt16(SQL.ReadSingleValue($"SELECT sprinter FROM {MainWindow.table}.fahrzeuge"));
fzgQuery = ($"UPDATE {MainWindow.table}.fahrzeuge SET `sprinter`='{i + 1}'");
fzgTime = ($"REPLACE INTO {MainWindow.table}.fzgTime (arrivalTime, fzgType, firma, fahrer, kennzeichen, telFahrer) VALUES ('{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', 'Sprinter', '{tbFirma.Text}', '{tbFahrer.Text}', '{tbKennzeichen.Text}', '{tbHandy.Text}')");
StartTimer(2, tbFirma.Text);
break;
case "PKW":
i = Convert.ToInt16(SQL.ReadSingleValue($"SELECT pkw FROM {MainWindow.table}.fahrzeuge"));
fzgQuery = ($"UPDATE {MainWindow.table}.fahrzeuge SET `pkw`='{i + 1}'");
break;
case "LKWLang":
i = Convert.ToInt16(SQL.ReadSingleValue("SELECT lkwlang FROM zkup.fahrzeuge"));
fzgQuery = ($"UPDATE {MainWindow.table}.fahrzeuge SET `lkwlang`='{i + 1}'");
if (!_emergency)
{
i = Convert.ToInt16(SQL.ReadSingleValue($"SELECT pkw FROM {MainWindow.table}.fahrzeuge"));
fzgQuery = ($"UPDATE {MainWindow.table}.fahrzeuge SET `pkw`='{i + 1}'");
fzgTime = ($"REPLACE INTO {MainWindow.table}.fzgTime (arrivalTime, fzgType, firma, fahrer, kennzeichen, telFahrer) VALUES ('{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', 'PKW', '{tbFirma.Text}', '{tbFahrer.Text}', '{tbKennzeichen.Text}', '{tbHandy.Text}')");
StartTimer(3, tbFirma.Text);
}
break;
}
if (!string.IsNullOrWhiteSpace(fzgQuery))
await SQL.WriteSQL(fzgQuery);
if (!string.IsNullOrWhiteSpace(fzgTime))
await SQL.WriteSQL(fzgTime);
//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 ('{Kategorie}','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 ('{Kategorie}','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)");
//query = ($"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung, signature_blob) VALUES ('{Kategorie}','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)");
var cmd = SQL.CreateAndReturnSQLCommand($"INSERT INTO {MainWindow.table}.zutritte (Kategorie,Name,Zutritt,Pruefung_Zutritt,Pruefung_Einweisung,AnzahlPers,AnzahlFzg,Ansprechpartner,Kl_Unterweisung,Fzg_gemeldet,Kennzeichen,Bemerkung, signature_blob) VALUES (@Kategorie,@tbFirma,@time,'--','--','1','1',@tbHandy,'1','1',@tbKennzeichen,@tbBemerkung, @signature)", new List<MySqlParameter>()
{
new MySqlParameter("@Kategorie", Kategorie),
new MySqlParameter("@tbFirma", $"Firma: {tbFirma.Text}, Fahrer: {tbFahrer.Text}"),
new MySqlParameter("@time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
new MySqlParameter("@tbHandy", tbHandy.Text),
new MySqlParameter("@tbKennzeichen", tbKennzeichen.Text),
new MySqlParameter("@tbBemerkung", tbBemerkung.Text)
});
await SQL.WriteSQL(query, _signature);
await SQL.CreateAndWriteSQLwithSignature(cmd, _signature);
//await SQL.WriteSQL(query, _signature);
}
catch (Exception ex)
@ -312,27 +525,74 @@ namespace ZKuP
}
}
private void StartTimer(int v, string text)
{
}
private async void cBLieferfirma_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
System.Data.DataTable result = new System.Data.DataTable();
ResetInputs();
//System.Data.DataTable result = new System.Data.DataTable();
if ((sender as ComboBox).SelectedItem != null)
{
string id = (sender as ComboBox).SelectedItem.ToString().Split(new string[] { " ID: " }, StringSplitOptions.None)[1].Trim(' ');
//string fahrer = (sender as ComboBox).SelectedItem.ToString().Split(new string[] { " Fahrer: " }, StringSplitOptions.None)[1].Split(new string[] { " Kennz.: " }, StringSplitOptions.None)[0].TrimEnd(' ');
if (_emergency)
{
//var list = SQL.ReadListStringMultipleColumns($"SELECT identstoerdienste, Firma, Fahrer, Kennzeichen FROM {MainWindow.table}.entstoerdienste WHERE Firma = '{cBLieferfirma.SelectedValue.ToString()}'", 4, " Firma: ", " Fahrer: ", " Kennz.: ").Result;
//list = list.OrderBy(p => p).ToList();
//if (fahrer != "")
// result = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.lieferanten WHERE Firma = '{firma}' AND Fahrer = '{fahrer}' LIMIT 1");
//else
// result = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.lieferanten WHERE Firma = '{firma}' LIMIT 1");
var list = await SQL.ReadSQL($"SELECT identstoerdienste, Firma, Fahrer, Kennzeichen, Handynr FROM {MainWindow.table}.entstoerdienste WHERE Firma = '{cBLieferfirma.SelectedValue.ToString().Trim()}'");
var items = from DataRow row in list.Rows
select new Lieferant
{
ID = row["identstoerdienste"].ToString(),
Firma = row["Firma"].ToString(),
Fahrer = row["Fahrer"].ToString(),
Kennzeichen = row["Kennzeichen"].ToString(),
Telefon = row["Handynr"].ToString()
};
result = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.lieferanten WHERE ID = '{id}' LIMIT 1");
cBEntstoerdienste.ItemsSource = items;
tbFirma.Text = (sender as ComboBox).SelectedItem.ToString();
}
else
{
//string id = (sender as ComboBox).SelectedItem.ToString().Split(new string[] { " ID: " }, StringSplitOptions.None)[1].Trim(' ');
////string fahrer = (sender as ComboBox).SelectedItem.ToString().Split(new string[] { " Fahrer: " }, StringSplitOptions.None)[1].Split(new string[] { " Kennz.: " }, StringSplitOptions.None)[0].TrimEnd(' ');
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() : "";
////if (fahrer != "")
//// result = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.lieferanten WHERE Firma = '{firma}' AND Fahrer = '{fahrer}' LIMIT 1");
////else
//// result = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.lieferanten WHERE Firma = '{firma}' LIMIT 1");
//result = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.lieferanten WHERE ID = '{id}' LIMIT 1");
var result = cBLieferfirma.SelectedItem as Lieferant;
tbFirma.Text = result.Firma != null ? result.Firma : "";
tbFahrer.Text = result.Fahrer != null ? result.Fahrer : "";
tbHandy.Text = result.Telefon != null ? result.Telefon : "";
tbKennzeichen.Text = result.Kennzeichen != null ? result.Kennzeichen : "";
CheckParkplatz();
}
}
}
private async void cBEntstoerdienste_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if ((sender as ComboBox).SelectedItem != null)
{
string id = (sender as ComboBox).SelectedItem.ToString().Split(' ')[0].Trim(' ');
var result = await SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.entstoerdienste WHERE identstoerdienste = '{id}'");
tbFirma.Text = result.Rows[0].ItemArray[1] != null ? result.Rows[0].ItemArray[1].ToString() : "";
tbFahrer.Text = result.Rows[0].ItemArray[2] != null ? result.Rows[0].ItemArray[2].ToString() : "";
tbHandy.Text = result.Rows[0].ItemArray[3] != null ? result.Rows[0].ItemArray[3].ToString() : "";
tbKennzeichen.Text = result.Rows[0].ItemArray[4] != null ? result.Rows[0].ItemArray[4].ToString() : "";
CheckParkplatz();
}
@ -347,7 +607,7 @@ namespace ZKuP
var ratio = Fuzz.Ratio(tbFirma.Text.ToLower(), s.Key.ToLower());
if (ratio > 80)
{
Debug.WriteLine(ratio);
//Debug.WriteLine(ratio);
ShowParkplatz(s.Key, s.Value);
break;
}
@ -367,6 +627,18 @@ namespace ZKuP
+ System.Reflection.Assembly.GetExecutingAssembly().GetName().Name
+ ";component/"
+ $"Assets/Parkplatz/{_parkplatz}.png", UriKind.Absolute));
if (parkplatz == 7)
{
popupParkplatz.Height = 650;
imgEnergie.Visibility = Visibility.Visible;
}
else
{
popupParkplatz.Height = 350;
imgEnergie.Visibility = Visibility.Collapsed;
}
popupParkplatz.IsOpen = true;
}
@ -384,9 +656,70 @@ namespace ZKuP
return;
}
ToolTip tt = new ToolTip();
private void tbFirma_TextChanged(object sender, TextChangedEventArgs e)
{
if (!_emergency)
{
var box = (sender as TextBox);
var input = box.Text;
if (input.ToLower().Contains("db") ||
input.ToLower().StartsWith("service") ||
Regex.IsMatch(input, @"^[\W_]"))
{
tt.Placement = System.Windows.Controls.Primitives.PlacementMode.RelativePoint;
tt.PlacementTarget = box;
tt.VerticalOffset = box.ActualHeight;
tt.HorizontalOffset = 0;
tt.Width = box.ActualWidth;
tt.Background = new SolidColorBrush(Colors.Red);
tt.Content = new Grid();
(tt.Content as Grid).Background = new SolidColorBrush(Colors.Red);
(tt.Content as Grid).Children.Add(new TextBlock() { Text = "DB Firmen dürfen nicht als Lieferant angelegt werden!!" });
tt.IsOpen = true;
box.ToolTip = tt;
}
else
{
tt.IsOpen = false;
box.ToolTip = null;
}
}
CheckParkplatz();
}
private void ResetInputs()
{
tbFahrer.Text = "";
tbHandy.Text = "";
tbKennzeichen.Text = "";
tbBemerkung.Text = "";
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
public class Lieferant
{
public string ID { get; set; }
public string Firma { get; set; }
public string Fahrer { get; set; }
public string Kennzeichen { get; set; }
public string Telefon { get; set; }
public override string ToString()
{
return $"{ID}\t\t{Firma}\t\t{Fahrer}\t\t{Kennzeichen}";
}
}
}

View File

@ -1,4 +1,4 @@
<Window
<mah:MetroWindow
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"
@ -8,9 +8,9 @@
mc:Ignorable="d"
Title="Werksführung" Height="300" Width="500" WindowStartupLocation="CenterOwner">
<Window.Resources>
<mah:MetroWindow.Resources>
<local:ConvertToSlot x:Key="ConvertToSlot"></local:ConvertToSlot>
</Window.Resources>
</mah:MetroWindow.Resources>
<Grid>
<Grid.ColumnDefinitions>
@ -94,4 +94,4 @@
</DataGrid>-->
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
@ -19,7 +20,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für Family.xaml
/// </summary>
public partial class Family : Window
public partial class Family : MetroWindow
{
DataTable dtOwn;
DataTable dtAll;
@ -172,5 +173,17 @@ namespace ZKuP
QueryTables();
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,8 +1,9 @@
<Window x:Class="ZKuP.FamilyBooking"
<mah:MetroWindow x:Class="ZKuP.FamilyBooking"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Führung buchen" Height="440" Width="322" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
@ -23,4 +24,4 @@
<TextBlock x:Name="lblDate" Text="am SamSonn 01.01.9999 von 99:99 - 99:99" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,50" FontSize="14" FontWeight="Bold" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Button x:Name="btnBook" Content="Führung buchen" VerticalAlignment="Bottom" Margin="5" Height="30" Click="btnBook_Click"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@ -14,13 +15,14 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Windows.System;
namespace ZKuP
{
/// <summary>
/// Interaktionslogik für FamilyBooking.xaml
/// </summary>
public partial class FamilyBooking : Window
public partial class FamilyBooking : MetroWindow
{
DateTime date = DateTime.MinValue;
int slot = 0;
@ -61,7 +63,24 @@ namespace ZKuP
{
try
{
await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.family (Name, TelNr, Persnr, AnzBegleiter, Date, Slot, User, Email) VALUES ('{tbName.Text}','{tbTel.Text}','{tbPersnr.Text}','{tbAnzBegleiter.Text}','{date.ToString("yyyy-MM-dd")}','{slot}','{Environment.UserName}','{tbEmail.Text}')");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.family (Name, TelNr, Persnr, AnzBegleiter, Date, Slot, User, Email) VALUES ('{tbName.Text}','{tbTel.Text}','{tbPersnr.Text}','{tbAnzBegleiter.Text}','{date.ToString("yyyy-MM-dd")}','{slot}','{Environment.UserName}','{tbEmail.Text}')");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.family (Name, TelNr, Persnr, AnzBegleiter, Date, Slot, User, Email) VALUES (@Name,@TelNr,@Persnr,@AnzBegleiter,@Date,@Slot,@User,@Email)", new List<MySql.Data.MySqlClient.MySqlParameter>()
{
new MySql.Data.MySqlClient.MySqlParameter("@Name",tbName.Text),
new MySql.Data.MySqlClient.MySqlParameter("@TelNr",tbTel.Text),
new MySql.Data.MySqlClient.MySqlParameter("@Persnr",tbPersnr.Text),
new MySql.Data.MySqlClient.MySqlParameter("@AnzBegleiter",tbAnzBegleiter.Text),
new MySql.Data.MySqlClient.MySqlParameter("@Date",date.ToString("yyyy-MM-dd")),
new MySql.Data.MySqlClient.MySqlParameter("@Slot",slot),
new MySql.Data.MySqlClient.MySqlParameter("@User",Environment.UserName),
new MySql.Data.MySqlClient.MySqlParameter("@Email",tbEmail.Text)
});
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.changes SET timestamp = @time WHERE idchanges = '4'", new List<MySql.Data.MySqlClient.MySqlParameter>()
{
new MySql.Data.MySqlClient.MySqlParameter("@time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
});
}
catch (Exception)
{
@ -160,5 +179,17 @@ namespace ZKuP
}
return;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

55
ZKuP/FileHandler.cs Normal file
View File

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ZKuP
{
internal static class FileHandler
{
private static ReaderWriterLockSlim _readWriteLock = new ReaderWriterLockSlim();
public static void WriteToFileThreadSafe(string path, string text)
{
// Set Status to Locked
_readWriteLock.EnterWriteLock();
try
{
// Append text to the file
using (StreamWriter sw = File.AppendText(path))
{
sw.WriteLine(text);
sw.Close();
}
}
finally
{
// Release lock
_readWriteLock.ExitWriteLock();
}
}
public static string ReadFromFileThreadSafe(string path)
{
var result = "";
// Set Status to Locked
_readWriteLock.EnterReadLock();
try
{
// Append text to the file
result = File.ReadAllText(path);
}
finally
{
// Release lock
_readWriteLock.ExitReadLock();
}
return result;
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.GrantParkausweis"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Parkausweis(e) genehmigen" Height="450" Width="1350">
Title="Parkausweis(e) genehmigen" Height="450" Width="1350" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<DataGrid x:Name="dgGrant" AutoGenerateColumns="False" ItemsSource="{Binding .}" CanUserDeleteRows="False" CanUserAddRows="False" CanUserReorderColumns="False">
<DataGrid.Columns>
@ -52,4 +53,4 @@
</DataGrid>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,7 +18,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für GrantParkausweis.xaml
/// </summary>
public partial class GrantParkausweis : Window
public partial class GrantParkausweis : MetroWindow
{
public GrantParkausweis()
{
@ -33,7 +34,7 @@ namespace ZKuP
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]}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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, Convert.ToInt16(arr[19]));
@ -78,19 +79,29 @@ namespace ZKuP
$"%0D%0A%0D%0A" +
$"Parkkarten können in ca. 5 Tagen im Gebäude G Raum G0006/7 abgeholt werden.%0D%0A" +
"Mit freundlichen Grüßen%0D%0A" +
$"{user[0]} {user[1]}%0D%0A" +
"Anlagenmanagement und IT-Service(P.FBW-M2(1))");
$"Ihr Anlagenmanagement");
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))");
$"Ihr Anlagenmanagement");
break;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
public class Grant

View File

@ -5,23 +5,266 @@ using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Management;
using System.Net;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Excel = Microsoft.Office.Interop.Excel;
using Word = Microsoft.Office.Interop.Word;
namespace ZKuP
{
class Helper
{
public static double width = 0;
public static double height = 0;
public static bool? IsFileLocked(FileInfo file)
{
try
{
using (FileStream stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None))
{
stream.Close();
}
}
catch (FileNotFoundException)
{
Log.WriteLog($"File does not exist: {file.Name}");
return null;
}
catch (IOException)
{
//the file is unavailable because it is:
//still being written to
//or being processed by another thread
//or does not exist (has already been processed)
return true;
}
//file is not locked
return false;
}
public static bool IsVPNConnected()
{
var available = false;
if (NetworkInterface.GetIsNetworkAvailable())
{
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface Interface in interfaces)
{
if (Interface.OperationalStatus == OperationalStatus.Up)
{
IPv4InterfaceStatistics statistics = Interface.GetIPv4Statistics();
if (Interface.Name == "Pulse Secure")
available = true;
}
}
if (available)
return true;
else
{
return false;
}
}
else return false;
}
private static List<string> GetBEs()
{
var asm = Assembly.GetEntryAssembly();
string resName = asm.GetName().Name + ".g.resources";
using (var stream = asm.GetManifestResourceStream(resName))
using (var reader = new System.Resources.ResourceReader(stream))
{
var res = reader.Cast<DictionaryEntry>().Select(entry => (string)entry.Key).Where(p => p.StartsWith("assets/be")).OrderBy(p => p).ToList();
return ReplaceSpecialCharacters(res);
}
}
public static List<string> GetBEFileNames()
{
List<string> BEs = new List<string>();
BEs = GetBEs();
BEs.ForEach(p => p.Replace("assets/", ""));
var res = BEs;
return res;
}
public static string GetBEFileNames(string beflaeche)
{
List<string> BEs = new List<string>();
BEs = GetBEs();
BEs.ForEach(p => p.Replace("assets/", ""));
return BEs.Where(p => p.Contains(beflaeche)).FirstOrDefault();
}
public static string GetBEFileNames(int beNr)
{
if (beNr > 0)
{
List<string> BEs = new List<string>();
BEs = GetBEs();
BEs.ForEach(p => p.Replace("assets/", ""));
return BEs.Where(p => p.Contains(beNr.ToString().PadLeft(2, '0'))).First();
}
return "";
}
public static List<string> GetBENames()
{
List<string> BEs = new List<string>();
BEs = GetBEs();
var res = BEs.Select(p => p.Split(' ')[0].Replace("assets/", "")).ToList();
return res;
}
public static List<string> GetBENumbers()
{
List<string> BEs = new List<string>();
BEs = GetBEs();
var res = BEs.Select(p => p.Split(' ')[0].Replace("assets/", "").Replace("be", "")).ToList();
return res;
}
public static List<string> GetBEDescription()
{
List<string> BEs = new List<string>();
BEs = GetBEs();
var res = BEs.Select(p => p.Substring(p.IndexOf("-") + 2,p.Length - (p.IndexOf("-") + 2)).Trim().Replace("_","/").Replace(".png", "").ToUpperInvariant()).ToList();
return res;
}
public static string GetBEDescription(int beNr)
{
List<string> BEs = new List<string>();
BEs = GetBEs();
var res = BEs.Select(p => p.Substring(p.IndexOf("/") + 1, p.Length - (p.IndexOf("/") + 1)).Trim().Replace("_", "/").Replace(".png", "").ToUpperInvariant());
var resNr = res.Where(q => q.Contains(beNr.ToString().PadLeft(2, '0'))).First();
return resNr;
}
public static bool IsValidEmailAddress(string s)
{
Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$");
return regex.IsMatch(s);
}
private static List<string> ReplaceSpecialCharacters(List<string> bEs)
{
List<string> res = new List<string>();
foreach (var e in bEs)
{
res.Add(e.Replace("%20", " ").Replace("%c3%bc", "ü").Replace("%c3%a4", "ä").Replace("%c3%b6", "ö"));
}
return res;
}
public static void CheckWindowIsInScreenSpace(Window sender)
{
var screen = WpfScreenHelper.Screen.FromHandle(new WindowInteropHelper(sender).Handle);
var workingArea = screen.WorkingArea;
// Maximale Top-Position, sodass das Fenster unten nicht rausgeht
if (sender.Top + sender.ActualHeight > workingArea.Bottom)
{
sender.Top = workingArea.Bottom - sender.ActualHeight;
}
// Optionale obere Begrenzung
if (sender.Top < workingArea.Top)
{
sender.Top = workingArea.Top;
}
if (sender.Left + sender.ActualWidth > workingArea.Right)
{
sender.Left = workingArea.Right - sender.ActualWidth;
}
// Optionale obere Begrenzung
if (sender.Left < workingArea.Left)
{
sender.Left = workingArea.Left;
}
}
public static void CheckWindowIsInScreenSpace(MahApps.Metro.Controls.MetroWindow sender)
{
var screen = WpfScreenHelper.Screen.FromHandle(new WindowInteropHelper(sender).Handle);
var workingArea = screen.WorkingArea;
// Maximale Top-Position, sodass das Fenster unten nicht rausgeht
if (sender.Top + (sender.ActualHeight * .1) > workingArea.Bottom)
{
sender.Top = workingArea.Bottom - (sender.ActualHeight * .1);
}
// Optionale obere Begrenzung
if (sender.Top < workingArea.Top)
{
sender.Top = workingArea.Top;
}
if (sender.Left + (sender.ActualWidth * .1) > workingArea.Right)
{
sender.Left = workingArea.Right - (sender.ActualWidth * .1);
}
// Optionale obere Begrenzung
if ((sender.Left + sender.ActualWidth * .8) < workingArea.Left)
{
sender.Left = workingArea.Left - (sender.ActualWidth * .8);
}
}
public static List<Tuple<string, string>> DataTableToTuple(System.Data.DataTable dataTable)
{
@ -244,6 +487,19 @@ namespace ZKuP
return sb.ToString();
}
/// <summary>
/// Removes specifed "stringToRemove" from End of String "input", if "input" ends with "stringToRemove"
/// </summary>
/// <param name="input">String that should be Trimmed</param>
/// <param name="stringToRemove">String value which should be removed</param>
/// <returns></returns>
public static string RemoveStringAtEndOfString(string input, string stringToRemove)
{
return input.EndsWith(stringToRemove)
? input.Substring(0, input.Length - stringToRemove.Length)
: input;
}
/// <summary>
/// Load a resource WPF-BitmapImage (png, bmp, ...) from embedded resource defined as 'Resource' not as 'Embedded resource'.
/// </summary>
@ -379,12 +635,11 @@ namespace ZKuP
}
else if (isKrad == 1)
{
document = wordApp.Documents.OpenNoRepairDialog("https://dbsw.sharepoint.com/:w:/r/sites/PfoertnerWerkMuenche/Freigegebene%20Dokumente/Zutrittskontrolle/Parkausweis_Kraftrad_DinA5.docx");
document = wordApp.Documents.OpenNoRepairDialog("https://dbsw.sharepoint.com/:w:/r/sites/PfoertnerWerkMuenche/Freigegebene%20Dokumente/Zutrittskontrolle/Parkausweis_Kraftrad_DinA6.docx");
document.Activate();
//Word.Table table = document.Tables[1];
dynamic table = document.Tables[1];
table.Cell(1, 2).Range.Text = Name;
table.Cell(2, 2).Range.Text = OE;
@ -493,11 +748,314 @@ namespace ZKuP
return treeVisual;
}
public static T GetVisualChild<T>(Visual parent) where T : Visual
{
T child = default(T);
int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < numVisuals; i++)
{
Visual v = (Visual)VisualTreeHelper.GetChild(parent, i);
child = v as T;
if (child == null)
{
child = GetVisualChild<T>(v);
}
if (child != null)
{
break;
}
}
return child;
}
public static DataGridRow GetSelectedRow(DataGrid grid)
{
return (DataGridRow)grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem);
}
public static DataGridRow GetRow(DataGrid grid, int index)
{
DataGridRow row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
if (row == null)
{
// May be virtualized, bring into view and try again.
grid.UpdateLayout();
grid.ScrollIntoView(grid.Items[index]);
row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
}
return row;
}
public static DataGridCell GetCell(DataGrid grid, DataGridRow row, int column)
{
if (row != null)
{
DataGridCellsPresenter presenter = GetVisualChild<DataGridCellsPresenter>(row);
if (presenter == null)
{
grid.ScrollIntoView(row, grid.Columns[column]);
presenter = GetVisualChild<DataGridCellsPresenter>(row);
}
DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
return cell;
}
return null;
}
public static DataGridCell GetCell(DataGrid grid, int row, int column)
{
DataGridRow rowContainer = GetRow(grid, row);
return GetCell(grid, rowContainer, column);
}
static double lastDpiScale = -1;
static bool _isCurrentlyScaled = false;
internal static async void CheckScale(Window mainWindow)
{
var dpi = VisualTreeHelper.GetDpi(mainWindow);
double dpiScale = dpi.DpiScaleX; // or DpiScaleY
double scaledWidth = width * dpiScale;
double scaledHeight = height * dpiScale;
var screen = WpfScreenHelper.Screen.FromHandle(new WindowInteropHelper(mainWindow).Handle);
var workingArea = screen.WorkingArea;
bool needsScaling = (width * dpiScale) > workingArea.Width || (height * dpiScale) > workingArea.Height;
lastDpiScale = dpiScale;
if (needsScaling)
{
// Calculate the scale to fit in working area
double scaleX = workingArea.Width / width;
double scaleY = workingArea.Height / height;
double scale = Math.Min(scaleX, scaleY);
scale = Math.Round(scale * 4) / 4.0;
mainWindow.MinWidth = scale * width;
mainWindow.MinHeight = scale * height;
mainWindow.LayoutTransform = new ScaleTransform(scale, scale);
mainWindow.Width = mainWindow.MinWidth;
mainWindow.Height = mainWindow.MinHeight;
TextOptions.SetTextFormattingMode(mainWindow, TextFormattingMode.Display);
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.ClearType);
_isCurrentlyScaled = true;
}
else if (_isCurrentlyScaled)
{
// Reset to normal scale
mainWindow.LayoutTransform = Transform.Identity;
mainWindow.MinWidth = width != 0 ? width : mainWindow.MinWidth;
mainWindow.MinHeight = height != 0 ? height : mainWindow.MinHeight;
TextOptions.SetTextFormattingMode(mainWindow, TextFormattingMode.Ideal);
TextOptions.SetTextRenderingMode(mainWindow, TextRenderingMode.Auto);
}
}
public static SerialPort serial = new SerialPort();
public static void InitSerial(string COM = "")
{
if (COM == "" && string.IsNullOrWhiteSpace(Settings.GetSettingString("COMPort")) && GetCOMPortCount() > 0)
{
COMSelector cOMSelector = new COMSelector();
cOMSelector.ShowDialog();
}
else if(COM != "")
{
var match = Regex.Match(COM, @"COM\d+(?=\))");
Settings.WriteSetting("COMPort", match.Value);
}
if (!serial.IsOpen)
{
try
{
var port = Settings.GetSettingString("COMPort");
if (!string.IsNullOrWhiteSpace(port))
{
serial.PortName = port; //Com Port Name
serial.BaudRate = Convert.ToInt32(9600); //COM Port Sp
serial.Handshake = System.IO.Ports.Handshake.None;
serial.Parity = Parity.None;
serial.DataBits = 8;
serial.StopBits = StopBits.One;
serial.ReadTimeout = 200;
serial.WriteTimeout = 50;
serial.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(OnDataReceived);
serial.Open();
}
}
catch (Exception ex)
{
MessageBox.Show("Fehler beim Öffnen des COM Ports\nKartenleser kann nicht aktiviert werden\n\nBitte Kartenleser anstecken oder anderen COM Port versuchen", "Fehler beim COM Port", MessageBoxButton.OK, MessageBoxImage.Error);
Log.WriteLog(ex.ToString());
}
}
}
public static int GetCOMPortCount()
{
var COMCount = SerialPort.GetPortNames().Count();
return COMCount;
}
public static List<string> GetCOMPorts()
{
List<string> coms = new List<string>();
using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE Caption like '%(COM%'"))
{
var portnames = SerialPort.GetPortNames();
var ports = searcher.Get().Cast<ManagementBaseObject>().ToList().Select(p => p["Caption"].ToString());
var portList = portnames.Select(n => n + " - " + ports.FirstOrDefault(s => s.Contains(n))).ToList();
if (portList.Count > 0)
{
foreach (string s in portList)
{
if (s.ToLower().Contains("seriell") || s.ToLower().Contains("serial"))
coms.Add(s);
}
}
}
return coms;
}
//public static string ReadSerial()
//{
// if (!serial.IsOpen)
// InitSerial();
// return Recieve();
//}
public static event EventHandler<string> DataReceived;
public static event EventHandler<byte[]> BinaryDataReceived;
private static void OnDataReceived(object sender, SerialDataReceivedEventArgs e)
{
try
{
if (serial.BytesToRead > 0)
{
// Read as string
string stringData = serial.ReadExisting();
if (!string.IsNullOrWhiteSpace(stringData))
{
DataReceived?.Invoke(sender, stringData);
}
// For binary data reception
if (serial.BytesToRead > 0)
{
byte[] binaryData = new byte[serial.BytesToRead];
serial.Read(binaryData, 0, binaryData.Length);
BinaryDataReceived?.Invoke(sender, binaryData);
}
}
}
catch (Exception ex)
{
Console.WriteLine($"Error in async data reception: {ex.Message}");
}
}
private static Mutex _mutex;
internal static void CheckIfMultipleInstances()
{
const string mutexName = "ZKuPMutex"; // Eindeutiger Name
bool createdNew;
_mutex = new Mutex(true, mutexName, out createdNew);
if (!createdNew)
{
// Bereits eine Instanz aktiv
var MessageResult = MessageBox.Show("Die Anwendung ist bereits gestartet.\nSoll eine weitere Instanz geöffnet werden?\n\n" +
"Ja: Zusätzliche Instanz wird geöffnet\n" +
"Nein: Geöffnete Instanz in den Vordergrund\n" +
"Abbrechen: Neue Instanz wird beendet", "Hinweis", MessageBoxButton.YesNoCancel, MessageBoxImage.Information);
switch (MessageResult)
{
case MessageBoxResult.Yes:
return;
break;
case MessageBoxResult.No:
App.BringOtherInstanceToFront();
Application.Current.Shutdown();
break;
case MessageBoxResult.Cancel:
Application.Current.Shutdown();
break;
default:
Application.Current.Shutdown();
break;
}
return;
}
//if (Process.GetProcessesByName("ZKuP").Length > 2)
//{
// App.BringOtherInstanceToFront();
// Application.Current.Shutdown();
//}
}
private static double GetDistanceToWindowEdge(GridSplitter splitter, Window window)
{
// Position des Splitters relativ zum Window ermitteln
System.Windows.Point splitterPosition = splitter.TransformToAncestor(window).Transform(new System.Windows.Point(0, 0));
// Je nach Orientierung des Splitters
if (splitter.HorizontalAlignment == HorizontalAlignment.Stretch)
{
// Horizontaler Splitter - Abstand zu oberer/unterer Kante
double topDistance = splitterPosition.Y;
double bottomDistance = window.ActualHeight - splitterPosition.Y - splitter.ActualHeight;
// Wenn einer der Abstände negativ ist, ist der Splitter außerhalb
if (topDistance < 0 || bottomDistance < 0)
{
return Math.Max(topDistance, bottomDistance); // Der weniger negative Wert
}
return Math.Min(topDistance, bottomDistance);
}
else
{
// Vertikaler Splitter - Abstand zu linker/rechter Kante
double leftDistance = splitterPosition.X;
double rightDistance = window.ActualWidth - splitterPosition.X - splitter.ActualWidth;
// Wenn einer der Abstände negativ ist, ist der Splitter außerhalb
if (leftDistance < 0 || rightDistance < 0)
{
return Math.Max(leftDistance, rightDistance); // Der weniger negative Wert
}
return Math.Min(leftDistance, rightDistance);
}
}
}
public class ExcelExporter
{
private Microsoft.Office.Interop.Excel.Application _excel;
@ -544,7 +1102,7 @@ namespace ZKuP
_cellRange = _worksheet.Range[_worksheet.Cells[1, 1], _worksheet.Cells[rowcount, table.Columns.Count]];
_cellRange.EntireColumn.AutoFit();
_excel.Visible = true;
_excel.Visible = true;
//_worksheet.Cells.AutoFilter();
//_workbook.SaveAs(pathWithFilename);
//_workbook.Close();
@ -626,7 +1184,31 @@ namespace ZKuP
}
}
public class HeightMinusConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is double height)
{
double subtractValue = 190; // Standard-Wert
// Optional: Parameter für flexiblen Abzug
if (parameter != null && double.TryParse(parameter.ToString(), out double paramValue))
{
subtractValue += paramValue;
}
double result = height - subtractValue;
return result > 0 ? result : 0; // Mindestens 0
}
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
//{
@ -649,9 +1231,23 @@ namespace ZKuP
// }
//}
public class NullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// Wenn value null ist -> sichtbar (Collapsed), sonst Hidden oder Visible
return string.IsNullOrWhiteSpace(value.ToString()) ? Visibility.Collapsed : Visibility.Visible;
}
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;
@ -679,6 +1275,34 @@ namespace ZKuP
}
}
public class IntToGenehmigungsstatus : System.Windows.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string input = value.ToString();
switch (input)
{
case "0":
return "Unbearbeitet";
case "1":
return "Genehmigt";
case "2":
return "Abgelehnt";
case "3":
return "Genehmigt\nMail gesendet";
case "4":
return "Abgelehnt\nMail gesendet";
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)
@ -768,7 +1392,8 @@ namespace ZKuP
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
//throw new NotImplementedException();
return 0;
}
}
@ -815,11 +1440,12 @@ namespace ZKuP
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string[] roles = { "Pförtner", "FFK", "Admin", "FFK-Sasse", "M2" };
//string[] roles = { "Pförtner", "FFK", "Admin", "FFK Sasse", "M2" };
try
{
return roles[(int)value];
return ManageUsers.RoleList[(int)value];
//return roles[(int)value];
}
catch (Exception)
{
@ -832,7 +1458,22 @@ namespace ZKuP
return null;
}
}
public class ComboBoxDisplayConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is DataRowView row)
{
return $"{row["Name"]} - {row["Beauftragte_Leistung"]}";
}
return value?.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
[ValueConversion(typeof(string), typeof(BitmapSource))]
@ -937,8 +1578,13 @@ namespace ZKuP
d.CommandBindings.Add(new CommandBinding(SelectToday,
(s, ea) =>
{
(s as DatePicker).SelectedDate = DateTime.Now.Date;
(s as DatePicker).IsDropDownOpen = false;
if (!(s as DatePicker).BlackoutDates.Contains(DateTime.Now.Date))
{
(s as DatePicker).SelectedDate = DateTime.Now.Date;
(s as DatePicker).IsDropDownOpen = false;
}
else
MessageBox.Show("Das angegebene Datum ist blockiert", "Auswahl nicht möglich", MessageBoxButton.OK, MessageBoxImage.Stop);
},
(s, ea) => { ea.CanExecute = true; }));
@ -982,4 +1628,58 @@ namespace ZKuP
obj.SetValue(ShowTodayButtonContentProperty, value);
}
}
public class PopupNonTopmost : Popup
{
public static DependencyProperty TopmostProperty = Window.TopmostProperty.AddOwner(
typeof(PopupNonTopmost),
new FrameworkPropertyMetadata(false, OnTopmostChanged));
public bool Topmost
{
get { return (bool)GetValue(TopmostProperty); }
set { SetValue(TopmostProperty, value); }
}
private static void OnTopmostChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
(obj as PopupNonTopmost).UpdateWindow();
}
protected override void OnOpened(EventArgs e)
{
UpdateWindow();
}
private void UpdateWindow()
{
var hwnd = ((HwndSource)PresentationSource.FromVisual(this.Child)).Handle;
RECT rect;
if (GetWindowRect(hwnd, out rect))
{
SetWindowPos(hwnd, Topmost ? -1 : -2, rect.Left, rect.Top, (int)this.Width, (int)this.Height, 0);
}
}
#region P/Invoke imports & definitions
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
[DllImport("user32", EntryPoint = "SetWindowPos")]
private static extern int SetWindowPos(IntPtr hWnd, int hwndInsertAfter, int x, int y, int cx, int cy, int wFlags);
#endregion
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.ImageView"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Unterschriftenanzeige" Height="370" Width="419" Loaded="Window_Loaded">
Title="Unterschriftenanzeige" Height="370" Width="419" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top">
@ -16,16 +17,16 @@
</Grid>
<Grid Margin="0,20,0,0">
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dPDate" Height="25" Margin="10,10,106,0" Text="" VerticalAlignment="Top" SelectedDateChanged="DatePicker_SelectedDateChanged" DateValidationError="dPDate_DateValidationError"/>
<DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dPDate" Height="25" Margin="10,10,106,0" Text="" VerticalAlignment="Top" DateValidationError="dPDate_DateValidationError"/>
<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"/>
<ComboBox x:Name="cBSignature" Margin="10,68,10,0" VerticalAlignment="Top"/>
<Button x:Name="btnToday" Content="Heute" FontSize="12" Padding="-2" Margin="0,13,140,0" VerticalAlignment="Top" Height="19" 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" FontSize="12" Padding="-2" HorizontalAlignment="Right" Margin="0,40,10,0" VerticalAlignment="Top" Width="91" Height="23" Click="btnFiltern_Click"/>
<CheckBox x:Name="cbOnlyWithSignature" Content="Nur mit&#xD;&#xA;Unterschrift" Margin="0,10,8,0" VerticalAlignment="Top" Height="25" FontSize="10" Checked="cbOnlyWithSignature_Checked" Unchecked="cbOnlyWithSignature_Unchecked" Width="91" HorizontalAlignment="Right" IsChecked="True"/>
<CheckBox x:Name="cbOnlyWithSignature" Content="Nur mit&#xD;&#xA;Unterschrift" Margin="0,10,8,0" VerticalAlignment="Top" Height="25" FontSize="10" Width="91" HorizontalAlignment="Right" IsChecked="True"/>
</Grid>
<Grid x:Name="gridSpinner" Background="White">
@ -41,4 +42,4 @@
</local:ucSpinnerPiston>
</Grid>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,7 +18,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für ImageView.xaml
/// </summary>
public partial class ImageView : Window
public partial class ImageView : MetroWindow
{
Categories category = Categories.Zutritte;
@ -46,6 +47,13 @@ namespace ZKuP
await Task.Run(() => Init(_image, _showComboBox));
dPDate.SelectedDate = DateTime.Now;
cBSignature.SelectionChanged += cBSignature_SelectionChanged;
cbOnlyWithSignature.Unchecked += cbOnlyWithSignature_Unchecked;
cbOnlyWithSignature.Checked += cbOnlyWithSignature_Checked;
dPDate.SelectedDateChanged += DatePicker_SelectedDateChanged;
Helper.CheckWindowIsInScreenSpace(this);
}
private async void Init(BitmapImage image, bool showComboBox = false)
@ -230,33 +238,33 @@ namespace ZKuP
{
//throw new NotImplementedException();
string withSign = "";
if (cbOnlyWithSignature.IsChecked.Value) withSign = " AND signature_blob IS NOT NULL";
if (cbOnlyWithSignature.IsChecked.Value) withSign = " AND Signature IS NOT NULL";
if (dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
{
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE AusgegebenTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%' AND Name LIKE '%{tbFilter.Text}%'{withSign}").Result;
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE AusgegebenTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%' AND Name LIKE '%{tbFilter.Text}%'{withSign} ORDER BY AusgegebenTimestamp").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
cBSignature.ItemsSource = list;
}
else if (!dPDate.SelectedDate.HasValue && !string.IsNullOrWhiteSpace(tbFilter.Text))
{
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE benutzer LIKE '%{tbFilter.Text}%'{withSign}").Result;
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE benutzer LIKE '%{tbFilter.Text}%'{withSign} ORDER BY AusgegebenTimestamp").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
cBSignature.ItemsSource = list;
}
else if (dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
{
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE AusgegebenTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%'{withSign}").Result;
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE AusgegebenTimestamp LIKE '%{(dPDate).SelectedDate.Value.ToString("yyyy-MM-dd")}%'{withSign} ORDER BY AusgegebenTimestamp").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
cBSignature.ItemsSource = list;
}
else if (!dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
{
if (cbOnlyWithSignature.IsChecked.Value) withSign = " WHERE signature_blob IS NOT NULL";
if (cbOnlyWithSignature.IsChecked.Value) withSign = " WHERE Signature IS NOT NULL";
cbOnlyWithSignature.IsChecked = false;
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog{withSign}").Result;
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog{withSign} ORDER BY AusgegebenTimestamp").Result;
cBSignature.ItemsSource = list.OrderByDescending(p => p);
cBSignature.ItemsSource = list;
}
}
@ -286,7 +294,7 @@ namespace ZKuP
}
else if (!dPDate.SelectedDate.HasValue && string.IsNullOrWhiteSpace(tbFilter.Text))
{
if (cbOnlyWithSignature.IsChecked.Value) withSign = " WHERE signature_blob IS NOT NULL";
if (cbOnlyWithSignature.IsChecked.Value) withSign = " WHERE Signature IS NOT NULL";
cbOnlyWithSignature.IsChecked = false;
var list = SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog{withSign}").Result;
@ -312,29 +320,31 @@ namespace ZKuP
private async void RadioButton_Checked(object sender, RoutedEventArgs e)
{
List<string> list = new List<string>();
var cont = (sender as RadioButton).Content;
switch ((sender as RadioButton).Content)
await Task.Run(async () =>
{
case "Zutritte":
category = Categories.Zutritte;
list = await SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog");
list = list.OrderByDescending(p => p).ToList();
break;
case "Karten":
category = Categories.Karten;
list = await SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog");
list = list.OrderByDescending(p => p).ToList();
break;
case "McFit":
category = Categories.McFit;
list = await SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog");
list = list.OrderByDescending(p => p).ToList();
break;
}
switch (cont)
{
case "Zutritte":
category = Categories.Zutritte;
list = await SQL.ReadDateTimeAndStringList($"SELECT Zutritt,Name FROM {MainWindow.table}.zutritteLog WHERE Zutritt IS NOT NULL");
list = list.OrderByDescending(p => p).ToList();
break;
case "Karten":
category = Categories.Karten;
list = await SQL.ReadDateTimeAndStringList($"SELECT AusgegebenTimestamp,benutzer FROM {MainWindow.table}.kartenLog WHERE AusgegebenTimestamp IS NOT NULL");
list = list.OrderByDescending(p => p).ToList();
break;
case "McFit":
category = Categories.McFit;
list = await SQL.ReadDateTimeAndStringList($"SELECT AusgabeTimestamp,Nachname FROM {MainWindow.table}.mcFitLog WHERE AusgabeTimestamp IS NOT NULL");
list = list.OrderByDescending(p => p).ToList();
break;
}
});
Dispatcher.Invoke(new Action(() =>
{
@ -346,5 +356,11 @@ namespace ZKuP
}));
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.KartenTausch"
<mah:MetroWindow x:Class="ZKuP.KartenTausch"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Rote Karte zu Grüner Karte tauschen" Height="250" Width="400">
Title="Rote Karte zu Grüner Karte tauschen" Height="250" Width="400" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="1.5*"/>
@ -26,4 +27,4 @@
<Button x:Name="btnClose" Content="Bestätigen" Grid.Row="2" Height="30" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="btnClose_Click"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,6 @@
using System;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,14 +19,17 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für KartenTausch.xaml
/// </summary>
public partial class KartenTausch : Window
{
public partial class KartenTausch : MetroWindow
{
public KartenTausch()
{
InitializeComponent();
cbRot.ItemsSource = SQL.ReadListString($"SELECT kartennr From {MainWindow.table}.karten WHERE farbe = 'Rot'").Result;
Helper.InitSerial();
Helper.DataReceived += Helper_DataReceived;
}
private void cbRot_SelectionChanged(object sender, SelectionChangedEventArgs e)
@ -32,9 +37,26 @@ namespace ZKuP
var info = SQL.ReadListStringTwoColumns($"SELECT benutzer,telnr From {MainWindow.table}.karten WHERE kartennr = '{(sender as ComboBox).SelectedValue}'").Result;
var split = info.First().ToString().Split(';');
lblRotInfo.Text = $"Benutzer: {split[0]} Telefon: {split[1]}";
if (split.Length > 1)
lblRotInfo.Text = $"Benutzer: {split[0]} Telefon: {split[1]}";
}
private void Helper_DataReceived(object sender, string e)
{
var text = "";
Dispatcher.Invoke(() =>
{
if (cbRot.ItemsSource.Cast<string>().ToList().Contains(e.Split('=')[0].ToString()))
cbRot.SelectedValue = e.Split('=')[0].ToString();
else if (cbRot.SelectedIndex != -1 || tbGruen.IsKeyboardFocused)
tbGruen.Text = e.Split('=')[0].ToString();
});
}
private async void btnClose_Click(object sender, RoutedEventArgs e)
{
byte[] _signature = null;
@ -56,13 +78,34 @@ namespace ZKuP
var red = SQL.ReadListStringMultipleColumns($"SELECT * From {MainWindow.table}.karten WHERE kartennr = '{cbRot.SelectedValue}'", 5).Result.First().Split(';');
SQL.WriteSQL($"DELETE FROM {MainWindow.table}.karten WHERE kartennr = '{red[1]}'");
SQL.WriteSQL($"INSERT INTO {MainWindow.table}.karten (kartennr,farbe,benutzer,telnr,AusgegebenDurch,AusgegebenTimestamp,Signature) VALUES ('{tbGruen.Text}','Grün','{red[3]}','{red[4]}','{Environment.UserName}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', @signature)", _signature);
//SQL.WriteSQL($"INSERT INTO {MainWindow.table}.karten (kartennr,farbe,benutzer,telnr,AusgegebenDurch,AusgegebenTimestamp,Signature) VALUES ('{tbGruen.Text}','Grün','{red[3]}','{red[4]}','{Environment.UserName}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', @signature)", _signature);
var cmd = SQL.CreateAndReturnSQLCommand($"INSERT INTO {MainWindow.table}.karten (kartennr,farbe,benutzer,telnr,AusgegebenDurch,AusgegebenTimestamp,Signature) VALUES (@tbGruen,'Grün',@red3,@red4,@UserName,@Date, @signature)", new List<MySqlParameter>()
{
new MySqlParameter("@tbGruen", tbGruen.Text),
new MySqlParameter("@red3", red[3]),
new MySqlParameter("@red4", red[4]),
new MySqlParameter("@UserName", Environment.UserName),
new MySqlParameter("@Date", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
});
await SQL.CreateAndWriteSQLwithSignature(cmd, _signature);
this.Close();
}
}
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,77 +1,30 @@
using System;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using Windows.Storage;
namespace ZKuP
{
class Log
{
public static void WriteLog(string Message)
public static async Task WriteLog(string Message)
{
string path = $@"\\mhb00swfs003v.fv-werke.db.de\GLW99\ZKuP\Log\log-{DateTime.Now.Date.ToString("dd-MM-yy")}";
#if DEBUG
Debug.WriteLine(Message);
#endif
if (Directory.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\ZKuP\Log"))
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.errorLog (User, TimeStamp, Message) VALUES (@user, @timestamp, @message)", new List<MySqlParameter>()
{
string currentContent = String.Empty;
string newContent = $"{ Environment.NewLine}" +
$"--------------------------------" +
$"{Environment.NewLine}" +
$"{DateTime.Now.ToString("dd.MM.yy HH:mm:ss")} | {Environment.UserName} | {Environment.MachineName}:" +
$"{Environment.NewLine}" +
$"Message:" +
$"{Environment.NewLine}" +
$"{Message}" +
$"{Environment.NewLine}" +
$"--------------------------------" +
$"{Environment.NewLine}";
try
{
if (File.Exists(path + ".log"))
{
currentContent = File.ReadAllText(path + ".log");
File.WriteAllText(path + ".log", newContent + currentContent);
}
else
{
File.WriteAllText(path + ".log", newContent);
}
}
catch(System.IO.IOException)
{
var rnd = new Random().Next(100);
if (File.Exists(path + $"_{rnd}" + ".log"))
{
currentContent = File.ReadAllText(path + $"_{rnd}" + ".log");
File.WriteAllText(path + $"_{rnd}" + ".log", newContent + currentContent);
}
else
{
File.WriteAllText(path + $"_{rnd}" + ".log", newContent);
}
}
catch (Exception ex)
{
File.WriteAllText($@"\\mhb00swfs003v.fv-werke.db.de\GLW99\ZKuP\Log\log-{DateTime.Now.Ticks.ToString().Substring(DateTime.Now.Ticks.ToString().Length - 5)}", ex.ToString());
}
}
//File.AppendAllText(path, $"{Environment.NewLine + Environment.NewLine}" +
// $"--------------------------------" +
// $"{Environment.NewLine}" +
// $"{DateTime.Now.ToString("dd.MM.yy HH:mm:ss")} | {Environment.UserName} | {Environment.MachineName}:" +
// $"{Environment.NewLine}" +
// $"Message:" +
// $"{Environment.NewLine}" +
// $"{Message}" +
// $"{Environment.NewLine}");
new MySqlParameter("@user", Environment.UserName),
new MySqlParameter("@timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
new MySqlParameter("@message", Message)
});
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,15 @@
<Window x:Class="ZKuP.ManageAsp"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Ansprechpartner verwalten" Height="457" Width="1079"
WindowStartupLocation="CenterOwner" ResizeMode="NoResize">
Title="Ansprechpartner verwalten" Height="450" Width="1080"
WindowStartupLocation="CenterOwner" MinHeight="450" MinWidth="1080">
<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 x:Name="dgAsp" Margin="305,10,7,52" ItemsSource="{Binding Path=., Mode=OneWay}" ToolTip="Einträge können mit Doppelklick auf die Zelle geändert werden" 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="*"/>
@ -16,6 +17,13 @@
<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="*"/>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="3" Width="20" Height="20" Padding="0,2,0,0" Foreground="Red" ToolTip="Eintrag löschen" ToolTipService.ShowOnDisabled="True" FontFamily="Wingdings 2" FontSize="18" Click="DeleteButton_Click" Loaded="DelButton_Loaded"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</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"/>
@ -33,4 +41,4 @@
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -20,7 +21,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für ManageAsp.xaml
/// </summary>
public partial class ManageAsp : Window
public partial class ManageAsp : MetroWindow
{
public event PropertyChangedEventHandler PropertyChanged;
@ -32,6 +33,7 @@ namespace ZKuP
}
DataTable asp = new DataTable("Asp");
string UserID = "0";
public ManageAsp()
{
@ -39,30 +41,44 @@ namespace ZKuP
InitializeComponent();
UserID = SQL.ReadSingleValue($"SELECT idusers FROM {MainWindow.table}.users WHERE Username = '{Environment.UserName}'");
Query();
}
private void Query()
{
if (MainWindow.LoggedInRole == Roles.Admin)
{
asp = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.ansprechpartner ORDER BY Name ASC", asp).Result;
}
else
{
asp = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.ansprechpartner WHERE Name LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}%' OR Vertreter LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}%' OR Vorgesetzter LIKE '%{Helper.InsertSpaceBeforeUpperCase(Environment.UserName)}%' OR CreatorID = '{UserID}' ORDER BY Name ASC", asp).Result;
}
asp = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.ansprechpartner", 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);
if (string.IsNullOrWhiteSpace(tbAsp.Text) || tbAsp.Text.ToList<char>().Distinct().Count() < 5)
MessageBox.Show(this, "Ansprechpartner muss qualifiziert ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (string.IsNullOrWhiteSpace(tbAspVertreter.Text) || tbAspVertreter.Text.ToList<char>().Distinct().Count() < 5)
MessageBox.Show(this, "Vertreter muss qualifiziert ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (string.IsNullOrWhiteSpace(tbAspVorgesetzter.Text) || tbAspVorgesetzter.Text.ToList<char>().Distinct().Count() < 5)
MessageBox.Show(this, "Vorgesetzter muss qualifiziert ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (string.IsNullOrWhiteSpace(tbAspTel.Text) || !System.Text.RegularExpressions.Regex.IsMatch(tbAspTel.Text, "^[0-9()+\\-/ ]*$") || tbAspTel.Text.ToList<char>().Distinct().Count() < 5)
MessageBox.Show(this, "Ansprechpartner-Telefonnummer muss qualifiziert ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (string.IsNullOrWhiteSpace(tbVertreterTel.Text) || !System.Text.RegularExpressions.Regex.IsMatch(tbAspTel.Text, "^[0-9()+\\-/ ]*$") || tbVertreterTel.Text.ToList<char>().Distinct().Count() < 5)
MessageBox.Show(this, "Vertreter-Telefonnummer muss qualifiziert ausgefüllt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
else if (string.IsNullOrWhiteSpace(tbVorgesetzterTel.Text) || !System.Text.RegularExpressions.Regex.IsMatch(tbVertreterTel.Text, "^[0-9()+\\-/ ]*$") || tbVertreterTel.Text.ToList<char>().Distinct().Count() < 5)
MessageBox.Show(this, "Vorgesetzter-Telefonnummer muss qualifiziert 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}')");
await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.ansprechpartner (Name,Vertreter,Tel_Nr,Vorgesetzter,Tel_Vertreter,Tel_Vorgesetzter,CreatorID) VALUES " +
$"('{tbAsp.Text}','{tbAspVertreter.Text}','{tbAspTel.Text}','{tbAspVorgesetzter.Text}','{tbVertreterTel.Text}','{tbVorgesetzterTel.Text}','{UserID}')");
tbAsp.Text = "";
tbAspTel.Text = "";
@ -71,22 +87,24 @@ namespace ZKuP
tbVertreterTel.Text = "";
tbVorgesetzterTel.Text = "";
asp = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.ansprechpartner", asp).Result;
aspView = Asp.DataTableToAsp(asp);
Query();
}
}
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 {MainWindow.table}.ansprechpartner WHERE `Name` = '{arr[0]}'");
var dg = sender as DataGrid;
var row = dg.SelectedItem as DataRowView;
var arr = row.Row.ItemArray;
asp = SQL.ReadSQL($"Select * from {MainWindow.table}.ansprechpartner", asp).Result;
aspView = Asp.DataTableToAsp(asp);
if (arr[0].ToString() == Helper.InsertSpaceBeforeUpperCase(Environment.UserName) || arr[6].ToString() == UserID)
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.ansprechpartner WHERE `Name` = '{arr[0]}'");
Query();
}
}
}
@ -105,22 +123,22 @@ namespace ZKuP
switch (header)
{
case "Ansprechpartner":
await SQL.WriteSQL($"UPDATE ansprechpartner SET Name = '{newValue}' WHERE Name = '{name}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.ansprechpartner SET Name = '{newValue}', CreatorID = '{UserID}' WHERE Name = '{name}'");
break;
case "Asp-Vertreter":
await SQL.WriteSQL($"UPDATE ansprechpartner SET Vertreter = '{newValue}' WHERE Name = '{name}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.ansprechpartner SET Vertreter = '{newValue}', CreatorID = '{UserID}' WHERE Name = '{name}'");
break;
case "Asp-Tel":
await SQL.WriteSQL($"UPDATE ansprechpartner SET Tel_Nr = '{newValue}' WHERE Name = '{name}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.ansprechpartner SET Tel_Nr = '{newValue}', CreatorID = '{UserID}' WHERE Name = '{name}'");
break;
case "Asp-Vorgesetzter":
await SQL.WriteSQL($"UPDATE ansprechpartner SET Vorgesetzter = '{newValue}' WHERE Name = '{name}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.ansprechpartner SET Vorgesetzter = '{newValue}', CreatorID = '{UserID}' WHERE Name = '{name}'");
break;
case "Vertreter-Tel":
await SQL.WriteSQL($"UPDATE ansprechpartner SET Tel_Vertreter = '{newValue}' WHERE Name = '{name}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.ansprechpartner SET Tel_Vertreter = '{newValue}', CreatorID = '{UserID}' WHERE Name = '{name}'");
break;
case "Vorgesetzter-Tel":
await SQL.WriteSQL($"UPDATE ansprechpartner SET Tel_Vorgesetzter = '{newValue}' WHERE Name = '{name}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.ansprechpartner SET Tel_Vorgesetzter = '{newValue}', CreatorID = '{UserID}' WHERE Name = '{name}'");
break;
}
@ -128,10 +146,52 @@ namespace ZKuP
dgAsp.RowValidationErrorTemplate = new ControlTemplate();
dgAsp.PreviewKeyDown += DgAsp_PreviewKeyDown;
asp = SQL.ReadSQL($"Select * from {MainWindow.table}.ansprechpartner", asp).Result;
aspView = Asp.DataTableToAsp(asp);
Query();
}
private void DelButton_Loaded(object sender, RoutedEventArgs e)
{
var btn = sender as Button;
var arr = (btn.DataContext as DataRowView).Row.ItemArray;
var user = arr[0].ToString();
if (MainWindow.LoggedInRole != Roles.Admin)
{
if (arr[0].ToString() == Helper.InsertSpaceBeforeUpperCase(Environment.UserName) || arr[6].ToString() == UserID)
{
btn.IsEnabled = true;
btn.Foreground = new SolidColorBrush(Colors.Red);
btn.ToolTip = $"Eintrag löschen";
}
else
{
btn.IsEnabled = false;
btn.Foreground = new SolidColorBrush(Colors.Gray);
btn.ToolTip = $"Gesperrt durch {user}";
}
}
}
private async void DeleteButton_Click(object sender, RoutedEventArgs e)
{
var arr = ((sender as Button).DataContext as DataRowView).Row.ItemArray;
if (MessageBoxResult.Yes == MessageBox.Show($"Wollen Sie den Eintrag für {arr[0]} sicher löschen?", "Eintrag löschen?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
{
Cursor = Cursors.Wait;
try
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.ansprechpartner WHERE Name = '{arr[0]}' OR CreatorID = '{UserID}'");
}
catch (Exception ex)
{
Log.WriteLog(ex.ToString());
MessageBox.Show("Es ist ein Fehler beim löschen aufgetreten, bitte erneut versuchen", "Fehler beim Löschen", MessageBoxButton.OK, MessageBoxImage.Error);
}
Query();
}
}
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
@ -143,6 +203,18 @@ namespace ZKuP
{
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
public class Asp

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.ManageDeliveries"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Lieferanten verwalten" Height="352" Width="800">
Title="Lieferanten verwalten" Height="352" Width="800" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<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&#xD;&#xA; →" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="220,40,0,50" Width="75" Click="btnAdd_Click"/>
@ -21,4 +22,4 @@
<Button x:Name="btnDeleteDeliver" Content="Markierten Lieferanten löschen" FontSize="12" Padding="-2" Height="25" Margin="0,15,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="182" Click="btnDeleteDeliver_Click"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,8 @@
using System;
using ControlzEx.Standard;
using FuzzySharp;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@ -7,6 +11,7 @@ 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;
@ -19,7 +24,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für ManageDeliveries.xaml
/// </summary>
public partial class ManageDeliveries : Window, INotifyPropertyChanged
public partial class ManageDeliveries : MetroWindow, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
@ -46,14 +51,23 @@ namespace ZKuP
private async void btnAdd_Click(object sender, RoutedEventArgs e)
{
if (tbFirma.Text == "")
if (string.IsNullOrWhiteSpace(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}')");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.lieferanten (Firma, Fahrer, Handynr, Kennzeichen) VALUES ('{tbFirma.Text}','{tbFahrer.Text}','{tbHandynr.Text}','{tbKennzeichen.Text}')");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.lieferanten (Firma, Fahrer, Handynr, Kennzeichen, EingetragenVon) VALUES (@tbFirma,@tbFahrer,@tbHandynr,@tbKennzeichen,@eingetragenVon)", new List<MySqlParameter>()
{
new MySqlParameter("@tbFirma", tbFirma.Text),
new MySqlParameter("@tbFahrer", tbFahrer.Text),
new MySqlParameter("@tbHandynr", tbHandynr.Text),
new MySqlParameter("@tbKennzeichen", tbKennzeichen.Text),
new MySqlParameter("@eingetragenVon", Environment.UserName)
});
lieferanten = SQL.ReadSQL($"Select * from {MainWindow.table}.lieferanten", lieferanten).Result;
DeliveriesView = Deliver.DataTableToDeliver(lieferanten);
@ -64,15 +78,15 @@ namespace ZKuP
}
private void ResetInput()
{
tbFirma.Text = "";
tbFahrer.Text = "";
tbHandynr.Text = "";
tbKennzeichen.Text = "";
}
private void ResetInput()
{
tbFirma.Text = "";
tbFahrer.Text = "";
tbHandynr.Text = "";
tbKennzeichen.Text = "";
}
private void BtnClose_Click(object sender, RoutedEventArgs e)
private void BtnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
@ -80,6 +94,8 @@ namespace ZKuP
private async void dgLieferanten_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (string.IsNullOrWhiteSpace((e.EditingElement as TextBox).Text)) return;
var header = e.Column.Header;
var newValue = (e.EditingElement as TextBox).Text;
var id = (e.Row.Item as System.Data.DataRowView).Row.ItemArray[4];
@ -92,16 +108,16 @@ namespace ZKuP
switch (header)
{
case "Firma":
await SQL.WriteSQL($"UPDATE lieferanten SET Firma = '{newValue}' WHERE `ID` = '{id}'");// + searchFahrer);
await SQL.WriteSQL($"UPDATE {MainWindow.table}.lieferanten SET Firma = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `ID` = '{id}'");// + searchFahrer);
break;
case "Fahrer":
await SQL.WriteSQL($"UPDATE lieferanten SET Fahrer = '{newValue}' WHERE `ID` = '{id}'");// + searchFahrer);
await SQL.WriteSQL($"UPDATE {MainWindow.table}.lieferanten SET Fahrer = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `ID` = '{id}'");// + searchFahrer);
break;
case "Handynr":
await SQL.WriteSQL($"UPDATE lieferanten SET Handynr = '{newValue}' WHERE `ID` = '{id}'");// + searchFahrer);
await SQL.WriteSQL($"UPDATE {MainWindow.table}.lieferanten SET Handynr = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `ID` = '{id}'");// + searchFahrer);
break;
case "Kennzeichen":
await SQL.WriteSQL($"UPDATE lieferanten SET Kennzeichen = '{newValue}' WHERE `ID` = '{id}'");// + searchFahrer);
await SQL.WriteSQL($"UPDATE {MainWindow.table}.lieferanten SET Kennzeichen = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `ID` = '{id}'");// + searchFahrer);
break;
}
@ -154,13 +170,38 @@ namespace ZKuP
else btnDeleteDeliver.IsEnabled = false;
}
ToolTip tt = new ToolTip();
private void TextBoxes_PreviewKeyDown(object sender, KeyEventArgs e)
{
var input = (sender as TextBox).Text;
if (input.ToLower().Contains("db") ||
input.ToLower() == "service")
{
tt.Placement = PlacementMode.RelativePoint;
tt.PlacementTarget = (sender as TextBox);
tt.VerticalOffset = (sender as TextBox).Height;
//tt.Width = (sender as TextBox).Width;
tt.Background = new SolidColorBrush(Colors.Red);
tt.Content = new Grid();
(tt.Content as Grid).Background = new SolidColorBrush(Colors.Red);
(tt.Content as Grid).Children.Add(new TextBlock() { Text = "DB Firmen dürfen nicht als Lieferant angelegt werden!!" });
tt.IsOpen = true;
(sender as TextBox).ToolTip = tt;
}
else
{
tt.IsOpen = false;
(sender as TextBox).ToolTip = null;
}
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;
@ -170,6 +211,16 @@ namespace ZKuP
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);

View File

@ -0,0 +1,35 @@
<mah:MetroWindow x:Class="ZKuP.ManageEntstoerdienste"
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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Entstördienste verwalten" Height="450" Width="1200" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<DataGrid x:Name="dgEntstoerdienste" Margin="300,40,10,50" ItemsSource="{Binding Path=., Mode=OneWay, UpdateSourceTrigger=LostFocus}" AutoGenerateColumns="False" CellEditEnding="dgEntstoerdienste_CellEditEnding" SelectionChanged="dgEntstoerdienste_SelectionChanged" BeginningEdit="dgEntstoerdienste_BeginningEdit" PreviewKeyDown="dgEntstoerdienste_PreviewKeyDown" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" CanUserAddRows="False" ColumnWidth="*">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding identstoerdienste}" Width="30" IsReadOnly="True"/>
<DataGridTextColumn Header="Firma" Binding="{Binding Firma}" IsReadOnly="True"/>
<DataGridTextColumn Header="Fahrer" Binding="{Binding Fahrer}"/>
<DataGridTextColumn Header="Handynr" Binding="{Binding Handynr}"/>
<DataGridTextColumn Header="Kennzeichen" Binding="{Binding Kennzeichen}"/>
<DataGridTextColumn Header="Eingetragen von" Binding="{Binding EingetragenVon}"/>
<DataGridTextColumn Header="Geändert von" Binding="{Binding GeändertVon}"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="btnAdd" Content="Hinzufügen&#xD;&#xA; →" FontSize="12" Padding="-2" 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" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Lieferfirma:" VerticalAlignment="Top"/>
<ComboBox x:Name="cbFirma" HorizontalAlignment="Left" Height="23" Margin="10,61,0,0" Text="" VerticalAlignment="Top" Width="205"/>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" 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 Entstördienst löschen" FontSize="12" Padding="-2" Height="25" Margin="0,15,10,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="182" Click="btnDeleteDeliver_Click"/>
</Grid>
</mah:MetroWindow>

View File

@ -0,0 +1,252 @@
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
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 ManageEntstoerdienste.xaml
/// </summary>
public partial class ManageEntstoerdienste : MetroWindow, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private List<Deliver> myVar;
public List<Deliver> DeliveriesView
{
get { return myVar; }
set { myVar = value; OnPropertyChanged(); }
}
System.Data.DataTable entstoerdienste = new System.Data.DataTable("entstoerdienste");
public ManageEntstoerdienste()
{
InitializeComponent();
var list = new List<string>()
{
"DB Energie",
"DB InfraGO",
"DB KT",
"DB Postservice",
"Gerätewagen"
};
cbFirma.ItemsSource = list;
entstoerdienste = SQL.ReadSQL($"Select * from {MainWindow.table}.entstoerdienste", entstoerdienste).Result;
DeliveriesView = Deliver.DataTableToDeliver(entstoerdienste);
dgEntstoerdienste.DataContext = entstoerdienste;
dgEntstoerdienste.Items.SortDescriptions.Clear();
dgEntstoerdienste.Items.SortDescriptions.Add(new SortDescription("Firma", ListSortDirection.Ascending));
dgEntstoerdienste.Items.Refresh();
}
private async void dgEntstoerdienste_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (string.IsNullOrWhiteSpace((e.EditingElement as TextBox).Text)) return;
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 {MainWindow.table}.entstoerdienste SET Firma = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `identstoerdienste` = '{id}'");// + searchFahrer);
break;
case "Fahrer":
await SQL.WriteSQL($"UPDATE {MainWindow.table}.entstoerdienste SET Fahrer = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `identstoerdienste` = '{id}'");// + searchFahrer);
break;
case "Handynr":
await SQL.WriteSQL($"UPDATE {MainWindow.table}.entstoerdienste SET Handynr = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `identstoerdienste` = '{id}'");// + searchFahrer);
break;
case "Kennzeichen":
await SQL.WriteSQL($"UPDATE {MainWindow.table}.entstoerdienste SET Kennzeichen = '{newValue}', GeändertVon = '{Environment.UserName}' WHERE `identstoerdienste` = '{id}'");// + searchFahrer);
break;
}
dgEntstoerdienste.PreviewKeyDown += DgEntstoerdienste_PreviewKeyDown;
entstoerdienste = await SQL.ReadSQL($"Select * from {MainWindow.table}.entstoerdienste", entstoerdienste);
DeliveriesView = Deliver.DataTableToDeliver(entstoerdienste);
}
private async void DgEntstoerdienste_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 {MainWindow.table}.entstoerdienste WHERE `identstoerdienste` = '{arr[0]}'");
entstoerdienste = SQL.ReadSQL($"Select * from {MainWindow.table}.entstoerdienste", entstoerdienste).Result;
DeliveriesView = Deliver.DataTableToDeliver(entstoerdienste);
}
}
private void dgEntstoerdienste_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (dgEntstoerdienste.SelectedIndex != -1) btnDeleteDeliver.IsEnabled = true;
else btnDeleteDeliver.IsEnabled = false;
}
private void dgEntstoerdienste_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{
dgEntstoerdienste.PreviewKeyDown -= DgEntstoerdienste_PreviewKeyDown;
}
private async void dgEntstoerdienste_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 {MainWindow.table}.entstoerdienste WHERE `identstoerdienste` = '{arr[0]}'");
entstoerdienste = SQL.ReadSQL($"Select * from {MainWindow.table}.entstoerdienste", entstoerdienste).Result;
DeliveriesView = Deliver.DataTableToDeliver(entstoerdienste);
}
}
private async void btnDeleteDeliver_Click(object sender, RoutedEventArgs e)
{
var dg = dgEntstoerdienste;
var row = dg.SelectedItem as System.Data.DataRowView;
var arr = row.Row.ItemArray;
if (MessageBox.Show(this, $"Markierten Entstördienst wirklich entfernen?", "Entstördienst entfernen?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.entstoerdienste WHERE `identstoerdienste` = '{arr[0]}'");
entstoerdienste = SQL.ReadSQL($"Select * from {MainWindow.table}.entstoerdienste", entstoerdienste).Result;
DeliveriesView = Deliver.DataTableToDeliver(entstoerdienste);
}
}
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;
}
}
private async void btnAdd_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrWhiteSpace(cbFirma.Text))
{
MessageBox.Show(this, "DB Firma muss eingetragen werden!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
else
{
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.lieferanten (Firma, Fahrer, Handynr, Kennzeichen) VALUES ('{tbFirma.Text}','{tbFahrer.Text}','{tbHandynr.Text}','{tbKennzeichen.Text}')");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.entstoerdienste (Firma, Fahrer, Handynr, Kennzeichen, EingetragenVon) VALUES (@tbFirma,@tbFahrer,@tbHandynr,@tbKennzeichen,@eingetragenVon)", new List<MySqlParameter>()
{
new MySqlParameter("@tbFirma", cbFirma.Text),
new MySqlParameter("@tbFahrer", tbFahrer.Text),
new MySqlParameter("@tbHandynr", tbHandynr.Text),
new MySqlParameter("@tbKennzeichen", tbKennzeichen.Text),
new MySqlParameter("@eingetragenVon", Environment.UserName)
});
entstoerdienste = SQL.ReadSQL($"Select * from {MainWindow.table}.entstoerdienste", entstoerdienste).Result;
DeliveriesView = Deliver.DataTableToDeliver(entstoerdienste);
dgEntstoerdienste.ScrollIntoView(dgEntstoerdienste.Items[dgEntstoerdienste.Items.Count - 1]); //scroll to last
dgEntstoerdienste.UpdateLayout();
ResetInput();
}
}
private void ResetInput()
{
cbFirma.Text = "";
tbFahrer.Text = "";
tbHandynr.Text = "";
tbKennzeichen.Text = "";
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
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;
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.ManageParkausweis"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Parkausweise verwalten" Height="450" Width="1300">
Title="Parkausweise verwalten" Height="450" Width="1300" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Grid>
<DataGrid x:Name="dgManage" PreviewKeyDown="DgManage_PreviewKeyDown" ItemsSource="{Binding .}" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" RowHeaderWidth="0" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserAddRows="False" CanUserReorderColumns="False">
<DataGrid.Columns>
@ -19,6 +20,7 @@
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
@ -26,6 +28,7 @@
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
<Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
@ -54,9 +57,10 @@
</Style>
</DataGridCheckBoxColumn.CellStyle>
</DataGridCheckBoxColumn>
<DataGridCheckBoxColumn Binding="{Binding isKrad}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Fzg.-Typ" IsReadOnly="True" Width="80"/>
<DataGridCheckBoxColumn Binding="{Binding isKrad}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Ist Krad?" IsReadOnly="True" Width="80"/>
<DataGridTextColumn Binding="{Binding Bemerkung}" CanUserReorder="False" ClipboardContentBinding="{x:Null}" Header="Bemerkung" IsReadOnly="True" Width="124"/>
</DataGrid.Columns>
</DataGrid>
<TextBox x:Name="searchBox" Width="150" Height="25" mah:TextBoxHelper.Watermark="Suchen..." VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-28,200,0" TextChanged="TextBox_TextChanged"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,5 @@
using System;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@ -12,22 +13,29 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace ZKuP
{
/// <summary>
/// Interaktionslogik für ManageParkausweis.xaml
/// </summary>
public partial class ManageParkausweis : Window
public partial class ManageParkausweis : MetroWindow
{
private DispatcherTimer _searchTimer;
public ManageParkausweis()
{
InitializeComponent();
var list = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.parkausweise").Result;
dgManage.DataContext = list;
}
_searchTimer = new DispatcherTimer();
_searchTimer.Interval = TimeSpan.FromMilliseconds(300);
_searchTimer.Tick += SearchTimer_Tick;
}
private async void DgManage_PreviewKeyDown(object sender, KeyEventArgs e)
{
@ -37,10 +45,13 @@ namespace ZKuP
if (e.Key == Key.Delete)
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.parkausweise WHERE `idparkausweise` = '{arr[0]}'");
if (MessageBoxResult.Yes == MessageBox.Show($"Möchten Sie den Parkausweis mit der ID {arr[0]} sicher löschen?", "Sicher löschen?", MessageBoxButton.YesNo, MessageBoxImage.Question))
{
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.parkausweise WHERE `idparkausweise` = '{arr[0]}'");
var list = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.parkausweise").Result;
dgManage.DataContext = list;
var list = SQL.ReadSQL($"SELECT * FROM {MainWindow.table}.parkausweise").Result;
dgManage.DataContext = list;
}
}
}
@ -61,5 +72,34 @@ namespace ZKuP
//await Task.Run(() => QueryProjekte());
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
RestartSearchTimer();
}
private void RestartSearchTimer()
{
_searchTimer.Stop();
_searchTimer.Start();
}
private void SearchTimer_Tick(object sender, EventArgs e)
{
_searchTimer.Stop();
var tb = searchBox.Text;
(dgManage.ItemsSource as DataView).RowFilter = $"MA_Vorname LIKE '%{(tb)}%' OR MA_Name LIKE '%{(tb)}%' OR Abteilung LIKE '%{(tb)}%' OR Kennzeichen LIKE '%{(tb)}%'";
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,33 +1,35 @@
<Window x:Class="ZKuP.ManageUsers"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Manage Users" Height="657" Width="450">
<Window.Resources>
Title="Manage Users" Height="657" Width="450" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<mah:MetroWindow.Resources>
<local:IntToRole x:Key="IntToRole"/>
</Window.Resources>
</mah:MetroWindow.Resources>
<Grid>
<Button x:Name="btnAddUser" FontSize="12" Padding="-2" Content="Add" Margin="10,130,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="140" Click="BtnAddUser_Click"/>
<Button x:Name="btnDelUser" FontSize="12" Padding="-2" Content="Markierten User löschen" Margin="10,160,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="140" Click="btnDelUser_Click"/>
<Button x:Name="btnClose" Content="Close" FontSize="12" Padding="-2" 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="140" Text=""/>
<ComboBox x:Name="cbRole" HorizontalAlignment="Left" Margin="10,78,0,0" VerticalAlignment="Top" Width="140">
<ComboBoxItem Content="Pförtner"/>
<ComboBoxItem Content="FFK"/>
<ComboBoxItem Content="Admin"/>
<ComboBoxItem Content="FFK Sasse"/>
<ComboBoxItem Content="M2"/>
</ComboBox>
<DataGrid x:Name="dgUsers" Margin="160,10,10,46" ItemsSource="{Binding Path=., Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" AutoGenerateColumns="False" PreviewKeyDown="DgUsers_PreviewKeyDown">
<ComboBox x:Name="cbRole" SelectedItem="{Binding Role, Mode=OneWay, Converter={StaticResource IntToRole}}" ItemsSource="{Binding RoleList}" HorizontalAlignment="Left" Margin="10,78,0,0" VerticalAlignment="Top" Width="140"/>
<DataGrid x:Name="dgUsers" Margin="160,10,10,46" ItemsSource="{Binding Path=., Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" AutoGenerateColumns="False" PreviewKeyDown="DgUsers_PreviewKeyDown" CellEditEnding="dgUsers_CellEditEnding">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Username, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Username" Width="*" SortDirection="Ascending"/>
<DataGridTextColumn Binding="{Binding Role, Mode=OneWay, Converter={StaticResource IntToRole}}" ClipboardContentBinding="{x:Null}" Header="Role" Width="70"/>
<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Role" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="cbDGRole" SelectedItem="{Binding Role, Mode=OneWay, Converter={StaticResource IntToRole}}" ItemsSource="{Binding RoleList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ManageUsers}}}" DropDownClosed="cbDGRole_DropDownClosed"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,9,0,0" TextWrapping="Wrap" Text="Username" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,57,0,0" TextWrapping="Wrap" Text="Role" VerticalAlignment="Top"/>
</Grid>
</Window>
</mah:MetroWindow>

View File

@ -1,4 +1,6 @@
using System;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -20,10 +22,20 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für ManageUsers.xaml
/// </summary>
public partial class ManageUsers : Window, INotifyPropertyChanged
public partial class ManageUsers : MetroWindow, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public static List<string> RoleList { get; set; } = new List<string>()
{
"Pförtner",
"FFK",
"Admin",
"FFK Sasse",
"M2",
"Organisator",
"M2 AM"
};
private List<Users> myVar;
public List<Users> UserView
@ -36,6 +48,8 @@ namespace ZKuP
public ManageUsers()
{
this.DataContext = this;
InitializeComponent();
userList = SQL.ReadSQL($"Select * from {MainWindow.table}.users", userList).Result;
@ -47,28 +61,39 @@ namespace ZKuP
private async void BtnAddUser_Click(object sender, RoutedEventArgs e)
{
if(tbUsername.Text == "")
if (!await SQL.RowExists("users", "Username", tbUsername.Text))
{
MessageBox.Show("Username eintragen!", "Fehler");
return;
if (tbUsername.Text == "")
{
MessageBox.Show("Username eintragen!", "Fehler");
return;
}
if (cbRole.SelectedIndex == -1)
{
MessageBox.Show("Role auswählen!", "Fehler");
return;
}
//await SQL.WriteSQL($"Insert into {MainWindow.table}.users (Username,Role) VALUES ('{tbUsername.Text}','{cbRole.SelectedIndex}')");
await SQL.CreateAndWriteSQL($"Insert into {MainWindow.table}.users (Username,Role) VALUES (@tbUsername,@cbRole_SelectedIndex)", new List<MySqlParameter>()
{
new MySqlParameter("@tbUsername", tbUsername.Text),
new MySqlParameter("@cbRole_SelectedIndex", cbRole.SelectedIndex)
});
userList = SQL.ReadSQL($"Select * from {MainWindow.table}.users", userList).Result;
userList.DefaultView.Sort = "Username";
userList = userList.DefaultView.ToTable();
UserView = Users.DataTableToUserList(userList);
dgUsers.DataContext = userList;
dgUsers.ScrollIntoView(UserView.Last());
}
if(cbRole.SelectedIndex == -1)
{
MessageBox.Show("Role auswählen!", "Fehler");
return;
}
await SQL.WriteSQL($"Insert into {MainWindow.table}.users (Username,Role) VALUES ('{tbUsername.Text}','{cbRole.SelectedIndex}')");
userList = SQL.ReadSQL($"Select * from {MainWindow.table}.users", userList).Result;
userList.DefaultView.Sort = "Username";
userList = userList.DefaultView.ToTable();
UserView = Users.DataTableToUserList(userList);
dgUsers.DataContext = userList;
dgUsers.ScrollIntoView(UserView.Last());
else
MessageBox.Show("Der angegebene User existiert bereits!", "User bereits vorhanden", MessageBoxButton.OK, MessageBoxImage.Error);
}
private async void btnDelUser_Click(object sender, RoutedEventArgs e)
@ -120,6 +145,46 @@ namespace ZKuP
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private async void cbDGRole_DropDownClosed(object sender, EventArgs e)
{
var combo = sender as ComboBox;
//var dg = (combo.DataContext as DataRowView).;
var row = combo.DataContext as DataRowView;
var arr = row.Row.ItemArray;
if (MessageBoxResult.Yes == MessageBox.Show($"Die Rolle des Users {arr[1]} sicher zu {(sender as ComboBox).SelectedValue.ToString()} ändern?", "Sicher ändern?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes))
{
await SQL.WriteSQL($"UPDATE {MainWindow.table}.users SET Role = '{combo.SelectedIndex}' WHERE Username = '{arr[1]}'");
userList = SQL.ReadSQL($"Select * from {MainWindow.table}.users", userList).Result;
userList.DefaultView.Sort = "Username";
userList = userList.DefaultView.ToTable();
UserView = Users.DataTableToUserList(userList);
dgUsers.DataContext = userList;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private async void dgUsers_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
await SQL.CreateAndWriteSQL($"UPDATE {MainWindow.table}.users SET Username = @user WHERE Username = @oldUser", new List<MySqlParameter>
{
new MySqlParameter("@user", (e.EditingElement as TextBox).Text),
new MySqlParameter("@oldUser", ((System.Data.DataRowView)e.Row.Item).Row.ItemArray[1])
});
}
}

View File

@ -8,7 +8,7 @@
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
Title="Besucher verwalten" Height="611" Width="1390" ResizeMode="NoResize"
WindowStartupLocation="CenterOwner" Loaded="Window_Loaded">
<Window.Resources>
<mah:MetroWindow.Resources>
<ResourceDictionary>
<ControlTemplate x:Key="ComboBoxControlTemplate1" TargetType="{x:Type ComboBox}">
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
@ -186,12 +186,12 @@
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>
</Window.Resources>
</mah:MetroWindow.Resources>
<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" TextChanged="tbName_TextChanged" LostFocus="tbName_LostFocus"/>
<TextBlock HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" Text="Name" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" Text="Name des Besuchers" 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"/>
<TextBlock HorizontalAlignment="Left" Margin="10,85,0,0" TextWrapping="Wrap" Text="Verantwortlicher Mitarbeiter der DB" 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" PreviewTextInput="Tel_Nr_Besucher_PreviewTextInput"/>
<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}"/>
@ -248,7 +248,7 @@
<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Tel. Besucher" MinWidth="150"> <!--Binding="{Binding Tel_Nr_Besucher}"-->
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Tel_Nr_Besucher}" Background="Transparent" BorderThickness="0" PreviewTextInput="Tel_Nr_Besucher_PreviewTextInput" TextAlignment="Left" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0"/>
<TextBox Text="{Binding Tel_Nr_Besucher}" Background="Transparent" BorderThickness="0" PreviewTextInput="Tel_Nr_Besucher_PreviewTextInput" LostKeyboardFocus="Tel_Nr_Besucher_LostKeyboardFocus" TextAlignment="Left" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<!--<DataGridTextColumn.ElementStyle>
@ -272,16 +272,16 @@
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Anzahl_Begleitpersonen}" Width="50" TextAlignment="Center" VerticalAlignment="Center"/>
<Button x:Name="btnEdit" Width="25" Height="25" HorizontalAlignment="Right" Padding="0" Click="btnEdit_Click">
<Button x:Name="btnEdit" Width="25" Height="25" ToolTip="Begleitpersonen bearbeiten/hinzufügen/entfernen" HorizontalAlignment="Right" Padding="0" Click="btnEdit_Click">
<Button.Content>
<Image Source="/Resources/Edit.png" Height="23"/>
</Button.Content>
<Button.ContextMenu>
<!--<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="Anzahl ändern" Tag="1" Click="MenuItem_Click"/>
<MenuItem Header="Personen anzeigen/bearbeiten" Tag="2" Click="MenuItem_Click"/>
</ContextMenu>
</Button.ContextMenu>
</Button.ContextMenu>-->
</Button>
</StackPanel>
</DataTemplate>
@ -348,6 +348,18 @@
</DataGrid.Columns>
</DataGrid>
<!--<Popup x:Name="popAnzahl" Placement="Mouse" AllowsTransparency="True">
<StackPanel>
<TextBlock Text="Anzahl anpassen und mit ENTER bestätigen:" Margin="5"/>
<TextBox Width="240" HorizontalAlignment="Left" Margin="5" PreviewKeyDown="Anzahl_PreviewKeyDown"/>
</StackPanel>
</Popup>
<Popup x:Name="popView" Placement="Mouse" AllowsTransparency="True">
<StackPanel>
</StackPanel>
</Popup>-->
<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"/>

View File

@ -1,4 +1,6 @@
using FuzzySharp;
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -22,7 +24,7 @@ namespace ZKuP
/// <summary>
/// Interaktionslogik für CreateVisitor.xaml
/// </summary>
public partial class ManageVisitor : MahApps.Metro.Controls.MetroWindow, INotifyPropertyChanged
public partial class ManageVisitor : MetroWindow, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
@ -76,7 +78,7 @@ namespace ZKuP
private void updateList()
{
if (MainWindow.LoggedInRole == Roles.Admin || MainWindow.LoggedInRole == Roles.Pförtner)
if (MainWindow.LoggedInRole == Roles.Admin || MainWindow.LoggedInRole == Roles.M2_AM || MainWindow.LoggedInRole == Roles.Pförtner)
{
requestListAdmin();
}
@ -237,14 +239,31 @@ namespace ZKuP
AddVisitorsList aVl = new AddVisitorsList(Convert.ToInt16(tbAnzahl_Begleiter.Text));
aVl.Owner = this;
aVl.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if (aVl.ShowDialog() == true)
{
var groupId = aVl.GroupID;
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,idBesucherGroups) 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}','{groupId}')");
await SQL.WriteSQL($"UPDATE besucherGroups SET idbesucher = '{Convert.ToInt32(SQL.ReadSingleValue($"SELECT LAST_INSERT_ID()"))}'");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.besucher (Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Ersteller,idBesucherGroups) 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}','{groupId}')");
var lastID = await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.besucher (Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Ersteller,idBesucherGroups) VALUES (@tbName,@tbVerantwortlicher_MA,@tbTel_Besucher,@tbAnzahl_Begleiter,@Besuchstag,@tbGrundDesBesuchs,@tbAnsprechp_Intern,@tbTel_Ansprechp,@tbOertlichkeit,@UserName,@groupId)", new List<MySqlParameter>()
{
new MySqlParameter("@tbName", tbName.Text),
new MySqlParameter("@tbVerantwortlicher_MA", tbVerantwortlicher_MA.Text),
new MySqlParameter("@tbTel_Besucher", tbTel_Besucher.Text),
new MySqlParameter("@tbAnzahl_Begleiter", tbAnzahl_Begleiter.Text),
new MySqlParameter("@Besuchstag", dpBesuchstag.SelectedDate.Value.ToString("yyyy-MM-dd")),
new MySqlParameter("@tbGrundDesBesuchs", tbGrundDesBesuchs.Text),
new MySqlParameter("@tbAnsprechp_Intern", tbAnsprechp_Intern.Text),
new MySqlParameter("@tbTel_Ansprechp", tbTel_Ansprechp.Text),
new MySqlParameter("@tbOertlichkeit", tbOertlichkeit.Text),
new MySqlParameter("@UserName", Environment.UserName),
new MySqlParameter("@groupId", groupId)
});
await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucherGroups SET idbesucher = '{lastID}' WHERE idbesucherGroups = '{groupId}'");
}
else
{
@ -254,8 +273,21 @@ namespace ZKuP
}
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}')");
//await SQL.WriteSQL($"INSERT INTO {MainWindow.table}.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}')");
await SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.besucher (Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Ersteller) VALUES (@tbName,@tbVerantwortlicher_MA,@tbTel_Besucher,@tbAnzahl_Begleiter,@Besuchstag,@tbGrundDesBesuchs,@tbAnsprechp_Intern,@tbTel_Ansprechp,@tbOertlichkeit,@UserName)", new List<MySqlParameter>()
{
new MySqlParameter("@tbName", tbName.Text),
new MySqlParameter("@tbVerantwortlicher_MA", tbVerantwortlicher_MA.Text),
new MySqlParameter("@tbTel_Besucher", tbTel_Besucher.Text),
new MySqlParameter("@tbAnzahl_Begleiter", tbAnzahl_Begleiter.Text),
new MySqlParameter("@Besuchstag", dpBesuchstag.SelectedDate.Value.ToString("yyyy-MM-dd")),
new MySqlParameter("@tbGrundDesBesuchs", tbGrundDesBesuchs.Text),
new MySqlParameter("@tbAnsprechp_Intern", tbAnsprechp_Intern.Text),
new MySqlParameter("@tbTel_Ansprechp", tbTel_Ansprechp.Text),
new MySqlParameter("@tbOertlichkeit", tbOertlichkeit.Text),
new MySqlParameter("@UserName", Environment.UserName)
});
}
}
@ -309,8 +341,9 @@ namespace ZKuP
newValue = (e.EditingElement as ComboBox).Text;
else if (header.ToString() == "Besuchstag")
newValue = (e.EditingElement as DatePicker).Text;
else
else if (e.EditingElement.GetType() == typeof(TextBox))
newValue = (e.EditingElement as TextBox).Text;
else return;
var id = (e.Row.Item as DataRowView).Row.ItemArray[0];
@ -331,34 +364,34 @@ namespace ZKuP
switch (header)
{
case "Name":
await SQL.WriteSQL($"UPDATE besucher SET Name = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.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}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Tel_Nr_Ansprechpartner_Intern = '{newValue}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
break;
}
}
@ -453,9 +486,22 @@ namespace ZKuP
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($"INSERT INTO {MainWindow.table}.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.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.besucherLog (idbesucher, Name,Verantwortlicher_MA,Tel_Nr_Besucher,Anzahl_Begleitpersonen,Besuchstag,Grund_des_Besuchs,Ansprechpartner_Intern,Tel_Nr_Ansprechpartner_Intern,Oertlichkeit,Geloescht_Von) VALUES (@arr0,@arr1,@arr2,@arr3,@arr4,@arr5,@arr6,@arr7,@arr8,@arr10,@UserName)", new List<MySqlParameter>()
{
new MySqlParameter("@arr0", arr[0]),
new MySqlParameter("@arr1", arr[1].ToString()),
new MySqlParameter("@arr2", arr[2].ToString()),
new MySqlParameter("@arr3", arr[3].ToString()),
new MySqlParameter("@arr4", arr[4].ToString()),
new MySqlParameter("@arr5", Convert.ToDateTime(arr[5].ToString()).ToString("yyyy-MM-dd")),
new MySqlParameter("@arr6", arr[6].ToString()),
new MySqlParameter("@arr7", arr[7].ToString()),
new MySqlParameter("@arr8", arr[8].ToString()),
new MySqlParameter("@arr10", arr[10].ToString()),
new MySqlParameter("@UserName", Environment.UserName)
});
await SQL.WriteSQL($"DELETE FROM {MainWindow.table}.besucher WHERE `idBesucher` = '{arr[0]}'");
@ -528,7 +574,7 @@ namespace ZKuP
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private async void dpDataGridBesuchstag_CalendarClosed(object sender, RoutedEventArgs e)
@ -538,7 +584,7 @@ namespace ZKuP
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValue}' in der Spalte 'Besuchstag' sicher zu '{(sender as DatePicker).Text}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
var id = (DataGridRow.GetRowContainingElement((sender as DatePicker)).Item as DataRowView).Row.ItemArray[0];
await SQL.WriteSQL($"UPDATE besucher SET Besuchstag = '{(sender as DatePicker).SelectedDate.Value.ToString("yyyy-MM-dd")}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Besuchstag = '{(sender as DatePicker).SelectedDate.Value.ToString("yyyy-MM-dd")}', Bearbeiter = '{Environment.UserName}' WHERE idBesucher = '{id}'");
}
}
}
@ -577,7 +623,7 @@ namespace ZKuP
{
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValueAsp}' in der Spalte 'Anspr. intern' sicher zu '{box.Text}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
await SQL.WriteSQL($"UPDATE besucher SET Ansprechpartner_Intern = '{box.Text}',Tel_Nr_Ansprechpartner_Intern = '{SQL.ReadSingleValue($"SELECT Tel_Nr FROM {MainWindow.table}.ansprechpartner WHERE Name = '{(sender as ComboBox).Text}'")}', Bearbeiter = '{Environment.UserName}' WHERE idbesucher = '{id}'");
await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Ansprechpartner_Intern = '{box.Text}',Tel_Nr_Ansprechpartner_Intern = '{SQL.ReadSingleValue($"SELECT Tel_Nr FROM {MainWindow.table}.ansprechpartner WHERE Name = '{(sender as ComboBox).Text}'")}', Bearbeiter = '{Environment.UserName}' WHERE idbesucher = '{id}'");
updateList();
@ -597,6 +643,33 @@ namespace ZKuP
}
private async void Tel_Nr_Besucher_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
var box = sender as TextBox;
DataGridRow dataGridRow = Helper.FindParent<DataGridRow>(box);
int index = dataGridRow.GetIndex();
var id = ((System.Data.DataRowView)dataGridRow.DataContext).Row.ItemArray[0];
if (oldValueAsp != box.Text)
{
if (MessageBox.Show(this, $"Möchten Sie den Eintrag '{oldValueAsp}' in der Spalte 'Tel. Besucher' sicher zu '{box.Text}' ändern?", "Sicher ändern?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
await SQL.WriteSQL($"UPDATE {MainWindow.table}.besucher SET Tel_Nr_Besucher = '{box.Text}' WHERE idbesucher = '{id}'");
updateList();
dgVisitors.RowValidationErrorTemplate = new ControlTemplate();
dgVisitors.SelectedIndex = (index);
dgVisitors.ScrollIntoView(dgVisitors.Items[index]);
}
}
}
string searchTerm = "";
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
@ -747,7 +820,7 @@ namespace ZKuP
{
tt.Placement = PlacementMode.RelativePoint;
tt.PlacementTarget = tbName;
tt.VerticalOffset = tbName.Height;
tt.HorizontalOffset = tbName.Width * .75;
tt.Width = tbName.Width;
tt.Background = new SolidColorBrush(Colors.Red);
tt.Content = new Grid();
@ -778,30 +851,26 @@ namespace ZKuP
tt.IsOpen = false;
}
string editID = "";
//int editID = 0;
private void btnEdit_Click(object sender, RoutedEventArgs e)
{
editID = (((sender as Button).Parent as StackPanel).DataContext as DataRowView).Row.ItemArray[0].ToString();
(sender as Button).ContextMenu.IsOpen = true;
int editID = Convert.ToInt32((((sender as Button).Parent as StackPanel).DataContext as DataRowView).Row.ItemArray[0]);
var anz = Convert.ToInt16((((sender as Button).Parent as StackPanel).DataContext as DataRowView).Row.ItemArray[4]);
AddVisitorsList aVl = new AddVisitorsList(anz, true, editID);
aVl.Owner = this;
aVl.WindowStartupLocation = WindowStartupLocation.CenterOwner;
aVl.ShowDialog();
updateList();
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
private void Window_LocationChanged(object sender, EventArgs e)
{
var item = (sender as MenuItem).Tag;
switch (item)
{
case "1": //Anzahl ändern
var pop = new Popup();
pop.Placement = PlacementMode.Mouse;
pop.Child = new StackPanel() { Orientation = Orientation.Horizontal };
break;
case "2": //Personen anzeigen / bearbeiten
break;
}
this.LocationChanged -= Window_LocationChanged;
Helper.CheckWindowIsInScreenSpace(this);
this.LocationChanged += Window_LocationChanged;
}
}

View File

@ -0,0 +1,102 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZKuP
{
internal class MySqlConnectionChecker
{
public class ConnectionResult
{
public bool IsConnected { get; set; }
public string Message { get; set; }
public TimeSpan ResponseTime { get; set; }
public Exception Exception { get; set; }
}
/// <summary>
/// Überprüft die Verbindung zu einem MySQL Server asynchron
/// </summary>
/// <param name="connectionString">MySQL Connection String</param>
/// <param name="timeoutSeconds">Timeout in Sekunden (Standard: 10)</param>
/// <returns>Task mit ConnectionResult</returns>
public static async Task<ConnectionResult> CheckConnectionAsync()
{
var result = new ConnectionResult();
var startTime = DateTime.Now;
try
{
using (var connection = new MySqlConnection(SQL.GetConnstr(true)))
{
await connection.OpenAsync();
// Teste mit einer einfachen Abfrage
using (var command = new MySqlCommand("SELECT 1", connection))
{
var testResult = await command.ExecuteScalarAsync();
if (testResult != null && testResult.ToString() == "1")
{
result.IsConnected = true;
result.Message = "Verbindung erfolgreich hergestellt";
}
else
{
result.IsConnected = false;
result.Message = "Verbindung hergestellt, aber Testabfrage fehlgeschlagen";
}
}
}
}
catch (MySqlException ex)
{
result.IsConnected = false;
result.Exception = ex;
result.Message = GetMySqlErrorMessage(ex);
}
catch (Exception ex)
{
result.IsConnected = false;
result.Exception = ex;
result.Message = $"Unerwarteter Fehler: {ex.Message}";
}
result.ResponseTime = DateTime.Now - startTime;
return result;
}
/// <summary>
/// Gibt eine benutzerfreundliche Fehlermeldung basierend auf MySQL-Fehlercodes zurück
/// </summary>
private static string GetMySqlErrorMessage(MySqlException ex)
{
switch (ex.Number)
{
case 0:
return "Verbindung zum MySQL-Server konnte nicht hergestellt werden. Überprüfen Sie die Serveradresse.";
case 1042:
return "MySQL-Server ist nicht erreichbar. Überprüfen Sie die Netzwerkverbindung.";
case 1045:
return "Zugriff verweigert. Überprüfen Sie Benutzername und Passwort.";
case 1049:
return "Die angegebene Datenbank existiert nicht.";
case 1130:
return "Host ist nicht berechtigt, sich mit dem MySQL-Server zu verbinden.";
case 2003:
return "MySQL-Server ist nicht erreichbar oder läuft nicht.";
default:
return $"MySQL-Fehler ({ex.Number}): {ex.Message}";
}
}
}
}

View File

@ -6,13 +6,13 @@
xmlns:local="clr-namespace:ZKuP"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="Notifications" Height="380" Width="430" MinHeight="420" MinWidth="430" MaxWidth="430" >
Title="Notifications" Height="380" Width="430" MinHeight="420" MinWidth="430" MaxWidth="430" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
<Window.Resources>
<mah:MetroWindow.Resources>
<ResourceDictionary>
<local:IntToYesNo x:Key="IntToBool"></local:IntToYesNo>
</ResourceDictionary>
</Window.Resources>
</mah:MetroWindow.Resources>
<Grid>

View File

@ -1,4 +1,5 @@
using MahApps.Metro.Controls;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
@ -98,7 +99,15 @@ namespace ZKuP
{
IntToBool iTb = new IntToBool();
SQL.WriteSQL($"INSERT INTO {MainWindow.table}.notification (Username, Visitor, SMS, SMSRepeat) VALUES ('{Environment.UserName}', '{cBVisitor.SelectedValue.ToString()}', '{tbSMS.Text}', '{iTb.ConvertBack(rbRepeatYes.IsChecked.Value, typeof(int), null, null)}')");
//SQL.WriteSQL($"INSERT INTO {MainWindow.table}.notification (Username, Visitor, SMS, SMSRepeat) VALUES ('{Environment.UserName}', '{cBVisitor.SelectedValue.ToString()}', '{tbSMS.Text}', '{iTb.ConvertBack(rbRepeatYes.IsChecked.Value, typeof(int), null, null)}')");
SQL.CreateAndWriteSQL($"INSERT INTO {MainWindow.table}.notification (Username, Visitor, SMS, SMSRepeat) VALUES (@UserName, @cBVisitor, @tbSMS, @iTb", new List<MySqlParameter>()
{
new MySqlParameter("@UserName", Environment.UserName),
new MySqlParameter("@cBVisitor", cBVisitor.SelectedValue.ToString()),
new MySqlParameter("@tbSMS", tbSMS.Text),
new MySqlParameter("@iTb", iTb.ConvertBack(rbRepeatYes.IsChecked.Value, typeof(int), null, null))
});
QueryList();
}
@ -117,5 +126,17 @@ namespace ZKuP
{
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
private void Window_LocationChanged(object sender, EventArgs e)
{
Helper.CheckWindowIsInScreenSpace(this);
}
}
}

View File

@ -1,11 +1,12 @@
<Window x:Class="ZKuP.ParkausweisDisclaimer"
<mah:MetroWindow 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:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:ZKuP"
mc:Ignorable="d"
Title="Parkausweis beantragen" Height="435" Width="673" WindowStyle="ToolWindow" ResizeMode="NoResize">
Title="Parkausweis beantragen" Height="435" Width="673" WindowStyle="ToolWindow" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
<Grid>
<RichTextBox Margin="10,10,10,0" Height="320" VerticalAlignment="Top" Focusable="False" IsTabStop="False" IsReadOnly="True" IsEnabled="False">
<RichTextBox.Template>
@ -78,4 +79,4 @@
<Button x:Name="btnAccept" Content="Akzeptieren" HorizontalAlignment="Right" Margin="0,0,10,8" VerticalAlignment="Bottom" Width="300" Click="btnAccept_Click" Height="28"/>
</Grid>
</Window>
</mah:MetroWindow>

Some files were not shown because too many files have changed in this diff Show More