KT erweiterung

This commit is contained in:
Marcus Bachler 2019-11-21 08:32:45 +01:00
parent d0d69ad045
commit 3b35dd0891
29 changed files with 1920 additions and 2670 deletions

View File

@ -9,7 +9,7 @@
</configSections>
<connectionStrings />
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
@ -25,9 +25,6 @@
<userSettings>
<PEP_Tool.Properties.Settings>
<setting name="LizenzenPath" serializeAs="String">
<value />
</setting>
<setting name="AbteilungsnamenPath" serializeAs="String">
<value />
</setting>
@ -41,7 +38,7 @@
<value>1.0</value>
</setting>
<setting name="Version" serializeAs="String">
<value>2.0.4</value>
<value>3.0.1</value>
</setting>
<setting name="WindowPosLeft" serializeAs="String">
<value>0</value>
@ -59,40 +56,48 @@
<value>1323</value>
</setting>
<setting name="WidthBemerkung" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthZuweisung" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthLizenzen" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthAbteilung" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthGehen" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthKommen" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthDatum" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthVorname" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthName" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
<setting name="WidthTelefon" serializeAs="String">
<value>0</value>
<value>*</value>
</setting>
</PEP_Tool.Properties.Settings>
</userSettings>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data></configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.9.1.0" newVersion="3.9.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -36,7 +36,37 @@
</RichTextBox.Template>-->
<FlowDocument>
<Paragraph LineHeight="6">
<Run Text="Version 2.0.3"/>
<Run Text="Version 3.0.1"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Druck- und Exportfunktion sind wieder funktionsfähig"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 3.0.0"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Umstellung auf SQL"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Performanceverbesserungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 2.0.3, 2.0.4, 2.0.4b, 2.0.4c, 2.0.4d"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>

View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public class ChangesQueue
{
public class BemerkungenChanges
{
public object sender { get; set; }
public int index { get; set; }
}
public class TelefonChanges
{
public object sender { get; set; }
public int index { get; set; }
}
}
}

View File

@ -1,76 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public static class Crypto
{
static string CryptoString = @"]VQr$gOKG_19m~p:9y0+DD{6?hL}##l_'^?M)>}OI&EIC~8thwY7YG<\d2[NdKA";
public static async Task<string> EncryptString(string Message)
{
await Task.Delay(100);
byte[] Results = null;
System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding();
MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider();
byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(CryptoString));
TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider();
TDESAlgorithm.Key = TDESKey;
TDESAlgorithm.Mode = CipherMode.ECB;
TDESAlgorithm.Padding = PaddingMode.PKCS7;
byte[] DataToEncrypt = UTF8.GetBytes(Message);
try
{
ICryptoTransform Encryptor = TDESAlgorithm.CreateEncryptor();
Results = Encryptor.TransformFinalBlock(DataToEncrypt, 0, DataToEncrypt.Length);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
finally
{
TDESAlgorithm.Clear();
HashProvider.Clear();
}
return Convert.ToBase64String(Results);
}
public static async Task<string> DecryptString(string Message)
{
await Task.Delay(100);
byte[] Results;
System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding();
MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider();
byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(CryptoString));
TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider();
TDESAlgorithm.Key = TDESKey;
TDESAlgorithm.Mode = CipherMode.ECB;
TDESAlgorithm.Padding = PaddingMode.PKCS7;
byte[] DataToDecrypt = Convert.FromBase64String(Message);
try
{
ICryptoTransform Decryptor = TDESAlgorithm.CreateDecryptor();
Results = Decryptor.TransformFinalBlock(DataToDecrypt, 0, DataToDecrypt.Length);
}
catch(Exception ex)
{
LogFile.WriteLine(ex.Message.ToString() + $" Datenlänge: {DataToDecrypt.Length}");
return "%%";
}
finally
{
TDESAlgorithm.Clear();
HashProvider.Clear();
}
return UTF8.GetString(Results);
}
}
}

View File

