First Commit

This commit is contained in:
Marcus 2025-10-08 10:11:18 +02:00
parent 3b35dd0891
commit e0ab181abe
27 changed files with 1835 additions and 304 deletions

View File

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="PEP_Tool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="PEP_Tool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<connectionStrings /> <connectionStrings/>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup> </startup>
<entityFramework> <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters> <parameters>
<parameter value="mssqllocaldb" /> <parameter value="mssqllocaldb"/>
</parameters> </parameters>
</defaultConnectionFactory> </defaultConnectionFactory>
<providers> <providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
</providers> </providers>
</entityFramework> </entityFramework>
<userSettings> <userSettings>
<PEP_Tool.Properties.Settings> <PEP_Tool.Properties.Settings>
<setting name="AbteilungsnamenPath" serializeAs="String"> <setting name="AbteilungsnamenPath" serializeAs="String">
<value /> <value/>
</setting> </setting>
<setting name="ZuweisungenPath" serializeAs="String"> <setting name="ZuweisungenPath" serializeAs="String">
<value /> <value/>
</setting> </setting>
<setting name="newVersionScreen" serializeAs="String"> <setting name="newVersionScreen" serializeAs="String">
<value>True</value> <value>True</value>
@ -38,7 +38,7 @@
<value>1.0</value> <value>1.0</value>
</setting> </setting>
<setting name="Version" serializeAs="String"> <setting name="Version" serializeAs="String">
<value>3.0.1</value> <value>4.2.2</value>
</setting> </setting>
<setting name="WindowPosLeft" serializeAs="String"> <setting name="WindowPosLeft" serializeAs="String">
<value>0</value> <value>0</value>
@ -91,12 +91,12 @@
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" /> <assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.9.1.0" newVersion="3.9.1.0" /> <bindingRedirect oldVersion="0.0.0.0-3.9.1.0" newVersion="3.9.1.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" /> <assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0" /> <bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>

View File

@ -36,6 +36,63 @@
</RichTextBox.Template>--> </RichTextBox.Template>-->
<FlowDocument> <FlowDocument>
<Paragraph LineHeight="6"> <Paragraph LineHeight="6">
<Run Text="Version 4.2.2"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Verschlüsselung der Kommunikation"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 4.2.1"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Anpassungen für neue Datenbereitstellung"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 4.1.1"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Weiteren Abteilungsfilter hinzugefügt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Updatefunktion auf Basic Workplace erweitert"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Performanceverbesserungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Stabilitätsverbesserungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 3.1.0"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Server gewechselt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Performanceverbesserungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Stabilitätsverbesserungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 3.0.1"/> <Run Text="Version 3.0.1"/>
</Paragraph> </Paragraph>
<Paragraph LineHeight="6"> <Paragraph LineHeight="6">

BIN
AV-ToolV3/Arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

50
AV-ToolV3/Crypto.cs Normal file
View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
internal class Crypto
{
public static byte[] GetHashKey(string hashKey, string Salt = "D99CFBD250C45D34B954C74E2054A282")
{
// Initialize
UTF8Encoding encoder = new UTF8Encoding();
// Get the salt
string salt = !string.IsNullOrEmpty(Salt) ? Salt : "I am a nice little salt";
byte[] saltBytes = encoder.GetBytes(salt);
// Setup the hasher
Rfc2898DeriveBytes rfc = new Rfc2898DeriveBytes(hashKey, saltBytes);
// Return the key
return rfc.GetBytes(16);
}
public static string Decrypt(byte[] key, string encryptedString)
{
// Initialize
AesManaged decryptor = new AesManaged();
byte[] encryptedData = Convert.FromBase64String(encryptedString);
// Set the key
decryptor.Key = key;
decryptor.IV = key;
// create a memory stream
using (MemoryStream decryptionStream = new MemoryStream())
{
// Create the crypto stream
using (CryptoStream decrypt = new CryptoStream(decryptionStream, decryptor.CreateDecryptor(), CryptoStreamMode.Write))
{
// Encrypt
decrypt.Write(encryptedData, 0, encryptedData.Length);
decrypt.Flush();
decrypt.Close();
// Return the unencrypted data
byte[] decryptedData = decryptionStream.ToArray();
return UTF8Encoding.UTF8.GetString(decryptedData, 0, decryptedData.Length);
}
}
}
}
}

View File

@ -18,13 +18,34 @@ namespace PEP_Tool
MainWindow.main.BarVisibility = System.Windows.Visibility.Visible; MainWindow.main.BarVisibility = System.Windows.Visibility.Visible;
MainWindow.main.BarMax = l.Rows.Count; MainWindow.main.BarMax = l.Rows.Count;
sb.AppendLine($"Name;Vorname;Datum;Abteilung;Zuweisung;Bemerkung;" + Environment.NewLine); sb.AppendLine($"Name;Vorname;Datum;Kommen;Gehen;Schicht;Lizenzen;Abteilung;Zuweisung;Bemerkung;" + Environment.NewLine);
int count = 0; int count = 0;
foreach (System.Data.DataRow user in l.Rows) foreach (System.Data.DataRow user in l.Rows)
{ {
string Schicht = "";
switch(user.ItemArray[8].ToString().Substring(0, 2))
{
case "MT":
Schicht = "Tagschicht";
break;
case "MF":
Schicht = "Frühschicht";
break;
case "MS":
Schicht = "Spätschicht";
break;
case "MN":
Schicht = "Nachtschicht";
break;
default:
Schicht = "Schicht nicht erkannt";
break;
}
count++; count++;
sb.AppendLine($"{user.ItemArray[1]};{user.ItemArray[2]};{user.ItemArray[4].ToString().Split(' ')[0]};{user.ItemArray[3]};{user.ItemArray[9]};{user.ItemArray[10]};"); sb.AppendLine($"{user.ItemArray[1]};{user.ItemArray[2]};{user.ItemArray[4].ToString().Split(' ')[0]};{user.ItemArray[5]};{user.ItemArray[6]};{Schicht};{user.ItemArray[12]} Lizenzen;{user.ItemArray[3]};{user.ItemArray[9]};{user.ItemArray[10].ToString().Replace('\n', ' ').Replace('\r', ' ')};");
MainWindow.main.BarValue = count; MainWindow.main.BarValue = count;
} }

View File

@ -3,12 +3,51 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
namespace PEP_Tool namespace PEP_Tool
{ {
public static class Helper public static class Helper
{ {
public static Parent FindParent<Parent>(DependencyObject child)
where Parent : DependencyObject
{
DependencyObject parentObject = child;
//We are not dealing with Visual, so either we need to fnd parent or
//get Visual to get parent from Parent Heirarchy.
while (!((parentObject is System.Windows.Media.Visual)
|| (parentObject is System.Windows.Media.Media3D.Visual3D)))
{
if (parentObject is Parent || parentObject == null)
{
return parentObject as Parent;
}
else
{
parentObject = (parentObject as FrameworkContentElement).Parent;
}
}
//We have not found parent yet , and we have now visual to work with.
parentObject = VisualTreeHelper.GetParent(parentObject);
//check if the parent matches the type we're looking for
if (parentObject is Parent || parentObject == null)
{
return parentObject as Parent;
}
else
{
//use recursion to proceed with next level
return FindParent<Parent>(parentObject);
}
}
public static string RemoveSpecialCharacters(string str) public static string RemoveSpecialCharacters(string str)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -37,7 +76,7 @@ namespace PEP_Tool
key == System.Windows.Input.Key.System || key == System.Windows.Input.Key.Play) key == System.Windows.Input.Key.System || key == System.Windows.Input.Key.Play)
b = true; b = true;
else else
b = false; // the key will sappressed b = false; // the key will suppressed
return b; return b;
} }
@ -137,6 +176,7 @@ namespace PEP_Tool
} }
} }
public static List<Gewerk> DataTableToGewerk(System.Data.DataTable dataTable) public static List<Gewerk> DataTableToGewerk(System.Data.DataTable dataTable)
{ {
List<Gewerk> x = new List<Gewerk>(); List<Gewerk> x = new List<Gewerk>();
@ -154,6 +194,37 @@ namespace PEP_Tool
return x; return x;
} }
public static int returnIndexForString(string input)
{
if (input.Contains("0") && !Regex.IsMatch(input, "[1-9]")) return 0;
else if (input.Contains("110")) return 1;
else if (input.Contains("670")) return 2;
else if (input.Contains("15")) return 3;
else if (input.Contains("un")) return 4;
else return -1;
}
public static IEnumerable<System.Windows.Controls.DataGridRow> GetDataGridRows(System.Windows.Controls.DataGrid grid)
{
var itemsSource = grid.ItemsSource;
if (null == itemsSource) { yield break; }
foreach (var item in itemsSource)
{
var row = grid.ItemContainerGenerator.ContainerFromItem(item) as System.Windows.Controls.DataGridRow;
if (null != row) yield return row;
}
}
public static bool IsWindowOpen<T>(string name = "") where T : System.Windows.Window
{
return string.IsNullOrEmpty(name)
? System.Windows.Application.Current.Windows.OfType<T>().Any()
: System.Windows.Application.Current.Windows.OfType<T>().Any(w => w.Title.Equals(name));
}
} }
public class ReplaceDotConverter : System.Windows.Data.IValueConverter public class ReplaceDotConverter : System.Windows.Data.IValueConverter
@ -173,4 +244,21 @@ namespace PEP_Tool
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public class IndexConverter : System.Windows.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
{
return ((int)value + 1).ToString().Replace("0", "--");
}
else return "";
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
} }

View File

@ -199,6 +199,7 @@
<DataGridTextColumn Binding="{Binding Ende, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Bis" Width="*"/> <DataGridTextColumn Binding="{Binding Ende, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Bis" Width="*"/>
<DataGridTextColumn Binding="{Binding Zustand, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Schaltzustand" Width="*"/> <DataGridTextColumn Binding="{Binding Zustand, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Schaltzustand" Width="*"/>
<DataGridTextColumn Binding="{Binding Grund, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Arbeiten / Bemerkung" MinWidth="150" Width="*"/> <DataGridTextColumn Binding="{Binding Grund, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Arbeiten / Bemerkung" MinWidth="150" Width="*"/>
<DataGridTextColumn Binding="{Binding AddedOn}" Header="AddedOn" Width="0" MaxWidth="0"/>
<!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>--> <!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>-->
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
@ -216,5 +217,7 @@
<TextBlock Margin="0,14,135,0" TextWrapping="Wrap" Text="Abteilungsfilter:" VerticalAlignment="Top" TextAlignment="Right" HorizontalAlignment="Right" Width="95"/> <TextBlock Margin="0,14,135,0" TextWrapping="Wrap" Text="Abteilungsfilter:" VerticalAlignment="Top" TextAlignment="Right" HorizontalAlignment="Right" Width="95"/>
<Button x:Name="btnDateAll" Content="Alle Tage" HorizontalAlignment="Left" Margin="216,9,0,0" VerticalAlignment="Top" Width="94" Height="25" Click="BtnDateAll_Click"/> <Button x:Name="btnDateAll" Content="Alle Tage" HorizontalAlignment="Left" Margin="216,9,0,0" VerticalAlignment="Top" Width="94" Height="25" Click="BtnDateAll_Click"/>
<Button x:Name="btnToday" Content="Heute" HorizontalAlignment="Left" Margin="315,10,0,0" VerticalAlignment="Top" Width="75" Height="24" Click="BtnToday_Click"/> <Button x:Name="btnToday" Content="Heute" HorizontalAlignment="Left" Margin="315,10,0,0" VerticalAlignment="Top" Width="75" Height="24" Click="BtnToday_Click"/>
<TextBlock HorizontalAlignment="Left" Margin="410,1,0,0" TextWrapping="Wrap" Text="Zuletzt aktualisiert um:" VerticalAlignment="Top"/>
<TextBlock x:Name="lblLastRefresh" HorizontalAlignment="Left" Margin="410,19,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" TextAlignment="Center"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@ -20,11 +22,16 @@ namespace PEP_Tool
public partial class KTOverview : Window public partial class KTOverview : Window
{ {
public System.Data.DataTable Overview { get; private set; } = new System.Data.DataTable("Overview"); public System.Data.DataTable Overview { get; private set; } = new System.Data.DataTable("Overview");
public static KTOverview KTO;
public KTOverview() public KTOverview()
{ {
KTO = this;
InitializeComponent(); InitializeComponent();
var abtFilterList = MainWindow.main.AbteilungsNamen.Select(p => p.Value.Item2).Distinct().ToList(); var abtFilterList = MainWindow.main.AbteilungsNamen.Select(p => p.Value.Item2).Distinct().ToList();
//abtFilterList.Insert(0, ""); //abtFilterList.Insert(0, "");
abtFilterList.Sort(); abtFilterList.Sort();
@ -32,12 +39,14 @@ namespace PEP_Tool
dGView.DataContext = Overview; dGView.DataContext = Overview;
SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s`", Overview); SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s", Overview);
System.Data.DataTable dt = SQL.ReadSQL($"SELECT Min(str_to_date(Datum, '%Y-%m-%d')), max(str_to_date(Datum, '%Y-%m-%d')) from `schaltung`").Result; System.Data.DataTable dt = SQL.ReadSQL($"SELECT Min(str_to_date(Datum, '%Y-%m-%d')), max(str_to_date(Datum, '%Y-%m-%d')) from pep_tool.schaltung").Result;
dPDate.DisplayDateStart = Convert.ToDateTime(dt.Rows[0].ItemArray[0].ToString()); dPDate.DisplayDateStart = Convert.ToDateTime(dt.Rows[0].ItemArray[0].ToString());
dPDate.DisplayDateEnd = Convert.ToDateTime(dt.Rows[0].ItemArray[1].ToString()); dPDate.DisplayDateEnd = Convert.ToDateTime(dt.Rows[0].ItemArray[1].ToString());
SortList();
} }
private async void cBFilterAbteilung_SelectionChanged(object sender, SelectionChangedEventArgs e) private async void cBFilterAbteilung_SelectionChanged(object sender, SelectionChangedEventArgs e)
@ -45,25 +54,29 @@ namespace PEP_Tool
System.Diagnostics.Debug.WriteLine(cBFilterAbteilung.SelectedItem); System.Diagnostics.Debug.WriteLine(cBFilterAbteilung.SelectedItem);
if (dPDate.SelectedDate == null && (cBFilterAbteilung.SelectedItem == "" || cBFilterAbteilung.SelectedItem == null)) if (dPDate.SelectedDate == null && (cBFilterAbteilung.SelectedItem == "" || cBFilterAbteilung.SelectedItem == null))
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s`", Overview); await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s", Overview);
else if(dPDate.SelectedDate == null) else if(dPDate.SelectedDate == null)
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Abteilung = '{cBFilterAbteilung.SelectedItem}'", Overview); await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s WHERE Abteilung = '{cBFilterAbteilung.SelectedItem}'", Overview);
else else
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Abteilung = '{cBFilterAbteilung.SelectedItem}' AND Datum = '{Convert.ToDateTime(dPDate.SelectedDate).ToString("yyyy-MM-dd")}'", Overview); await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s WHERE Abteilung = '{cBFilterAbteilung.SelectedItem}' AND Datum = '{Convert.ToDateTime(dPDate.SelectedDate).ToString("yyyy-MM-dd")}'", Overview);
SortList();
} }
private async void DPDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e) private async void DPDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{ {
if (dPDate.SelectedDate == null && (cBFilterAbteilung.SelectedItem == "" || cBFilterAbteilung.SelectedItem == null)) if (dPDate.SelectedDate == null && (cBFilterAbteilung.SelectedItem == "" || cBFilterAbteilung.SelectedItem == null))
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s`", Overview); await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung s", Overview);
else else
{ {
if (cBFilterAbteilung.SelectedItem != "" && cBFilterAbteilung.SelectedItem != null) if (cBFilterAbteilung.SelectedItem != "" && cBFilterAbteilung.SelectedItem != null)
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Datum = '{Convert.ToDateTime(dPDate.SelectedDate).ToString("yyyy-MM-dd")}' AND Abteilung = '{cBFilterAbteilung.SelectedItem}'", Overview); await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s WHERE Datum = '{Convert.ToDateTime(dPDate.SelectedDate).ToString("yyyy-MM-dd")}' AND Abteilung = '{cBFilterAbteilung.SelectedItem}'", Overview);
else else
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Datum = '{Convert.ToDateTime(dPDate.SelectedDate).ToString("yyyy-MM-dd")}'", Overview); await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s WHERE Datum = '{Convert.ToDateTime(dPDate.SelectedDate).ToString("yyyy-MM-dd")}'", Overview);
} }
SortList();
} }
private void BtnDatePlus_Click(object sender, RoutedEventArgs e) private void BtnDatePlus_Click(object sender, RoutedEventArgs e)
@ -93,5 +106,27 @@ namespace PEP_Tool
this.Close(); this.Close();
} }
public async void refreshDGView()
{
if (dPDate.SelectedDate == null && (cBFilterAbteilung.SelectedItem == "" || cBFilterAbteilung.SelectedItem == null))
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s", Overview);
else if (dPDate.SelectedDate == null)
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s WHERE Abteilung = '{cBFilterAbteilung.SelectedItem}'", Overview);
else
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund,AddedOn FROM pep_tool.schaltung s WHERE Abteilung = '{cBFilterAbteilung.SelectedItem}' AND Datum = '{Convert.ToDateTime(dPDate.SelectedDate).ToString("yyyy-MM-dd")}'", Overview);
lblLastRefresh.Text = DateTime.Now.ToString();
SortList();
}
private void SortList()
{
dGView.Items.SortDescriptions.Clear();
dGView.Items.SortDescriptions.Add(new SortDescription("AddedOn", ListSortDirection.Descending));
dGView.Items.Refresh();
}
} }
} }

View File

@ -16,14 +16,14 @@ namespace PEP_Tool
try try
{ {
byte[] t = Encoding.ASCII.GetBytes(Text); byte[] t = Encoding.ASCII.GetBytes(Text);
if (!Directory.Exists(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt")); if (!Directory.Exists(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"));
//using (var fs = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt", FileMode.Append, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete)) //using (var fs = Writer.WaitForFile(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt", FileMode.Append, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete))
//{ //{
// fs.WriteAsync(t, (int)fs.Length, t.Count()); // fs.WriteAsync(t, (int)fs.Length, t.Count());
//} //}
WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}"); WaitForFile(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}");
} }
catch (Exception) catch (Exception)
{ {
@ -35,8 +35,8 @@ namespace PEP_Tool
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text); Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
try try
{ {
if (!Directory.Exists(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt")); if (!Directory.Exists(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"));
WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}"); WaitForFile(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}");
} }
catch (Exception) catch (Exception)
{ {
@ -48,8 +48,8 @@ namespace PEP_Tool
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text); Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
try try
{ {
if (!Directory.Exists(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt")); if (!Directory.Exists(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"));
WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}"); WaitForFile(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}");
} }
catch (Exception) catch (Exception)
{ {
@ -61,8 +61,9 @@ namespace PEP_Tool
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text); Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
try try
{ {
if (!Directory.Exists(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt")); //if (!Directory.Exists(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"));
WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}"); //WaitForFile(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}");
SendLogToDB(Text.ToString());
} }
catch (Exception) catch (Exception)
{ {
@ -74,14 +75,20 @@ namespace PEP_Tool
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text); Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
try try
{ {
if (!Directory.Exists(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt")); //if (!Directory.Exists(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt"));
WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}"); //WaitForFile(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Log\Log.txt", $"{DateTime.Now} v{Properties.Settings.Default.Version} {Environment.MachineName} {Environment.UserDomainName}:{Environment.NewLine}{Environment.NewLine} {Text.ToString()}{Environment.NewLine}{Environment.NewLine}");
SendLogToDB(Text.ToString());
} }
catch (Exception) catch (Exception)
{ {
} }
} }
private static void SendLogToDB(string Text)
{
SQL.WriteSQL($"INSERT INTO ProjektDB.errorLog (User, Message) VALUES ('{Environment.UserName}','{"1: " + Text}')");
}
public static bool IsFileReady(string filename) public static bool IsFileReady(string filename)
{ {
// If the file can be opened for exclusive access it means that the file // If the file can be opened for exclusive access it means that the file

View File

@ -29,7 +29,8 @@
<!-- <!--
</ResourceDictionary.MergedDictionaries>--> </ResourceDictionary.MergedDictionaries>-->
<local:ReplaceDotConverter x:Key="ReplaceDotConv" /> <local:ReplaceDotConverter x:Key="ReplaceDotConv"/>
<local:IndexConverter x:Key="IndexConverter"/>
<ControlTemplate x:Key="ComboBoxControlTemplate1" TargetType="{x:Type ComboBox}"> <ControlTemplate x:Key="ComboBoxControlTemplate1" TargetType="{x:Type ComboBox}">
<Grid x:Name="templateRoot" SnapsToDevicePixels="True"> <Grid x:Name="templateRoot" SnapsToDevicePixels="True">
@ -274,32 +275,35 @@
<!--xmlns:ValueEditors="clr-namespace:Microsoft.VisualStudio.DesignTools.Utility.ValueEditors;assembly=Microsoft.VisualStudio.DesignTools.Utility"--> <!--xmlns:ValueEditors="clr-namespace:Microsoft.VisualStudio.DesignTools.Utility.ValueEditors;assembly=Microsoft.VisualStudio.DesignTools.Utility"-->
<!--xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"--> <!--xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"-->
<Grid x:Name="gridSettings" Visibility="Visible" Margin="1" Grid.IsSharedSizeScope="True" Background="White"> <Grid x:Name="gridSettings" Visibility="Visible" Margin="1" Grid.IsSharedSizeScope="True" Background="White">
<Canvas x:Name="canvasImpressum" Canvas.Left="5" Canvas.Top="10" Canvas.Bottom="10" Canvas.Right="5" Background="White" Visibility="Collapsed" Margin="1" Width="1315" Height="654">
<TextBlock Canvas.Left="33" TextWrapping="Wrap" Canvas.Top="34" Height="381" Width="567" FontSize="14"><Run Text="Impressum:"/><LineBreak/><Run/><LineBreak/><Run Text="Copyright:"/><LineBreak/><Run Text="&#x9;Marcus Bachler "/><Run Text="© 2018 - 2024"/><LineBreak/><Run/><LineBreak/><Run Text="Design und Entwicklung:"/><LineBreak/><Run Text="&#x9;Marcus Bachler"/><LineBreak/><Run/><LineBreak/><Run Text="Dieses Tool ist nur zur internen Verwendung bestimmt."/><LineBreak/><Run Text="Bei Fragen und Anregungen bitte an Marcus Bachler wenden."/><LineBreak/><Run/></TextBlock>
<Button x:Name="btnCloseImpressum" Content="Schließen" Canvas.Right="40" Canvas.Bottom="40" Width="132" Height="27" Click="btnCloseImpressum_Click"/>
</Canvas>
<Canvas x:Name="canvasVersionInfo" Canvas.Left="5" Canvas.Top="10" Background="White" Visibility="Collapsed" Margin="1" Width="1315" Height="654">
<ContentControl Content="{StaticResource rtbVersionInfo}"/>
<Button x:Name="btnCloseVersionInfo" Content="Schließen" Canvas.Left="1135" Canvas.Top="585" Width="132" Height="27" Click="btnCloseVersionInfo_Click"/>
</Canvas>
<Canvas x:Name="canvasSettings" Margin="10,10,10,0" Background="White" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Top" Width="1315" Height="654"> <Canvas x:Name="canvasSettings" Margin="10,10,10,0" Background="White" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Top" Width="1315" Height="654">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Liste mit Lizenzen auswählen" VerticalAlignment="Top" Canvas.Left="10" Canvas.Top="10" Height="20" Width="180"/>
<Button x:Name="btnCloseSettings" Content="Speichern" Canvas.Left="1087" Canvas.Top="603" Width="200" Height="27" Click="btnCloseSettings_Click" VerticalAlignment="Bottom" HorizontalAlignment="Right"/> <Button x:Name="btnCloseSettings" Content="Speichern" Canvas.Left="1087" Canvas.Top="603" Width="200" Height="27" Click="btnCloseSettings_Click" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
<Button x:Name="btnCancelSettings" Content="Abbrechen" Canvas.Left="882" Canvas.Top="603" Width="200" Height="27" Click="btnCancelSettings_Click" VerticalAlignment="Bottom" HorizontalAlignment="Right"/> <!--<Button x:Name="btnCancelSettings" Content="Abbrechen" Canvas.Left="882" Canvas.Top="603" Width="200" Height="27" Click="btnCancelSettings_Click" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Canvas.Left="10" Canvas.Top="77" Height="20" Width="235"><Run Text="Liste mit "/><Run Text="Abteilungsbezeichnungen"/></TextBlock> <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Canvas.Left="10" Canvas.Top="77" Height="20" Width="235"><Run Text="Liste mit "/><Run Text="Abteilungsbezeichnungen"/></TextBlock>
<TextBox x:Name="tBAbtTranslatePath" Height="23" Canvas.Left="10" Canvas.Top="102" Width="1125" Background="White" MaxLines="1"/> <TextBox x:Name="tBAbtTranslatePath" Height="23" Canvas.Left="10" Canvas.Top="102" Width="1125" Background="White" MaxLines="1"/>
<Button x:Name="btnSelectAbtTranslateFile" Content="Auswählen" Canvas.Left="1140" Canvas.Top="102" Width="135" Click="btnSelectAbtTranslateFile_Click" HorizontalAlignment="Right"/> <Button x:Name="btnSelectAbtTranslateFile" Content="Auswählen" Canvas.Left="1140" Canvas.Top="102" Width="135" Click="btnSelectAbtTranslateFile_Click" HorizontalAlignment="Right"/>
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Liste möglicher Zuweisungen" VerticalAlignment="Top" Canvas.Left="10" Canvas.Top="142" Height="20" Width="180"/> <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Liste möglicher Zuweisungen" VerticalAlignment="Top" Canvas.Left="10" Canvas.Top="142" Height="20" Width="180"/>
<TextBox x:Name="tBZuweisungenPath" Height="23" Canvas.Left="10" Canvas.Top="167" Width="1125" Background="White" MaxLines="1"/> <TextBox x:Name="tBZuweisungenPath" Height="23" Canvas.Left="10" Canvas.Top="167" Width="1125" Background="White" MaxLines="1"/>
<Button x:Name="btnSelectZuweisungenFile" Content="Auswählen" Canvas.Left="1140" Canvas.Top="167" Width="135" Click="btnSelectZuweisungenFile_Click" HorizontalAlignment="Right" Margin="0"/> <Button x:Name="btnSelectZuweisungenFile" Content="Auswählen" Canvas.Left="1140" Canvas.Top="167" Width="135" Click="btnSelectZuweisungenFile_Click" HorizontalAlignment="Right" Margin="0"/>
<!--<Button x:Name="btnClear" Content="Zuweisungen und Bemerkungen leeren" HorizontalAlignment="Left" VerticalAlignment="Top" Width="238" Visibility="Visible" Canvas.Left="22" Canvas.Top="603" Height="27"/>--> --><!--<Button x:Name="btnClear" Content="Zuweisungen und Bemerkungen leeren" HorizontalAlignment="Left" VerticalAlignment="Top" Width="238" Visibility="Visible" Canvas.Left="22" Canvas.Top="603" Height="27"/>-->
<Button x:Name="btnImpressum" Content="Impressum" Canvas.Left="10" Canvas.Top="607" Width="238" Click="btnImpressum_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left"/> <Button x:Name="btnImpressum" Content="Impressum" Canvas.Left="10" Canvas.Top="607" Width="238" Click="btnImpressum_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Button x:Name="btnVersionInfo" Content="Versionsinfo" Canvas.Left="253" Canvas.Top="607" Width="238" Click="btnVersionInfo_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left"/> <Button x:Name="btnVersionInfo" Content="Versionsinfo" Canvas.Left="253" Canvas.Top="607" Width="238" Click="btnVersionInfo_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Canvas x:Name="canvasImpressum" Canvas.Left="5" Canvas.Top="10" Canvas.Bottom="10" Canvas.Right="5" Background="White" Visibility="Collapsed" Margin="1" Width="1315" Height="654">
<TextBlock Canvas.Left="33" TextWrapping="Wrap" Canvas.Top="34" Height="381" Width="567" FontSize="14"><Run Text="Impressum:"/><LineBreak/><Run/><LineBreak/><Run Text="Copyright:"/><LineBreak/><Run Text="&#x9;Marcus Bachler "/><Run Text="© 2018 - 2019"/><LineBreak/><Run/><LineBreak/><Run Text="Design und Entwicklung:"/><LineBreak/><Run Text="&#x9;Marcus Bachler"/><LineBreak/><Run/><LineBreak/><Run Text="Dieses Tool ist nur zur internen Verwendung bestimmt."/><LineBreak/><Run Text="Bei Fragen und Anregungen bitte an Marcus Bachler wenden."/><LineBreak/><Run/></TextBlock>
<Button x:Name="btnCloseImpressum" Content="Schließen" Canvas.Right="40" Canvas.Bottom="40" Width="132" Height="27" Click="btnCloseImpressum_Click"/>
</Canvas>
<Canvas x:Name="canvasVersionInfo" Canvas.Left="5" Canvas.Top="10" Background="White" Visibility="Collapsed" Margin="1" Width="1315" Height="654">
<ContentControl Content="{StaticResource rtbVersionInfo}"/>
<Button x:Name="btnCloseVersionInfo" Content="Schließen" Canvas.Left="1135" Canvas.Top="585" Width="132" Height="27" Click="btnCloseVersionInfo_Click"/>
</Canvas>
</Canvas> </Canvas>
@ -319,10 +323,17 @@
<Button x:Name="btnDatePickerToday" Content="Heute" HorizontalAlignment="Left" Margin="554,116,0,0" VerticalAlignment="Top" Width="75" Click="btnDatePickerToday_Click" Background="#4CDDDDDD" BorderBrush="#4C707070"/> <Button x:Name="btnDatePickerToday" Content="Heute" HorizontalAlignment="Left" Margin="554,116,0,0" VerticalAlignment="Top" Width="75" Click="btnDatePickerToday_Click" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<Button x:Name="btnAllDays" Content="Alle Tage" HorizontalAlignment="Left" Margin="340,116,0,0" VerticalAlignment="Top" Width="75" Click="btnAllDays_Click" Background="#4CDDDDDD" BorderBrush="#4C707070"/> <Button x:Name="btnAllDays" Content="Alle Tage" HorizontalAlignment="Left" Margin="340,116,0,0" VerticalAlignment="Top" Width="75" Click="btnAllDays_Click" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<!--<Button x:Name="btnOpenFile" Content="Datei öffnen" Margin="0,59,9.8,0" VerticalAlignment="Top" Height="40" HorizontalAlignment="Right" Width="137" Click="btnOpenFile_Click" Background="#4CDDDDDD" BorderBrush="#4C707070" IsEnabled="False"/>--> <!--<Button x:Name="btnOpenFile" Content="Datei öffnen" Margin="0,59,9.8,0" VerticalAlignment="Top" Height="40" HorizontalAlignment="Right" Width="137" Click="btnOpenFile_Click" Background="#4CDDDDDD" BorderBrush="#4C707070" IsEnabled="False"/>-->
<Button x:Name="btnSettings" Content="Einstellungen" Margin="0,14,9.8,0" VerticalAlignment="Top" Height="40" Click="btnSettings_Click" HorizontalAlignment="Right" Width="137" Background="#4CDDDDDD" BorderBrush="#4C707070"/> <Button x:Name="btnSettings" Content="?" Margin="0,14,9.8,0" VerticalAlignment="Top" Height="20" Click="btnSettings_Click" HorizontalAlignment="Right" Width="20" Background="#4CDDDDDD" BorderBrush="#4C707070">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="Impressum" Click="btnImpressum_Click"/>
<MenuItem Header="Versionsinfo" Click="btnVersionInfo_Click"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
<TextBlock HorizontalAlignment="Left" Margin="639,115,0,0" TextWrapping="Wrap" Text="Abteilungsfilter" VerticalAlignment="Top" Width="98" TextAlignment="Right"/> <TextBlock HorizontalAlignment="Left" Margin="639,95,0,0" TextWrapping="Wrap" Text="Abteilungsfilter" VerticalAlignment="Top" Width="98" TextAlignment="Right"/>
<ComboBox x:Name="cBFilterAbteilung" HorizontalAlignment="Left" Margin="755,113,0,0" VerticalAlignment="Top" Width="120" SelectionChanged="cBFilterAbteilung_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}"> <ComboBox x:Name="cBFilterAbteilung" HorizontalAlignment="Left" Margin="755,93,0,0" VerticalAlignment="Top" Width="120" SelectionChanged="cBFilterAbteilung_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox.Background> <ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/> <GradientStop Color="#4CF0F0F0" Offset="0"/>
@ -330,7 +341,7 @@
</LinearGradientBrush> </LinearGradientBrush>
</ComboBox.Background> </ComboBox.Background>
</ComboBox> </ComboBox>
<ComboBox x:Name="cBFilterAbteilung2" HorizontalAlignment="Left" Margin="755,135,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False" SelectionChanged="cBFilterAbteilung2_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}"> <ComboBox x:Name="cBFilterAbteilung2" HorizontalAlignment="Left" Margin="755,115,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False" SelectionChanged="cBFilterAbteilung2_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox.Background> <ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/> <GradientStop Color="#4CF0F0F0" Offset="0"/>
@ -338,7 +349,15 @@
</LinearGradientBrush> </LinearGradientBrush>
</ComboBox.Background> </ComboBox.Background>
</ComboBox> </ComboBox>
<ComboBox x:Name="cBFilterAbteilung3" HorizontalAlignment="Left" Margin="755,157,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False" SelectionChanged="cBFilterAbteilung3_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}"> <ComboBox x:Name="cBFilterAbteilung4" HorizontalAlignment="Left" Margin="755,157,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False" SelectionChanged="cBFilterAbteilung4_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/>
<GradientStop Color="#4CE5E5E5" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
</ComboBox>
<ComboBox x:Name="cBFilterAbteilung3" HorizontalAlignment="Left" Margin="755,137,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False" SelectionChanged="cBFilterAbteilung3_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox.Background> <ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0"> <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/> <GradientStop Color="#4CF0F0F0" Offset="0"/>
@ -379,25 +398,35 @@
<Button x:Name="btnPrint" Content="6" Margin="0,104,10,0" IsDefault="True" MinWidth="2" Padding="0,1,0,0" FontFamily="Wingdings 2" FontSize="24" Click="btnPrint_Click" ToolTip="Aktuelle Ansicht drucken" Height="30" VerticalAlignment="Top" HorizontalAlignment="Right" Width="30" Visibility="Visible" Background="#4CDDDDDD" BorderBrush="#4C707070"/> <Button x:Name="btnPrint" Content="6" Margin="0,104,10,0" IsDefault="True" MinWidth="2" Padding="0,1,0,0" FontFamily="Wingdings 2" FontSize="24" Click="btnPrint_Click" ToolTip="Aktuelle Ansicht drucken" Height="30" VerticalAlignment="Top" HorizontalAlignment="Right" Width="30" Visibility="Visible" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<Button x:Name="btnExport" Content="&lt;" Margin="0,135,10,0" IsDefault="True" MinWidth="2" Padding="0,1,0,0" FontFamily="Wingdings" FontSize="24" Click="btnExport_Click" ToolTip="Aktuelle Ansicht exportieren" HorizontalAlignment="Right" Width="30" Height="30" VerticalAlignment="Top" Background="#4CDDDDDD" BorderBrush="#4C707070"/> <Button x:Name="btnExport" Content="&lt;" Margin="0,135,10,0" IsDefault="True" MinWidth="2" Padding="0,1,0,0" FontFamily="Wingdings" FontSize="24" Click="btnExport_Click" ToolTip="Aktuelle Ansicht exportieren" HorizontalAlignment="Right" Width="30" Height="30" VerticalAlignment="Top" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<CheckBox x:Name="cBzuweisungFullDataset" Content="Zuweisung alle Tage" Margin="895,147,0,0" Height="21" VerticalAlignment="Top" Padding="3,-1,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left" Width="135" ToolTip="Ist dieser Haken gesetzt wird die Auswahl der Zuweisung auf alle Tage des Mitarbeiters gesetzt"/> <CheckBox x:Name="cBzuweisungFullDataset" Content="Zuweisung alle Tage" Margin="895,147,0,0" Height="21" VerticalAlignment="Top" Padding="3,-1,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left" Width="135" ToolTip="Ist dieser Haken gesetzt wird die Auswahl der Zuweisung auf alle Tage des Mitarbeiters gesetzt"/>
<Line Fill="#99000000" HorizontalAlignment="Left" Height="4" Margin="742,124,0,0" Stroke="#99000000" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y1="2" Y2="2"/>
<Line x:Name="lineHor1" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung2}" HorizontalAlignment="Left" Height="4" Margin="742,145,0,0" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y2="2" Y1="2" X2="6" Style="{DynamicResource LineStyle}"/> <Line Fill="#99000000" HorizontalAlignment="Left" Height="4" Margin="742,101,0,0" Stroke="#99000000" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y1="2" Y2="2"/>
<Line x:Name="lineVert1" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung2}" HorizontalAlignment="Left" Height="46" Margin="742,125,0,0" VerticalAlignment="Top" Width="15" X1="5" StrokeThickness="2" X2="5" Y1="23" Y2="2" Style="{DynamicResource LineStyle}"/> <Line x:Name="lineHor1" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung2}" HorizontalAlignment="Left" Height="4" Margin="742,124,0,0" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y2="2" Y1="2" X2="6" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineVert2" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung3}" HorizontalAlignment="Left" Height="46" Margin="742,125,0,0" VerticalAlignment="Top" Width="15" X1="5" StrokeThickness="2" X2="5" Y1="23" Y2="43" Style="{DynamicResource LineStyle}"/> <Line x:Name="lineVert1" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung2}" HorizontalAlignment="Left" Height="46" Margin="742,102,0,0" VerticalAlignment="Top" Width="15" X1="5" StrokeThickness="2" X2="5" Y1="23" Y2="2" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineHor2" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung3}" HorizontalAlignment="Left" Height="4" Margin="742,167,0,0" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y1="2" Y2="2" X2="4" Style="{DynamicResource LineStyle}"/> <Line x:Name="lineVert2" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung3}" HorizontalAlignment="Left" Height="46" Margin="742,102,0,0" VerticalAlignment="Top" Width="15" X1="5" StrokeThickness="2" X2="5" Y1="23" Y2="43" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineHor2" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung3}" HorizontalAlignment="Left" Height="4" Margin="742,144,0,0" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y1="2" Y2="2" X2="4" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineVert3" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung4}" HorizontalAlignment="Left" Height="46" Margin="742,124,0,0" VerticalAlignment="Top" Width="15" X1="5" StrokeThickness="2" X2="5" Y1="23" Y2="43" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineHor3" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung4}" HorizontalAlignment="Left" Height="4" Margin="742,166,0,0" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y1="2" Y2="2" X2="4" Style="{DynamicResource LineStyle}"/>
<TextBlock HorizontalAlignment="Left" Margin="901,105,0,0" TextWrapping="Wrap" Text="Letzte Datenänderung:" VerticalAlignment="Top" Width="124" Height="20"/> <TextBlock HorizontalAlignment="Left" Margin="901,105,0,0" TextWrapping="Wrap" Text="Letzte Datenänderung:" VerticalAlignment="Top" Width="124" Height="20"/>
<TextBlock x:Name="lblLastChange" HorizontalAlignment="Left" Margin="901,125,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="124" Text="" TextAlignment="Center"/> <TextBlock x:Name="lblLastChange" HorizontalAlignment="Left" Margin="901,125,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="124" Text="" TextAlignment="Center"/>
<Button x:Name="btnMinusDay" Content="-" HorizontalAlignment="Left" Margin="420,142,0,0" VerticalAlignment="Top" Width="55" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnMinusDay_Click"/> <Button x:Name="btnMinusDay" Content="-" HorizontalAlignment="Left" Margin="420,142,0,0" VerticalAlignment="Top" Width="55" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnMinusDay_Click"/>
<Button x:Name="btnPlusDay" Content="+" HorizontalAlignment="Left" Margin="494,142,0,0" VerticalAlignment="Top" Width="55" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnPlusDay_Click"/> <Button x:Name="btnPlusDay" Content="+" HorizontalAlignment="Left" Margin="494,142,0,0" VerticalAlignment="Top" Width="55" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnPlusDay_Click"/>
<Button x:Name="btnZugZuweisungen" Content="Zugzuweisung&#xD;&#xA; hinzufügen" Margin="0,14,150,0" VerticalAlignment="Top" Height="40" HorizontalContentAlignment="Center" IsEnabled="False" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnZugZuweisungen_Click" HorizontalAlignment="Right" Width="135" Visibility="Hidden"/> <Button x:Name="btnZugZuweisungen" Content="Zugzuweisung&#xA; hinzufügen" Margin="0,14,150,0" VerticalAlignment="Top" Height="40" HorizontalContentAlignment="Center" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnZugZuweisungen_Click" HorizontalAlignment="Right" Width="135" Visibility="Collapsed"/>
<Button x:Name="btnPlannedKT" Content="KT Planung Übersicht" Margin="0,59,10,0" VerticalAlignment="Top" Height="40" HorizontalAlignment="Right" Width="137" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnPlannedKT_Click"/> <Button x:Name="btnPlannedKT" Content="KT Planung Übersicht" Margin="0,59,10,0" VerticalAlignment="Top" Height="40" HorizontalAlignment="Right" Width="137" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="BtnPlannedKT_Click" Visibility="Collapsed"/>
<Button x:Name="btnVorplanung" Visibility="Collapsed" Content="Vorplanung" Margin="0,59,150,0" VerticalAlignment="Top" HorizontalAlignment="Right" Height="40" Width="135" Background="#4CDDDDDD" BorderBrush="#4C707070" Click="btnVorplanung_Click"/>
</Grid> </Grid>
<Grid x:Name="gridTable" Margin="0,0,0,2" MinHeight="200" Height="466" VerticalAlignment="Bottom" Visibility="Visible"> <Grid x:Name="gridTable" Margin="0,0,0,2" MinHeight="200" Height="466" VerticalAlignment="Bottom" Visibility="Visible">
<!--<Grid.RowDefinitions>
<RowDefinition Height="229*"/>
<RowDefinition Height="237*"/>
</Grid.RowDefinitions>-->
<DataGrid x:Name="flowDocu" ColumnWidth="*" HorizontalGridLinesBrush="Gray" ItemsSource="{Binding Path=., Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalGridLinesBrush="#99808080" AlternatingRowBackground="#4CFFFFFF" RowBackground="#99E6E6FA" AutoGenerateColumns="False" CanUserAddRows="False" VerticalContentAlignment="Bottom" HorizontalContentAlignment="Stretch" Margin="5,0,5,5" GridLinesVisibility="None" Padding="0,0,0,1" MinHeight="200" Background="#4CF0F0F0" Template="{DynamicResource DataGridControlTemplate1}" SelectionMode="Single" CanUserResizeRows="False" HeadersVisibility="Column" BorderBrush="#FFADB2B5" MinWidth="60"> <DataGrid x:Name="flowDocu" ColumnWidth="*" HorizontalGridLinesBrush="Gray" ItemsSource="{Binding Path=., Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalGridLinesBrush="#99808080" AlternatingRowBackground="#4CFFFFFF" RowBackground="#99E6E6FA" AutoGenerateColumns="False" CanUserAddRows="False" VerticalContentAlignment="Bottom" HorizontalContentAlignment="Stretch" Margin="5,0,5,27" GridLinesVisibility="None" Padding="0,0,0,1" MinHeight="200" Background="#4CF0F0F0" Template="{DynamicResource DataGridControlTemplate1}" SelectionMode="Single" CanUserResizeRows="False" HeadersVisibility="Column" BorderBrush="#FFADB2B5" MinWidth="60" Grid.RowSpan="2">
<DataGrid.Resources> <DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
@ -443,7 +472,7 @@
<DataTemplate> <DataTemplate>
<Grid> <Grid>
<TextBlock Text="{Binding AnzahlLizenzen, StringFormat='{}{0} Lizenzen'}" TextAlignment="Center" Margin="-5,2,0,0"/> <TextBlock Text="{Binding AnzahlLizenzen, StringFormat='{}{0} Lizenzen'}" TextAlignment="Center" Margin="-5,2,0,0"/>
<ComboBox Text="Lizenzen" Template="{DynamicResource ComboBoxControlTemplate1}" IsSynchronizedWithCurrentItem="True" IsReadOnly="True" SelectionChanged="Lizenzen_SelectionChanged" DropDownOpened="Lizenzen_DropDownOpened"> <ComboBox Text="Lizenzen" Template="{StaticResource ComboBoxControlTemplate1}" IsSynchronizedWithCurrentItem="True" IsReadOnly="True" SelectionChanged="Lizenzen_SelectionChanged" DropDownOpened="Lizenzen_DropDownOpened">
<!--Template="{DynamicResource ComboBoxControlTemplate1}" SelectedIndex="0"--> <!--Template="{DynamicResource ComboBoxControlTemplate1}" SelectedIndex="0"-->
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate> <DataTemplate>
@ -489,7 +518,7 @@
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTemplateColumn Header="Zug" IsReadOnly="True" MaxWidth="120" CanUserReorder="False" CanUserSort="True" MinWidth="80" > <DataGridTemplateColumn x:Name="columnZug" Header="Zug" IsReadOnly="True" MaxWidth="120" CanUserReorder="False" CanUserSort="True" MinWidth="80" Visibility="Collapsed" >
<DataGridTemplateColumn.HeaderStyle> <DataGridTemplateColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader"> <Style TargetType="DataGridColumnHeader">
<Setter Property="ToolTip" Value="Klicken um Mitarbeiter zum Zug inkl. Schaltzustände zuzuweisen"/> <Setter Property="ToolTip" Value="Klicken um Mitarbeiter zum Zug inkl. Schaltzustände zuzuweisen"/>
@ -505,9 +534,9 @@
</DataGridTemplateColumn> </DataGridTemplateColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<ProgressBar x:Name="bar" Height="66" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="100" IsIndeterminate="True" Visibility="Collapsed"/> <ProgressBar x:Name="bar" Height="66" Margin="608,200,607,200" VerticalAlignment="Center" HorizontalAlignment="Center" Width="100" IsIndeterminate="True" Visibility="Collapsed" Grid.RowSpan="2"/>
<TextBlock x:Name="lblBar" Visibility="Collapsed" Margin="0" TextAlignment="Center" FontWeight="Bold" Padding="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="66"><Run Text="Dieser Vorgang"/><LineBreak/><Run Text="kann einige"/><LineBreak/><Run Text="Sekunden dauern"/></TextBlock> <TextBlock x:Name="lblBar" Visibility="Collapsed" Margin="658,200,657,200" TextAlignment="Center" FontWeight="Bold" Padding="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="66" Grid.RowSpan="2"><Run Text="Dieser Vorgang"/><LineBreak/><Run Text="kann einige"/><LineBreak/><Run Text="Sekunden dauern"/></TextBlock>
<local:ucSpinnerPiston x:Name="li" Margin="0" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Visibility="Collapsed" > <local:ucSpinnerPiston x:Name="li" Margin="0" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Grid.RowSpan="2" Visibility="Collapsed" >
<local:ucSpinnerPiston.RenderTransform> <local:ucSpinnerPiston.RenderTransform>
<TransformGroup> <TransformGroup>
<ScaleTransform ScaleX="2" ScaleY="2"/> <ScaleTransform ScaleX="2" ScaleY="2"/>
@ -518,6 +547,17 @@
</local:ucSpinnerPiston.RenderTransform> </local:ucSpinnerPiston.RenderTransform>
</local:ucSpinnerPiston> </local:ucSpinnerPiston>
<Border x:Name="canvasMaintenance" Grid.RowSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="3" BorderThickness="1" BorderBrush="Black" Background="White" Width="250" Height="70" Margin="0,170,0,0" Visibility="Collapsed" >
<TextBlock TextWrapping="Wrap" Margin="0" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" ><Run Text="Bitte warten..."/><LineBreak/><Run/><LineBreak/><Run Text="Die Anwendung"/><Run Text=" "/><Run Text="ist in Kürze wieder verfügbar"/></TextBlock>
</Border>
<TextBlock x:Name="lblStatusBar" VerticalAlignment="Bottom" Background="WhiteSmoke" Height="22">
<Run Text=" Zeile "/>
<Run Text="{Binding SelectedIndex, ElementName=flowDocu, Mode=OneWay, Converter={StaticResource IndexConverter}}"/>
<Run Text=" von "/>
<Run Text="{Binding Items.Count, ElementName=flowDocu, Mode=OneWay}"/>
<Run Text="{Binding filterString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat=' | {0}', FallbackValue=' ohne Filter', RelativeSource={RelativeSource AncestorType=local:MainWindow, Mode=FindAncestor}}"/>
</TextBlock>
</Grid> </Grid>
</StackPanel> </StackPanel>

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -28,7 +29,7 @@ namespace PEP_Tool
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
FileSystemWatcher fs = new FileSystemWatcher(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\", "*.json"); //FileSystemWatcher fs = new FileSystemWatcher(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\", "*.json");
DispatcherTimer bemerkungTimer = new DispatcherTimer(); DispatcherTimer bemerkungTimer = new DispatcherTimer();
@ -38,11 +39,16 @@ namespace PEP_Tool
#region Properties #region Properties
public bool isKTEnabled { get; set; } = false;
public List<string> ZuweisungsMoeglichkeiten { get; set; } public List<string> ZuweisungsMoeglichkeiten { get; set; }
public Dictionary<string, Tuple<string, string>> AbteilungsNamen { get; set; } public Dictionary<string, Tuple<string, string>> AbteilungsNamen { get; set; }
private string lastChangeTime; private string lastChangeTime = DateTime.MinValue.ToString("dd.MM. HH:mm:ss");
public string LastChangeTime public string LastChangeTime
{ {
get get
@ -59,13 +65,22 @@ namespace PEP_Tool
})); }));
} }
} }
private string filterS = " ohne Filter";
public string filterString
{
get { return filterS; }
set { filterS = value; OnPropertyChanged(); }
}
public DataTable sqlList = new DataTable("UserList"); public DataTable sqlList = new DataTable("UserList");
#endregion #endregion
public MainWindow() public MainWindow()
{ {
if (Properties.Settings.Default.newVersionString != Properties.Settings.Default.Version) if (Properties.Settings.Default.newVersionString != Properties.Settings.Default.Version)
{ {
Properties.Settings.Default.newVersionScreen = true; Properties.Settings.Default.newVersionScreen = true;
@ -73,13 +88,13 @@ namespace PEP_Tool
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
if (System.IO.File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Version.txt")) if (System.IO.File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Version.txt"))
{ {
main = this; main = this;
PreStart(1); PreStart(1);
} }
#if !DEBUG #if !DEBUG
else if (System.IO.File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Maintenance.txt")) else if (System.IO.File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Maintenance.txt"))
{ {
main = this; main = this;
PreStart(2); PreStart(2);
@ -119,6 +134,13 @@ namespace PEP_Tool
this.Title += Properties.Settings.Default.Version; this.Title += Properties.Settings.Default.Version;
if (isKTEnabled)
{
btnZugZuweisungen.Visibility = Visibility.Visible;
btnPlannedKT.Visibility = Visibility.Visible;
columnZug.Visibility = Visibility.Visible;
}
} }
public static bool MessageShown { get; set; } = false; public static bool MessageShown { get; set; } = false;
@ -131,6 +153,7 @@ namespace PEP_Tool
/// <param name="VersionOrMaintenance">1: Neue Version, 2: Wartungsarbeiten</param> /// <param name="VersionOrMaintenance">1: Neue Version, 2: Wartungsarbeiten</param>
private async void PreStart(int VersionOrMaintenance) private async void PreStart(int VersionOrMaintenance)
{ {
CheckWorkingDir();
onStartup = true; onStartup = true;
if (VersionOrMaintenance == 1) if (VersionOrMaintenance == 1)
@ -175,12 +198,26 @@ namespace PEP_Tool
} }
} }
private void CheckWorkingDir()
{
if (Environment.CurrentDirectory.StartsWith(@"\\"))
{
//MessageBox.Show("Die Anwendung darf nicht vom Netzlaufwerk gestartet werden!\n\n", "Warnung!", MessageBoxButton.OK, MessageBoxImage.Error);
XMessageBox box = new XMessageBox("Warnung!", "Die Anwendung darf nicht vom Netzlaufwerk gestartet werden!\n\nDie Anwendung wird automatisch in 10 Sekunden geschlossen", MessageBoxImage.Warning);
box.ShowDialog();
//Application.Current.Shutdown();
}
}
private async void Start() private async void Start()
{ {
bemerkungTimer.Interval = TimeSpan.FromSeconds(10); bemerkungTimer.Interval = TimeSpan.FromSeconds(30);
bemerkungTimer.Tick += (sender, e) => { BemerkungTimer_Tick(sender, e); }; bemerkungTimer.Tick += (sender, e) => { BemerkungTimer_Tick(sender, e); };
telefonTimer.Interval = TimeSpan.FromSeconds(10); telefonTimer.Interval = TimeSpan.FromSeconds(30);
telefonTimer.Tick += TelefonTimer_Tick; telefonTimer.Tick += TelefonTimer_Tick;
newVersionTimer.Interval = TimeSpan.FromSeconds(10); newVersionTimer.Interval = TimeSpan.FromSeconds(10);
@ -188,6 +225,8 @@ namespace PEP_Tool
li.Visibility = Visibility.Visible; li.Visibility = Visibility.Visible;
LastChangeTime = ReadLastUpdate();
await Task.Run(() => await Task.Run(() =>
{ {
ZuweisungsMoeglichkeiten = Reader.ReadZuweisungsMoeglichkeiten(); ZuweisungsMoeglichkeiten = Reader.ReadZuweisungsMoeglichkeiten();
@ -202,7 +241,7 @@ namespace PEP_Tool
var abtFilterList = AbteilungsNamen.Select(p => p.Value.Item2).Distinct().ToList(); var abtFilterList = AbteilungsNamen.Select(p => p.Value.Item2).Distinct().ToList();
//abtFilterList.Insert(0, ""); //abtFilterList.Insert(0, "");
abtFilterList.Sort(); abtFilterList.Sort();
cBFilterAbteilung.ItemsSource = cBFilterAbteilung2.ItemsSource = cBFilterAbteilung3.ItemsSource = abtFilterList; cBFilterAbteilung.ItemsSource = cBFilterAbteilung2.ItemsSource = cBFilterAbteilung3.ItemsSource = cBFilterAbteilung4.ItemsSource = abtFilterList;
flowDocu.DataContext = sqlList; flowDocu.DataContext = sqlList;
@ -215,18 +254,20 @@ namespace PEP_Tool
newVersionTimer.Start(); newVersionTimer.Start();
FileWatcher(); //FileWatcher();
for (var i = 0; i <= 7; i++) for (var i = 0; i <= 7; i++)
flowDocu.Columns[i].Width = flowDocu.Columns[i].ActualWidth + 40; flowDocu.Columns[i].Width = flowDocu.Columns[i].ActualWidth + 40;
SQL.WriteSQL($"REPLACE INTO track SET `Client` = '{Environment.MachineName}', `User` = '{Environment.UserName}', `Online` = true, `Version` = '{Properties.Settings.Default.Version}'"); SQL.WriteSQL($"REPLACE INTO track SET Client = '{Environment.MachineName}', User = '{Environment.UserName}', Online = true, Version = '{Properties.Settings.Default.Version}'");
//SQL.WriteSQL($"IF EXISTS (SELECT @Client From pep_tool.track WHERE @Client = '{Environment.MachineName}') UPDATE @Client = '{Environment.MachineName}', @User = '{Environment.UserName}', @Online = true, @Version = '{Properties.Settings.Default.Version}' ELSE INSERT @Client = '{Environment.MachineName}', @User = '{Environment.UserName}', @Online = true, @Version = '{Properties.Settings.Default.Version}'");
//SQL.WriteSQL($"IF EXISTS (SELECT Client From pep_tool.track WHERE Client = '{Environment.MachineName}') UPDATE pep_tool.track SET Client = '{Environment.MachineName}', [User] = '{Environment.UserName}', [Online] = 1, Version = '{Properties.Settings.Default.Version}' WHERE Client = '{Environment.MachineName}' ELSE INSERT INTO pep_tool.track ([Client], [User], [Online], [Version]) VALUES ('{Environment.MachineName}','{Environment.UserName}',1,'{Properties.Settings.Default.Version}')");
} }
bool versionMessage = false; bool versionMessage = false;
private void NewVersionTimer_Tick(object sender, EventArgs e) private void NewVersionTimer_Tick(object sender, EventArgs e)
{ {
if (System.IO.File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Version.txt")) if (System.IO.File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Version.txt"))
{ {
if (!versionMessage) if (!versionMessage)
{ {
@ -239,13 +280,15 @@ namespace PEP_Tool
} }
} }
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Maintenance.txt"))//@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Maintenance.txt")) if (File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Maintenance.txt"))//@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Maintenance.txt"))
{ {
if (!versionMessage) if (!versionMessage)
{ {
flowDocu.IsEnabled = false; flowDocu.IsEnabled = false;
DisableFilterChange(); DisableFilterChange();
li.Visibility = Visibility.Visible; li.Visibility = Visibility.Visible;
canvasMaintenance.Visibility = Visibility.Visible;
//Task.Run(() => MessageBox.Show("Es ist eine neue Version verfügbar\nDie Anwendung wird in 60 Sekunden automatisch beendet.", "Neue Version", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification)); //Task.Run(() => MessageBox.Show("Es ist eine neue Version verfügbar\nDie Anwendung wird in 60 Sekunden automatisch beendet.", "Neue Version", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification));
MessageBox.Show(this, "Die Anwendung kann aufgrund von Wartungsarbeiten aktuell nicht genutzt werden\nDie Anwendung wird anschließend automatisch freigeschaltet.\n\n", "Info", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); MessageBox.Show(this, "Die Anwendung kann aufgrund von Wartungsarbeiten aktuell nicht genutzt werden\nDie Anwendung wird anschließend automatisch freigeschaltet.\n\n", "Info", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
@ -253,7 +296,7 @@ namespace PEP_Tool
} }
} }
if (versionMessage && !File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Maintenance.txt")) if (versionMessage && !File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Maintenance.txt"))
{ {
sqlList = SQL.ReadAllData(sqlList.DefaultView.RowFilter).Result; sqlList = SQL.ReadAllData(sqlList.DefaultView.RowFilter).Result;
flowDocu.DataContext = sqlList; flowDocu.DataContext = sqlList;
@ -261,30 +304,61 @@ namespace PEP_Tool
flowDocu.IsEnabled = true; flowDocu.IsEnabled = true;
EnableFilterChange(); EnableFilterChange();
li.Visibility = Visibility.Collapsed; li.Visibility = Visibility.Collapsed;
canvasMaintenance.Visibility = Visibility.Collapsed;
MessageBox.Show(this, "Die Anwendung steht Ihnen jetzt wieder zur Verfügung!\n\n", "Info", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); MessageBox.Show(this, "Die Anwendung steht Ihnen jetzt wieder zur Verfügung!\n\n", "Info", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
versionMessage = false; versionMessage = false;
} }
var x = ReadLastUpdate();
LastChangeTime = x;
} }
private string ReadLastUpdate()
private void FileWatcher()
{ {
FileSystemWatcher fs = new FileSystemWatcher(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\", "sql.lck"); var x = SQL.ReadSQL("SELECT Value FROM pep_tool.misc WHERE `idmisc`='LastUpdate'").Result.Rows[0].ItemArray[0].ToString();
fs.EnableRaisingEvents = true; //var newTime = DateTime.TryParse(x, out DateTime date);
fs.IncludeSubdirectories = false; //var oldTime = DateTime.TryParse(LastChangeTime, out DateTime result);
var newTime = DateTime.MinValue;
newTime = DateTime.ParseExact(x, "dd.MM. HH:mm:ss", CultureInfo.InvariantCulture);
var oldTime = DateTime.MinValue;
oldTime = DateTime.ParseExact(LastChangeTime, "dd.MM. HH:mm:ss", CultureInfo.InvariantCulture);
fs.Changed += Fs_Changed; if (newTime != DateTime.MinValue && oldTime != DateTime.MinValue)
if(newTime > oldTime) RefreshData();
li.Visibility = Visibility.Collapsed; return x;
} }
private async void RefreshData()
{
await Task.Run(() =>
{
sqlList = SQL.ReadAllData(sqlList.DefaultView.RowFilter).Result;
});
flowDocu.DataContext = sqlList;
}
//private void FileWatcher()
//{
// FileSystemWatcher fs = new FileSystemWatcher(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\", "sql.lck");
// fs.EnableRaisingEvents = true;
// fs.IncludeSubdirectories = false;
// fs.Changed += Fs_Changed;
// li.Visibility = Visibility.Collapsed;
//}
int fsChangeError = 0; int fsChangeError = 0;
bool checkOldJsonData = true; bool checkOldJsonData = true;
string eName = ""; string eName = "";
private async void Fs_Changed(object sender, FileSystemEventArgs e) private async void Fs_Changed(object sender, FileSystemEventArgs e)
{ {
var x = File.GetLastWriteTime(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\sql.lck").ToString("HH:mm:ss dd.MM.yy"); var x = ReadLastUpdate();
LastChangeTime = x; LastChangeTime = x;
//await Task.Delay(20); //await Task.Delay(20);
@ -292,6 +366,9 @@ namespace PEP_Tool
{ {
sqlList = SQL.ReadAllData(sqlList.DefaultView.RowFilter).Result; sqlList = SQL.ReadAllData(sqlList.DefaultView.RowFilter).Result;
flowDocu.DataContext = sqlList; flowDocu.DataContext = sqlList;
if (Helper.IsWindowOpen<Window>("KT Planung Übersicht"))
KTOverview.KTO.refreshDGView();
})); }));
} }
@ -312,7 +389,9 @@ namespace PEP_Tool
persnummer = flowDocu.Columns[9].GetCellContent(flowDocu.Items[index]) as TextBlock; persnummer = flowDocu.Columns[9].GetCellContent(flowDocu.Items[index]) as TextBlock;
var zuw = box.SelectedItem.ToString(); var zuw = box.SelectedItem.ToString();
await SQL.WriteSQL($"UPDATE `mitarbeiter_static` `p` left join `mitarbeiter_change` `o` ON o.mitarbeiter_static_PersNr = p.PersNr SET Zuweisung = '{zuw}' WHERE p.PersNr = '{persnummer.Text}' AND o.Datum = '{Convert.ToDateTime(datum.Text).ToString("yyyy-MM-dd")}'", sqlList); await SQL.WriteSQL($"UPDATE pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr SET Zuweisung = '{zuw}' WHERE p.PersNr = '{persnummer.Text}' AND o.Datum = '{Convert.ToDateTime(datum.Text).ToString("yyyy-MM-dd")}'", sqlList);
//await SQL.WriteSQL($"UPDATE pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON [o.mitarbeiter_static_PersNr] = [p.PersNr] SET Zuweisung = '{zuw}' WHERE [p.PersNr] = '{persnummer.Text}' AND [o.Datum] = '{Convert.ToDateTime(datum.Text).ToString("yyyy-MM-dd")}'", sqlList);
} }
catch (Exception) catch (Exception)
{ {
@ -322,12 +401,12 @@ namespace PEP_Tool
flowDocu.IsEnabled = true; flowDocu.IsEnabled = true;
fs.Changed += Fs_Changed; //fs.Changed += Fs_Changed;
} }
private void Zuweisung_DropDownOpened(object sender, EventArgs e) private void Zuweisung_DropDownOpened(object sender, EventArgs e)
{ {
fs.Changed -= Fs_Changed; //fs.Changed -= Fs_Changed;
} }
#region Bemerkung #region Bemerkung
@ -338,9 +417,11 @@ namespace PEP_Tool
try try
{ {
var box = sender as TextBox; var box = sender as TextBox;
if (!Helper.keyIsSpecialKey(e.Key)) if (!Helper.keyIsSpecialKey(e.Key))
{ {
if (box.Text.EndsWith(";")) box.Text = box.Text.Trim(';');
if (box.Text.ToLower().Contains("krank")) MessageBox.Show("Bitte nicht \"Krank\" eintragen (Datenschutz)\nWenn möglich stattdessen Zuweisung auf \"nicht Anwesend\" stellen", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Exclamation); if (box.Text.ToLower().Contains("krank")) MessageBox.Show("Bitte nicht \"Krank\" eintragen (Datenschutz)\nWenn möglich stattdessen Zuweisung auf \"nicht Anwesend\" stellen", "Achtung!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
e.Handled = false; e.Handled = false;
} }
@ -359,7 +440,7 @@ namespace PEP_Tool
{ {
Mouse.OverrideCursor = Cursors.Wait; Mouse.OverrideCursor = Cursors.Wait;
//li.Visibility = Visibility.Visible; //li.Visibility = Visibility.Visible;
await Task.Delay(10); //await Task.Delay(10);
SaveBemerkung(sender); SaveBemerkung(sender);
} }
@ -376,11 +457,26 @@ namespace PEP_Tool
try try
{ {
var x = (sender as TextBox); var x = (sender as TextBox);
var y = x.DataContext as DataRowView; //var y = x.DataContext as DataRowView;
var z = y.Row.ItemArray[0]; //var y = DataGridRow.GetRowContainingElement(x);
var datum = y.Row.ItemArray[4]; if (x.DataContext != null)
{
var i = Helper.FindParent<DataGridRow>(x);
if (i != null)
{
var j = i.GetIndex();
var y = (x.DataContext as DataRowView).DataView;
//y = y.DataView
//if(y == null) y = x.
await SQL.WriteSQL($"UPDATE `mitarbeiter_static` `p` left join `mitarbeiter_change` `o` ON o.mitarbeiter_static_PersNr = p.PersNr SET Bemerkung = '{x.Text}' WHERE p.PersNr = '{z}' AND o.Datum = '{Convert.ToDateTime(datum).ToString("yyyy-MM-dd")}'", sqlList); var zz = y[j].Row.ItemArray;
var z = zz[0];
var datum = zz[4];
await SQL.WriteSQL($"UPDATE pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr SET Bemerkung = '{x.Text}' WHERE p.PersNr = '{z}' AND o.Datum = '{Convert.ToDateTime(datum).ToString("yyyy-MM-dd")}'", sqlList);
//await SQL.WriteSQL($"UPDATE [pep_tool.mitarbeiter_static] [p] left join [pep_tool.mitarbeiter_change] [o] ON o.mitarbeiter_static_PersNr = p.PersNr SET Bemerkung = '{x.Text}' WHERE p.PersNr = '{z}' AND o.Datum = '{Convert.ToDateTime(datum).ToString("yyyy-MM-dd")}'", sqlList);
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -396,8 +492,8 @@ namespace PEP_Tool
private void Bemerkung_GotFocus(object sender, RoutedEventArgs e) private void Bemerkung_GotFocus(object sender, RoutedEventArgs e)
{ {
(sender as TextBox).Focus(); (sender as TextBox).Focus();
bemerkungTimer.Start(); //bemerkungTimer.Start();
fs.Changed -= Fs_Changed; //fs.Changed -= Fs_Changed;
var box = sender as TextBox; var box = sender as TextBox;
box.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; box.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
@ -410,7 +506,7 @@ namespace PEP_Tool
box.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; box.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
box.Height = 30; box.Height = 30;
fs.Changed += Fs_Changed; //fs.Changed += Fs_Changed;
} }
@ -486,7 +582,8 @@ namespace PEP_Tool
var y = x.DataContext as DataRowView; var y = x.DataContext as DataRowView;
var z = y.Row.ItemArray[0]; var z = y.Row.ItemArray[0];
await SQL.WriteSQL($"UPDATE `mitarbeiter_static` `p` left join `mitarbeiter_change` `o` ON o.mitarbeiter_static_PersNr = p.PersNr SET Telefon = '{x.Text}' WHERE p.PersNr = '{z}'", sqlList); await SQL.WriteSQL($"UPDATE pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr SET Telefon = '{x.Text}' WHERE p.PersNr = '{z}'", sqlList);
//await SQL.WriteSQL($"UPDATE Telefon SET Telefon = '{x.Text}' pep_tool.mitarbeiter_static p left join [pep_tool.mitarbeiter_change] [o] ON o.mitarbeiter_static_PersNr = p.PersNr WHERE p.PersNr = '{z}'", sqlList);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -512,7 +609,8 @@ namespace PEP_Tool
persnummer = flowDocu.Columns[9].GetCellContent(flowDocu.Items[index]) as TextBlock; persnummer = flowDocu.Columns[9].GetCellContent(flowDocu.Items[index]) as TextBlock;
var l = await SQL.ReadSQL($"select lizenz from lizenzen_has_mitarbeiter_static m left join lizenzen l ON m.lizenzen_ID = l.ID where m.mitarbeiter_static_PersNr = {persnummer.Text}"); var l = await SQL.ReadSQL($"select lizenz from pep_tool.lizenzen_has_mitarbeiter_static m left join pep_tool.lizenzen l ON m.lizenzen_ID = l.ID where m.mitarbeiter_static_PersNr = {persnummer.Text}");
//var l = await SQL.ReadSQL($"select lizenz from pep_tool.lizenzen_has_mitarbeiter_static m left join pep_tool.lizenzen l ON m.lizenzen_ID = l.ID where m.mitarbeiter_static_PersNr = {persnummer.Text}");
var t = Helper.DataTableToListString(l); var t = Helper.DataTableToListString(l);
@ -552,6 +650,7 @@ namespace PEP_Tool
string abtFilter = ""; string abtFilter = "";
string abtFilter2 = ""; string abtFilter2 = "";
string abtFilter3 = ""; string abtFilter3 = "";
string abtFilter4 = "";
private async void cBFilterAbteilung_SelectionChanged(object sender, SelectionChangedEventArgs e) private async void cBFilterAbteilung_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
try try
@ -608,6 +707,31 @@ namespace PEP_Tool
abtFilter3 = cBFilterAbteilung3.SelectedItem == null ? "" : cBFilterAbteilung3.SelectedItem.ToString(); abtFilter3 = cBFilterAbteilung3.SelectedItem == null ? "" : cBFilterAbteilung3.SelectedItem.ToString();
FilterList(); FilterList();
if (cBFilterAbteilung3.SelectedItem != null && cBFilterAbteilung3.SelectedItem.ToString() != "") cBFilterAbteilung4.IsEnabled = true;
else if (cBFilterAbteilung3.SelectedItem == null || cBFilterAbteilung3.SelectedItem.ToString() == "")
{
cBFilterAbteilung4.IsEnabled = false;
cBFilterAbteilung4.SelectedIndex = 0;
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
}
}
private async void cBFilterAbteilung4_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
abtFilter = cBFilterAbteilung.SelectedItem == null ? "" : cBFilterAbteilung.SelectedItem.ToString();
abtFilter2 = cBFilterAbteilung2.SelectedItem == null ? "" : cBFilterAbteilung2.SelectedItem.ToString();
abtFilter3 = cBFilterAbteilung3.SelectedItem == null ? "" : cBFilterAbteilung3.SelectedItem.ToString();
abtFilter4 = cBFilterAbteilung4.SelectedItem == null ? "" : cBFilterAbteilung4.SelectedItem.ToString();
FilterList();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -862,11 +986,30 @@ namespace PEP_Tool
{ {
try try
{ {
var date = dPDatum.SelectedDate.HasValue ? dPDatum.SelectedDate.ToString() : ""; var date = dPDatum.SelectedDate.HasValue ? dPDatum.SelectedDate.Value.ToShortDateString() : "";
sqlList = await TableCreater.CreateList(sqlList, abtFilter, abtFilter2, abtFilter3, lastButton, date, search, searchWithFilter, isSearch); sqlList = await TableCreater.CreateList(sqlList, abtFilter, abtFilter2, abtFilter3, abtFilter4, lastButton, date, search, searchWithFilter, isSearch);
string aF1,aF2,aF3, aF4, sch1,sch2,sch3,dat,such;
aF1 = aF2 = aF3 = aF4 = sch1 = sch2 = sch3 = dat = such = "";
if (abtFilter != "") aF1 = "Abteilung(en): " + abtFilter;
if (abtFilter2 != "") aF2 = ", " + abtFilter2;
if (abtFilter3 != "") aF3 = ", " + abtFilter3;
if (abtFilter4 != "") aF4 = ", " + abtFilter4;
if (lastButton != "") sch1 = " | Schicht(en): " + lastButton.Replace("MS", " Spät").Replace("MN", " Nacht").Replace("MT;MF"," Früh/Tag");
if (date != "") dat = " | Datum: " + date;
if (isSearch && search != "") such = " | Suche: " + search;
filterString = $"{aF1}{aF2}{aF3}{aF4}{sch1}{dat}{such}".StartsWith(" | ") ? " Filter: " + $"{aF1}{aF2}{aF3}{aF4}{sch1}{dat}{such}".Substring(4) : " Filter: " + $"{aF1}{aF2}{aF3}{aF4}{sch1}{dat}{such}";
if (filterString == " Filter: ") filterString = " ohne Filter";
//flowDocu.ItemsSource = UserList; //flowDocu.ItemsSource = UserList;
} }
catch (Exception ex) catch (Exception ex)
@ -1038,16 +1181,7 @@ namespace PEP_Tool
//})); //}));
} }
public IEnumerable<DataGridRow> GetDataGridRows(DataGrid grid)
{
var itemsSource = grid.ItemsSource;
if (null == itemsSource) yield return null;
foreach (var item in itemsSource)
{
var row = grid.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow;
if (null != row) yield return row;
}
}
#endregion #endregion
@ -1055,26 +1189,27 @@ namespace PEP_Tool
private void btnSettings_Click(object sender, RoutedEventArgs e) private void btnSettings_Click(object sender, RoutedEventArgs e)
{ {
tBAbtTranslatePath.Text = Properties.Settings.Default.AbteilungsnamenPath; (sender as Button).ContextMenu.IsOpen = true;
tBZuweisungenPath.Text = Properties.Settings.Default.ZuweisungenPath; //tBAbtTranslatePath.Text = Properties.Settings.Default.AbteilungsnamenPath;
//tBZuweisungenPath.Text = Properties.Settings.Default.ZuweisungenPath;
gridSettings.Visibility = Visibility.Visible; //gridSettings.Visibility = Visibility.Visible;
canvasSettings.Visibility = Visibility.Visible; //canvasSettings.Visibility = Visibility.Visible;
gridToolbar.Visibility = Visibility.Collapsed; //gridToolbar.Visibility = Visibility.Collapsed;
gridTable.Visibility = Visibility.Collapsed; //gridTable.Visibility = Visibility.Collapsed;
} }
private void btnCloseSettings_Click(object sender, RoutedEventArgs e) private void btnCloseSettings_Click(object sender, RoutedEventArgs e)
{ {
canvasSettings.Visibility = Visibility.Collapsed; //canvasSettings.Visibility = Visibility.Collapsed;
gridSettings.Visibility = Visibility.Collapsed; //gridSettings.Visibility = Visibility.Collapsed;
gridToolbar.Visibility = Visibility.Visible; //gridToolbar.Visibility = Visibility.Visible;
gridTable.Visibility = Visibility.Visible; //gridTable.Visibility = Visibility.Visible;
Properties.Settings.Default.AbteilungsnamenPath = tBAbtTranslatePath.Text; //Properties.Settings.Default.AbteilungsnamenPath = tBAbtTranslatePath.Text;
Properties.Settings.Default.ZuweisungenPath = tBZuweisungenPath.Text; //Properties.Settings.Default.ZuweisungenPath = tBZuweisungenPath.Text;
Properties.Settings.Default.Save(); //Properties.Settings.Default.Save();
} }
private void btnCancelSettings_Click(object sender, RoutedEventArgs e) private void btnCancelSettings_Click(object sender, RoutedEventArgs e)
@ -1087,28 +1222,28 @@ namespace PEP_Tool
private void btnSelectAbtTranslateFile_Click(object sender, RoutedEventArgs e) private void btnSelectAbtTranslateFile_Click(object sender, RoutedEventArgs e)
{ {
var p = Reader.OpenFile("Abteilungsnamen"); //var p = Reader.OpenFile("Abteilungsnamen");
var lines = System.IO.File.ReadAllLines(p); //var lines = System.IO.File.ReadAllLines(p);
if (lines[0].StartsWith("Abteilung;")) tBAbtTranslatePath.Text = p; //if (lines[0].StartsWith("Abteilung;")) tBAbtTranslatePath.Text = p;
else //else
{ //{
var x = MessageBox.Show("Keine gültige Abteilungsliste ausgewählt!", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); // var x = MessageBox.Show("Keine gültige Abteilungsliste ausgewählt!", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
btnSelectAbtTranslateFile.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // btnSelectAbtTranslateFile.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
} //}
} }
private void btnSelectZuweisungenFile_Click(object sender, RoutedEventArgs e) private void btnSelectZuweisungenFile_Click(object sender, RoutedEventArgs e)
{ {
var p = Reader.OpenFile("Zuweisungen"); //var p = Reader.OpenFile("Zuweisungen");
var lines = System.IO.File.ReadAllLines(p); //var lines = System.IO.File.ReadAllLines(p);
if (!lines.Contains(";")) tBZuweisungenPath.Text = p; //if (!lines.Contains(";")) tBZuweisungenPath.Text = p;
else //else
{ //{
var x = MessageBox.Show("Keine gültige Zuweisungen-Liste ausgewählt!", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); // var x = MessageBox.Show("Keine gültige Zuweisungen-Liste ausgewählt!", "Fehler!", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
btnSelectZuweisungenFile.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // btnSelectZuweisungenFile.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
} //}
} }
private void btnImpressum_Click(object sender, RoutedEventArgs e) private void btnImpressum_Click(object sender, RoutedEventArgs e)
@ -1143,6 +1278,11 @@ namespace PEP_Tool
} }
private void FlowDocu_SourceUpdated(object sender, System.Windows.Data.DataTransferEventArgs e)
{
lblStatusBar.Text = $" {flowDocu.Items.Count}";
}
private void btnHideToolbar_Click(object sender, RoutedEventArgs e) private void btnHideToolbar_Click(object sender, RoutedEventArgs e)
{ {
if (gridToolbar.Height == 184) if (gridToolbar.Height == 184)
@ -1167,6 +1307,7 @@ namespace PEP_Tool
bool onStartup = false; bool onStartup = false;
private async void Window_Closing(object sender, CancelEventArgs e) private async void Window_Closing(object sender, CancelEventArgs e)
{ {
//await SQL.WriteSQL($"UPDATE pep_tool.track SET Client = '{Environment.MachineName}', [User] = '', [Online] = 0, Version = '{Properties.Settings.Default.Version}' WHERE Client = '{Environment.MachineName}'");
await SQL.WriteSQL($"REPLACE INTO track SET `Client` = '{Environment.MachineName}', `Online` = false"); await SQL.WriteSQL($"REPLACE INTO track SET `Client` = '{Environment.MachineName}', `Online` = false");
if (!onStartup) Application.Current.Shutdown(); if (!onStartup) Application.Current.Shutdown();
@ -1201,16 +1342,16 @@ namespace PEP_Tool
private static void GetDesktopShortcuts() private static void GetDesktopShortcuts()
{ {
if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdatePEP.bat") || File.GetLastWriteTime(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdatePEP.bat") != File.GetLastWriteTime(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\UpdatePEP.bat")) if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\PEPUpdater.exe") || File.GetLastWriteTime(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\PEPUpdater.exe") != File.GetLastWriteTime(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\PEPUpdater.exe"))
{ {
File.Copy(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\UpdatePEP.bat", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdatePEP.bat", true); File.Copy(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\PEPUpdater.exe", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\PEPUpdater.exe", true);
GetDesktopShortcuts(); GetDesktopShortcuts();
} }
else else
{ {
if (File.GetLastWriteTime(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\PEP-Tool.exe") < File.GetLastWriteTime(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\PEP-Tool.exe")) if (File.GetLastWriteTime(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\PEP-Tool.exe") < File.GetLastWriteTime(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\PEP-Tool.exe"))
{ {
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\UpdatePEP.bat"); Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\PEPUpdater.exe");
Application.Current.Shutdown(); Application.Current.Shutdown();
} }
} }
@ -1263,6 +1404,12 @@ namespace PEP_Tool
} }
private void btnVorplanung_Click(object sender, RoutedEventArgs e)
{
Vorplanung vorP = new Vorplanung();
vorP.Show();
}
@ -1271,5 +1418,6 @@ namespace PEP_Tool
Debug.WriteLine("PropertyChanged " + propertyName); Debug.WriteLine("PropertyChanged " + propertyName);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>PEP_Tool</RootNamespace> <RootNamespace>PEP_Tool</RootNamespace>
<AssemblyName>PEP-Tool</AssemblyName> <AssemblyName>PEP-Tool</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -71,6 +71,54 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\LoadingIndicators.WPF.dll</HintPath> <HintPath>bin\Debug\LoadingIndicators.WPF.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Identity.Client, Version=4.17.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Identity.Client.4.17.0\lib\net45\Microsoft.Identity.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Client.Policy, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.Office.Client.Policy.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Client.TranslationServices, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.Office.Client.TranslationServices.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.SharePoint.Tools, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.Office.SharePoint.Tools.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Online.SharePoint.Client.Tenant, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.Online.SharePoint.Client.Tenant.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ProjectServer.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.ProjectServer.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.DocumentManagement, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.DocumentManagement.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Publishing, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.Publishing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Runtime, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.Runtime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Runtime.Windows, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.Runtime.Windows.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Search, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.Search.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Search.Applications, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.Search.Applications.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Taxonomy, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.Taxonomy.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.UserProfiles, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.UserProfiles.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.WorkflowServices, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.20317.12000\lib\net45\Microsoft.SharePoint.Client.WorkflowServices.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.17.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"> <Reference Include="MySql.Data, Version=8.0.17.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.17\lib\net452\MySql.Data.dll</HintPath> <HintPath>..\packages\MySql.Data.8.0.17\lib\net452\MySql.Data.dll</HintPath>
</Reference> </Reference>
@ -87,12 +135,21 @@
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" /> <Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Data.Common, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll</HintPath>
</Reference>
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data.SqlClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SqlClient.4.7.0\lib\net451\System.Data.SqlClient.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" /> <Reference Include="System.Drawing.Design" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.Management" /> <Reference Include="System.Management" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Printing" /> <Reference Include="System.Printing" />
<Reference Include="System.Transactions" /> <Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -124,6 +181,7 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="Crypto.cs" />
<Compile Include="Export.cs" /> <Compile Include="Export.cs" />
<Compile Include="Helper.cs" /> <Compile Include="Helper.cs" />
<Compile Include="KTOverview.xaml.cs"> <Compile Include="KTOverview.xaml.cs">
@ -140,9 +198,18 @@
<Compile Include="Reader.cs" /> <Compile Include="Reader.cs" />
<Compile Include="SQL.cs" /> <Compile Include="SQL.cs" />
<Compile Include="TableCreater.cs" /> <Compile Include="TableCreater.cs" />
<Compile Include="ucAnimatedArrow.xaml.cs">
<DependentUpon>ucAnimatedArrow.xaml</DependentUpon>
</Compile>
<Compile Include="ucSpinnerPiston.xaml.cs"> <Compile Include="ucSpinnerPiston.xaml.cs">
<DependentUpon>ucSpinnerPiston.xaml</DependentUpon> <DependentUpon>ucSpinnerPiston.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Vorplanung.xaml.cs">
<DependentUpon>Vorplanung.xaml</DependentUpon>
</Compile>
<Compile Include="XMessageBox.xaml.cs">
<DependentUpon>XMessageBox.xaml</DependentUpon>
</Compile>
<Compile Include="Zugzuweisung.xaml.cs"> <Compile Include="Zugzuweisung.xaml.cs">
<DependentUpon>Zugzuweisung.xaml</DependentUpon> <DependentUpon>Zugzuweisung.xaml</DependentUpon>
</Compile> </Compile>
@ -170,10 +237,22 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="ucAnimatedArrow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ucSpinnerPiston.xaml"> <Page Include="ucSpinnerPiston.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Vorplanung.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="XMessageBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Zugzuweisung.xaml"> <Page Include="Zugzuweisung.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -241,6 +320,9 @@
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference> </COMReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Arrow.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.2.5.0\build\Fody.targets" Condition="Exists('..\packages\Fody.2.5.0\build\Fody.targets')" /> <Import Project="..\packages\Fody.2.5.0\build\Fody.targets" Condition="Exists('..\packages\Fody.2.5.0\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -19,7 +19,7 @@ namespace PEP_Tool.Properties {
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {

View File

@ -12,7 +12,7 @@ namespace PEP_Tool.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -73,7 +73,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("3.0.1")] [global::System.Configuration.DefaultSettingValueAttribute("4.2.2")]
public string Version { public string Version {
get { get {
return ((string)(this["Version"])); return ((string)(this["Version"]));

View File

@ -15,7 +15,7 @@
<Value Profile="(Default)">1.0</Value> <Value Profile="(Default)">1.0</Value>
</Setting> </Setting>
<Setting Name="Version" Type="System.String" Scope="User"> <Setting Name="Version" Type="System.String" Scope="User">
<Value Profile="(Default)">3.0.1</Value> <Value Profile="(Default)">4.2.2</Value>
</Setting> </Setting>
<Setting Name="WindowPosLeft" Type="System.Double" Scope="User"> <Setting Name="WindowPosLeft" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value> <Value Profile="(Default)">0</Value>

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@ -34,7 +35,7 @@ namespace PEP_Tool
{ {
var path = ""; var path = "";
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Zuweisungen.csv")) path = @"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Zuweisungen.csv"; if (File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Zuweisungen.csv")) path = @"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\Zuweisungen.csv";
else else
path = Properties.Settings.Default.ZuweisungenPath == "" ? OpenFile("Zuweisungen") : Properties.Settings.Default.ZuweisungenPath; path = Properties.Settings.Default.ZuweisungenPath == "" ? OpenFile("Zuweisungen") : Properties.Settings.Default.ZuweisungenPath;
@ -66,7 +67,7 @@ namespace PEP_Tool
{ {
var path = ""; var path = "";
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\DKEYS.csv")) path = @"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\DKEYS.csv"; if (File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\DKEYS.csv")) path = @"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\DKEYS.csv";
else else
path = Properties.Settings.Default.AbteilungsnamenPath == "" ? OpenFile("Abteilungsnamen") : Properties.Settings.Default.AbteilungsnamenPath; path = Properties.Settings.Default.AbteilungsnamenPath == "" ? OpenFile("Abteilungsnamen") : Properties.Settings.Default.AbteilungsnamenPath;
@ -94,9 +95,28 @@ namespace PEP_Tool
return ReadAbteilungsNamen(); return ReadAbteilungsNamen();
} }
} }
internal static List<sWork> ReadsWork()
{
var path = "";
//if (File.Exists(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\sWork.csv")) path = @"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\sWork.csv";
//else
// MessageBox.Show("Standardarbeiten nicht gefunden\nBitte an Marcus Bachler wenden", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
//if (!File.Exists(path)) path = OpenFile("Abteilungsnamen");
var list = new List<sWork>();
foreach (var line in File.ReadAllLines(path).Skip(1))
{
list.Add(new sWork() { Title = line.Split(';')[0], Work = line.Split(';')[1], Schaltzustand = line.Split(';')[2] });
}
return list;
}
} }
public static class Extensions public static class Extensions
{ {
/// <summary> /// <summary>

View File

@ -2,19 +2,48 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.Entity.Infrastructure;
using System.Data.SqlClient;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
namespace PEP_Tool namespace PEP_Tool
{ {
public static class SQL public static class SQL
{ {
static string connstr = "Server=10.20.97.146;Uid=PEPTool;Pwd=PEPUser;database=pep_tool"; private static string p = "TTk3M3ibIPeyTagYPbtY6jtR9qHbL8DdtzhEwbGlMEVimC0BJb1Q3UEjGoKVRC9L";
static MySqlConnection conn = new MySqlConnection(connstr); private static string s = "00dv35EtwBftlIyfGhp9UA==";
private static string u = "MXgxjJ/UrLOYrW5RLTUSFA==";
private static string uSSL = "PK9zR2pVrqcp0rrEUcdoqg==";
private static string d = "r2ryY4uVzlr/xjohFwdDZg==";
static MySqlConnection conn = new MySqlConnection(GetConnstr());
static MySqlDataAdapter adp = new MySqlDataAdapter(); static MySqlDataAdapter adp = new MySqlDataAdapter();
private static string GetIP()
{
return Crypto.Decrypt(Crypto.GetHashKey("32F34372C1FF605B409C22EF135ACEE1"), s);
}
internal static string GetConnstr()
{
return $"Server={GetIP()};" +
$"Uid={Crypto.Decrypt(Crypto.GetHashKey("93380A87635F99B4A25FFA6E62A2AB59"), uSSL)};" +
$"Pwd={Crypto.Decrypt(Crypto.GetHashKey("DD18BA4FD3CED369794C8E020E7180E7"), p)};" +
$"database={Crypto.Decrypt(Crypto.GetHashKey("35E41210D890F44186F62DA1C6BA030F"), d)};" +
$"SslMode=Required;";
//return $"Server={GetIP()};" +
// $"Uid={Crypto.Decrypt(Crypto.GetHashKey("494094CF6E4DA4B0E4C8CF4AC418BFC0"), u)};" +
// $"Pwd={Crypto.Decrypt(Crypto.GetHashKey("DD18BA4FD3CED369794C8E020E7180E7"), p)};" +
// $"database={Crypto.Decrypt(Crypto.GetHashKey("35E41210D890F44186F62DA1C6BA030F"), d)}";
}
public static MySqlDataAdapter GetAdapter() public static MySqlDataAdapter GetAdapter()
{ {
return adp; return adp;
@ -22,71 +51,154 @@ namespace PEP_Tool
public static MySqlConnection GetConnection() public static MySqlConnection GetConnection()
{ {
return conn; if (CheckDeviceConnection())
{
return conn;
}
else
{
if (System.Windows.MessageBox.Show(MainWindow.main, $"Server ist nicht erreichbar\n" +
$"Netzwerkverbindung überprüfen\n" +
$"Sie können versuchen erneut zu Verbinden, andernfalls die die Anwendung beendet\n\n" +
$"Verbindung erneut versuchen?", "Fehler", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Error) == System.Windows.MessageBoxResult.Yes)
return GetConnection();
else
{
Application.Current.Shutdown();
return conn;
}
}
}
public static bool CheckDeviceConnection()
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
//change the following ip variable into the ip adress you are looking for
System.Net.IPAddress address = System.Net.IPAddress.Parse(GetIP());
System.Net.NetworkInformation.PingReply pong = ping.Send(address);
if (pong.Status == System.Net.NetworkInformation.IPStatus.Success)
{
return true;
}
else
{
return false;
}
} }
public static async Task<DataTable> WriteSQL(string SQLQuery, DataTable list) public static async Task<DataTable> WriteSQL(string SQLQuery, DataTable list)
{ {
var filter = list.DefaultView.RowFilter; try
using (conn)
{ {
if (conn.State == ConnectionState.Open) conn.Close(); var filter = list.DefaultView.RowFilter;
using (GetConnection())
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open(); conn.Open();
adp.UpdateCommand = new MySqlCommand(SQLQuery, conn); adp.UpdateCommand = new MySqlCommand(SQLQuery, conn);
adp.Update(list); adp.Update(list);
list.AcceptChanges(); list.AcceptChanges();
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\sql.lck", "erwischt!!"); //File.WriteAllText(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\sql.lck", "erwischt!!");
if(SQLQuery.Contains("track")) if (!SQLQuery.Contains("track"))
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\track.lck", "erwischt!!"); WriteLastUpdate();
//if (SQLQuery.Contains("track"))
// File.WriteAllText(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\track.lck", "erwischt!!");
conn.Close(); conn.Close();
}
list.DefaultView.RowFilter = filter;
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
} }
list.DefaultView.RowFilter = filter;
return list; return list;
} }
public static async Task WriteSQL(string SQLQuery) public static async Task WriteSQL(string SQLQuery)
{ {
using (conn) try
{ {
if (conn.State == ConnectionState.Open) conn.Close(); using (GetConnection())
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open(); conn.Open();
MySqlCommand cmd = new MySqlCommand(SQLQuery, conn); MySqlCommand cmd = new MySqlCommand(SQLQuery, conn);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
conn.Close(); conn.Close();
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\sql.lck", "erwischt!!"); if (!SQLQuery.Contains("track"))
if (SQLQuery.Contains("track")) WriteLastUpdate();
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\track.lck", "erwischt!!");
//if (SQLQuery.Contains("track"))
// File.WriteAllText(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\track.lck", "erwischt!!");
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
} }
} }
private static void WriteLastUpdate()
{
try
{
using (GetConnection())
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
MySqlCommand cmd = new MySqlCommand($"UPDATE pep_tool.misc SET `Value`='{DateTime.Now.ToString("dd.MM. HH:mm:ss")}' WHERE `idmisc`='LastUpdate'", conn);
cmd.ExecuteNonQuery();
conn.Close();
//if (SQLQuery.Contains("track"))
// File.WriteAllText(@"\\mhb00swfs003v.fv-werke.db.de\GLW99\PEP\track.lck", "erwischt!!");
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
}
}
public static async Task<DataTable> ReadSQL(string SQLCommand, DataTable list) public static async Task<DataTable> ReadSQL(string SQLCommand, DataTable list)
{ {
var filter = list.DefaultView.RowFilter; try
using (conn)
{ {
if (conn.State == ConnectionState.Open) conn.Close(); var filter = list.DefaultView.RowFilter;
conn.Open(); using (GetConnection())
adp.SelectCommand = new MySqlCommand(SQLCommand, conn); {
if (conn.State == ConnectionState.Open) conn.Close();
list.Clear(); conn.Open();
adp.Fill(list); adp.SelectCommand = new MySqlCommand(SQLCommand, conn);
conn.Close();
list.Clear();
adp.Fill(list);
conn.Close();
}
list.DefaultView.RowFilter = filter;
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
} }
list.DefaultView.RowFilter = filter;
return list; return list;
} }
@ -94,7 +206,10 @@ namespace PEP_Tool
{ {
DataTable list = new DataTable(); DataTable list = new DataTable();
using (conn) try
{
using (GetConnection())
{ {
if (conn.State == ConnectionState.Open) conn.Close(); if (conn.State == ConnectionState.Open) conn.Close();
@ -106,6 +221,11 @@ namespace PEP_Tool
conn.Close(); conn.Close();
} }
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
}
return list; return list;
} }
@ -115,19 +235,26 @@ namespace PEP_Tool
public static async Task<DataTable> ReadAllData(DataTable list) public static async Task<DataTable> ReadAllData(DataTable list)
{ {
var filter = list.DefaultView.RowFilter; var filter = list.DefaultView.RowFilter;
try
using (conn)
{ {
if (conn.State == ConnectionState.Open) conn.Close(); using (GetConnection())
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open(); conn.Open();
adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from mitarbeiter_static p left join mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn); adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn);
list.Clear(); list.Clear();
adp.Fill(list); adp.Fill(list);
conn.Close(); conn.Close();
}
list.DefaultView.RowFilter = filter;
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
} }
list.DefaultView.RowFilter = filter;
return list; return list;
} }
@ -137,12 +264,12 @@ namespace PEP_Tool
{ {
DataTable list = new DataTable("UserList"); DataTable list = new DataTable("UserList");
using (conn) using (GetConnection())
{ {
if (conn.State == ConnectionState.Open) conn.Close(); if (conn.State == ConnectionState.Open) conn.Close();
conn.Open(); conn.Open();
adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from mitarbeiter_static p left join mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn); adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from pep_tool.mitarbeiter_static p left join pep_tool.mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn);
list.Columns.Clear(); list.Columns.Clear();
adp.Fill(list); adp.Fill(list);
conn.Close(); conn.Close();

View File

@ -11,7 +11,7 @@ namespace PEP_Tool
{ {
static int errCount = 0; static int errCount = 0;
public static async Task<DataTable> CreateList(DataTable userList, string filterAbteilung = "%", string filterAbteilung2 = "%", string filterAbteilung3 = "%", string Arbeitsmuster = "", string Datum = "", string Search = "", bool searchWithFilter = false, bool isSearch = false) public static async Task<DataTable> CreateList(DataTable userList, string filterAbteilung = "%", string filterAbteilung2 = "%", string filterAbteilung3 = "%", string filterAbteilung4 = "%", string Arbeitsmuster = "", string Datum = "", string Search = "", bool searchWithFilter = false, bool isSearch = false)
{ {
errCount++; errCount++;
//System.Diagnostics.Debug.WriteLine($"{filterAbteilung}, {filterAbteilung2}, {filterAbteilung3}, {Arbeitsmuster}, {Datum}, {Search}, {isSearch}, {searchWithFilter}"); //System.Diagnostics.Debug.WriteLine($"{filterAbteilung}, {filterAbteilung2}, {filterAbteilung3}, {Arbeitsmuster}, {Datum}, {Search}, {isSearch}, {searchWithFilter}");
@ -48,11 +48,11 @@ namespace PEP_Tool
} }
if ((filterAbteilung == "%" || filterAbteilung == "") && (filterAbteilung2 == "%" || filterAbteilung2 == "") && (filterAbteilung3 == "%" || filterAbteilung3 == "")) if ((filterAbteilung == "%" || filterAbteilung == "") && (filterAbteilung2 == "%" || filterAbteilung2 == "") && (filterAbteilung3 == "%" || filterAbteilung3 == "") && (filterAbteilung4 == "%" || filterAbteilung4 == ""))
list = userList; list = userList;
else if(list.DefaultView.RowFilter == "") else if(list.DefaultView.RowFilter == "")
list.DefaultView.RowFilter = $"(Abteilung like '{filterAbteilung}' OR Abteilung like '{filterAbteilung2}' OR Abteilung like '{filterAbteilung3}')"; list.DefaultView.RowFilter = $"(Abteilung like '{filterAbteilung}' OR Abteilung like '{filterAbteilung2}' OR Abteilung like '{filterAbteilung3}' OR Abteilung like '{filterAbteilung4}')";
else list.DefaultView.RowFilter = list.DefaultView.RowFilter += $" AND (Abteilung like '{filterAbteilung}' OR Abteilung like '{filterAbteilung2}' OR Abteilung like '{filterAbteilung3}')"; else list.DefaultView.RowFilter = list.DefaultView.RowFilter += $" AND (Abteilung like '{filterAbteilung}' OR Abteilung like '{filterAbteilung2}' OR Abteilung like '{filterAbteilung3}' OR Abteilung like '{filterAbteilung4}')";
if (list.DefaultView.RowFilter == "") if (list.DefaultView.RowFilter == "")
list.DefaultView.RowFilter = Datum != "" ? list.DefaultView.RowFilter = $"Datum = {String.Format(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat, "#{0}#", DateTime.Parse(Datum))}" : list.DefaultView.RowFilter; list.DefaultView.RowFilter = Datum != "" ? list.DefaultView.RowFilter = $"Datum = {String.Format(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat, "#{0}#", DateTime.Parse(Datum))}" : list.DefaultView.RowFilter;

59
AV-ToolV3/Vorplanung.xaml Normal file
View File

@ -0,0 +1,59 @@
<Window x:Class="PEP_Tool.Vorplanung"
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:PEP_Tool"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="Vorplanung" Height="450" Width="900">
<Grid>
<StackPanel Orientation="Vertical">
<Grid x:Name="MainInput">
<StackPanel Orientation="Horizontal" Margin="10,10,10,0" Height="60" VerticalAlignment="Top" >
<StackPanel Orientation="Vertical">
<TextBlock Text="Datum:" Margin="10,0,0,0"/>
<DatePicker HorizontalAlignment="Left" Margin="10" VerticalAlignment="Top"/>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock Text="Triebzug:" Margin="10,0,0,0"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="10" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock Text="Von:" Margin="10,0,0,0"/>
<xctk:DateTimePicker Height="23" Margin="10,10" Width="150" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock Text="Bis:" Margin="10,0,0,0"/>
<xctk:DateTimePicker Height="23" Margin="10" Width="150" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</StackPanel>
</StackPanel>
</Grid>
<Grid x:Name="dGResult" Margin="10">
<DataGrid HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="0">
<DataGrid.Columns>
<DataGridTextColumn Header="Fzg" Width="50"/>
<DataGridTextColumn Header="Fehlercode/-text" Width="*"/>
<DataGridTextColumn Header="Schaltzustand" Width="*"/>
<DataGridTextColumn Header="Theoretische Arbeitszeit" Width="*"/>
<DataGridTemplateColumn Header="Vorschlag MA" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Fehlerklasse" Width="*"/>
<DataGridTextColumn Header="LN/LF" Width="50"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace PEP_Tool
{
/// <summary>
/// Interaktionslogik für Vorplanung.xaml
/// </summary>
public partial class Vorplanung : Window
{
public Vorplanung()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,15 @@
<Window x:Class="PEP_Tool.XMessageBox"
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:PEP_Tool"
mc:Ignorable="d"
Title="XMessageBox" Height="195" Width="390" ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" Closed="Window_Closed">
<Grid>
<Button x:Name="btnBox" Content="OK" Margin="0,0,10,10" HorizontalAlignment="Right" Width="94" Height="29" VerticalAlignment="Bottom"/>
<TextBlock x:Name="Message" Margin="90,10,10,35" TextWrapping="Wrap" Text="TextBlock" TextAlignment="Left" VerticalAlignment="Center"/>
<Image x:Name="Image" HorizontalAlignment="Left" Height="44" Margin="26,34,0,88" VerticalAlignment="Center" Width="44"/>
</Grid>
</Window>

View File

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace PEP_Tool
{
/// <summary>
/// Interaktionslogik für XMessageBox.xaml
/// </summary>
public partial class XMessageBox : Window
{
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
int timerCount = 0;
public XMessageBox(string Title, string Message, MessageBoxImage image)
{
InitializeComponent();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
this.Title = Title;
this.Message.Text = Message;
var selectedImage = System.Drawing.SystemIcons.Error;
switch (image)
{
case MessageBoxImage.Error:
selectedImage = System.Drawing.SystemIcons.Error;
break;
case MessageBoxImage.Information:
selectedImage = System.Drawing.SystemIcons.Information;
break;
case MessageBoxImage.Question:
selectedImage = System.Drawing.SystemIcons.Question;
break;
case MessageBoxImage.Warning:
selectedImage = System.Drawing.SystemIcons.Warning;
break;
default:
selectedImage = System.Drawing.SystemIcons.Error;
break;
}
this.Image.Source = ConvertBitmapToImage(selectedImage.ToBitmap());
}
private void Timer_Tick(object sender, EventArgs e)
{
timerCount += 1;
btnBox.Content = $"OK - {(10 - timerCount).ToString()}";
if (timerCount >= 10)
Application.Current.Shutdown();
}
private void Window_Closed(object sender, EventArgs e)
{
Application.Current.Shutdown();
}
/// <summary>
/// Takes a bitmap and converts it to an image that can be handled by WPF ImageBrush
/// </summary>
/// <param name="src">A bitmap image</param>
/// <returns>The image as a BitmapImage for WPF</returns>
public static BitmapImage ConvertBitmapToImage(System.Drawing.Bitmap src)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
src.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff);
BitmapImage image = new BitmapImage();
image.BeginInit();
ms.Seek(0, System.IO.SeekOrigin.Begin);
image.StreamSource = ms;
image.EndInit();
return image;
}
}
}

View File

@ -11,7 +11,90 @@
<local:SearchFilterConverter x:Key="searchFilterConverter" /> <local:SearchFilterConverter x:Key="searchFilterConverter" />
</Window.Resources> </Window.Resources>
<Grid> <Grid>
<DataGrid x:Name="dGSchaltList" Margin="10,325,10,0" ItemsSource="{Binding Path=., Mode=TwoWay}" CanUserAddRows="False" AutoGenerateColumns="False" ColumnWidth="*" PreviewKeyDown="DGSchaltList_PreviewKeyDown" Height="170" VerticalAlignment="Top" CanUserReorderColumns="False" HorizontalGridLinesBrush="#99808080" VerticalGridLinesBrush="#99808080"> <local:ucAnimatedArrow x:Name="arrow1Date" HorizontalAlignment="Left" Height="302" Margin="0,-75,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow2Schicht" HorizontalAlignment="Left" Height="302" Margin="214,-75,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow3Name" HorizontalAlignment="Left" Height="302" Margin="388,-75,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow4Von" HorizontalAlignment="Left" Height="302" Margin="550,-75,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow5Bis" HorizontalAlignment="Left" Height="302" Margin="725,-75,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow6MAView" HorizontalAlignment="Left" Height="302" Margin="118,-75,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow9Schaltzustand" HorizontalAlignment="Left" Height="302" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Margin="112,137,0,0" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow11Add" HorizontalAlignment="Left" Height="302" Margin="358,150,0,0" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<DataGrid x:Name="dGSchaltList" Margin="9,405,11,0" ItemsSource="{Binding Path=., Mode=TwoWay}" CanUserAddRows="False" AutoGenerateColumns="False" ColumnWidth="*" PreviewKeyDown="DGSchaltList_PreviewKeyDown" Height="150" VerticalAlignment="Top" CanUserReorderColumns="False" HorizontalGridLinesBrush="#99808080" VerticalGridLinesBrush="#99808080">
<DataGrid.CellStyle> <DataGrid.CellStyle>
<Style TargetType="DataGridCell"> <Style TargetType="DataGridCell">
<Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/> <Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/>
@ -28,29 +111,29 @@
<!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>--> <!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>-->
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<TextBlock x:Name="lblZugMitarbeiter" HorizontalAlignment="Left" Margin="10,41,0,0" VerticalAlignment="Top" Width="261"/> <!--<TextBlock x:Name="lblZugMitarbeiter" HorizontalAlignment="Left" Margin="10,61,0,0" VerticalAlignment="Top" Width="261"/>-->
<TextBlock x:Name="lbl2" Text="für den" HorizontalAlignment="Left" Margin="10,67,0,0" VerticalAlignment="Top" Width="40"/> <TextBlock x:Name="lbl2" Text="für den" HorizontalAlignment="Left" Margin="10,240,0,0" VerticalAlignment="Top" Width="40"/>
<TextBlock x:Name="lblDate" HorizontalAlignment="Left" Margin="55,67,0,0" VerticalAlignment="Top" Width="185"/> <TextBlock x:Name="lblDate" HorizontalAlignment="Left" Margin="55,240,0,0" VerticalAlignment="Top" Width="185"/>
<Button x:Name="btnOK" Content="OK" Margin="0,0,11.4,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Height="23" Width="100" Click="BtnOK_Click"/> <Button x:Name="btnOK" Content="OK" Margin="0,0,11.4,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Height="23" Width="100" Click="BtnOK_Click"/>
<TextBlock x:Name="lbl1" HorizontalAlignment="Left" Margin="10,20,0,0" TextWrapping="Wrap" Text="Benötigte MA Anzahl:" VerticalAlignment="Top"/> <TextBlock x:Name="lbl1" HorizontalAlignment="Left" Margin="555,256,0,0" TextWrapping="Wrap" Text="Benötigte MA Anzahl:" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="304,20,0,0" TextWrapping="Wrap" Text="Triebzug" VerticalAlignment="Top"/> <TextBlock HorizontalAlignment="Left" Margin="407,10,0,0" TextWrapping="Wrap" Text="Triebzug" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="446,20,0,0" TextWrapping="Wrap" Text="Von" VerticalAlignment="Top"/> <TextBlock HorizontalAlignment="Left" Margin="570,10,0,0" TextWrapping="Wrap" Text="Von" VerticalAlignment="Top"/>
<xctk:DateTimePicker x:Name="dPSchaltVon" Margin="446,40,0,0" VerticalAlignment="Top" Height="23" Format="Custom" FormatString="dd.MM. HH:mm" HorizontalAlignment="Left" Width="142"/> <xctk:DateTimePicker x:Name="dPSchaltVon" Margin="570,30,0,0" VerticalAlignment="Top" Height="23" Format="Custom" FormatString="dd.MM. HH:mm" HorizontalAlignment="Left" Width="142" IsEnabled="False" PreviewTextInput="dPSchaltVon_PreviewTextInput"/>
<TextBlock HorizontalAlignment="Left" Margin="599,20,0,0" TextWrapping="Wrap" Text="Bis" VerticalAlignment="Top"/> <TextBlock HorizontalAlignment="Left" Margin="743,10,0,0" TextWrapping="Wrap" Text="Bis" VerticalAlignment="Top"/>
<xctk:DateTimePicker x:Name="dPSchaltBis" Margin="599,40,0,0" VerticalAlignment="Top" Height="23" Format="Custom" FormatString="dd.MM. HH:mm" HorizontalAlignment="Left" Width="142"/> <xctk:DateTimePicker x:Name="dPSchaltBis" Margin="743,30,0,0" VerticalAlignment="Top" Height="23" Format="Custom" FormatString="dd.MM. HH:mm" HorizontalAlignment="Left" Width="142" IsEnabled="False" PreviewTextInput="dPSchaltBis_PreviewTextInput"/>
<ComboBox x:Name="cbSchaltzustand" Margin="751,41,11.4,0" VerticalAlignment="Top"> <ComboBox x:Name="cbSchaltzustand" Margin="220,276,542,0" VerticalAlignment="Top" IsEnabled="False" SelectionChanged="cbSchaltzustand_SelectionChanged">
<ComboBoxItem Content="0 V"/> <ComboBoxItem Content="0 V"/>
<ComboBoxItem Content="110 V"/> <ComboBoxItem Content="110 V"/>
<ComboBoxItem Content="670 V"/> <ComboBoxItem Content="670 V"/>
<ComboBoxItem Content="15 kV"/> <ComboBoxItem Content="15 kV"/>
<ComboBoxItem Content="unbestimmt"/> <ComboBoxItem Content="unbestimmt"/>
</ComboBox> </ComboBox>
<TextBlock HorizontalAlignment="Left" Margin="751,20,0,0" TextWrapping="Wrap" Text="Schaltzustand" VerticalAlignment="Top"/> <TextBlock HorizontalAlignment="Left" Margin="220,255,0,0" TextWrapping="Wrap" Text="Schaltzustand" VerticalAlignment="Top"/>
<Button x:Name="btnAdd" Content="Hinzufügen" Margin="10,280,10,0" VerticalAlignment="Top" Click="BtnAdd_Click"/> <Button x:Name="btnAdd" Content="Hinzufügen" Margin="10,324,10,0" VerticalAlignment="Top" Click="BtnAdd_Click" IsEnabled="False"/>
<DataGrid x:Name="dGMAView" HorizontalAlignment="Left" Height="118" Margin="10,119,0,0" VerticalAlignment="Top" Width="413" ItemsSource="{Binding MAView, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" SelectionChanged="DGMAView_SelectionChanged" CanUserReorderColumns="False" CanUserResizeColumns="False" GridLinesVisibility="Horizontal" HorizontalGridLinesBrush="#99808080" SelectionMode="Single" IsReadOnly="True"> <DataGrid x:Name="dGMAView" HorizontalAlignment="Left" Height="145" Margin="10,90,0,0" VerticalAlignment="Top" Width="413" ItemsSource="{Binding MAView, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" SelectionChanged="DGMAView_SelectionChanged" CanUserReorderColumns="False" CanUserResizeColumns="False" GridLinesVisibility="Horizontal" HorizontalGridLinesBrush="#99808080" SelectionMode="Single" IsReadOnly="True" IsEnabled="False">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="Gewerke" Binding="{Binding Abteilung}" Width="*" MinWidth="100"/> <DataGridTextColumn Header="Gewerke" Binding="{Binding Abteilung}" Width="*" MinWidth="100"/>
@ -77,20 +160,50 @@
</DataGridTextColumn> </DataGridTextColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Button x:Name="btnAddMitarbeiter" Content="+" HorizontalAlignment="Left" Margin="388,242,0,0" VerticalAlignment="Top" Width="35" Height="22"/> <!--<Button x:Name="btnAddMitarbeiter" Content="+" HorizontalAlignment="Left" Margin="388,242,0,0" VerticalAlignment="Top" Width="35" Height="22" Visibility="Collapsed"/>
<ComboBox x:Name="cBGewerke" HorizontalAlignment="Left" ItemsSource="{Binding MAView}" Margin="10,242,0,0" VerticalAlignment="Top" Width="370"> <ComboBox x:Name="cBGewerke" HorizontalAlignment="Left" ItemsSource="{Binding MAView.Gewerke}" Margin="10,242,0,0" VerticalAlignment="Top" Width="370" Visibility="Collapsed">
<!--<ListView HorizontalAlignment="Left" ItemsSource="{Binding MAView}" Height="118" Margin="10,119,0,0" VerticalAlignment="Top" Width="261"/>--> <ListView HorizontalAlignment="Left" ItemsSource="{Binding MAView}" Height="118" Margin="10,119,0,0" VerticalAlignment="Top" Width="261"/>
</ComboBox> </ComboBox>-->
<local:ucAnimatedArrow x:Name="arrow7sWork" HorizontalAlignment="Left" Height="302" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Margin="332,-49,0,0" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow8Grund" HorizontalAlignment="Left" Height="302" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Margin="332,31,0,0" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<local:ucAnimatedArrow x:Name="arrow10MA" HorizontalAlignment="Left" Height="302" VerticalAlignment="Top" Width="171" RenderTransformOrigin="0.5,0.5" Margin="442,137,0,0" Visibility="Collapsed">
<local:ucAnimatedArrow.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.15" ScaleY="0.15"/>
<SkewTransform/>
<RotateTransform Angle="90"/>
<TranslateTransform/>
</TransformGroup>
</local:ucAnimatedArrow.RenderTransform>
</local:ucAnimatedArrow>
<TextBox x:Name="tbGrund" Height="91" Margin="446,173,10,0" TextWrapping="Wrap" VerticalAlignment="Top"/> <TextBox x:Name="tbGrund" Height="91" Margin="446,144,10,0" TextWrapping="Wrap" VerticalAlignment="Top" IsEnabled="False" TextChanged="tbGrund_TextChanged"/>
<TextBlock HorizontalAlignment="Left" Margin="446,152,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="132"><Run Text="Arbeiten / Bemerkung"/><Run Text=":"/></TextBlock> <TextBlock HorizontalAlignment="Left" Margin="446,123,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="132"><Run Text="Arbeiten / Bemerkung"/><Run Text=":"/></TextBlock>
<ComboBox Margin="446,119,11,0" VerticalAlignment="Top"/> <ComboBox x:Name="cBsWork" ItemsSource="{Binding sWorks}" DisplayMemberPath="Display" Margin="446,90,11,0" VerticalAlignment="Top" SelectionChanged="cBsWork_SelectionChanged" IsEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Margin="446,98,0,0" TextWrapping="Wrap" Text="Standardarbeiten:" VerticalAlignment="Top"/> <TextBlock HorizontalAlignment="Left" Margin="446,69,0,0" TextWrapping="Wrap" Text="Standardarbeiten:" VerticalAlignment="Top"/>
<DatePicker x:Name="dPMAFilter" HorizontalAlignment="Left" Margin="10,89,0,0" VerticalAlignment="Top" Width="413" SelectedDateChanged="DPMAFilter_SelectedDateChanged"/> <DatePicker x:Name="dPMAFilter" HorizontalAlignment="Left" Margin="9,29,0,0" VerticalAlignment="Top" Width="176" SelectedDateChanged="DPMAFilter_SelectedDateChanged"/>
@ -104,10 +217,10 @@
</TransformGroup> </TransformGroup>
</local:ucSpinnerPiston.RenderTransform> </local:ucSpinnerPiston.RenderTransform>
</local:ucSpinnerPiston> </local:ucSpinnerPiston>
<ComboBox x:Name="cBAnzahlMA" HorizontalAlignment="Left" Margin="10,40,0,0" VerticalAlignment="Top" Width="115" Text="Zuerst ein Gewerk wählen" DropDownOpened="CBAnzahlMA_DropDownOpened"/> <ComboBox x:Name="cBAnzahlMA" HorizontalAlignment="Left" Margin="555,276,0,0" VerticalAlignment="Top" Width="115" Text="Zuerst ein Gewerk wählen" DropDownOpened="CBAnzahlMA_DropDownOpened" IsEnabled="False" SelectionChanged="cBAnzahlMA_SelectionChanged"/>
<TextBlock x:Name="lblPlanungTz" HorizontalAlignment="Left" FontWeight="Bold" Margin="10,309,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Planung für "/><Run Text="Triebzug"/><Run Text=":"/></TextBlock> <TextBlock x:Name="lblPlanungTz" HorizontalAlignment="Left" FontWeight="Bold" Margin="10,384,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Planung für "/><Run Text="Triebzug"/><Run Text=":"/></TextBlock>
<TextBlock x:Name="lblPlanungGewerk" HorizontalAlignment="Left" FontWeight="Bold" Margin="10,500,0,0" TextWrapping="Wrap" Height="16" VerticalAlignment="Top"><Run Text="Planung für "/><Run Text="Gewerk"/><Run Text=":"/></TextBlock> <TextBlock x:Name="lblPlanungGewerk" HorizontalAlignment="Left" FontWeight="Bold" Margin="10,564,0,0" TextWrapping="Wrap" Height="16" VerticalAlignment="Top"><Run Text="Planung für "/><Run Text="Gewerk"/><Run Text=":"/></TextBlock>
<DataGrid x:Name="dGSchaltListGewerk" Margin="9,516,11,0" ItemsSource="{Binding ., Mode=TwoWay}" CanUserAddRows="False" AutoGenerateColumns="False" ColumnWidth="*" MinColumnWidth="20" CanUserReorderColumns="False" IsReadOnly="True" HorizontalGridLinesBrush="#99808080" VerticalGridLinesBrush="#99808080" VerticalAlignment="Top" Height="200"> <DataGrid x:Name="dGSchaltListGewerk" Margin="9,585,11,0" ItemsSource="{Binding ., Mode=TwoWay}" CanUserAddRows="False" AutoGenerateColumns="False" ColumnWidth="*" MinColumnWidth="20" CanUserReorderColumns="False" IsReadOnly="True" HorizontalGridLinesBrush="#99808080" VerticalGridLinesBrush="#99808080" VerticalAlignment="Top" Height="131" RowBackground="White">
<!--<DataGrid.CellStyle> <!--<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}"> <Style TargetType="{x:Type DataGridCell}">
<Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/> <Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/>
@ -125,13 +238,13 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<TextBox x:Name="tbName" Height="23" Margin="304,40,0,0" TextWrapping="Wrap" Text="Tz " VerticalAlignment="Top" TextChanged="TbName_TextChanged" HorizontalAlignment="Left" Width="129"/> <TextBox x:Name="tbName" Height="23" Margin="407,30,0,0" TextWrapping="Wrap" Text="Tz " VerticalAlignment="Top" TextChanged="TbName_TextChanged" HorizontalAlignment="Left" Width="129" IsEnabled="False"/>
<ComboBox x:Name="cBSchicht" HorizontalAlignment="Left" Margin="151,40,0,0" VerticalAlignment="Top" Width="120" SelectionChanged="CBSchicht_SelectionChanged"> <ComboBox x:Name="cBSchicht" HorizontalAlignment="Left" Margin="226,31,0,0" VerticalAlignment="Top" Width="143" SelectionChanged="CBSchicht_SelectionChanged" IsEnabled="False">
<ComboBoxItem Content="Früh- /Tagschicht"/> <ComboBoxItem Content="Früh- /Tagschicht"/>
<ComboBoxItem Content="Spätschicht"/> <ComboBoxItem Content="Spätschicht"/>
<ComboBoxItem Content="Nachtschicht"/> <ComboBoxItem Content="Nachtschicht"/>
</ComboBox> </ComboBox>
<DataGrid x:Name="dGSchaltListTag" Margin="9,742,11,41" ItemsSource="{Binding ., Mode=TwoWay}" CanUserAddRows="False" AutoGenerateColumns="False" ColumnWidth="*" MinColumnWidth="20" CanUserReorderColumns="False" IsReadOnly="True" HorizontalGridLinesBrush="#99808080" VerticalGridLinesBrush="#99808080"> <DataGrid x:Name="dGSchaltListTag" Margin="9,742,11,41" ItemsSource="{Binding ., Mode=TwoWay}" CanUserAddRows="False" AutoGenerateColumns="False" ColumnWidth="*" MinColumnWidth="20" CanUserReorderColumns="False" IsReadOnly="True" HorizontalGridLinesBrush="#99808080" VerticalGridLinesBrush="#99808080" RowBackground="White">
<!--<DataGrid.CellStyle> <!--<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}"> <Style TargetType="{x:Type DataGridCell}">
<Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/> <Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/>
@ -149,5 +262,6 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<TextBlock x:Name="lblPlanungTag" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,725,0,0" TextWrapping="Wrap" Height="16" VerticalAlignment="Top"><Run Text="Planung für "/><Run Text="Tag"/><Run Text=":"/></TextBlock> <TextBlock x:Name="lblPlanungTag" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,725,0,0" TextWrapping="Wrap" Height="16" VerticalAlignment="Top"><Run Text="Planung für "/><Run Text="Tag"/><Run Text=":"/></TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="226,10,0,0" TextWrapping="Wrap" Text="Schicht" VerticalAlignment="Top"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -17,6 +17,7 @@ using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
//using Xceed.Wpf.Toolkit;
namespace PEP_Tool namespace PEP_Tool
{ {
@ -26,7 +27,7 @@ namespace PEP_Tool
public partial class Zugzuweisung : Window, INotifyPropertyChanged public partial class Zugzuweisung : Window, INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
private DataTable mACombo = new DataTable(); private DataTable mACombo = new DataTable();
public DataTable MACombo public DataTable MACombo
@ -47,12 +48,26 @@ namespace PEP_Tool
DataTable schaltListGewerk = new DataTable("SchaltListGewerk"); DataTable schaltListGewerk = new DataTable("SchaltListGewerk");
DataTable schaltListTag = new DataTable("SchaltListTag"); DataTable schaltListTag = new DataTable("SchaltListTag");
//public sWork work { get; set; }
private List<sWork> sworks = new List<sWork>();
public List<sWork> sWorks
{
get { return sworks; }
set { sworks = value; OnPropertyChanged(); }
}
int lastSelectedIndex = 0;
public Zugzuweisung(Button sender = null) public Zugzuweisung(Button sender = null)
{ {
this.DataContext = this; this.DataContext = this;
InitializeComponent(); InitializeComponent();
if (sender != null) if (sender != null)
ZuweisungFromList(sender); ZuweisungFromList(sender);
else else
@ -61,68 +76,102 @@ namespace PEP_Tool
dGSchaltList.DataContext = schaltList; dGSchaltList.DataContext = schaltList;
dGSchaltListGewerk.DataContext = schaltListGewerk; dGSchaltListGewerk.DataContext = schaltListGewerk;
dGSchaltListTag.DataContext = schaltListTag; dGSchaltListTag.DataContext = schaltListTag;
sWorks = Reader.ReadsWork();
} }
private void ZuweisungFromMenu() private void ZuweisungFromMenu()
{ {
lbl1.Visibility = Visibility.Collapsed; lbl1.Visibility = Visibility.Visible;
lbl2.Visibility = Visibility.Collapsed; //lbl2.Visibility = Visibility.Collapsed;
btnAddMitarbeiter.Visibility = Visibility.Visible; //btnAddMitarbeiter.Visibility = Visibility.Visible;
dPMAFilter.Visibility = Visibility.Visible; dPMAFilter.Visibility = Visibility.Visible;
cBGewerke.Visibility = Visibility.Visible; //cBGewerke.Visibility = Visibility.Visible;
dPSchaltVon.ValueChanged += DPSchaltVon_ValueChanged;
dPSchaltBis.ValueChanged += DPSchaltBis_ValueChanged;
} }
object sending; object sending;
object buttonDatum; object buttonDatum;
private async void ZuweisungFromList(Button sender) private async void ZuweisungFromList(Button sender)
{ {
sending = sender;
dPMAFilter.Visibility = Visibility.Collapsed; dPSchaltVon.ValueChanged -= DPSchaltVon_ValueChanged;
cBGewerke.Visibility = Visibility.Collapsed; dPSchaltBis.ValueChanged -= DPSchaltBis_ValueChanged;
btnAddMitarbeiter.Visibility = Visibility.Collapsed;
lbl1.Visibility = Visibility.Visible; lbl1.Visibility = Visibility.Visible;
lbl2.Visibility = Visibility.Visible; //lbl2.Visibility = Visibility.Collapsed;
//btnAddMitarbeiter.Visibility = Visibility.Visible;
dPMAFilter.Visibility = Visibility.Visible;
//cBGewerke.Visibility = Visibility.Visible;
var x = (sender); dPMAFilter.SelectedDate = ((DateTime)((sender.DataContext as System.Data.DataRowView).Row.ItemArray[4]));
var y = x.DataContext as System.Data.DataRowView;
var z = y.Row.ItemArray[0];
buttonDatum = y.Row.ItemArray[4];
var schicht = y.Row.ItemArray[8].ToString().Substring(0, 2);
lblDate.Text = Convert.ToDateTime(buttonDatum).ToShortDateString();
switch (schicht)
{
case "MF":
cBSchicht.SelectedIndex = 0;
break;
case "MT":
cBSchicht.SelectedIndex = 0;
break;
case "MS":
cBSchicht.SelectedIndex = 1;
break;
case "MN":
cBSchicht.SelectedIndex = 2;
break;
default:
cBSchicht.SelectedIndex = 0;
break;
}
if (schicht == "MF" || schicht == "MT") #region old
MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) From `mitarbeiter_static` `m` left join `mitarbeiter_change` `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung"); //sending = sender;
else
MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) From `mitarbeiter_static` `m` left join `mitarbeiter_change` `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
//schaltList = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE ZugName = '{tbName.Text}'", schaltList); //dPMAFilter.Visibility = Visibility.Collapsed;
schaltListTag = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}'", schaltListTag); ////cBGewerke.Visibility = Visibility.Collapsed;
////btnAddMitarbeiter.Visibility = Visibility.Collapsed;
//lbl1.Visibility = Visibility.Visible;
//lbl2.Visibility = Visibility.Visible;
MAView = Helper.DataTableToGewerk(MACombo); //var x = (sender);
//var y = x.DataContext as System.Data.DataRowView;
//var z = y.Row.ItemArray[0];
//buttonDatum = y.Row.ItemArray[4];
//var schicht = y.Row.ItemArray[8].ToString().Substring(0, 2);
//lblDate.Text = Convert.ToDateTime(buttonDatum).ToShortDateString();
//switch (schicht)
//{
// case "MF":
// cBSchicht.SelectedIndex = 0;
// break;
// case "MT":
// cBSchicht.SelectedIndex = 0;
// break;
// case "MS":
// cBSchicht.SelectedIndex = 1;
// break;
// case "MN":
// cBSchicht.SelectedIndex = 2;
// break;
// default:
// cBSchicht.SelectedIndex = 0;
// break;
//}
//if (schicht == "MF" || schicht == "MT")
// FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), "$$", dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
//else
// FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), schicht, dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
////var s = $"SELECT Abteilung, MIN(DISTINCT (COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0)),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung";
////if (schicht == "MF" || schicht == "MT")
//// MACombo = await SQL.ReadSQL($"SELECT Abteilung, MIN(DISTINCT (COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0)),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
//////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////else
//// MACombo = await SQL.ReadSQL($"SELECT Abteilung, MIN(DISTINCT (COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0)),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
//////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////schaltList = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung s WHERE ZugName = '{tbName.Text}'", schaltList);
////schaltListTag = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung s WHERE Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}'", schaltListTag);
//schaltListTag = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung `s` WHERE Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}'", schaltListTag);
////MAView = Helper.DataTableToGewerk(MACombo);
//dPSchaltVon.ValueChanged += DPSchaltVon_ValueChanged;
//dPSchaltBis.ValueChanged += DPSchaltBis_ValueChanged;
#endregion
} }
bool resultChanged = false; bool resultChanged = false;
private void BtnOK_Click(object sender, RoutedEventArgs e) private void BtnOK_Click(object sender, RoutedEventArgs e)
{ {
@ -154,12 +203,21 @@ namespace PEP_Tool
await Task.Delay(50); await Task.Delay(50);
await SQL.WriteSQL($"INSERT INTO `schaltung` (ZugName,Datum,Start,Ende,Zustand,Grund,AnzahlMA,Abteilung) VALUES ('{tbName.Text}','{date.ToString("yyyy-MM-dd")}','{dPSchaltVon.Text}','{dPSchaltBis.Text}','{cbSchaltzustand.Text}','{tbGrund.Text}','{cBAnzahlMA.SelectedValue.ToString()}','{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}')"); //await SQL.WriteSQL($"INSERT INTO pep_tool.schaltung (ZugName,Datum,Start,Ende,Zustand,Grund,AnzahlMA,Abteilung) VALUES ('{tbName.Text}','{date.ToString("yyyy-MM-dd")}','{dPSchaltVon.Text}','{dPSchaltBis.Text}','{cbSchaltzustand.Text}','{tbGrund.Text}','{cBAnzahlMA.SelectedValue.ToString()}','{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}')");
schaltList = await SQL.ReadSQL($"Select Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE ZugName = '{tbName.Text}'", schaltList); //schaltList = await SQL.ReadSQL($"Select Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung s WHERE ZugName = '{tbName.Text}'", schaltList);
schaltListGewerk = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Abteilung = '{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}' AND Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListGewerk); //schaltListGewerk = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung s WHERE Abteilung = '{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}' AND Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListGewerk);
schaltListTag = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListTag); //schaltListTag = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung s WHERE Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListTag);
if (cBAnzahlMA.SelectedValue != null && cBAnzahlMA.SelectedIndex != -1 && cBAnzahlMA.SelectedValue.ToString() != "Keine MA verfügbar")
await SQL.WriteSQL($"INSERT INTO pep_tool.schaltung (ZugName,Datum,Start,Ende,Zustand,Grund,AnzahlMA,Abteilung,StartEx,EndEx) VALUES ('{tbName.Text}','{date.ToString("yyyy-MM-dd")}','{dPSchaltVon.Text}','{dPSchaltBis.Text}','{cbSchaltzustand.Text}','{tbGrund.Text}','{cBAnzahlMA.SelectedValue.ToString()}','{(((Gewerk)((ItemCollection)(dGMAView.Items))[lastSelectedIndex]).Abteilung)}','{dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm")}','{dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm")}')");
else
MessageBox.Show(this, "Anzahl Mitarbeiter auswählen!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
schaltList = await SQL.ReadSQL($"Select Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung `s` WHERE ZugName = '{tbName.Text}'", schaltList);
schaltListGewerk = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung `s` WHERE Abteilung = '{(((Gewerk)((ItemCollection)(dGMAView.Items))[lastSelectedIndex]).Abteilung)}' AND Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListGewerk);
schaltListTag = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung `s` WHERE Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListTag);
var schicht = ""; var schicht = "";
@ -179,29 +237,100 @@ namespace PEP_Tool
break; break;
} }
if (schicht == "MF" || schicht == "MT") if (schicht == "MF" || schicht == "MT")
MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) From `mitarbeiter_static` `m` left join `mitarbeiter_change` `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung"); FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), "$$", dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
else else
MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) From `mitarbeiter_static` `m` left join `mitarbeiter_change` `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung"); FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), schicht, dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
MAView = Helper.DataTableToGewerk(MACombo); //if (schicht == "MF" || schicht == "MT")
// MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
//else
// MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
//MAView = Helper.DataTableToGewerk(MACombo);
dPSchaltVon.ValueChanged -= DPSchaltVon_ValueChanged;
dPSchaltBis.ValueChanged -= DPSchaltBis_ValueChanged;
dPMAFilter.SelectedDateChanged -= DPMAFilter_SelectedDateChanged;
cBSchicht.SelectionChanged -= CBSchicht_SelectionChanged;
tbName.TextChanged -= TbName_TextChanged;
dGMAView.SelectionChanged -= DGMAView_SelectionChanged;
cBsWork.SelectionChanged -= cBsWork_SelectionChanged;
tbGrund.TextChanged -= tbGrund_TextChanged;
cbSchaltzustand.SelectionChanged -= cbSchaltzustand_SelectionChanged;
cBAnzahlMA.SelectionChanged -= cBAnzahlMA_SelectionChanged;
li.Visibility = Visibility.Collapsed; li.Visibility = Visibility.Collapsed;
dPSchaltVon.Value = null;
dPSchaltBis.Value = null;
cBSchicht.SelectedIndex = -1;
cbSchaltzustand.SelectedIndex = -1;
cBAnzahlMA.SelectedIndex = -1;
cBsWork.SelectedIndex = -1;
dPMAFilter.SelectedDate = null;
tbName.Text = "Tz ";
tbGrund.Text = "";
tbName.IsEnabled = false;
dPSchaltBis.IsEnabled = false;
dPSchaltVon.IsEnabled = false;
dGMAView.IsEnabled = false;
cbSchaltzustand.IsEnabled = false;
cBsWork.IsEnabled = false;
tbGrund.IsEnabled = false;
cbSchaltzustand.IsEnabled = false;
cBAnzahlMA.IsEnabled = false;
btnAdd.IsEnabled = false;
arrow6MAView.Visibility = Visibility.Collapsed;
arrow10MA.Visibility = Visibility.Collapsed;
arrow11Add.Visibility = Visibility.Collapsed;
arrow1Date.Visibility = Visibility.Visible;
dPSchaltVon.ValueChanged += DPSchaltVon_ValueChanged;
dPSchaltBis.ValueChanged += DPSchaltBis_ValueChanged;
dPMAFilter.SelectedDateChanged += DPMAFilter_SelectedDateChanged;
cBSchicht.SelectionChanged += CBSchicht_SelectionChanged;
tbName.TextChanged += TbName_TextChanged;
dGMAView.SelectionChanged += DGMAView_SelectionChanged;
cBsWork.SelectionChanged += cBsWork_SelectionChanged;
tbGrund.TextChanged += tbGrund_TextChanged;
cbSchaltzustand.SelectionChanged += cbSchaltzustand_SelectionChanged;
cBAnzahlMA.SelectionChanged += cBAnzahlMA_SelectionChanged;
} }
private void DPMAFilter_SelectedDateChanged(object sender, SelectionChangedEventArgs e) private void DPMAFilter_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{ {
throw new NotImplementedException(); buttonDatum = dPMAFilter.SelectedDate;
lblDate.Text = Convert.ToDateTime(buttonDatum).ToShortDateString();
GetDates();
if (buttonDatum.ToString() != "")
{
cBSchicht.IsEnabled = true;
arrow2Schicht.Visibility = Visibility.Visible;
arrow1Date.Visibility = Visibility.Collapsed;
}
else
{
cBSchicht.IsEnabled = false;
arrow2Schicht.Visibility = Visibility.Collapsed;
arrow1Date.Visibility = Visibility.Visible;
}
} }
private async void DGSchaltList_PreviewKeyDown(object sender, KeyEventArgs e) private async void DGSchaltList_PreviewKeyDown(object sender, KeyEventArgs e)
{ {
var dg = sender as DataGrid; var dg = sender as DataGrid;
var row = dg.SelectedItem as DataRowView; var row = dg.SelectedItem as DataRowView;
var arr = row.Row.ItemArray; var arr = row.Row.ItemArray;
if (e.Key == Key.Delete) if (e.Key == Key.Delete)
{ {
@ -210,10 +339,11 @@ namespace PEP_Tool
await Task.Delay(50); await Task.Delay(50);
//await SQL.WriteSQL($"UPDATE `mitarbeiter_change` `m` left join `schaltung` `s` ON m.mitarbeiter_static_PersNr = s.mitarbeiter_static_PersNr AND s.Datum = m.Datum SET `ZugNameB` = (select s.ZugName WHERE s.mitarbeiter_static_PersNr = '{arr[8]}' AND s.Start > DATE_FORMAT(NOW(), '%d.%m. %H:%i')) WHERE (s.ZugName = '{arr[1]}' AND s.Datum = '{Convert.ToDateTime(arr[3]).ToString("yyyy-MM-dd")}' AND s.Start = '{arr[4]}' AND s.Ende = '{arr[5]}' AND s.Zustand = '{arr[6]}' AND s.Grund = '{arr[7]}')"); await SQL.WriteSQL($"UPDATE pep_tool.mitarbeiter_change `m` left join pep_tool.schaltung `s` ON m.mitarbeiter_static_PersNr = s.mitarbeiter_static_PersNr AND s.Datum = m.Datum SET ZugNameB = (select s.ZugName WHERE s.mitarbeiter_static_PersNr = '{arr[8]}' AND s.Start > DATE_FORMAT(NOW(), '%d.%m. %H:%i')) WHERE (s.ZugName = '{arr[1]}' AND s.Datum = '{Convert.ToDateTime(arr[3]).ToString("yyyy-MM-dd")}' AND s.Start = '{arr[4]}' AND s.Ende = '{arr[5]}' AND s.Zustand = '{arr[6]}' AND s.Grund = '{arr[7]}')");
await SQL.WriteSQL($"DELETE FROM `schaltung` WHERE (`Abteilung` = '{arr[0]}' AND `ZugName` = '{arr[2]}' AND `Datum` = '{Convert.ToDateTime(arr[3].ToString().Split(' ')[0] + "." + DateTime.Now.Year).ToString("yyyy-MM-dd")}' AND `Start` = '{arr[3]}' AND `Ende` = '{arr[4]}' AND `Zustand` = '{arr[5]}' AND `Grund` = '{arr[6]}')"); await SQL.WriteSQL($"DELETE FROM pep_tool.schaltung WHERE (Abteilung = '{arr[0]}' AND ZugName = '{arr[2]}' AND Datum = '{Convert.ToDateTime(arr[3].ToString().Split(' ')[0] + "." + DateTime.Now.Year).ToString("yyyy-MM-dd")}' AND Start = '{arr[3]}' AND Ende = '{arr[4]}' AND Zustand = '{arr[5]}' AND Grund = '{arr[6]}')");
//await SQL.WriteSQL($"DELETE FROM [pep_tool.schaltung] WHERE ([Abteilung] = '{arr[0]}' AND [ZugName] = '{arr[2]}' AND [Datum] = '{Convert.ToDateTime(arr[3].ToString().Split(' ')[0] + "." + DateTime.Now.Year).ToString("yyyy-MM-dd")}' AND [Start] = '{arr[3]}' AND [Ende] = '{arr[4]}' AND [Zustand] = '{arr[5]}' AND [Grund] = '{arr[6]}')");
//schaltList = await SQL.ReadSQL($"Select Name,ZugName,Start,Ende,Zustand,Grund FROM `mitarbeiter_static` `m` left join `schaltung` `s` ON m.PersNr = s.mitarbeiter_static_PersNr WHERE {pers}", schaltList); //schaltList = await SQL.ReadSQL($"Select Name,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.mitarbeiter_static m left join pep_tool.schaltung s ON m.PersNr = s.mitarbeiter_static_PersNr WHERE {pers}", schaltList);
li.Visibility = Visibility.Collapsed; li.Visibility = Visibility.Collapsed;
} }
} }
@ -222,18 +352,66 @@ namespace PEP_Tool
{ {
if (dGMAView.SelectedIndex != -1) if (dGMAView.SelectedIndex != -1)
{ {
var i = Convert.ToInt16((((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).MAVerfuegbar)); lastSelectedIndex = dGMAView.SelectedIndex;
var a = new int[i];
for (var j = 1; j != i + 1; ++j) var i = Convert.ToInt16((((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).MAVerfuegbar));
//var a = new int[i];
var a = new List<int>();
if (i <= 0) { a.Clear(); a.Add(0); }
else
{ {
a[j - 1] = j; for (var j = 1; j != i + 1; ++j)
{
//a[j - 1] = j;
a.Add(j);
}
} }
cBAnzahlMA.ItemsSource = a; if (a.Count == 1 && a[0] == 0)
{
cBAnzahlMA.ItemsSource = new string[1] { "Keine MA verfügbar" };
}
else
{
cBAnzahlMA.ItemsSource = a;
}
lblPlanungGewerk.Text = $"Planung für Gewerk '{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}' am {Convert.ToDateTime(buttonDatum).ToShortDateString()}:"; lblPlanungGewerk.Text = $"Planung für Gewerk '{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}' am {Convert.ToDateTime(buttonDatum).ToShortDateString()}:";
schaltListGewerk = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Abteilung = '{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}' AND Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListGewerk); schaltListGewerk = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung `s` WHERE Abteilung = '{(((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).Abteilung)}' AND Start like '{Convert.ToDateTime(buttonDatum).ToString("dd.MM.")}%'", schaltListGewerk);
cbSchaltzustand.IsEnabled = true;
cBsWork.IsEnabled = true;
tbGrund.IsEnabled = true;
cbSchaltzustand.IsEnabled = true;
//cBAnzahlMA.IsEnabled = true;
//btnAdd.IsEnabled = true;
arrow6MAView.Visibility = Visibility.Collapsed;
arrow7sWork.Visibility = Visibility.Visible;
arrow8Grund.Visibility = Visibility.Visible;
arrow9Schaltzustand.Visibility = Visibility.Visible;
//arrow10MA.Visibility = Visibility.Visible;
}
else
{
cbSchaltzustand.IsEnabled = false;
cBsWork.IsEnabled = false;
tbGrund.IsEnabled = false;
cbSchaltzustand.IsEnabled = false;
//cBAnzahlMA.IsEnabled = false;
btnAdd.IsEnabled = false;
arrow6MAView.Visibility = Visibility.Visible;
arrow7sWork.Visibility = Visibility.Collapsed;
arrow8Grund.Visibility = Visibility.Collapsed;
arrow9Schaltzustand.Visibility = Visibility.Collapsed;
//arrow10MA.Visibility = Visibility.Collapsed;
} }
} }
@ -248,14 +426,24 @@ namespace PEP_Tool
if (System.Text.RegularExpressions.Regex.IsMatch(tbName.Text, @".{1,3}\d\d\d+")) if (System.Text.RegularExpressions.Regex.IsMatch(tbName.Text, @".{1,3}\d\d\d+"))
{ {
schaltList = await SQL.ReadSQL($"Select Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE ZugName = '{tbName.Text}'", schaltList); schaltList = await SQL.ReadSQL($"Select Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung `s` WHERE ZugName = '{tbName.Text}'", schaltList);
lblPlanungTz.Text = $"Planung für Triebzug '{tbName.Text}':"; lblPlanungTz.Text = $"Planung für Triebzug '{tbName.Text}':";
dPSchaltVon.IsEnabled = true;
arrow4Von.Visibility = Visibility.Visible;
arrow3Name.Visibility = Visibility.Collapsed;
} }
else else
{ {
schaltList.Clear(); schaltList.Clear();
lblPlanungTz.Text = $"Planung für Triebzug:"; lblPlanungTz.Text = $"Planung für Triebzug:";
dPSchaltVon.IsEnabled = false;
arrow4Von.Visibility = Visibility.Collapsed;
if(tbName.Text != "Tz ") arrow3Name.Visibility = Visibility.Visible;
} }
} }
@ -266,6 +454,31 @@ namespace PEP_Tool
private async void CBSchicht_SelectionChanged(object sender, SelectionChangedEventArgs e) private async void CBSchicht_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
GetDates();
if ((sender as ComboBox).SelectedIndex != -1)
{
tbName.IsEnabled = true;
arrow3Name.Visibility = Visibility.Visible;
arrow2Schicht.Visibility = Visibility.Collapsed;
}
else
{
tbName.IsEnabled = false;
arrow3Name.Visibility = Visibility.Collapsed;
arrow2Schicht.Visibility = Visibility.Visible;
}
dPSchaltVon.ValueChanged += DPSchaltVon_ValueChanged;
dPSchaltBis.ValueChanged += DPSchaltBis_ValueChanged;
}
private async void GetDates ()
{
dPSchaltVon.ValueChanged -= DPSchaltVon_ValueChanged;
dPSchaltBis.ValueChanged -= DPSchaltBis_ValueChanged;
var schicht = "";//((DataRowView)((Button)sending).DataContext).Row.ItemArray[8].ToString().Substring(0, 2); var schicht = "";//((DataRowView)((Button)sending).DataContext).Row.ItemArray[8].ToString().Substring(0, 2);
switch (cBSchicht.SelectedIndex) switch (cBSchicht.SelectedIndex)
@ -286,9 +499,9 @@ namespace PEP_Tool
DataTable dt = null; DataTable dt = null;
if (schicht == "MF" || schicht == "MT") if (schicht == "MF" || schicht == "MT")
dt = await SQL.ReadSQL($"SELECT Min(str_to_date(REPLACE(Beginn, '*', ':'), '%H:%i')), max(str_to_date(REPLACE(Gehen, '*', ':'), '%H:%i')) from mitarbeiter_change where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (Arbeitsmuster like '%{schicht}%' OR Arbeitsmuster like '%MT%')"); dt = await SQL.ReadSQL($"SELECT Min(str_to_date(REPLACE(Beginn, '*', ':'), '%H:%i')), max(str_to_date(REPLACE(Gehen, '*', ':'), '%H:%i')) from pep_tool.mitarbeiter_change where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (Arbeitsmuster like '%MF%' OR Arbeitsmuster like '%MT%')");
else else
dt = await SQL.ReadSQL($"SELECT Min(str_to_date(REPLACE(Beginn, '*', ':'), '%H:%i')), max(str_to_date(REPLACE(Gehen, '*', ':'), '%H:%i')) from mitarbeiter_change where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND Arbeitsmuster like '%{schicht}%'"); dt = await SQL.ReadSQL($"SELECT Min(str_to_date(REPLACE(Beginn, '*', ':'), '%H:%i')), max(str_to_date(REPLACE(Gehen, '*', ':'), '%H:%i')) from pep_tool.mitarbeiter_change where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND Arbeitsmuster like '%{schicht}%'");
var from = dt.Rows[0].ItemArray[0].ToString(); var from = dt.Rows[0].ItemArray[0].ToString();
var until = dt.Rows[0].ItemArray[1].ToString(); var until = dt.Rows[0].ItemArray[1].ToString();
@ -320,25 +533,265 @@ namespace PEP_Tool
dPSchaltVon.Value = dPSchaltVon.Minimum.Value; dPSchaltVon.Value = dPSchaltVon.Minimum.Value;
dPSchaltBis.Value = dPSchaltBis.Maximum.Value; dPSchaltBis.Value = dPSchaltBis.Maximum.Value;
if (schicht == "MF" || schicht == "MT") if (schicht == "MF" || schicht == "MT")
MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) From `mitarbeiter_static` `m` left join `mitarbeiter_change` `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung"); FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), "$$", dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
else else
MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) From `mitarbeiter_static` `m` left join `mitarbeiter_change` `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung"); FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), schicht, dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
schaltListTag = await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM pep_tool.schaltung `s` WHERE Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}'", schaltListTag);
MAView = Helper.DataTableToGewerk(MACombo); MAView = Helper.DataTableToGewerk(MACombo);
//dPSchaltVon.ValueChanged += DPSchaltVon_ValueChanged;
//dPSchaltBis.ValueChanged += DPSchaltBis_ValueChanged;
} }
private void OnPropertyChanged([CallerMemberName] string propertyName = null) private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName); System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
private async void DPSchaltVon_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (dPSchaltVon.Value.HasValue && dPSchaltBis.Value.HasValue)
{
var schicht = "";//((DataRowView)((Button)sending).DataContext).Row.ItemArray[8].ToString().Substring(0, 2);
switch (cBSchicht.SelectedIndex)
{
case 0:
schicht = "MF";
break;
case 1:
schicht = "MS";
break;
case 2:
schicht = "MN";
break;
default:
schicht = "MF";
break;
}
if (schicht == "MF" || schicht == "MT")
FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), "$$", dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
else
FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), schicht, dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
//if (schicht == "MF" || schicht == "MT")
// MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
//else
// MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
MAView = Helper.DataTableToGewerk(MACombo);
}
if ((sender as Xceed.Wpf.Toolkit.DateTimePicker).Value.HasValue)
{
dPSchaltBis.IsEnabled = true;
arrow5Bis.Visibility = Visibility.Visible;
arrow4Von.Visibility = Visibility.Collapsed;
}
else
{
dPSchaltBis.IsEnabled = false;
arrow5Bis.Visibility = Visibility.Collapsed;
arrow4Von.Visibility = Visibility.Visible;
}
}
private async void DPSchaltBis_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (dPSchaltVon.Value.HasValue && dPSchaltBis.Value.HasValue)
{
var schicht = "";//((DataRowView)((Button)sending).DataContext).Row.ItemArray[8].ToString().Substring(0, 2);
switch (cBSchicht.SelectedIndex)
{
case 0:
schicht = "MF";
break;
case 1:
schicht = "MS";
break;
case 2:
schicht = "MN";
break;
default:
schicht = "MF";
break;
}
if (schicht == "MF" || schicht == "MT")
FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), "$$", dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
else
FillComboAndView(Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd"), schicht, dPSchaltVon.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"), dPSchaltBis.Value.Value.ToString("yyyy-MM-dd HH:mm:ss"));
// MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
//else
// MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) - IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0),COUNT(*),IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung),0) + IFNULL((SELECT count(*) from mitarbeiter_change join mitarbeiter_static on PersNr = mitarbeiter_static_PersNr where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND Zuweisung != '' AND m.Abteilung = Abteilung),0) From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
////MACombo = await SQL.ReadSQL($"SELECT Abteilung, COUNT(*) - CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END,COUNT(*),CASE WHEN (SELECT SUM(AnzahlMA) from pep_tool.schaltung s where Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' AND c.Arbeitsmuster like '%{schicht}%' AND s.Abteilung = m.Abteilung) IS NULL THEN 0 ELSE NULL END From pep_too.mitarbeiter_static m left join pep_tool.mitarbeiter_change [c] ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{schicht}%' AND c.Datum = '{Convert.ToDateTime(buttonDatum).ToString("yyyy-MM-dd")}' group by m.Abteilung order by Abteilung");
MAView = Helper.DataTableToGewerk(MACombo);
}
if ((sender as Xceed.Wpf.Toolkit.DateTimePicker).Value.HasValue)
{
dGMAView.IsEnabled = true;
arrow6MAView.Visibility = Visibility.Visible;
arrow5Bis.Visibility = Visibility.Collapsed;
}
else
{
dGMAView.IsEnabled = false;
arrow6MAView.Visibility = Visibility.Collapsed;
arrow5Bis.Visibility = Visibility.Visible;
}
}
private void cBsWork_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var x = sender as ComboBox;
tbGrund.Text = (x.SelectedItem as sWork).Work != "" ? (x.SelectedItem as sWork).Work : (x.SelectedItem as sWork).Title;
cbSchaltzustand.SelectedIndex = Helper.returnIndexForString((x.SelectedItem as sWork).Schaltzustand);
arrow7sWork.Visibility = Visibility.Collapsed;
arrow8Grund.Visibility = Visibility.Collapsed;
arrow9Schaltzustand.Visibility = cbSchaltzustand.SelectedIndex != -1 ? Visibility.Collapsed : Visibility.Visible;
arrow10MA.Visibility= cbSchaltzustand.SelectedIndex != -1 ? Visibility.Visible : Visibility.Collapsed;
cBAnzahlMA.IsEnabled = cbSchaltzustand.SelectedIndex != -1 ? true : false;
}
private async void FillComboAndView(string date, string arbeitsmuster, string starttime, string endtime)
{
var s = $"SELECT Abteilung, count(*) - max(IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{date}' AND (((CAST('{starttime}' AS DATETIME) BETWEEN StartEx AND EndEx) OR (CAST('{endtime}' AS DATETIME) BETWEEN StartEx AND EndEx)) OR ((StartEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)) OR (EndEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)))) AND c.Arbeitsmuster like '%{arbeitsmuster}%' AND s.Abteilung = m.Abteilung),0)) as verfügbar, count(*) as anwesend, max(IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{date}' AND (((CAST('{starttime}' AS DATETIME) BETWEEN StartEx AND EndEx) OR (CAST('{endtime}' AS DATETIME) BETWEEN StartEx AND EndEx)) OR ((StartEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)) OR (EndEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)))) AND c.Arbeitsmuster like '%{arbeitsmuster}%' AND s.Abteilung = m.Abteilung),0)) as verplant From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{arbeitsmuster}%' AND c.Datum = '{date}' group by m.Abteilung order by Abteilung";
if (arbeitsmuster == "$$")
MACombo = await SQL.ReadSQL($"SELECT Abteilung, count(*) - max(IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{date}' AND (((CAST('{starttime}' AS DATETIME) BETWEEN StartEx AND EndEx) OR (CAST('{endtime}' AS DATETIME) BETWEEN StartEx AND EndEx)) OR ((StartEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)) OR (EndEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)))) AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0)) as verfügbar, count(*) as anwesend, max(IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{date}' AND (((CAST('{starttime}' AS DATETIME) BETWEEN StartEx AND EndEx) OR (CAST('{endtime}' AS DATETIME) BETWEEN StartEx AND EndEx)) OR ((StartEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)) OR (EndEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)))) AND (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND s.Abteilung = m.Abteilung),0)) as verplant From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE (c.Arbeitsmuster like '%MF%' OR c.Arbeitsmuster like '%MT%') AND c.Datum = '{date}' group by m.Abteilung order by Abteilung");
else
MACombo = await SQL.ReadSQL($"SELECT Abteilung, count(*) - max(IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{date}' AND (((CAST('{starttime}' AS DATETIME) BETWEEN StartEx AND EndEx) OR (CAST('{endtime}' AS DATETIME) BETWEEN StartEx AND EndEx)) OR ((StartEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)) OR (EndEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)))) AND c.Arbeitsmuster like '%{arbeitsmuster}%' AND s.Abteilung = m.Abteilung),0)) as verfügbar, count(*) as anwesend, max(IFNULL((SELECT SUM(AnzahlMA) from pep_tool.schaltung `s` where Datum = '{date}' AND (((CAST('{starttime}' AS DATETIME) BETWEEN StartEx AND EndEx) OR (CAST('{endtime}' AS DATETIME) BETWEEN StartEx AND EndEx)) OR ((StartEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)) OR (EndEx BETWEEN CAST('{starttime}' AS DATETIME) AND CAST('{endtime}' AS DATETIME)))) AND c.Arbeitsmuster like '%{arbeitsmuster}%' AND s.Abteilung = m.Abteilung),0)) as verplant From pep_tool.mitarbeiter_static `m` left join pep_tool.mitarbeiter_change `c` ON m.PersNr = c.mitarbeiter_static_PersNr WHERE c.Arbeitsmuster like '%{arbeitsmuster}%' AND c.Datum = '{date}' group by m.Abteilung order by Abteilung");
MAView = Helper.DataTableToGewerk(MACombo);
var dgGewerk = Helper.GetDataGridRows(dGSchaltListGewerk) != null && Helper.GetDataGridRows(dGSchaltListGewerk).Count() != 0 ? Helper.GetDataGridRows(dGSchaltListGewerk) : Enumerable.Empty<DataGridRow>();
var dgTag = Helper.GetDataGridRows(dGSchaltListTag) != null && Helper.GetDataGridRows(dGSchaltListTag).Count() != 0 ? Helper.GetDataGridRows(dGSchaltListTag) : Enumerable.Empty<DataGridRow>();
var start = Convert.ToDateTime(starttime);
var end = Convert.ToDateTime(endtime);
SolidColorBrush w = new SolidColorBrush(Colors.White);
SolidColorBrush r = new SolidColorBrush(Colors.LightSalmon);
foreach(DataGridRow DGrow in dgGewerk)
{
var rView = DGrow.DataContext as DataRowView;
var row = rView.Row;
var von = DateTime.ParseExact(row.ItemArray[3].ToString(), "dd.MM. HH:mm", null);
var bis = DateTime.ParseExact(row.ItemArray[4].ToString(), "dd.MM. HH:mm", null);
if (((start >= von && start <= bis) || (end >= von && end <= bis)) || ((von >= start && von <= end) || (bis >= start && bis <= end)))
{
DGrow.Background = r;
}
else DGrow.Background = w;
}
foreach (DataGridRow DGrow in dgTag)
{
var rView = DGrow.DataContext as DataRowView;
var row = rView.Row;
var von = DateTime.ParseExact(row.ItemArray[3].ToString(), "dd.MM. HH:mm", null);
var bis = DateTime.ParseExact(row.ItemArray[4].ToString(), "dd.MM. HH:mm", null);
if (((start >= von && start <= bis) || (end >= von && end <= bis)) || ((von >= start && von <= end) || (bis >= start && bis <= end)))
{
DGrow.Background = r;
}
else DGrow.Background = w;
}
}
private void tbGrund_TextChanged(object sender, TextChangedEventArgs e)
{
arrow8Grund.Visibility = Visibility.Collapsed;
arrow7sWork.Visibility = Visibility.Collapsed;
arrow10MA.Visibility = cbSchaltzustand.SelectedIndex != -1 ? Visibility.Visible : Visibility.Collapsed;
cBAnzahlMA.IsEnabled = cbSchaltzustand.SelectedIndex != -1 ? true : false;
}
private void cbSchaltzustand_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (cbSchaltzustand.SelectedIndex != -1)
{
arrow9Schaltzustand.Visibility = Visibility.Collapsed;
arrow7sWork.Visibility = Visibility.Collapsed;
arrow10MA.Visibility = Visibility.Visible;
cBAnzahlMA.IsEnabled = true;
}
else
{
arrow9Schaltzustand.Visibility = Visibility.Visible;
arrow7sWork.Visibility = Visibility.Visible;
arrow10MA.Visibility = Visibility.Collapsed;
cBAnzahlMA.IsEnabled = false;
}
}
private void cBAnzahlMA_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (cBAnzahlMA.SelectedIndex != -1)
{
arrow10MA.Visibility = Visibility.Collapsed;
arrow11Add.Visibility = Visibility.Visible;
btnAdd.IsEnabled = true;
}
else
{
arrow10MA.Visibility = Visibility.Visible;
arrow11Add.Visibility = Visibility.Collapsed;
btnAdd.IsEnabled = false;
}
}
private void dPSchaltVon_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
arrow4Von.Visibility = Visibility.Collapsed;
dPSchaltBis.IsEnabled = true;
arrow5Bis.Visibility = Visibility.Visible;
}
private void dPSchaltBis_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
arrow5Bis.Visibility = Visibility.Collapsed;
dGMAView.IsEnabled = true;
arrow6MAView.Visibility = Visibility.Visible;
}
} }
@ -369,4 +822,13 @@ namespace PEP_Tool
public string MAVerplant { get; set; } public string MAVerplant { get; set; }
public string MAVerfuegbar { get; set; } public string MAVerfuegbar { get; set; }
} }
public class sWork
{
public string Title { get; set; }
public string Work { get; set; }
public string Schaltzustand { get; set; }
public string Display { get { return Schaltzustand != "" ? $"'{Title}' bei '{Schaltzustand}'" : Title; } }
}
} }

View File

@ -6,7 +6,11 @@
<package id="Extended.Wpf.Toolkit" version="3.5.0" targetFramework="net45" /> <package id="Extended.Wpf.Toolkit" version="3.5.0" targetFramework="net45" />
<package id="Fody" version="2.5.0" targetFramework="net452" developmentDependency="true" /> <package id="Fody" version="2.5.0" targetFramework="net452" developmentDependency="true" />
<package id="Google.Protobuf" version="3.6.1" targetFramework="net452" /> <package id="Google.Protobuf" version="3.6.1" targetFramework="net452" />
<package id="Microsoft.Identity.Client" version="4.17.0" targetFramework="net452" requireReinstallation="true" />
<package id="Microsoft.SharePointOnline.CSOM" version="16.1.20317.12000" targetFramework="net452" />
<package id="MySql.Data" version="8.0.17" targetFramework="net452" /> <package id="MySql.Data" version="8.0.17" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" /> <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net452" /> <package id="SSH.NET" version="2016.1.0" targetFramework="net452" />
<package id="System.Data.Common" version="4.3.0" targetFramework="net452" />
<package id="System.Data.SqlClient" version="4.7.0" targetFramework="net452" requireReinstallation="true" />
</packages> </packages>

View File

@ -0,0 +1,54 @@
<UserControl x:Name="AnimatedArrow" x:Class="PEP_Tool.ucAnimatedArrow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PEP_Tool"
mc:Ignorable="d" Height="300" Width="171">
<UserControl.Resources>
<Storyboard x:Key="Storyboard1" RepeatBehavior="Forever" SpeedRatio="0.7">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<EasingDoubleKeyFrame KeyTime="00:00:00.1000000" Value="-30"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.1500000" Value="-67.333"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="-30"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2500000" Value="30"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="67.333"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.3500000" Value="30"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.4000000" Value="-1.333"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<EasingDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.667"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.667"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2500000" Value="-0.666"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.3500000" Value="-0.666"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0.001"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.1500000" Value="0.689"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.689"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.3500000" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</EventTrigger>
</UserControl.Triggers>
<Grid>
<Image x:Name="image" Source="Arrow.png" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Height="240" Width="171">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PEP_Tool
{
/// <summary>
/// Interaktionslogik für ucAnimatedArrow.xaml
/// </summary>
public partial class ucAnimatedArrow : UserControl
{
public ucAnimatedArrow()
{
InitializeComponent();
}
}
}