@ -7,26 +7,50 @@ using System.Threading.Tasks;
namespace PEP_Tool
{
public static class Export
{/*System.Windows.Controls.DataGrid*/
public static void ExportCSV(System.Data.DataView list)
{
public static void ExportCSV(List<TableInfo> list)
{
string[] arr = new string[list.Count];
var l = list.ToTable();
string[] arr = new string[l.Rows.Count];
StringBuilder sb = new StringBuilder();
MainWindow.main.BarIsIndeterminate = false;
MainWindow.main.BarVisibility = System.Windows.Visibility.Visible;
MainWindow.main.BarMax = list.Count;
MainWindow.main.BarMax = l.Rows.Count;
sb.AppendLine($"Name;Vorname;Datum;Zuweisung;Bemerkung;" + Environment.NewLine);
sb.AppendLine($"Name;Vorname;Datum;Abteilung;Zuweisung;Bemerkung;" + Environment.NewLine);
int count = 0;
foreach(var user in list)
foreach (System.Data.DataRow user in l.Rows)
{
count++;
sb.AppendLine($"{user.Name};{user.Vorname};{user.Datum.ToString("dd.MM.yyyy")};{user.Zuweisung};{user.Bemerkung};");
sb.AppendLine($"{user.ItemArray[1]};{user.ItemArray[2]};{user.ItemArray[4].ToString().Split(' ')[0]};{user.ItemArray[3]};{user.ItemArray[9]};{user.ItemArray[10]};");
MainWindow.main.BarValue = count;
}
//StringBuilder sb = new StringBuilder();
//IEnumerable<string> columnNames = l.Columns.Cast<System.Data.DataColumn>().
// Select(column => column.ColumnName);
//sb.AppendLine(string.Join(",", columnNames));
//foreach (System.Data.DataRow row in l.Rows)
//{
// IEnumerable<string> fields = row.ItemArray.Select(field => field.ToString());
// sb.AppendLine(string.Join(",", fields));
//}
//object[,] data = list.PrepareData();
//StringBuilder builder = new StringBuilder(Convert.ToString((char)65279));
//for (int k = 0; k < data.GetLength(0); k++)
//{
// List<string> tempList = new List<string>();
// for (int l = 0; l < data.GetLength(1); l++)
// tempList.Add(data[k, l].ToString());
// builder.Append(string.Join(",", tempList)).Append(Environment.NewLine);
//}
MainWindow.main.BarIsIndeterminate = true;
MainWindow.main.BarVisibility = System.Windows.Visibility.Collapsed;
@ -43,7 +67,7 @@ namespace PEP_Tool
if (dialog.FileName != "")
System.IO.File.WriteAllText(dialog.FileName, sb.ToString());
System.IO.File.WriteAllText(dialog.FileName, sb.ToString(), Encoding.UTF8);
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>

111
AV-ToolV3/FodyWeavers.xsd Normal file
View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -118,6 +119,41 @@ namespace PEP_Tool
text = string.Join("\n", strArr);
return text;
}
public static List<string> DataTableToListString(System.Data.DataTable dataTable, int Columns = 1, int startColumn = 0)
{
switch (Columns)
{
case 1:
return (from System.Data.DataRow dr in dataTable.Rows select dr[startColumn + 0].ToString()).ToList();
break;
case 2:
return (from System.Data.DataRow dr in dataTable.Rows select dr[startColumn + 0].ToString() + " " + dr[startColumn + 1].ToString()).ToList();
break;
default:
return (from System.Data.DataRow dr in dataTable.Rows select dr[0].ToString()).ToList();
}
}
public static List<Gewerk> DataTableToGewerk(System.Data.DataTable dataTable)
{
List<Gewerk> x = new List<Gewerk>();
foreach (DataRow dr in dataTable.Rows)
{
x.Add(new Gewerk()
{
Abteilung = dr[0].ToString(),
MAVerfuegbar = dr[1].ToString(),
MAAnwesend = dr[2].ToString(),
MAVerplant = dr[3].ToString()
});
}
return x;
}
}
public class ReplaceDotConverter : System.Windows.Data.IValueConverter

220
AV-ToolV3/KTOverview.xaml Normal file
View File

@ -0,0 +1,220 @@
<Window x:Class="PEP_Tool.KTOverview"
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="KT Planung Übersicht" Height="450" Width="800">
<Window.Resources>
<ResourceDictionary>
<ControlTemplate x:Key="ComboBoxControlTemplate1" TargetType="{x:Type ComboBox}">
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
</Grid.ColumnDefinitions>
<Popup x:Name="PART_Popup" AllowsTransparency="True" Grid.ColumnSpan="2" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
<!--</Themes:SystemDropShadowChrome>-->
<!--<Themes:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}">-->
<Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<ScrollViewer x:Name="DropDownScrollViewer">
<Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
<Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
<Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
</Canvas>
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Grid>
</ScrollViewer>
</Border>
</Popup>
<ToggleButton x:Name="toggleButton" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="ClickMode" Value="Press"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="templateRoot" BorderBrush="#99ACACAC" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<Border.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#99F0F0F0" Offset="0"/>
<GradientStop Color="#99E5E5E5" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="True" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
<Path x:Name="Arrow" Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z" Fill="#CC000000" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
</Border>
</Border>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CABADB3"/>
<Setter Property="Background" TargetName="splitBorder" Value="Transparent"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="Transparent"/>
</MultiDataTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Fill" TargetName="Arrow" Value="Black"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot">
<Setter.Value>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CECF4FC" Offset="0"/>
<GradientStop Color="#4CDCECFC" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C7EB4EA"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C7EB4EA"/>
<Setter Property="Background" TargetName="splitBorder">
<Setter.Value>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CEBF4FC" Offset="0"/>
<GradientStop Color="#4CDCECFC" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="#4C7EB4EA"/>
</MultiDataTrigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Fill" TargetName="Arrow" Value="Black"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot">
<Setter.Value>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CDAECFC" Offset="0"/>
<GradientStop Color="#4CC4E0FC" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C569DE5"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C569DE5"/>
<Setter Property="Background" TargetName="splitBorder">
<Setter.Value>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CDAEBFC" Offset="0"/>
<GradientStop Color="#4CC4E0FC" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="#4C569DE5"/>
</MultiDataTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Fill" TargetName="Arrow" Value="#4C000000"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="#4CF0F0F0"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CD9D9D9"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="White"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CBFBFBF"/>
<Setter Property="Background" TargetName="splitBorder" Value="Transparent"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="Transparent"/>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToggleButton.Style>
</ToggleButton>
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<!--<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="True">
<Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
<Setter Property="Color" TargetName="shadow" Value="#71000000"/>
</Trigger>-->
<Trigger Property="HasItems" Value="False">
<Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="True"/>
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
</MultiTrigger>
<Trigger Property="CanContentScroll" SourceName="DropDownScrollViewer" Value="False">
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Button x:Name="btnOK" Content="OK" Margin="0,0,10,10" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" Click="BtnOK_Click"/>
<DataGrid x:Name="dGView" Margin="10,40,10,35" AutoGenerateColumns="False" ItemsSource="{Binding ., Mode=OneWay}" CanUserAddRows="False" CanUserDeleteRows="False">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Abteilung, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Gewerke" Width="*"/>
<DataGridTextColumn Binding="{Binding AnzahlMA, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Anzahl MA" Width="*"/>
<DataGridTextColumn Binding="{Binding ZugName, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Zugname" Width="*"/>
<DataGridTextColumn Binding="{Binding Start, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Von" 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 Grund, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Arbeiten / Bemerkung" MinWidth="150" Width="*"/>
<!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>-->
</DataGrid.Columns>
</DataGrid>
<DatePicker x:Name="dPDate" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" SelectedDateChanged="DPDate_SelectedDateChanged"/>
<Button x:Name="btnDatePlus" Content="+" HorizontalAlignment="Left" Margin="144,9,0,0" VerticalAlignment="Top" Width="31" Height="25" Click="BtnDatePlus_Click"/>
<Button x:Name="btnDateMinus" Content="-" HorizontalAlignment="Left" Margin="180,9,0,0" VerticalAlignment="Top" Width="31" Height="25" Click="BtnDateMinus_Click"/>
<ComboBox x:Name="cBFilterAbteilung" Margin="0,10,10,0" VerticalAlignment="Top" SelectionChanged="cBFilterAbteilung_SelectionChanged" BorderBrush="#4CACACAC" Padding="10,0,0,0" Height="25" HorizontalAlignment="Right" Width="120" Template="{DynamicResource ComboBoxControlTemplate1}" VerticalContentAlignment="Center">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/>
<GradientStop Color="#4CE5E5E5" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
</ComboBox>
<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="btnToday" Content="Heute" HorizontalAlignment="Left" Margin="315,10,0,0" VerticalAlignment="Top" Width="75" Height="24" Click="BtnToday_Click"/>
</Grid>
</Window>

View File

@ -0,0 +1,97 @@
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 KTOverview.xaml
/// </summary>
public partial class KTOverview : Window
{
public System.Data.DataTable Overview { get; private set; } = new System.Data.DataTable("Overview");
public KTOverview()
{
InitializeComponent();
var abtFilterList = MainWindow.main.AbteilungsNamen.Select(p => p.Value.Item2).Distinct().ToList();
//abtFilterList.Insert(0, "");
abtFilterList.Sort();
cBFilterAbteilung.ItemsSource = abtFilterList;
dGView.DataContext = Overview;
SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `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;
dPDate.DisplayDateStart = Convert.ToDateTime(dt.Rows[0].ItemArray[0].ToString());
dPDate.DisplayDateEnd = Convert.ToDateTime(dt.Rows[0].ItemArray[1].ToString());
}
private async void cBFilterAbteilung_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
System.Diagnostics.Debug.WriteLine(cBFilterAbteilung.SelectedItem);
if (dPDate.SelectedDate == null && (cBFilterAbteilung.SelectedItem == "" || cBFilterAbteilung.SelectedItem == null))
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s`", Overview);
else if(dPDate.SelectedDate == null)
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s` WHERE Abteilung = '{cBFilterAbteilung.SelectedItem}'", Overview);
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);
}
private async void DPDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
if (dPDate.SelectedDate == null && (cBFilterAbteilung.SelectedItem == "" || cBFilterAbteilung.SelectedItem == null))
await SQL.ReadSQL($"SELECT Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `schaltung` `s`", Overview);
else
{
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);
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);
}
}
private void BtnDatePlus_Click(object sender, RoutedEventArgs e)
{
if (dPDate.SelectedDate < dPDate.DisplayDateEnd)
dPDate.SelectedDate = dPDate.SelectedDate + TimeSpan.FromDays(1);
}
private void BtnDateMinus_Click(object sender, RoutedEventArgs e)
{
if (dPDate.SelectedDate > dPDate.DisplayDateStart)
dPDate.SelectedDate = dPDate.SelectedDate - TimeSpan.FromDays(1);
}
private void BtnDateAll_Click(object sender, RoutedEventArgs e)
{
dPDate.SelectedDate = null;
}
private void BtnToday_Click(object sender, RoutedEventArgs e)
{
dPDate.SelectedDate = DateTime.Now.Date;
}
private void BtnOK_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}

View File

@ -23,7 +23,7 @@ namespace PEP_Tool
// fs.WriteAsync(t, (int)fs.Length, t.Count());
//}
File.AppendAllText(@"\\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(@"\\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}");
}
catch (Exception)
{
@ -36,7 +36,7 @@ namespace PEP_Tool
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"));
File.AppendAllText(@"\\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(@"\\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}");
}
catch (Exception)
{
@ -49,7 +49,7 @@ namespace PEP_Tool
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"));
File.AppendAllText(@"\\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(@"\\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}");
}
catch (Exception)
{
@ -62,7 +62,7 @@ namespace PEP_Tool
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"));
File.AppendAllText(@"\\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(@"\\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}");
}
catch (Exception)
{
@ -75,11 +75,42 @@ namespace PEP_Tool
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"));
File.AppendAllText(@"\\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(@"\\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}");
}
catch (Exception)
{
}
}
public static bool IsFileReady(string filename)
{
// If the file can be opened for exclusive access it means that the file
// is no longer locked by another process.
try
{
using (FileStream inputStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.None))
return inputStream.Length > 0;
}
catch (Exception)
{
return false;
}
}
public static void WaitForFile(string filename, string Text)
{
//This will lock the execution until the file is ready
//TODO: Add some logic to make it async and cancelable
while (!IsFileReady(filename)) { Task.Delay(20); }
try
{
File.AppendAllText(filename, Text);
}
catch (Exception)
{
WaitForFile(filename, Text);
}
}
}
}

View File

@ -19,8 +19,8 @@
<ResourceDictionary>
<!--<ResourceDictionary.MergedDictionaries>
-->
<!--<ResourceDictionary.MergedDictionaries> -->
<!--<ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingWave.xaml"/>
<ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingThreeDots.xaml"/>
<ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingFlipPlane.xaml"/>
@ -69,7 +69,7 @@
</LinearGradientBrush>
</Border.Background>
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="True" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
<Path x:Name="Arrow" Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z" Fill="#4C606060" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
<Path x:Name="Arrow" Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z" Fill="#CC000000" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
</Border>
</Border>
<ControlTemplate.Triggers>
@ -156,7 +156,7 @@
<Setter Property="BorderBrush" TargetName="splitBorder" Value="#4C569DE5"/>
</MultiDataTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Fill" TargetName="Arrow" Value="#4CBFBFBF"/>
<Setter Property="Fill" TargetName="Arrow" Value="#4C000000"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
@ -276,8 +276,6 @@
<Grid x:Name="gridSettings" Visibility="Visible" Margin="1" Grid.IsSharedSizeScope="True" Background="White">
<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"/>
<TextBox x:Name="tBLicenseFilePath" Height="23" Canvas.Left="10" Canvas.Top="35" Width="1125" Background="White" MaxLines="1"/>
<Button x:Name="btnSelectLicenseFile" Content="Auswählen" Canvas.Left="1140" Canvas.Top="35" Width="135" Click="btnSelectLicenseFile_Click" 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"/>
<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>
@ -320,8 +318,8 @@
<DatePicker x:Name="dPDatum" HorizontalAlignment="Left" Margin="420,114,0,0" VerticalAlignment="Top" SelectedDateChanged="dPDatum_SelectedDateChanged"/>
<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="btnOpenFile" Content="Datei öffnen" Margin="0,59,10,0" VerticalAlignment="Top" Height="40" HorizontalAlignment="Right" Width="337" Click="btnOpenFile_Click" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<Button x:Name="btnSettings" Content="Einstellungen" Margin="0,14,10,0" VerticalAlignment="Top" Height="40" Click="btnSettings_Click" HorizontalAlignment="Right" Width="337" 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="btnSettings" Content="Einstellungen" Margin="0,14,9.8,0" VerticalAlignment="Top" Height="40" Click="btnSettings_Click" HorizontalAlignment="Right" Width="137" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<TextBlock HorizontalAlignment="Left" Margin="639,115,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}">
@ -390,6 +388,8 @@
<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="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="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"/>
</Grid>
@ -397,7 +397,7 @@
<Grid x:Name="gridTable" Margin="0,0,0,2" MinHeight="200" Height="466" VerticalAlignment="Bottom" Visibility="Visible">
<DataGrid x:Name="flowDocu" ColumnWidth="*" ScrollViewer.ScrollChanged="DataGrid_ScrollChanged" HorizontalGridLinesBrush="Gray" VerticalGridLinesBrush="#99808080" ItemsSource="{Binding UserList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" 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}" CellStyle="{DynamicResource Body_Content_DataGrid_Centering}" SelectionMode="Single" CanUserResizeRows="False" HeadersVisibility="Column" BorderBrush="#FFADB2B5" SelectionChanged="flowDocu_SelectionChanged" 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,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.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
@ -417,30 +417,48 @@
</Style>
</DataGrid.Resources>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Name" MinWidth="80" IsReadOnly="True" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthName, Mode=TwoWay}"/>
<DataGridTextColumn Binding="{Binding Vorname}" Header="Vorname" MinWidth="80" IsReadOnly="True" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthVorname, Mode=TwoWay}"/>
<DataGridTextColumn Binding="{Binding Datum, StringFormat=\{0:dd.MM.yyyy\}}" Header="Datum" MinWidth="70" IsReadOnly="True" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthDatum, Mode=TwoWay}"/>
<DataGridTextColumn Binding="{Binding Beginn}" Header="Kommen" MinWidth="60" IsReadOnly="True" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthKommen, Mode=TwoWay}"/>
<DataGridTextColumn Binding="{Binding Gehen}" Header="Gehen" MinWidth="50" IsReadOnly="True" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthGehen, Mode=TwoWay}"/>
<DataGridTextColumn Binding="{Binding Abteilung}" Header="Abteilung" MinWidth="100" IsReadOnly="True" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthAbteilung, Mode=TwoWay}"/>
<DataGridTemplateColumn x:Name="dataGridTemplateColumn" Header="Lizenzen" MinWidth="150" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthLizenzen, Mode=TwoWay}">
<DataGridTextColumn Binding="{Binding Name}" Header="Name" MinWidth="80" IsReadOnly="True" Width="Auto"/>
<DataGridTextColumn Binding="{Binding Vorname}" Header="Vorname" MinWidth="80" IsReadOnly="True" Width="Auto"/>
<DataGridTextColumn Binding="{Binding Datum, StringFormat=\{0:dd.MM.yyyy\}}" Header="Datum" MinWidth="70" IsReadOnly="True" Width="Auto"/>
<DataGridTextColumn Binding="{Binding Beginn}" Header="Kommen" MinWidth="60" IsReadOnly="True" Width="Auto"/>
<DataGridTextColumn Binding="{Binding Gehen}" Header="Gehen" MinWidth="50" IsReadOnly="True" Width="Auto"/>
<DataGridTextColumn Binding="{Binding Abteilung}" Header="Abteilung" MinWidth="100" IsReadOnly="True" Width="Auto"/>
<!--<DataGridTextColumn Binding="{Binding AnzahlLizenzen}" Header="#" MaxWidth="20" IsReadOnly="True"/>-->
<DataGridTemplateColumn x:Name="dataGridTemplateColumn" Header="Lizenzen" MinWidth="150" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Lizenzen}" SelectedIndex="0" Template="{DynamicResource ComboBoxControlTemplate1}" IsSynchronizedWithCurrentItem="True" IsReadOnly="True" SelectionChanged="ComboBox_SelectionChanged" >
<Grid>
<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">
<!--Template="{DynamicResource ComboBoxControlTemplate1}" SelectedIndex="0"-->
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" IsHitTestVisible="False" Focusable="False"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Zuweisungen" MinWidth="150" SortMemberPath="Zuweisung" CanUserSort="True" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthZuweisung, Mode=TwoWay}">
<DataGridTemplateColumn Header="Zuweisungen" MinWidth="150" SortMemberPath="Zuweisung" CanUserSort="True" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="combo" ItemsSource="{Binding ZuweisungsMoeglichkeiten}" SelectedItem="{Binding Zuweisung}" DropDownClosed="ComboBox_DropDownClosed" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox x:Name="combo" ItemsSource="{Binding ZuweisungsMoeglichkeiten, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" SelectedItem="{Binding Zuweisung, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" DropDownClosed="Zuweisung_DropDownClosed" Template="{DynamicResource ComboBoxControlTemplate1}" DropDownOpened="Zuweisung_DropDownOpened">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/>
@ -456,34 +474,35 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn x:Name="bemerkungColumn" Header="Bemerkung" MinWidth="200" CanUserSort="True" SortMemberPath="Bemerkung" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthBemerkung, Mode=TwoWay}">
<DataGridTemplateColumn x:Name="bemerkungColumn" Header="Bemerkung" MinWidth="200" CanUserSort="True" SortMemberPath="Bemerkung" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Bemerkung}" IsEnabled="{Binding BemerkungIsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" VerticalAlignment="Center" AcceptsReturn="True" GotFocus="Bemerkung_GotFocus" LostFocus="Bemerkung_LostFocus" MinHeight="30" PreviewKeyDown="Bemerkung_KeyDown" Background="#4CFFFFFF" LostKeyboardFocus="Bemerkung_LostKeyboardFocus"/>
<TextBox Text="{Binding Bemerkung, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" AcceptsReturn="True" GotFocus="Bemerkung_GotFocus" LostFocus="Bemerkung_LostFocus" MinHeight="30" Background="#4CFFFFFF" LostKeyboardFocus="Bemerkung_LostKeyboardFocus" PreviewKeyUp="Bemerkung_PreviewKeyUp"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding PersNummer}" Header="Personalnummer" Visibility="Visible" MaxWidth="0" IsReadOnly="True" CanUserReorder="False" CanUserSort="False" MinWidth="0" CanUserResize="False" Width="0" Foreground="{x:Null}"/>
<DataGridTemplateColumn x:Name="telefonColumn" Header="Telefonnummer" MinWidth="120" SortMemberPath="Telefon" Width="{Binding Source={x:Static p:Settings.Default}, Path=WidthTelefon, Mode=TwoWay}">
<DataGridTextColumn Binding="{Binding PersNr}" Header="Personalnummer" Visibility="Visible" MaxWidth="0" IsReadOnly="True" CanUserReorder="False" CanUserSort="False" MinWidth="0" CanUserResize="False" Width="0" Foreground="{x:Null}"/>
<DataGridTemplateColumn x:Name="telefonColumn" Header="Telefonnummer" MinWidth="120" SortMemberPath="Telefon" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Telefon}" VerticalAlignment="Center" AcceptsReturn="False" MinHeight="30" PreviewKeyDown="Telefon_KeyDown" Background="#4CFFFFFF" PreviewLostKeyboardFocus="Telefon_PreviewLostKeyboardFocus"/>
<TextBox Text="{Binding Telefon, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" AcceptsReturn="False" MinHeight="30" PreviewKeyDown="Telefon_KeyDown" Background="#4CFFFFFF" LostKeyboardFocus="Telefon_LostKeyboardFocus"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding FilePath, UpdateSourceTrigger=PropertyChanged}" ClipboardContentBinding="{x:Null}" Header="Ä" IsReadOnly="True" Foreground="Red" MaxWidth="21" FontFamily="Wingdings" FontSize="22">
<DataGridTextColumn.HeaderStyle>
<DataGridTemplateColumn Header="Zug" IsReadOnly="True" MaxWidth="120" CanUserReorder="False" CanUserSort="True" MinWidth="80" >
<DataGridTemplateColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="ToolTip" Value="Bei Zeilen mit rotem Punkt wurden, seit Ihrer letzten Nutzung, Änderungen der Zuweisung oder Bemerkung durchgeführt"/>
<Setter Property="ToolTip" Value="Klicken um Mitarbeiter zum Zug inkl. Schaltzustände zuzuweisen"/>
</Style>
</DataGridTextColumn.HeaderStyle>
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="ToolTip" Value="{Binding FilePath, Converter={StaticResource ReplaceDotConv}}"/>
<Setter Property="Height" Value="28"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGridTemplateColumn.HeaderStyle>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button x:Name="btnSchalt" Click="BtnSchalt_Click" ToolTip="Klicken um Gewerke an diesem Tag zum Zug inkl. Schaltzuständen zuzuweisen" Height="20" Background="#4CDDDDDD" BorderBrush="#4C707070">
<TextBlock Text="{Binding Datum, StringFormat=d, ConverterCulture=de-DE}"/>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<ProgressBar x:Name="bar" Height="66" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="100" IsIndeterminate="True" Visibility="Collapsed"/>

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,14 @@
<OutputType>WinExe</OutputType>
<RootNamespace>PEP_Tool</RootNamespace>
<AssemblyName>PEP-Tool</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@ -26,7 +28,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@ -53,6 +54,9 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath>
<Private>False</Private>
@ -60,19 +64,35 @@
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="LoadingIndicators.WPF, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\LoadingIndicators.WPF.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<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>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ReachFramework" />
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Management" />
<Reference Include="System.Printing" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
@ -83,16 +103,32 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.AvalonDock, Version=3.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.5.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=3.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.5.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ChangesQueue.cs" />
<Compile Include="Crypto.cs" />
<Compile Include="Export.cs" />
<Compile Include="Helper.cs" />
<Compile Include="KTOverview.xaml.cs">
<DependentUpon>KTOverview.xaml</DependentUpon>
</Compile>
<Compile Include="LogFile.cs" />
<Compile Include="NewVersionMessageBox.xaml.cs">
<DependentUpon>NewVersionMessageBox.xaml</DependentUpon>
@ -102,13 +138,18 @@
</Compile>
<Compile Include="Print.cs" />
<Compile Include="Reader.cs" />
<Compile Include="TableCreator.cs" />
<Compile Include="TableInfo.cs" />
<Compile Include="Tracker.cs" />
<Compile Include="SQL.cs" />
<Compile Include="TableCreater.cs" />
<Compile Include="ucSpinnerPiston.xaml.cs">
<DependentUpon>ucSpinnerPiston.xaml</DependentUpon>
</Compile>
<Compile Include="Writer.cs" />
<Compile Include="Zugzuweisung.xaml.cs">
<DependentUpon>Zugzuweisung.xaml</DependentUpon>
</Compile>
<Page Include="KTOverview.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -133,6 +174,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Zugzuweisung.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@ -197,15 +242,13 @@
</COMReference>
</ItemGroup>
<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')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.0.0\build\dotnet\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.2.5.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.5.0\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" />
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.110.0\build\net45\System.Data.SQLite.Core.targets'))" />
</Target>
<Import Project="..\packages\Fody.2.0.0\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" />
<Import Project="..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.110.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net45\System.Data.SQLite.Core.targets')" />
</Project>

View File

@ -18,7 +18,7 @@ namespace PEP_Tool
{
class Print
{
public DataGrid CreatePrintGrid(List<TableInfo> List)
public DataGrid CreatePrintGrid(DataTable List)
{
var aktuellesGrid = List;
DataGrid grid = new DataGrid();
@ -69,7 +69,10 @@ namespace PEP_Tool
grid.Width = nameColumn.Width.Value + prenameColumn.Width.Value + dateColumn.Width.Value + abtColumn.Width.Value + zuweisungenColumn.Width.Value + bemerkungColumn.Width.Value;
grid.ItemsSource = aktuellesGrid;
grid.AutoGenerateColumns = false;
grid.CanUserAddRows = false;
//grid.DataContext = aktuellesGrid;
return grid;
}
@ -144,9 +147,17 @@ namespace PEP_Tool
r.Cells[j].Background = Brushes.DarkGray;
r.Cells[j].Foreground = Brushes.White;
r.Cells[j].BorderThickness = new Thickness(1, 1, 1, 1);
try
{
var binding = (dataGrid.Columns[j] as DataGridBoundColumn).Binding as Binding;
bindList.Add(binding.Path.Path);
}
catch (Exception)
{
}
}
tableRowGroup.Rows.Add(r);
table.RowGroups.Add(tableRowGroup);
@ -170,12 +181,48 @@ namespace PEP_Tool
r = new TableRow();
for (int j = 1; j <= 6; j++)
{
if (row.GetType() == typeof(TableInfo))
//if (row.GetType() == typeof(DataGridRow))
//{
//var x = row.GetPropertyValueForID(j, row) != null ? row.GetPropertyValueForID(j, row).ToString() : "";
//if (j == 3) x = x.ToString().Split(' ')[0];
var h = 0;
//r.Cells.Add(new TableCell(new Paragraph(new Run(x))));
switch(j)
{
var x = row.GetPropertyValueForID(j, row) != null ? row.GetPropertyValueForID(j, row).ToString() : "";
if (j == 3) x = x.ToString().Split(' ')[0];
case 1:
h = 1;
break;
case 2:
h = 2;
break;
case 3:
h = 4;
break;
case 4:
h = 3;
break;
case 5:
h = 9;
break;
case 6:
h = 10;
break;
}
if (dataGrid.ItemsSource.ToString().ToLower() == "system.data.linqdataview")
{
if (j == 3)
r.Cells.Add(new TableCell(new Paragraph(new Run(row.Row.ItemArray[h].ToString().Split(' ')[0]))));
else r.Cells.Add(new TableCell(new Paragraph(new Run(row.Row.ItemArray[h].ToString()))));
}
else
{
if (j == 3)
r.Cells.Add(new TableCell(new Paragraph(new Run(row.Row.ItemArray[h].ToString().Split(' ')[0]))));
else r.Cells.Add(new TableCell(new Paragraph(new Run(row.Row.ItemArray[h].ToString()))));
}
r.Cells.Add(new TableCell(new Paragraph(new Run(x))));
int span = 0;
switch (j - 1)
@ -208,7 +255,7 @@ namespace PEP_Tool
r.Cells[j - 1].BorderBrush = Brushes.DarkGray;
r.Cells[j - 1].BorderThickness = new Thickness(0, 0, 1, 1);
}
//}
}
tableRowGroup.Rows.Add(r);

View File

@ -23,18 +23,6 @@ namespace PEP_Tool.Properties {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string LizenzenPath {
get {
return ((string)(this["LizenzenPath"]));
}
set {
this["LizenzenPath"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@ -85,7 +73,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("2.0.4")]
[global::System.Configuration.DefaultSettingValueAttribute("3.0.1")]
public string Version {
get {
return ((string)(this["Version"]));
@ -157,7 +145,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthBemerkung {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthBemerkung"]));
@ -169,7 +157,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthZuweisung {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthZuweisung"]));
@ -181,7 +169,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthLizenzen {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthLizenzen"]));
@ -193,7 +181,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthAbteilung {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthAbteilung"]));
@ -205,7 +193,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthGehen {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthGehen"]));
@ -217,7 +205,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthKommen {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthKommen"]));
@ -229,7 +217,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthDatum {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthDatum"]));
@ -241,7 +229,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthVorname {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthVorname"]));
@ -253,7 +241,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthName {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthName"]));
@ -265,7 +253,7 @@ namespace PEP_Tool.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
[global::System.Configuration.DefaultSettingValueAttribute("*")]
public global::System.Windows.Controls.DataGridLength WidthTelefon {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthTelefon"]));

View File

@ -2,9 +2,6 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="PEP_Tool.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="LizenzenPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AbteilungsnamenPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
@ -18,7 +15,7 @@
<Value Profile="(Default)">1.0</Value>
</Setting>
<Setting Name="Version" Type="System.String" Scope="User">
<Value Profile="(Default)">2.0.4</Value>
<Value Profile="(Default)">3.0.1</Value>
</Setting>
<Setting Name="WindowPosLeft" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
@ -36,34 +33,34 @@
<Value Profile="(Default)">1323</Value>
</Setting>
<Setting Name="WidthBemerkung" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthZuweisung" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthLizenzen" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthAbteilung" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthGehen" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthKommen" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthDatum" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthVorname" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthName" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
<Setting Name="WidthTelefon" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
<Value Profile="(Default)">*</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -1,6 +1,7 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
@ -11,8 +12,6 @@ namespace PEP_Tool
{
public static class Reader
{
public static bool PersonalNummerIsEnabled { get; set; } = true;
public static string OpenFile(string Dialogname = "Datei")
{
OpenFileDialog dialog = new OpenFileDialog();
@ -31,692 +30,6 @@ namespace PEP_Tool
return result;
}
private static List<TableInfo> CreateLizenzList()
{
var path = "";
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Lizenzen.csv")) path = @"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Lizenzen.csv";
else
path = Properties.Settings.Default.LizenzenPath == "" ? OpenFile("Lizenzen") : Properties.Settings.Default.LizenzenPath;
if (!File.Exists(path)) path = OpenFile("Lizenzen");
if (File.ReadAllLines(path).First().StartsWith("Name;") || File.ReadAllLines(path).First().StartsWith("Personalnummer;0001"))
{
if (path != Properties.Settings.Default.LizenzenPath)
{
Properties.Settings.Default.LizenzenPath = path;
Properties.Settings.Default.Save();
}
var lizenzen = File.ReadAllLines(path, Encoding.GetEncoding(850));
var LizenzName = lizenzen.First().Split(';');
var lizenzList = new List<TableInfo>();
var sa = new List<string>();
for (var j = 1; j < lizenzen.Count(); j++)
{
string fLine = "";
var x = lizenzen[j].Split(';');
for (var i = 0; i < x.Length; i++)
{
var word = x[i];
if (word == "vorhanden" || word.Contains("."))
word = LizenzName[i];
if (word == "nicht mehr benötigt" || word == "verfallen") word = "";
fLine += word + ";";
}
lizenzList.Add(new TableInfo()
{
PersNummer = fLine.Split(';')[0],
Lizenzen = fLine.Split(';').Slice(1, fLine.Split(';').Count()).ToList().Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList()
});
}
return lizenzList;
}
else
{
MessageBox.Show("Keine korrekte Lizenzen-Datei ausgewählt", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
return CreateLizenzList();
}
}
static bool exceptionBemerkungen = false;
static List<TableInfo> lastBemerkungenList = new List<TableInfo>();
static DateTime lastWriteBemerkungen = DateTime.Now;
public static async Task<List<TableInfo>> CreateBemerkungenList()
{
if (MainWindow.propertyChangeAllowed)
{
try
{
var list = new List<TableInfo>();
list = null;
var tNew = File.GetLastWriteTime(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Bemerkungen.json");
if (tNew != lastWriteBemerkungen)
{
if (Convert.ToDateTime(MainWindow.main.LastChangeTime) < tNew) MainWindow.main.LastChangeTime = tNew.ToString();
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Bemerkungen.json"))
{
try
{
//var jsonBemerkungen = File.ReadAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Bemerkungen.json");
for (var i = 0; list == null; i++)
{
if (i >= 50)
{
throw new StackOverflowException("Anzahl der Versuche 'ReadBemerkungenJSON' überschritten (i >= 50)");
break;
}
await Task.Delay(100);
list = await ReadBemerkungenJSON();
//if (list != null) break;
}
if (exceptionBemerkungen)
{
LogFile.WriteLine("Successfully created BemerkungenList");
exceptionBemerkungen = false;
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
exceptionBemerkungen = true;
return await CreateBemerkungenList();
}
}
else File.CreateText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Bemerkungen.json");
lastWriteBemerkungen = tNew;
if (list != null)
{
lastBemerkungenList = list;
return list;
}
else
{
LogFile.WriteLine("B-list is null");
return await CreateBemerkungenList();
}
}
else return lastBemerkungenList;
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
return lastBemerkungenList;
}
}
else if (lastBemerkungenList != null) return lastBemerkungenList;
else return await CreateBemerkungenList();
}
private static async Task<List<TableInfo>> ReadBemerkungenJSON()
{
var fail = false;
try
{
using (var fs = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Bemerkungen.json", FileMode.Open, FileAccess.Read, FileShare.Read)) //Write | FileShare.Delete
{
if (fs != null)
{
byte[] json = new byte[fs.Length];
await fs.ReadAsync(json, 0, (int)fs.Length);
var jsonBemerkungen = Encoding.UTF8.GetString(json);
if (!Helper.IsBase64String(jsonBemerkungen) || jsonBemerkungen == "")
return null;
var jsonBemerkungenDecrypted = "%%";
for (var i = 0; jsonBemerkungenDecrypted == "%%" || i <= 10; i++)
{
jsonBemerkungenDecrypted = await Crypto.DecryptString(jsonBemerkungen);
if (jsonBemerkungenDecrypted == "%%")
{
if (i > 0)
{
LogFile.WriteLine($"Decrypt Bemerkungen failed - for the {i}. Time - Trying again...");
fail = true;
}
using (var fs1 = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Bemerkungen.json", FileMode.Open, FileAccess.Read, FileShare.Read))//Write | FileShare.Delete
{
json = new byte[fs1.Length];
await fs1.ReadAsync(json, 0, (int)fs1.Length);
jsonBemerkungen = Encoding.UTF8.GetString(json);
await Task.Delay(100);
}
}
else break;
}
if (fail) LogFile.WriteLine("Decrypt Bemerkungen succeeded");
fail = false;
//jsonBemerkungen = Crypto.DecryptString(jsonBemerkungen);
var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TableInfo>>(jsonBemerkungenDecrypted);
//jsonLength = json == null ? 111111 : json.Length;
//jsonBemerkungenLength = jsonBemerkungen == null ? 111111 : jsonBemerkungen.Length;
return list;
}
else
{
fs.Dispose();
return null;
}
}
}
catch (Exception)
{
return null;
}
}
static bool exceptionZuweisungen = false;
static List<TableInfo> lastZuweisungenList = new List<TableInfo>();
public static DateTime lastWriteZuweisungen = DateTime.Now;
public static async Task<List<TableInfo>> CreateZuweisungenList()
{
if (MainWindow.propertyChangeAllowed)
{
try
{
var list = new List<TableInfo>();
list = null;
var tNew = File.GetLastWriteTime(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Zuweisungen.json");
if (tNew != lastWriteZuweisungen)
{
if (Convert.ToDateTime(MainWindow.main.LastChangeTime) < tNew) MainWindow.main.LastChangeTime = tNew.ToString();
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Zuweisungen.json"))
{
var jsonLength = 0;
var jsonZuweisungenLength = 0;
try
{
//var jsonZuweisungen = File.ReadAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Zuweisungen.json");
for (var i = 0; list == null; i++)
{
await Task.Delay(100);
list = await ReadZuweisungenJSON();
//if (list != null) break;
if (i >= 50)
{
LogFile.WriteLine("Anzahl der Versuche 'ReadZuweisungenJSON' überschritten (i >= 50)");
i = 0;
break;
}
}
if (exceptionZuweisungen)
{
LogFile.WriteLine("Successfully created ZuweisungenList");
exceptionZuweisungen = false;
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
LogFile.WriteLine("json.Length: " + jsonLength);
LogFile.WriteLine("jsonZuweisungen.Length " + jsonZuweisungenLength);
exceptionZuweisungen = true;
return await CreateZuweisungenList();
}
}
else File.CreateText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Zuweisungen.json");
lastWriteZuweisungen = tNew;
if (list != null)
{
lastZuweisungenList = list;
return list;
}
else
{
LogFile.WriteLine("list is null");
return lastZuweisungenList;//await CreateZuweisungenList();
}
}
else return lastZuweisungenList;
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
return lastZuweisungenList;
}
}
else if (lastZuweisungenList != null) return lastZuweisungenList;
else return await CreateZuweisungenList();
}
private static async Task<List<TableInfo>> ReadZuweisungenJSON()
{
var fail = false;
try
{
using (var fs = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Zuweisungen.json", FileMode.Open, FileAccess.Read, FileShare.Read)) //Test 25.07.19 FileShare.ReadWrite | FileShare.Delete
{
if (fs != null)
{
byte[] json = new byte[fs.Length];
await fs.ReadAsync(json, 0, (int)fs.Length);
var jsonZuweisungen = Encoding.UTF8.GetString(json);
if (!Helper.IsBase64String(jsonZuweisungen) || jsonZuweisungen == "")
return null;
var jsonZuweisungenDecrypted = "%%";
for (var i = 0; jsonZuweisungenDecrypted == "%%" || i <= 10; i++)
{
jsonZuweisungenDecrypted = await Crypto.DecryptString(jsonZuweisungen);
if (jsonZuweisungenDecrypted == "%%")
{
if (i > 0)
{
LogFile.WriteLine($"Decrypt Zuweisungen failed - for the {i}. Time - Trying again...");
fail = true;
}
using (var fs1 = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Zuweisungen.json", FileMode.Open, FileAccess.Read, FileShare.Read))//Write | FileShare.Delete
{
json = new byte[fs1.Length];
await fs1.ReadAsync(json, 0, (int)fs1.Length);
jsonZuweisungen = Encoding.UTF8.GetString(json);
await Task.Delay(1000);
}
}
else break;
}
if (fail) LogFile.WriteLine("Decrypt Zuweisungen succeeded");
fail = false;
var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TableInfo>>(jsonZuweisungenDecrypted);
//var items = Enumerable.SequenceEqual(list, lastZuweisungenList);
//jsonLength = json == null ? 111111 : json.Length;
//jsonZuweisungenLength = jsonZuweisungen == null ? 111111 : jsonZuweisungen.Length;
return list;
}
else
{
fs.Dispose();
return null;
}
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
return null;
}
}
static bool exceptionTelefon = false;
static List<TableInfo> lastTelefonList = new List<TableInfo>();
public static DateTime lastWriteTelefon = DateTime.Now;
public static async Task<List<TableInfo>> CreateTelefonList()
{
if (MainWindow.propertyChangeAllowed)
{
try
{
var list = new List<TableInfo>();
list = null;
var tNew = File.GetLastWriteTime(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Telefon.json");
if (tNew != lastWriteTelefon)
{
if (Convert.ToDateTime(MainWindow.main.LastChangeTime) < tNew) MainWindow.main.LastChangeTime = tNew.ToString();
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Telefon.json"))
{
var jsonLength = 0;
var jsonTelefonLength = 0;
try
{
//var jsonTelefon = File.ReadAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Telefon.json");
for (var i = 0; list == null; i++)
{
list = await ReadTelefonJSON();
await Task.Delay(100);
//if (list != null) break;
if (i >= 50)
{
LogFile.WriteLine("Anzahl der Versuche 'ReadTelefonJSON' überschritten (i >= 50)");
i = 0;
break;
}
}
if (exceptionTelefon)
{
LogFile.WriteLine("Successfully created TelefonList");
exceptionTelefon = false;
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
LogFile.WriteLine("json.Length: " + jsonLength);
LogFile.WriteLine("jsonTelefon.Length " + jsonTelefonLength);
exceptionTelefon = true;
return await CreateTelefonList();
}
}
else File.CreateText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Telefon.json");
lastWriteTelefon = tNew;
if (list != null)
{
lastTelefonList = list;
return list;
}
else
{
LogFile.WriteLine("list is null");
return lastTelefonList;//await CreateTelefonList();
}
}
else return lastTelefonList;
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
return lastTelefonList;
}
}
else if (lastTelefonList != null) return lastTelefonList;
else return await CreateTelefonList();
}
private static async Task<List<TableInfo>> ReadTelefonJSON()
{
var fail = false;
try
{
using (var fs = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Telefon.json", FileMode.Open, FileAccess.Read, FileShare.Read)) //Write | FileShare.Delete
{
if (fs != null)
{
byte[] json = new byte[fs.Length];
await fs.ReadAsync(json, 0, (int)fs.Length);
var jsonTelefon = Encoding.UTF8.GetString(json);
if (!Helper.IsBase64String(jsonTelefon) || jsonTelefon == "")
return null;
var jsonTelefonDecrypted = "%%";
for (var i = 0; jsonTelefonDecrypted == "%%" || i <= 10; i++)
{
jsonTelefonDecrypted = await Crypto.DecryptString(jsonTelefon);
if (jsonTelefonDecrypted == "%%")
{
if (i > 0)
{
LogFile.WriteLine($"Decrypt Telefon failed - for the {i}. Time - Trying again...");
fail = true;
}
using (var fs1 = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\Telefon.json", FileMode.Open, FileAccess.Read, FileShare.Read))//Write | FileShare.Delete
{
json = new byte[fs1.Length];
await fs1.ReadAsync(json, 0, (int)fs1.Length);
jsonTelefon = Encoding.UTF8.GetString(json);
await Task.Delay(1000);
}
}
else break;
}
if (fail) LogFile.WriteLine("Decrypt Telefon succeeded");
fail = false;
var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TableInfo>>(jsonTelefonDecrypted);
//var items = Enumerable.SequenceEqual(list, lastTelefonList);
//jsonLength = json == null ? 111111 : json.Length;
//jsonTelefonLength = jsonTelefon == null ? 111111 : jsonTelefon.Length;
return list;
}
else
{
fs.Dispose();
return null;
}
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex.ToString());
return null;
}
}
public static List<TableInfo> LizenzList { get; set; }
public static List<TableInfo> ReadUserList(bool FilePicker = false)
{
var lizenzList = CreateLizenzList();
LizenzList = lizenzList;
var bemerkungenList = CreateBemerkungenList();
var zuweisungenList = CreateZuweisungenList();
var telefonList = CreateTelefonList();
List<TableInfo> list = new List<TableInfo>();
var users = OpenUserList(FilePicker);
foreach (var user in users)
{
if (user.StartsWith("0"))
{
var liz = new TableInfo();
if (PersonalNummerIsEnabled)
{
var li = lizenzList.Where(p => p.PersNummer == user.Split(';')[0]);
if (li.Count() > 0)
{
liz = li.First();
}
}
else
{
var li = lizenzList.Where(p => p.Name == user.Split(';')[1] && p.Vorname == user.Split(';')[2]);
if (li.Count() > 0) liz = li.First();
}
var bem = new TableInfo();
if (bemerkungenList.Result != null)
{
if (PersonalNummerIsEnabled)
{
var be = bemerkungenList.Result.Where(p => p.PersNummer == user.Split(';')[0] && p.Datum == DateTime.Parse(user.Split(';')[3]));
if (be.Count() > 0) bem = be.First();
}
else
{
var be = bemerkungenList.Result.Where(p => p.Name == user.Split(';')[1] && p.Vorname == user.Split(';')[2] && p.Datum == DateTime.Parse(user.Split(';')[3]));
if (be.Count() > 0) bem = be.First();
}
}
var zuw = new TableInfo();
if (zuweisungenList.Result != null)
{
if (PersonalNummerIsEnabled)
{
var zu = zuweisungenList.Result.Where(p => p.PersNummer == user.Split(';')[0] && p.Datum == DateTime.Parse(user.Split(';')[3]));
if (zu.Count() > 0) zuw = zu.First();
}
else
{
var zu = zuweisungenList.Result.Where(p => p.Name == user.Split(';')[1] && p.Vorname == user.Split(';')[2] && p.Datum == DateTime.Parse(user.Split(';')[3]));
if (zu.Count() > 0) zuw = zu.First();
}
}
var tele = new TableInfo();
if (telefonList.Result != null)
{
if (PersonalNummerIsEnabled)
{
var tel = telefonList.Result.Where(p => p.PersNummer == user.Split(';')[0]);// && p.Datum == DateTime.Parse(user.Split(';')[3]));
if (tel.Count() > 0) tele = tel.First();
}
else
{
var tel = telefonList.Result.Where(p => p.Name == user.Split(';')[1] && p.Vorname == user.Split(';')[2] && p.Datum == DateTime.Parse(user.Split(';')[3]));
if (tel.Count() > 0) tele = tel.First();
}
}
Tuple<string, string> abtName = null;
if (MainWindow.main.AbteilungsNamen.TryGetValue(user.Split(';')[10], out abtName)) ;
else abtName = new Tuple<string, string>(user.Split(';')[10].Split(';')[0], user.Split(';')[10].Split(';')[1]);
list.Add(new TableInfo()
{
PersNummer = user.Split(';')[0],
Name = user.Split(';')[1],
Vorname = user.Split(';')[2],
Datum = DateTime.Parse(user.Split(';')[3]),
Gehen = user.Split(';')[6],
Arbeitsmuster = user.Split(';')[4],
Abteilung = abtName.Item2 == "" ? abtName.Item1 : abtName.Item2,
Tagescode = user.Split(';')[12],
Beginn = user.Split(';')[5],
Zuweisung = zuw.Zuweisung,
ZuweisungsMoeglichkeiten = MainWindow.main.ZuweisungsMoeglichkeiten,
Lizenzen = liz.Lizenzen,
Bemerkung = bem.Bemerkung,
Telefon = tele.Telefon
});
}
}
var last = 0;
foreach (var entry in list)
{
if (last != Convert.ToInt32(entry.PersNummer))
{
if (entry.Lizenzen != null) entry.Lizenzen.Insert(0, $"{entry.Lizenzen.Count} Lizenzen");
else
{
entry.Lizenzen = new List<string>();
entry.Lizenzen.Add("keine Lizenzen");
}
}
else if (entry.Lizenzen == null)
{
entry.Lizenzen = new List<string>();
entry.Lizenzen.Add("keine Lizenzen");
}
last = Convert.ToInt32(entry.PersNummer);
}
list = list.Where(p => p.Tagescode == "" || p.Tagescode.All(char.IsDigit)).ToList();
list = list.Where(p => p.Arbeitsmuster.ToLower() != "frei").ToList();
//list.Sort((a, b) => a.Name.CompareTo(b.Name));
list = list.OrderBy(name => name.Name).ThenBy(vorname => vorname.Vorname).ThenBy(abteilung => abteilung.Abteilung).ThenBy(datum => datum.Datum).ToList();
return list;
}
private static string[] OpenUserList(bool FilePicker = false)
{
var path = "";
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\DTIME.csv") && !FilePicker) path = @"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\DTIME.csv";
else
path = OpenFile("Mitarbeiterliste");
var users = System.IO.File.ReadAllLines(path, Encoding.GetEncoding(65001));
if (users[0].StartsWith("Personalnummer;Nachname")) users = users;
else
{
var x = System.Windows.MessageBox.Show("Keine gültige Mitarbeiterliste ausgewählt!", "Fehler!", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Exclamation, System.Windows.MessageBoxResult.OK, System.Windows.MessageBoxOptions.ServiceNotification);
return OpenUserList();
}
return users;
}
internal static List<string> ReadZuweisungsMoeglichkeiten()
{
var path = "";
@ -781,58 +94,7 @@ namespace PEP_Tool
return ReadAbteilungsNamen();
}
}
public static async Task<double> ReadTime(Dictionary<string, Tuple<double, bool, string>> keyValuePairs)
{
var client = await Crypto.EncryptString(Environment.MachineName);
KeyValuePair<string, double> output = new KeyValuePair<string, double>();
if (keyValuePairs != null && keyValuePairs.Where(p => p.Key == client).Count() > 0)
{
var o = keyValuePairs.Where(p => p.Key == client).First();
output = new KeyValuePair<string, double>(o.Key, o.Value.Item1);
}
else return 0;
return output.Value;
}
public static async Task<Dictionary<string, Tuple<double, bool, string>>> ReadTimeJSON()
{
using (var fs = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Track.json", FileMode.Open, FileAccess.Read, FileShare.Read)) //Write | FileShare.Delete
{
byte[] json = new byte[fs.Length];
await fs.ReadAsync(json, 0, (int)fs.Length);
var jsonTrack = Encoding.UTF8.GetString(json);
//if (!Helper.IsBase64String(jsonTrack) || jsonTrack == "")
// return null;
//var enc = "%%";
//enc = await Crypto.DecryptString(jsonTrack);
try
{
var keyValuePairs = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, Tuple<double, bool, string>>>(jsonTrack);
return keyValuePairs;
}
catch (Exception)
{
fs.Dispose();
return await ReadTimeJSON();
}
}
}
}
public static class Extensions

View File

@ -1,7 +1,8 @@
using System;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,117 +11,150 @@ namespace PEP_Tool
{
public static class SQL
{
private static SQLiteConnection dbConnection;
public static SQLiteConnection DBConnection
static string connstr = "Server=10.20.97.146;Uid=PEPTool;Pwd=PEPUser;database=pep_tool";
static MySqlConnection conn = new MySqlConnection(connstr);
static MySqlDataAdapter adp = new MySqlDataAdapter();
public static MySqlDataAdapter GetAdapter()
{
get
{
if (dbConnection == null) ConnectDB();
return dbConnection;
return adp;
}
set
public static MySqlConnection GetConnection()
{
dbConnection = value;
return conn;
}
public static async Task<DataTable> WriteSQL(string SQLQuery, DataTable list)
{
var filter = list.DefaultView.RowFilter;
using (conn)
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
adp.UpdateCommand = new MySqlCommand(SQLQuery, conn);
adp.Update(list);
list.AcceptChanges();
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\sql.lck", "erwischt!!");
if(SQLQuery.Contains("track"))
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\track.lck", "erwischt!!");
conn.Close();
}
list.DefaultView.RowFilter = filter;
return list;
}
public static async Task WriteSQL(string SQLQuery)
{
using (conn)
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
MySqlCommand cmd = new MySqlCommand(SQLQuery, conn);
cmd.ExecuteNonQuery();
conn.Close();
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\sql.lck", "erwischt!!");
if (SQLQuery.Contains("track"))
File.WriteAllText(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\JSON\track.lck", "erwischt!!");
}
}
public static async Task ConnectDB()
public static async Task<DataTable> ReadSQL(string SQLCommand, DataTable list)
{
DBConnection = new SQLiteConnection("Data Source = PEP_DB.sqlite; Version = 3;");
DBConnection.Open();
var filter = list.DefaultView.RowFilter;
using (conn)
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
adp.SelectCommand = new MySqlCommand(SQLCommand, conn);
list.Clear();
adp.Fill(list);
conn.Close();
}
list.DefaultView.RowFilter = filter;
return list;
}
public static async Task<DataTable> ReadSQL(string SQLCommand)
{
DataTable list = new DataTable();
using (conn)
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
adp.SelectCommand = new MySqlCommand(SQLCommand, conn);
list.Clear();
adp.Fill(list);
conn.Close();
}
return list;
}
public static async Task WriteDB(string WriteString)
public static async Task<DataTable> ReadAllData(DataTable list)
{
if (DBConnection.State != System.Data.ConnectionState.Open) await ConnectDB();
var filter = list.DefaultView.RowFilter;
SQLiteCommand command = new SQLiteCommand(WriteString, DBConnection);
await command.ExecuteNonQueryAsync();
using (conn)
{
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from mitarbeiter_static p left join mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn);
list.Clear();
adp.Fill(list);
conn.Close();
}
public static void ReadDB()
{
list.DefaultView.RowFilter = filter;
return list;
}
public static void CloseDB()
public static async Task<DataTable> ReadAllData(string filter = "")
{
dbConnection.Close();
}
public static async Task<SQLiteDataAdapter> CreateDataAdapter()
{
SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter("SELECT * FROM serial", DBConnection);
DataSet ds = new DataSet();
dataAdapter.FillSchema(ds, System.Data.SchemaType.Mapped);
return dataAdapter;
}
public static async void CreateDB()
{
SQLiteConnection.CreateFile("PEP_DB.sqlite");
await ConnectDB();
string tableinfo = "CREATE TABLE TableInfo(" +
"PersNummer TEXT, " +
"FilePath TEXT, " +
"Datum TEXT, " +
"Zuweisung TEXT," +
"Bemerkung TEXT, " +
"Telefon TEXT)";
SQLiteCommand Command = new SQLiteCommand(tableinfo, DBConnection);
Command.ExecuteNonQuery();
//Lizenzen list string
//Zuweisungsmöglichkeiten list string
}
}
public class SQLtoDataGrid
{
public DataView UserListView;
public DataView ZuweisungsMoeglichkeiten;
public SQLtoDataGrid()
{
SQLiteConnection con = new SQLiteConnection("Data Source = PEP_DB.sqlite; Version = 3;");
try
{
con.Open();
string Query = "select * from UserList";
SQLiteCommand cmdp = new SQLiteCommand(Query, con);
DataTable UserList = new DataTable();
using (SQLiteDataAdapter ap = new SQLiteDataAdapter(cmdp))
{
ap.Fill(UserList);
}
UserListView = UserList.DefaultView;
DataTable list = new DataTable("UserList");
SQLiteCommand cmdc = new SQLiteCommand("select * from ZuweisungsMoeglichkeiten", con);
DataTable ZWDT = new DataTable();
using (SQLiteDataAdapter ac = new SQLiteDataAdapter(cmdc))
using (conn)
{
ac.Fill(ZWDT);
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
adp.SelectCommand = new MySqlCommand("select PersNr,Name,Vorname,Abteilung,o.Datum,Beginn,Gehen,Tagescode,Arbeitsmuster,Zuweisung,Bemerkung,Telefon,AnzahlLizenzen,ZugNameB from mitarbeiter_static p left join mitarbeiter_change o ON o.mitarbeiter_static_PersNr = p.PersNr ORDER BY Name", conn);
list.Columns.Clear();
adp.Fill(list);
conn.Close();
}
ZuweisungsMoeglichkeiten = ZWDT.DefaultView;
list.DefaultView.RowFilter = filter;
return list;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
return await ReadAllData();
}
}
}

View File

@ -0,0 +1,14 @@
using System;
namespace PEP_Tool
{
public class Schaltzustand
{
public System.Collections.Generic.List<string> PersNr { get; set; }
public string ZugName { get; set; }
public DateTime Start { get; set; }
public DateTime Ende { get; set; }
public string Zustand { get; set; }
public string Grund { get; set; }
}
}

96
AV-ToolV3/TableCreater.cs Normal file
View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public static class TableCreater
{
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)
{
errCount++;
//System.Diagnostics.Debug.WriteLine($"{filterAbteilung}, {filterAbteilung2}, {filterAbteilung3}, {Arbeitsmuster}, {Datum}, {Search}, {isSearch}, {searchWithFilter}");
try
{
userList.DefaultView.RowFilter = "";
DataTable list = new DataTable("UserList");
list = userList;
if (Arbeitsmuster.Contains(";"))
{
switch (Arbeitsmuster.Count(t => t == ';'))
{
case 1:
if (list != null) list.DefaultView.RowFilter = $"(Arbeitsmuster like '{Arbeitsmuster.Split(';')[0]}*' OR Arbeitsmuster like '{Arbeitsmuster.Split(';')[1]}*')";
break;
case 2:
if (list != null) list.DefaultView.RowFilter = $"(Arbeitsmuster like '{Arbeitsmuster.Split(';')[0]}*' OR Arbeitsmuster like '{Arbeitsmuster.Split(';')[1]}*' OR Arbeitsmuster like '{Arbeitsmuster.Split(';')[2]}*')";
break;
case 3:
if (list != null) list.DefaultView.RowFilter = $"(Arbeitsmuster like '{Arbeitsmuster.Split(';')[0]}*' OR Arbeitsmuster like '{Arbeitsmuster.Split(';')[1]}*' OR Arbeitsmuster like '{Arbeitsmuster.Split(';')[2]}*' OR Arbeitsmuster like '{Arbeitsmuster.Split(';')[3]}*')";
break;
default:
break;
}
}
else
{
if (list != null)
list.DefaultView.RowFilter = Arbeitsmuster != "" ? $"Arbeitsmuster like '{Arbeitsmuster}*'" : list.DefaultView.RowFilter;
}
if ((filterAbteilung == "%" || filterAbteilung == "") && (filterAbteilung2 == "%" || filterAbteilung2 == "") && (filterAbteilung3 == "%" || filterAbteilung3 == ""))
list = userList;
else if(list.DefaultView.RowFilter == "")
list.DefaultView.RowFilter = $"(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}')";
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;
else list.DefaultView.RowFilter = Datum != "" ? list.DefaultView.RowFilter += $" AND Datum = {String.Format(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat, "#{0}#", DateTime.Parse(Datum.Replace(" 00:00:00", "")))}" : list.DefaultView.RowFilter;
if (!searchWithFilter && Search == "" && isSearch) list.DefaultView.RowFilter = "";
else if ((searchWithFilter && Search == "" && isSearch) || !isSearch) list = list;
else if (!searchWithFilter && Search != "" && isSearch && list.DefaultView.RowFilter == "")
list.DefaultView.RowFilter = $"(Name like '%{Search.ToLower()}%' OR Vorname like '%{Search.ToLower()}%')";
else if (!searchWithFilter && Search != "" && isSearch && list.DefaultView.RowFilter != "")
list.DefaultView.RowFilter = list.DefaultView.RowFilter += $" AND (Name like '%{Search.ToLower()}%' OR Vorname like '%{Search.ToLower()}%')";
else if (searchWithFilter && Search != "" && isSearch && list.DefaultView.RowFilter == "") list.DefaultView.RowFilter = $"(Name like '%{Search.ToLower()}%' OR Vorname like '%{Search.ToLower()}%')";
else if (searchWithFilter && Search != "" && isSearch && list.DefaultView.RowFilter != "") list.DefaultView.RowFilter = list.DefaultView.RowFilter += $" AND (Name like '%{Search.ToLower()}%' OR Vorname like '%{Search.ToLower()}%')";
list.DefaultView.Sort = "Name,Vorname,Abteilung,Datum";
return list;
//if (list != null)
//{
// errCount = 0;
// return list;
//}
//else return new List<TableInfo>();
}
catch (Exception ex)
{
if (errCount > 1)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
}
return null;
//if (errCount < 5) return await Task.Run(() => CreateList(userList, filterAbteilung, filterAbteilung2, filterAbteilung3, Arbeitsmuster, Datum, Search, searchWithFilter, isSearch));
//else return new List<TableInfo>();
}
}
}
}

View File

@ -1,82 +0,0 @@
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.Documents;
namespace PEP_Tool
{
class TableCreator
{
static int errCount = 0;
public static async Task<List<TableInfo>> CreateList(List<TableInfo> userList, string filterAbteilung = "%", string filterAbteilung2 = "%", string filterAbteilung3 = "%", string Arbeitsmuster = "", string Datum = "", string Search = "", bool searchWithFilter = false, bool isSearch = false)
{
errCount++;
//System.Diagnostics.Debug.WriteLine($"{filterAbteilung}, {filterAbteilung2}, {filterAbteilung3}, {Arbeitsmuster}, {Datum}, {Search}, {isSearch}, {searchWithFilter}");
try
{
var list = ((filterAbteilung == "%" || filterAbteilung == "") && (filterAbteilung2 == "%" || filterAbteilung2 == "") && (filterAbteilung3 == "%" || filterAbteilung3 == "")) ? MainWindow.main.DefaultUserList : userList.Where(p => (p.Abteilung == filterAbteilung || p.Abteilung == filterAbteilung2 || p.Abteilung == filterAbteilung3)).ToList();
if (Arbeitsmuster.Contains(";"))
{
switch (Arbeitsmuster.Count(t => t == ';'))
{
case 1:
if (list != null) list = list.Where(p => (p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[0]) || p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[1]))).ToList();
break;
case 2:
if (list != null) list = list.Where(p => (p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[0]) || p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[1]) || p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[2]))).ToList();
break;
case 3:
if (list != null) list = list.Where(p => (p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[0]) || p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[1]) || p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[2]) || p.Arbeitsmuster.StartsWith(Arbeitsmuster.Split(';')[3]))).ToList();
break;
default:
break;
}
}
else
{
if (list != null)
list = Arbeitsmuster != "" ? list.Where(p => p.Arbeitsmuster.StartsWith(Arbeitsmuster)).ToList() : list;
}
if(list != null) list = Datum != "" ? list.Where(p => p.Datum == DateTime.Parse(Datum)).ToList() : list;
if (!searchWithFilter && Search == "" && isSearch) list = MainWindow.main.DefaultUserList;
else if ((searchWithFilter && Search == "" && isSearch) || !isSearch) list = list;
else if (!searchWithFilter && Search != "" && isSearch) list = userList.Where(p => (p.Name.ToLower().Contains(Search.ToLower()) || p.Vorname.ToLower().Contains(Search.ToLower()))).ToList();
else if (searchWithFilter && Search != "" && isSearch) if (list != null) list = list.Where(p => (p.Name.ToLower().Contains(Search.ToLower()) || p.Vorname.ToLower().Contains(Search.ToLower()))).ToList();
if (list != null) list = list.OrderBy(name => name.Name).ThenBy(vorname => vorname.Vorname).ThenBy(abteilung => abteilung.Abteilung).ThenBy(datum => datum.Datum).ToList();
if (list != null)
{
errCount = 0;
return list;
}
else return new List<TableInfo>();
}
catch (Exception ex)
{
if (errCount > 1)
{
LogFile.WriteLine(ex.ToString());
LogFile.WriteLine("Message: " + ex.Message);
if (ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
}
if (errCount < 5) return await Task.Run(() => CreateList(userList, filterAbteilung, filterAbteilung2, filterAbteilung3, Arbeitsmuster, Datum, Search, searchWithFilter, isSearch));
else return new List<TableInfo>();
}
}
}
}

View File

@ -72,6 +72,18 @@ namespace PEP_Tool
}
}
public List<Schaltzustand> Schaltung { get; set; }
private string zugname;
public string ZugName
{
get { return zugname; }
set
{
zugname = value;
OnPropertyChanged();
}
}
public void Clear()

View File

@ -42,12 +42,19 @@ namespace PEP_Tool
public static async Task SaveTrack(bool Online)
{
var save = await Reader.ReadTimeJSON();
//var save = new Dictionary<string, double>();
var r = new Random();
await Task.Delay(r.Next(10, 200));
if (save == null)
save = new Dictionary<string, Tuple<double, bool, string>>();
var save = await Reader.ReadTimeJSON()
#if DEBUG
?? new Dictionary<string, Tuple<double, bool, string>>();
#endif
//var save = ;
if (save != null)
//save = new Dictionary<string, Tuple<double, bool, string>>();
{
if (save.ContainsKey(client))
save[client] = new Tuple<double, bool, string>(time, Online, Properties.Settings.Default.Version);
else save.Add(client, new Tuple<double, bool, string>(time, Online, Properties.Settings.Default.Version));
@ -61,7 +68,7 @@ namespace PEP_Tool
byte[] jsonB = new UTF8Encoding(true).GetBytes(json);
using (var fs = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Track.json", System.IO.FileMode.Open, System.IO.FileAccess.Write, System.IO.FileShare.Read))//Write | System.IO.FileShare.Delete
using (var fs = await Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Track.json", System.IO.FileMode.Open, System.IO.FileAccess.Write, System.IO.FileShare.Read))//Write | System.IO.FileShare.Delete
{
if (fs != null)
{
@ -75,7 +82,7 @@ namespace PEP_Tool
{
LogFile.WriteLine(ex);
}
}
}
}
}

View File

@ -10,30 +10,46 @@ namespace PEP_Tool
public static class Writer
{
static int errCount = 0;
static bool ready = true;
public static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
public static async Task<FileStream> WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
ready = false;
var err = false;
FileStream fs = null;
var r = new Random();
for (int numTries = 0; numTries < 50; numTries++)
{
fs = null;
try
{
if(err && errCount > 5) LogFile.WriteLine(access.ToString() + "error #" + errCount + ": " + Path.GetFileName(fullPath));
await Task.Delay(r.Next(5, 100));
if (err && errCount > 20)
{
LogFile.WriteLine(access.ToString() + "error #" + errCount + ": " + Path.GetFileName(fullPath));
await Task.Delay(r.Next(200, 1000));
}
fs = new FileStream(fullPath, mode, access, share);
if (err && errCount > 5) LogFile.WriteLine(access.ToString() + " done" + ": " + Path.GetFileName(fullPath));
if (err && errCount > 20) LogFile.WriteLine(access.ToString() + " done" + ": " + Path.GetFileName(fullPath));
err = false;
errCount = 0;
ready = true;
return fs;
}
catch (IOException ex)
{
await Task.Delay(r.Next(5, 100));
errCount++;
System.Diagnostics.Debug.WriteLine("Writer_IOException: " + DateTime.Now.TimeOfDay);
//LogFile.WriteLine($"{Environment.MachineName}: {access.ToString()} denied: {Path.GetFileName(fullPath)}\n\nDies ist das {errCount}. vorkommen\n\n");
//LogFile.WriteLine(ex.ToString());
//LogFile.WriteLine("Message: " + ex.Message);
@ -43,7 +59,10 @@ namespace PEP_Tool
{
fs.Dispose();
}
System.Threading.Thread.Sleep(500);
await Task.Delay(r.Next(200, 500));
ready = true;
}
catch (Exception exc)
{
@ -56,14 +75,19 @@ namespace PEP_Tool
{
fs.Dispose();
}
System.Threading.Thread.Sleep(500);
await Task.Delay(r.Next(200, 500));
ready = true;
}
}
fs.Dispose();
//fs.Dispose();
if (err) System.Windows.MessageBox.Show("Daten konnten nicht geschrieben werden!\nBitte erneut versuchen\n\nWenn dieser Fehler mehrmals direkt hintereinander auftritt, bitte an Marcus Bachler wenden.", "Fehler", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxResult.OK);
ready = true;
return null;
}
}
}

153
AV-ToolV3/Zugzuweisung.xaml Normal file
View File

@ -0,0 +1,153 @@
<Window
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" x:Class="PEP_Tool.Zugzuweisung"
mc:Ignorable="d"
Title="Zugzuweisung" Height="1002" Width="904">
<Window.Resources>
<local:SearchFilterConverter x:Key="searchFilterConverter" />
</Window.Resources>
<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">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Abteilung, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Gewerke"/>
<DataGridTextColumn Binding="{Binding AnzahlMA, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Anzahl MA"/>
<DataGridTextColumn Binding="{Binding ZugName, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Zugname"/>
<DataGridTextColumn Binding="{Binding Start, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Von"/>
<DataGridTextColumn Binding="{Binding Ende, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Bis"/>
<DataGridTextColumn Binding="{Binding Zustand, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Schaltzustand"/>
<DataGridTextColumn Binding="{Binding Grund, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Arbeiten / Bemerkung" MinWidth="150"/>
<!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>-->
</DataGrid.Columns>
</DataGrid>
<TextBlock x:Name="lblZugMitarbeiter" HorizontalAlignment="Left" Margin="10,41,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="lblDate" HorizontalAlignment="Left" Margin="55,67,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"/>
<TextBlock x:Name="lbl1" HorizontalAlignment="Left" Margin="10,20,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="446,20,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"/>
<TextBlock HorizontalAlignment="Left" Margin="599,20,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"/>
<ComboBox x:Name="cbSchaltzustand" Margin="751,41,11.4,0" VerticalAlignment="Top">
<ComboBoxItem Content="0 V"/>
<ComboBoxItem Content="110 V"/>
<ComboBoxItem Content="670 V"/>
<ComboBoxItem Content="15 kV"/>
<ComboBoxItem Content="unbestimmt"/>
</ComboBox>
<TextBlock HorizontalAlignment="Left" Margin="751,20,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"/>
<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.Columns>
<DataGridTextColumn Header="Gewerke" Binding="{Binding Abteilung}" Width="*" MinWidth="100"/>
<DataGridTextColumn Header="Verfügbare MA" Binding="{Binding MAVerfuegbar}" Width="*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Anwesende MA" Binding="{Binding MAAnwesend}" Width="*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Verplante MA" Binding="{Binding MAVerplant}" Width="*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="btnAddMitarbeiter" Content="+" HorizontalAlignment="Left" Margin="388,242,0,0" VerticalAlignment="Top" Width="35" Height="22"/>
<ComboBox x:Name="cBGewerke" HorizontalAlignment="Left" ItemsSource="{Binding MAView}" Margin="10,242,0,0" VerticalAlignment="Top" Width="370">
<!--<ListView HorizontalAlignment="Left" ItemsSource="{Binding MAView}" Height="118" Margin="10,119,0,0" VerticalAlignment="Top" Width="261"/>-->
</ComboBox>
<TextBox x:Name="tbGrund" Height="91" Margin="446,173,10,0" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="446,152,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="132"><Run Text="Arbeiten / Bemerkung"/><Run Text=":"/></TextBlock>
<ComboBox Margin="446,119,11,0" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="446,98,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"/>
<local:ucSpinnerPiston x:Name="li" Margin="0" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Visibility="Collapsed" >
<local:ucSpinnerPiston.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="2" ScaleY="2"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</local:ucSpinnerPiston.RenderTransform>
</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"/>
<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="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>
<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.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/>
</Style>
</DataGrid.CellStyle>-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Abteilung, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Gewerke"/>
<DataGridTextColumn Binding="{Binding AnzahlMA, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Anzahl MA"/>
<DataGridTextColumn Binding="{Binding ZugName, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Zugname"/>
<DataGridTextColumn Binding="{Binding Start, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Von"/>
<DataGridTextColumn Binding="{Binding Ende, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Bis"/>
<DataGridTextColumn Binding="{Binding Zustand, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Schaltzustand"/>
<DataGridTextColumn Binding="{Binding Grund, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Arbeiten / Bemerkung" MinWidth="150"/>
<!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>-->
</DataGrid.Columns>
</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"/>
<ComboBox x:Name="cBSchicht" HorizontalAlignment="Left" Margin="151,40,0,0" VerticalAlignment="Top" Width="120" SelectionChanged="CBSchicht_SelectionChanged">
<ComboBoxItem Content="Früh- /Tagschicht"/>
<ComboBoxItem Content="Spätschicht"/>
<ComboBoxItem Content="Nachtschicht"/>
</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.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="ToolTip" Value="Markieren und &quot;ENTF&quot; um Zeile zu löschen"/>
</Style>
</DataGrid.CellStyle>-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Abteilung, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Gewerke"/>
<DataGridTextColumn Binding="{Binding AnzahlMA, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Anzahl MA"/>
<DataGridTextColumn Binding="{Binding ZugName, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Zugname"/>
<DataGridTextColumn Binding="{Binding Start, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Von"/>
<DataGridTextColumn Binding="{Binding Ende, Mode=TwoWay, StringFormat=\{0:dd.MM.yy HH:mm\}}" ClipboardContentBinding="{x:Null}" Header="Bis"/>
<DataGridTextColumn Binding="{Binding Zustand, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Schaltzustand"/>
<DataGridTextColumn Binding="{Binding Grund, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="Arbeiten / Bemerkung" MinWidth="150"/>
<!--<DataGridTextColumn Binding="{Binding mitarbeiter_static_PersNr, Mode=TwoWay}" ClipboardContentBinding="{x:Null}" Header="PersNr" Width="0" MaxWidth="0" CanUserResize="False"/>-->
</DataGrid.Columns>
</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>
</Grid>
</Window>

View File

@ -0,0 +1,372 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.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 Zugzuweisung.xaml
/// </summary>
public partial class Zugzuweisung : Window, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private DataTable mACombo = new DataTable();
public DataTable MACombo
{
get { return mACombo; }
set { mACombo = value; OnPropertyChanged(); }
}
private List<Gewerk> mAView = new List<Gewerk>();
public List<Gewerk> MAView
{
get { return mAView; }
set { mAView = value; OnPropertyChanged(); }
}
DataTable schaltList = new DataTable("SchaltList");
DataTable schaltListGewerk = new DataTable("SchaltListGewerk");
DataTable schaltListTag = new DataTable("SchaltListTag");
public Zugzuweisung(Button sender = null)
{
this.DataContext = this;
InitializeComponent();
if (sender != null)
ZuweisungFromList(sender);
else
ZuweisungFromMenu();
dGSchaltList.DataContext = schaltList;
dGSchaltListGewerk.DataContext = schaltListGewerk;
dGSchaltListTag.DataContext = schaltListTag;
}
private void ZuweisungFromMenu()
{
lbl1.Visibility = Visibility.Collapsed;
lbl2.Visibility = Visibility.Collapsed;
btnAddMitarbeiter.Visibility = Visibility.Visible;
dPMAFilter.Visibility = Visibility.Visible;
cBGewerke.Visibility = Visibility.Visible;
}
object sending;
object buttonDatum;
private async void ZuweisungFromList(Button sender)
{
sending = sender;
dPMAFilter.Visibility = Visibility.Collapsed;
cBGewerke.Visibility = Visibility.Collapsed;
btnAddMitarbeiter.Visibility = Visibility.Collapsed;
lbl1.Visibility = Visibility.Visible;
lbl2.Visibility = Visibility.Visible;
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")
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");
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);
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);
MAView = Helper.DataTableToGewerk(MACombo);
}
bool resultChanged = false;
private void BtnOK_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private async void BtnAdd_Click(object sender, RoutedEventArgs e)
{
DateTime date = DateTime.Now;
if (dPSchaltVon.Value.HasValue)
{
date = dPSchaltVon.Value.Value;
if (dPSchaltVon.Value.Value >= dPSchaltBis.Value.Value)
{
MessageBox.Show("Startzeit größer als Endzeit", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
}
else
{
MessageBox.Show("Kein gültiges Datum gewählt", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
li.Visibility = Visibility.Visible;
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)}')");
schaltList = await SQL.ReadSQL($"Select Abteilung,AnzahlMA,ZugName,Start,Ende,Zustand,Grund FROM `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);
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);
var schicht = "";
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")
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");
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");
MAView = Helper.DataTableToGewerk(MACombo);
li.Visibility = Visibility.Collapsed;
}
private void DPMAFilter_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
throw new NotImplementedException();
}
private async void DGSchaltList_PreviewKeyDown(object sender, KeyEventArgs e)
{
var dg = sender as DataGrid;
var row = dg.SelectedItem as DataRowView;
var arr = row.Row.ItemArray;
if (e.Key == Key.Delete)
{
li.Visibility = Visibility.Visible;
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($"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]}')");
//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);
li.Visibility = Visibility.Collapsed;
}
}
private async void DGMAView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (dGMAView.SelectedIndex != -1)
{
var i = Convert.ToInt16((((Gewerk)((ItemCollection)(dGMAView.Items))[dGMAView.SelectedIndex]).MAVerfuegbar));
var a = new int[i];
for (var j = 1; j != i + 1; ++j)
{
a[j - 1] = j;
}
cBAnzahlMA.ItemsSource = a;
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);
}
}
private async void TbName_TextChanged(object sender, TextChangedEventArgs e)
{
if (tbName.Text != "" && char.IsDigit(tbName.Text[0]))
{
tbName.Text = "Tz " + tbName.Text;
tbName.CaretIndex = tbName.Text.Length;
}
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);
lblPlanungTz.Text = $"Planung für Triebzug '{tbName.Text}':";
}
else
{
schaltList.Clear();
lblPlanungTz.Text = $"Planung für Triebzug:";
}
}
private void CBAnzahlMA_DropDownOpened(object sender, EventArgs e)
{
if (cBAnzahlMA.Items.Count == 0) cBAnzahlMA.ItemsSource = new string[1] { "Bitte zuerst Gewerk wählen" };
}
private async void CBSchicht_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
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;
}
DataTable dt = null;
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%')");
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}%'");
var from = dt.Rows[0].ItemArray[0].ToString();
var until = dt.Rows[0].ItemArray[1].ToString();
dPSchaltVon.Value = null;
dPSchaltBis.Value = null;
dPSchaltVon.Minimum = null;
dPSchaltBis.Maximum = DateTime.MaxValue;
if (!(string.IsNullOrEmpty(from) || string.IsNullOrEmpty(until)))
{
if (TimeSpan.Parse(from) > TimeSpan.Parse(until))
{
dPSchaltVon.Minimum = Convert.ToDateTime(buttonDatum) + TimeSpan.Parse(from);
dPSchaltBis.Maximum = Convert.ToDateTime(buttonDatum) + TimeSpan.FromDays(1) + TimeSpan.Parse(until);
}
else
{
dPSchaltVon.Minimum = Convert.ToDateTime(buttonDatum) + TimeSpan.Parse(from);
dPSchaltBis.Maximum = Convert.ToDateTime(buttonDatum) + TimeSpan.Parse(until);
}
}
else
{
dPSchaltVon.Minimum = Convert.ToDateTime(buttonDatum);
dPSchaltBis.Maximum = Convert.ToDateTime(buttonDatum) + TimeSpan.FromDays(2);
}
dPSchaltVon.Value = dPSchaltVon.Minimum.Value;
dPSchaltBis.Value = dPSchaltBis.Maximum.Value;
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");
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");
MAView = Helper.DataTableToGewerk(MACombo);
}
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
System.Diagnostics.Debug.WriteLine("PropertyChanged " + propertyName);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public class SearchFilterConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return $"{values[0].ToString()} {values[1].ToString()}";
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class Gewerk
{
public string Abteilung { get; set; }
public string MAAnwesend { get; set; }
public string MAVerplant { get; set; }
public string MAVerfuegbar { get; set; }
}
}

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="1.6.2" targetFramework="net45" developmentDependency="true" />
<package id="BouncyCastle" version="1.8.3.1" targetFramework="net452" />
<package id="Costura.Fody" version="1.6.2" targetFramework="net452" developmentDependency="true" />
<package id="EntityFramework" version="6.2.0" targetFramework="net45" />
<package id="Fody" version="2.0.0" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
<package id="System.Data.SQLite" version="1.0.110.0" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.110.0" targetFramework="net45" />
<package id="System.Data.SQLite.EF6" version="1.0.110.0" targetFramework="net45" />
<package id="System.Data.SQLite.Linq" version="1.0.110.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="Google.Protobuf" version="3.6.1" targetFramework="net452" />
<package id="MySql.Data" version="8.0.17" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
<package id="SSH.NET" version="2016.1.0" targetFramework="net452" />
</packages>

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PEP_Tool", "AV-ToolV3\PEP_Tool.csproj", "{4E161CEA-E5E0-4E4A-9923-64CD9D2BD1F0}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PEP_Tool_SQL", "AV-ToolV3\PEP_Tool_SQL.csproj", "{4E161CEA-E5E0-4E4A-9923-64CD9D2BD1F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution