Projektdateien hinzufügen.

This commit is contained in:
Marcus Bachler 2019-07-26 07:36:50 +02:00
parent 5e126f9106
commit d0d69ad045
35 changed files with 6955 additions and 0 deletions

98
AV-ToolV3/App.config Normal file
View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="PEP_Tool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings />
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<userSettings>
<PEP_Tool.Properties.Settings>
<setting name="LizenzenPath" serializeAs="String">
<value />
</setting>
<setting name="AbteilungsnamenPath" serializeAs="String">
<value />
</setting>
<setting name="ZuweisungenPath" serializeAs="String">
<value />
</setting>
<setting name="newVersionScreen" serializeAs="String">
<value>True</value>
</setting>
<setting name="newVersionString" serializeAs="String">
<value>1.0</value>
</setting>
<setting name="Version" serializeAs="String">
<value>2.0.4</value>
</setting>
<setting name="WindowPosLeft" serializeAs="String">
<value>0</value>
</setting>
<setting name="WindowState" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="WindowPosTop" serializeAs="String">
<value>0</value>
</setting>
<setting name="WindowHeight" serializeAs="String">
<value>681</value>
</setting>
<setting name="WindowWidth" serializeAs="String">
<value>1323</value>
</setting>
<setting name="WidthBemerkung" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthZuweisung" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthLizenzen" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthAbteilung" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthGehen" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthKommen" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthDatum" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthVorname" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthName" serializeAs="String">
<value>0</value>
</setting>
<setting name="WidthTelefon" serializeAs="String">
<value>0</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>

442
AV-ToolV3/App.xaml Normal file
View File

@ -0,0 +1,442 @@
<Application x:Class="PEP_Tool.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PEP_Tool"
StartupUri="MainWindow.xaml" Exit="Application_Exit" Startup="Application_Startup">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Colors.xaml"/>
<ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles.xaml"/>-->
</ResourceDictionary.MergedDictionaries>
<RichTextBox x:Key="rtbVersionInfo" HorizontalAlignment="Left" Height="450" Width="772" Padding="10" Margin="10" IsReadOnly="True" VerticalAlignment="Top" FontSize="14" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" AutoWordSelection="False" AcceptsReturn="False" IsUndoEnabled="False" IsEnabled="True" VerticalScrollBarVisibility="Visible" IsHitTestVisible="True" Focusable="False" Grid.IsSharedSizeScope="True" MinWidth="702" MinHeight="400" >
<!---->
<RichTextBox.Template>
<ControlTemplate TargetType="{x:Type TextBoxBase}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
<ControlTemplate.Triggers>
</ControlTemplate.Triggers>
</ControlTemplate>
</RichTextBox.Template>
<!--<RichTextBox.Template>
<ControlTemplate TargetType="{x:Type TextBoxBase}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
<ControlTemplate.Triggers>
</ControlTemplate.Triggers>
</ControlTemplate>
</RichTextBox.Template>-->
<FlowDocument>
<Paragraph LineHeight="6">
<Run Text="Version 2.0.3"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 2.0.2"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Performanceverbesserungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Startgeschwindigkeit stark verbessert"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 2.0.1"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Anzahl der Lizenzen wird jetzt angezeigt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- +/- beim Datum hinzugefügt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 2.0"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Abarbeitung der Daten geändert"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Performance verbessert"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Vollständige Änderung des Namens auf PEP-Tool"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.9.4"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Neue Spalte: Telefonnummer"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehler behoben, der zum Absturz der Anwendung führen kann"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.9.3"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Die eingestellte Breite der Spalten wird jetzt gespeichert und beim Start wiederhergestellt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Bemerkungsfeld kann wieder länger gezogen werden"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.9.2"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Verbesserung bei der Ver- und Entschlüsselung der Daten"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.9.1"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fensterposition und Größe werden gespeichert und beim Start wiederhergestellt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Kleine Optimierung"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.9"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Zeit der letzten Datenänderung wird jetzt angezeigt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text=" - Bei noch nicht gesehenen Änderungen ist die Zeit rot"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text=" - Geänderte Zeilen haben ebenfalls einen roten Punkt in der Spalte Ä (Änderungen)"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text=" - Durch überfahren des Punktes mit der Maus (ToolTip) werden die letzten 6 geänderten Daten angezeigt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text=" - Wurde die geänderte Zeile vom User gesehen, verschwindet der Punkt nach 10 Sekunden"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text=" - Wurde die geänderte Zeile vom User geklickt, verschwindet der Punkt nach 3 Sekunden"/>
</Paragraph>
<Paragraph LineHeight="1">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Die Anzeige fehlerhafter Lizenzen wurde behoben"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Sortieren nach Zuweisung und Bemerkung jetzt möglich"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Ladebalken geändert"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.8"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Druckfunktion verbessert"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Optimierungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.7"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- App-Interne Optimierungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.6"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Listen im Standardpfad müssen nicht mehr ausgewählt werden"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Cursor springt bei Eingabe von Bemerkungen nicht mehr zum Anfang"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.5"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Kleinere Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.4"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Auswahl mehrerer Schichten ist jetzt möglich"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Verbesserungen bei der Eingabe von Bemerkungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Fehlerbehebungen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.3"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Wochenzuweisung funktioniert nun unabhängig von der aktuellen Ansicht"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.2:"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Namensänderung: alt: AV-Tool 2&#x9;neu: PEP - Tool München"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="Version 1.1:"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="-"/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" &quot;Neu in dieser Version&quot; - Fenster"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text="Mitarbeiter mit Schichteintrag &quot;frei&quot; werden nicht angezeigt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="-"/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" Bei gleichen Namen werden Lizenzen jetzt richtig zugewiesen"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Foreground="Red" Text="&#x9;!!! Es muss beim Start eine neue Lizenzdatei ausgewählt werden !!!"/>
<LineBreak/>
<Run Foreground="Red" Text="&#x9;&#x9;Bitte auf Titel des &quot;Datei öffnen&quot; - Fensters achten !"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Foreground="Red"/>
<LineBreak/>
<Run/>
<LineBreak/>
<Run Text="- Abfrage ob Dateien aus den Einstellungen noch existieren eingeführt"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text="Abfangprozedur für Abstürze bei Filterung"/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" und Eintragung der Zuweisung / Bemerkung"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Möglichkeit zum Setzen der Zuweisung "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Run Text="auf alle Tage eines Mitarbeiters"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Druckfunktion mit Abteilung und Überschrift nach Filter erweitert"/>
</Paragraph>
<Paragraph LineHeight="6">
<Run Text="- Daten für Zuweisung und Bemerkung sind jetzt verschlüsselt"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</ResourceDictionary>
</Application.Resources>
</Application>

65
AV-ToolV3/App.xaml.cs Normal file
View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace PEP_Tool
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class App : Application
{
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
// Process unhandled exception
LogFile.WriteLine($"{Environment.NewLine} UnhandledException: {Environment.NewLine + e.Exception}");
e.Handled = true;
}
private void Application_Startup(object sender, StartupEventArgs e)
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
//FirstChanceEx();
}
void FirstChanceEx()
{
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
LogFile.WriteLine(eventArgs.Exception.ToString());
};
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = e.ExceptionObject as Exception;
LogFile.WriteLine($"{Environment.NewLine} UnhandledException: {Environment.NewLine + ex.ToString()}");
//MessageBox.Show(ex.Message, "Uncaught Thread Exception", MessageBoxButton.OK, MessageBoxImage.Error);
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
// Log the exception, display it, etc
LogFile.WriteLine(e.Exception.Message);
}
private void Application_Exit(object sender, ExitEventArgs e)
{
PEP_Tool.Properties.Settings.Default.Save();
}
}
}

23
AV-ToolV3/ChangesQueue.cs Normal file
View File

@ -0,0 +1,23 @@
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; }
}
}
}

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

@ -0,0 +1,76 @@
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);
}
}
}

BIN
AV-ToolV3/Download.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

51
AV-ToolV3/Export.cs Normal file
View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public static class Export
{
public static void ExportCSV(List<TableInfo> list)
{
string[] arr = new string[list.Count];
StringBuilder sb = new StringBuilder();
MainWindow.main.BarIsIndeterminate = false;
MainWindow.main.BarVisibility = System.Windows.Visibility.Visible;
MainWindow.main.BarMax = list.Count;
sb.AppendLine($"Name;Vorname;Datum;Zuweisung;Bemerkung;" + Environment.NewLine);
int count = 0;
foreach(var user in list)
{
count++;
sb.AppendLine($"{user.Name};{user.Vorname};{user.Datum.ToString("dd.MM.yyyy")};{user.Zuweisung};{user.Bemerkung};");
MainWindow.main.BarValue = count;
}
MainWindow.main.BarIsIndeterminate = true;
MainWindow.main.BarVisibility = System.Windows.Visibility.Collapsed;
Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog();
dialog.AddExtension = true;
dialog.DefaultExt = "csv";
dialog.Filter = "Excel Arbeitsblatt CSV|*.csv";
dialog.OverwritePrompt = true;
dialog.RestoreDirectory = true;
dialog.Title = "Liste exportieren";
dialog.ShowDialog();
if (dialog.FileName != "")
System.IO.File.WriteAllText(dialog.FileName, sb.ToString());
}
}
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura />
</Weavers>

140
AV-ToolV3/Helper.cs Normal file
View File

@ -0,0 +1,140 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public static class Helper
{
public static string RemoveSpecialCharacters(string str)
{
StringBuilder sb = new StringBuilder();
foreach (char c in str)
{
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '.' || c == '_')
{
sb.Append(c);
}
}
return sb.ToString();
}
public static bool keyIsSpecialKey(System.Windows.Input.Key key)
{
var b = false;
if (key == System.Windows.Input.Key.Escape || key == System.Windows.Input.Key.Tab ||
key == System.Windows.Input.Key.CapsLock || key == System.Windows.Input.Key.LWin ||
key == System.Windows.Input.Key.Left || key == System.Windows.Input.Key.Up ||
key == System.Windows.Input.Key.Down || key == System.Windows.Input.Key.Right ||
key == System.Windows.Input.Key.End || key == System.Windows.Input.Key.Home ||
key == System.Windows.Input.Key.PageUp || key == System.Windows.Input.Key.PageDown ||
key == System.Windows.Input.Key.PrintScreen || key == System.Windows.Input.Key.Print ||
(key >= System.Windows.Input.Key.F1 && key <= System.Windows.Input.Key.LaunchApplication2) ||
key == System.Windows.Input.Key.System || key == System.Windows.Input.Key.Play)
b = true;
else
b = false; // the key will sappressed
return b;
}
public static bool isTelNumber(System.Windows.Input.Key Char)
{
return ((Char >= System.Windows.Input.Key.D0 && Char <= System.Windows.Input.Key.D9) ||
(Char >= System.Windows.Input.Key.NumPad0 && Char <= System.Windows.Input.Key.NumPad9) ||
(Char == System.Windows.Input.Key.Delete ||
Char == System.Windows.Input.Key.Divide ||
Char == System.Windows.Input.Key.Space ||
Char == System.Windows.Input.Key.Back ||
Char == System.Windows.Input.Key.Add));
}
public static bool IsBase64String(this string s)
{
s = s.Trim();
return (s.Length % 4 == 0) && System.Text.RegularExpressions.Regex.IsMatch(s, @"^[a-zA-Z0-9\+/]*={0,3}$", System.Text.RegularExpressions.RegexOptions.None);
}
public static T FindVisualChild<T>(System.Windows.DependencyObject depObj) where T : System.Windows.DependencyObject
{
if (depObj != null)
{
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(depObj); i++)
{
System.Windows.DependencyObject child = System.Windows.Media.VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T)
{
return (T)child;
}
T childItem = FindVisualChild<T>(child);
if (childItem != null) return childItem;
}
}
return null;
}
public static int IndexOfNth(this string str, string value, int nth = 1)
{
if (nth <= 0)
throw new ArgumentException("Can not find the zeroth index of substring in string. Must start with 1");
int offset = str.IndexOf(value);
for (int i = 1; i < nth; i++)
{
if (offset == -1) return -1;
offset = str.IndexOf(value, offset + 1);
}
return offset;
}
public static int CountSubstring(this string text, string value)
{
int count = 0, minIndex = text.IndexOf(value, 0);
while (minIndex != -1)
{
minIndex = text.IndexOf(value, minIndex + value.Length);
count++;
}
return count;
}
public static string AddLineNumbers(this string text, int startLine = 1)
{
var i = text.CountSubstring("\n");
var strArr = text.Split("\n".ToCharArray());
for(var j = startLine; j <= i; j++)
{
strArr[j] = $"{j - startLine + 1}. " + strArr[j].TrimStart("1234567890. ".ToCharArray());
}
text = string.Join("\n", strArr);
return text;
}
}
public class ReplaceDotConverter : System.Windows.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
{
string original = value.ToString();
return original.Replace("l, ", "");
}
else return "";
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

BIN
AV-ToolV3/Info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

85
AV-ToolV3/LogFile.cs Normal file
View File

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public static class LogFile
{
public static void WriteLine(string Text)
{
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
try
{
byte[] t = Encoding.ASCII.GetBytes(Text);
if (!Directory.Exists(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt"))) Directory.CreateDirectory(Path.GetDirectoryName(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt"));
//using (var fs = Writer.WaitForFile(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Log\Log.txt", FileMode.Append, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete))
//{
// 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}");
}
catch (Exception)
{
}
}
public static void WriteLine(double Text)
{
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
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}");
}
catch (Exception)
{
}
}
public static void WriteLine(int Text)
{
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
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}");
}
catch (Exception)
{
}
}
public static void WriteLine(bool Text)
{
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
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}");
}
catch (Exception)
{
}
}
public static void WriteLine(Exception Text)
{
Debug.WriteLine(DateTime.Now + " v" + Properties.Settings.Default.Version + " " + Text);
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}");
}
catch (Exception)
{
}
}
}
}

505
AV-ToolV3/MainWindow.xaml Normal file
View File

@ -0,0 +1,505 @@
<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:p="clr-namespace:PEP_Tool.Properties"
x:Class="PEP_Tool.MainWindow"
mc:Ignorable="d"
Title="PEP - Tool München v" Icon="icon.ico" MinWidth="1090" MinHeight="320" Closing="Window_Closing" SizeChanged="Window_SizeChanged"
Height="{Binding Source={x:Static p:Settings.Default}, Path=WindowHeight, Mode=TwoWay}"
Width="{Binding Source={x:Static p:Settings.Default}, Path=WindowWidth, Mode=TwoWay}"
Left="{Binding Source={x:Static p:Settings.Default}, Path=WindowPosLeft, Mode=TwoWay}"
Top="{Binding Source={x:Static p:Settings.Default}, Path=WindowPosTop, Mode=TwoWay}"
WindowState="{Binding Source={x:Static p:Settings.Default}, Path=WindowState, Mode=TwoWay}" Grid.IsSharedSizeScope="True" PreviewMouseDown="Window_PreviewMouseDown" Deactivated="Window_Deactivated">
<!--xmlns:WPF="clr-namespace:LoadingIndicators.WPF;assembly=LoadingIndicators.WPF"-->
<Window.Resources>
<ResourceDictionary>
<!--<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"/>
<ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingPulse.xaml"/>
<ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingDoubleBounce.xaml"/>-->
<!--
</ResourceDictionary.MergedDictionaries>-->
<local:ReplaceDotConverter x:Key="ReplaceDotConv" />
<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="#4C606060" 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="#4CBFBFBF"/>
</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>
<ControlTemplate x:Key="DataGridControlTemplate1" TargetType="{x:Type DataGrid}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="DG_ScrollViewer" Focusable="False">
<ScrollViewer.Template>
<ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Command="ApplicationCommands.SelectAll" Focusable="False" Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type DataGrid}}}">
<Button.Visibility>
<Binding Path="HeadersVisibility" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type DataGrid}}">
<Binding.ConverterParameter>
<DataGridHeadersVisibility>All</DataGridHeadersVisibility>
</Binding.ConverterParameter>
</Binding>
</Button.Visibility>
</Button>
<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.Column="1">
<DataGridColumnHeadersPresenter.Visibility>
<Binding Path="HeadersVisibility" RelativeSource="{RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type DataGrid}}">
<Binding.ConverterParameter>
<DataGridHeadersVisibility>Column</DataGridHeadersVisibility>
</Binding.ConverterParameter>
</Binding>
</DataGridColumnHeadersPresenter.Visibility>
</DataGridColumnHeadersPresenter>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" Grid.ColumnSpan="2" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Grid.Row="1"/>
<ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
<Grid Grid.Column="1" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type DataGrid}}}"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableWidth}" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
</Grid>
</ControlTemplate>
</ScrollViewer.Template>
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Border>
</ControlTemplate>
<Style x:Key="LineStyle" TargetType="{x:Type Line}">
<Setter Property="Stroke" Value="#99000000"/>
<Setter Property="Fill" Value="#99000000"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Stroke" Value="#4C000000"/>
<Setter Property="Fill" Value="#4C000000"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</Window.Resources>
<StackPanel>
<TextBlock x:Name="newVersionCounter" Foreground="#FFE00000" Margin="10,0" TextAlignment="Center" Visibility="Collapsed"/>
<!--xmlns:ValueEditors="clr-namespace:Microsoft.VisualStudio.DesignTools.Utility.ValueEditors;assembly=Microsoft.VisualStudio.DesignTools.Utility"-->
<!--xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"-->
<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>
<TextBox x:Name="tBAbtTranslatePath" Height="23" Canvas.Left="10" Canvas.Top="102" Width="1125" Background="White" MaxLines="1"/>
<Button x:Name="btnSelectAbtTranslateFile" Content="Auswählen" Canvas.Left="1140" Canvas.Top="102" Width="135" Click="btnSelectAbtTranslateFile_Click" HorizontalAlignment="Right"/>
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Liste möglicher Zuweisungen" VerticalAlignment="Top" Canvas.Left="10" Canvas.Top="142" Height="20" Width="180"/>
<TextBox x:Name="tBZuweisungenPath" Height="23" Canvas.Left="10" Canvas.Top="167" Width="1125" Background="White" MaxLines="1"/>
<Button x:Name="btnSelectZuweisungenFile" Content="Auswählen" Canvas.Left="1140" Canvas.Top="167" Width="135" Click="btnSelectZuweisungenFile_Click" HorizontalAlignment="Right" Margin="0"/>
<!--<Button x:Name="btnClear" Content="Zuweisungen und Bemerkungen leeren" HorizontalAlignment="Left" VerticalAlignment="Top" Width="238" Visibility="Visible" Canvas.Left="22" Canvas.Top="603" Height="27"/>-->
<Button x:Name="btnImpressum" Content="Impressum" Canvas.Left="10" Canvas.Top="607" Width="238" Click="btnImpressum_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Button x:Name="btnVersionInfo" Content="Versionsinfo" Canvas.Left="253" Canvas.Top="607" Width="238" Click="btnVersionInfo_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
<Canvas x:Name="canvasImpressum" Canvas.Left="5" Canvas.Top="10" Canvas.Bottom="10" Canvas.Right="5" Background="White" Visibility="Collapsed" Margin="1" Width="1315" Height="654">
<TextBlock Canvas.Left="33" TextWrapping="Wrap" Canvas.Top="34" Height="381" Width="567" FontSize="14"><Run Text="Impressum:"/><LineBreak/><Run/><LineBreak/><Run Text="Copyright:"/><LineBreak/><Run Text="&#x9;Marcus Bachler "/><Run Text="© 2018 - 2019"/><LineBreak/><Run/><LineBreak/><Run Text="Design und Entwicklung:"/><LineBreak/><Run Text="&#x9;Marcus Bachler"/><LineBreak/><Run/><LineBreak/><Run Text="Dieses Tool ist nur zur internen Verwendung bestimmt."/><LineBreak/><Run Text="Bei Fragen und Anregungen bitte an Marcus Bachler wenden."/><LineBreak/><Run/></TextBlock>
<Button x:Name="btnCloseImpressum" Content="Schließen" Canvas.Right="40" Canvas.Bottom="40" Width="132" Height="27" Click="btnCloseImpressum_Click"/>
</Canvas>
<Canvas x:Name="canvasVersionInfo" Canvas.Left="5" Canvas.Top="10" Background="White" Visibility="Collapsed" Margin="1" Width="1315" Height="654">
<ContentControl Content="{StaticResource rtbVersionInfo}"/>
<Button x:Name="btnCloseVersionInfo" Content="Schließen" Canvas.Left="1135" Canvas.Top="585" Width="132" Height="27" Click="btnCloseVersionInfo_Click"/>
</Canvas>
</Canvas>
</Grid>
<Grid x:Name="gridToolbar" Height="184" MaxHeight="184" Visibility="Visible">
<Button x:Name="btnFrueh" Content="Früh- /Tagschicht" Margin="10,14,0,0" VerticalAlignment="Top" Height="70" Visibility="Visible" IsEnabled="False" Click="btnFrueh_Click" HorizontalAlignment="Left" Width="210" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<Button x:Name="btnTag" Content="Tagschicht" Margin="245,10,0,0" VerticalAlignment="Top" Height="70" Visibility="Collapsed" IsEnabled="False" Width="230" HorizontalAlignment="Left"/>
<Button x:Name="btnSpaet" Content="Spätschicht" Margin="225,14,0,0" VerticalAlignment="Top" Height="70" Visibility="Visible" IsEnabled="False" Click="btnSpaet_Click" HorizontalAlignment="Left" Width="210" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<Button x:Name="btnNacht" Content="Nachtschicht" Margin="440,14,0,0" VerticalAlignment="Top" Height="70" Visibility="Visible" Click="btnNacht_Click" HorizontalAlignment="Left" Width="210" Background="#4CDDDDDD" BorderBrush="#4C707070" IsEnabled="False"/>
<CheckBox x:Name="cBFrueh" Content="" HorizontalAlignment="Left" Margin="105,84,0,0" VerticalAlignment="Top" Checked="cBFrueh_Checked" ToolTip="Mehrfachauswahl für Schichten&#xA;Haken setzen um nach mehreren Schichten zu filtern" Unchecked="cBFrueh_Unchecked"/>
<CheckBox x:Name="cBSpaet" Content="" HorizontalAlignment="Left" Margin="320,84,0,0" VerticalAlignment="Top" Checked="cBSpaet_Checked" ToolTip="Mehrfachauswahl für Schichten&#xA;Haken setzen um nach mehreren Schichten zu filtern" Unchecked="cBSpaet_Unchecked"/>
<CheckBox x:Name="cBNacht" Content="" HorizontalAlignment="Left" Margin="539,84,0,0" VerticalAlignment="Top" Checked="cBNacht_Checked" ToolTip="Mehrfachauswahl für Schichten&#xA;Haken setzen um nach mehreren Schichten zu filtern" Unchecked="cBNacht_Unchecked"/>
<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"/>
<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}">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/>
<GradientStop Color="#4CE5E5E5" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
</ComboBox>
<ComboBox x:Name="cBFilterAbteilung2" HorizontalAlignment="Left" Margin="755,135,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False" SelectionChanged="cBFilterAbteilung2_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/>
<GradientStop Color="#4CE5E5E5" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
</ComboBox>
<ComboBox x:Name="cBFilterAbteilung3" HorizontalAlignment="Left" Margin="755,157,0,0" VerticalAlignment="Top" Width="120" IsEnabled="False" SelectionChanged="cBFilterAbteilung3_SelectionChanged" BorderBrush="#4CACACAC" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/>
<GradientStop Color="#4CE5E5E5" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
</ComboBox>
<Button Content="Button" HorizontalAlignment="Left" Margin="855,105,0,0" VerticalAlignment="Top" Width="75" Visibility="Collapsed"/>
<TextBox x:Name="tbSearch" HorizontalAlignment="Left" Height="29" Margin="10,112,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="225" VerticalContentAlignment="Center" KeyDown="tbSearch_KeyDown" BorderBrush="#4CABADB3"/>
<TextBlock x:Name="tbSearch1" IsHitTestVisible="False" Text="Name oder Vorname suchen" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,112,0,0" Foreground="DarkGray" Height="29" Width="225" Padding="5,5,0,0">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Text, ElementName=tbSearch}" Value="">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Button x:Name="btnSearch" Content="Suchen" HorizontalAlignment="Left" Margin="240,112,0,0" VerticalAlignment="Top" Width="75" Height="29" Click="btnSearch_Click" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<CheckBox x:Name="cBSearchWithFilters" Content="mit gesetzten Filtern suchen" HorizontalAlignment="Left" Margin="10,142,0,0" VerticalAlignment="Top" Width="225" Height="24"/>
<!--<Button x:Name="btnSaveComment" Content="Bemerkungen speichern" Margin="0,0,19,1" Visibility="Collapsed" Height="20" HorizontalAlignment="Right" Width="140" VerticalAlignment="Bottom" Click="btnSaveComment_Click"/>-->
<Button x:Name="btnSaveZuweisungen" Content="Zuweisungen speichern" Margin="0,0,19,22" Visibility="Collapsed" Height="20" HorizontalAlignment="Right" Width="140" VerticalAlignment="Bottom"/>
<Canvas x:Name="canvasSaved" Visibility="Collapsed" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="85" Width="405">
<Border BorderThickness="1" BorderBrush="#E5FFFDFD" CornerRadius="40" Height="85" Width="405" Background="#E5FFFDFD" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="lblSaved" HorizontalAlignment="Center" TextWrapping="Wrap" Text="Gespeichert" VerticalAlignment="Center" FontSize="36" TextAlignment="Center" Visibility="Visible" Foreground="#FF00A80F" Margin="9" Height="65" Width="385" Padding="0,4,0,0"/>
</Border>
</Canvas>
<Button x:Name="btnHideToolbar" Content="^^" Margin="608,0,0,0" VerticalAlignment="Bottom" Height="18" Padding="0" MinHeight="14" Click="btnHideToolbar_Click" HorizontalAlignment="Left" Width="100" ToolTip="Toolbar schließen" MinWidth="100" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<Button x:Name="btnPrint" Content="6" Margin="0,104,10,0" IsDefault="True" MinWidth="2" Padding="0,1,0,0" FontFamily="Wingdings 2" FontSize="24" Click="btnPrint_Click" ToolTip="Aktuelle Ansicht drucken" Height="30" VerticalAlignment="Top" HorizontalAlignment="Right" Width="30" Visibility="Visible" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<Button x:Name="btnExport" Content="&lt;" Margin="0,135,10,0" IsDefault="True" MinWidth="2" Padding="0,1,0,0" FontFamily="Wingdings" FontSize="24" Click="btnExport_Click" ToolTip="Aktuelle Ansicht exportieren" HorizontalAlignment="Right" Width="30" Height="30" VerticalAlignment="Top" Background="#4CDDDDDD" BorderBrush="#4C707070"/>
<CheckBox x:Name="cBzuweisungFullDataset" Content="Zuweisung alle Tage" Margin="895,147,0,0" Height="21" VerticalAlignment="Top" Padding="3,-1,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Left" Width="135" ToolTip="Ist dieser Haken gesetzt wird die Auswahl der Zuweisung auf alle Tage des Mitarbeiters gesetzt"/>
<Line Fill="#99000000" HorizontalAlignment="Left" Height="4" Margin="742,124,0,0" Stroke="#99000000" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y1="2" Y2="2"/>
<Line x:Name="lineHor1" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung2}" HorizontalAlignment="Left" Height="4" Margin="742,145,0,0" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y2="2" Y1="2" X2="6" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineVert1" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung2}" HorizontalAlignment="Left" Height="46" Margin="742,125,0,0" VerticalAlignment="Top" Width="15" X1="5" StrokeThickness="2" X2="5" Y1="23" Y2="2" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineVert2" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung3}" HorizontalAlignment="Left" Height="46" Margin="742,125,0,0" VerticalAlignment="Top" Width="15" X1="5" StrokeThickness="2" X2="5" Y1="23" Y2="43" Style="{DynamicResource LineStyle}"/>
<Line x:Name="lineHor2" IsEnabled="{Binding IsEnabled, ElementName=cBFilterAbteilung3}" HorizontalAlignment="Left" Height="4" Margin="742,167,0,0" VerticalAlignment="Top" Width="15" X1="12" StrokeThickness="2" Y1="2" Y2="2" X2="4" Style="{DynamicResource LineStyle}"/>
<TextBlock HorizontalAlignment="Left" Margin="901,105,0,0" TextWrapping="Wrap" Text="Letzte Datenänderung:" VerticalAlignment="Top" Width="124" Height="20"/>
<TextBlock x:Name="lblLastChange" HorizontalAlignment="Left" Margin="901,125,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="124" Text="" TextAlignment="Center"/>
<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"/>
</Grid>
<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.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="#99FF0000"/>
<Style x:Key="Body_Content_DataGrid_Centering"
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.Resources>
<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}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Lizenzen}" SelectedIndex="0" Template="{DynamicResource ComboBoxControlTemplate1}" IsSynchronizedWithCurrentItem="True" IsReadOnly="True" SelectionChanged="ComboBox_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" IsHitTestVisible="False" Focusable="False"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</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.CellTemplate>
<DataTemplate>
<ComboBox x:Name="combo" ItemsSource="{Binding ZuweisungsMoeglichkeiten}" SelectedItem="{Binding Zuweisung}" DropDownClosed="ComboBox_DropDownClosed" Template="{DynamicResource ComboBoxControlTemplate1}">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#4CF0F0F0" Offset="0"/>
<GradientStop Color="#4CFF0000" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</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.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"/>
</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}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Telefon}" VerticalAlignment="Center" AcceptsReturn="False" MinHeight="30" PreviewKeyDown="Telefon_KeyDown" Background="#4CFFFFFF" PreviewLostKeyboardFocus="Telefon_PreviewLostKeyboardFocus"/>
</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>
<Style TargetType="DataGridColumnHeader">
<Setter Property="ToolTip" Value="Bei Zeilen mit rotem Punkt wurden, seit Ihrer letzten Nutzung, Änderungen der Zuweisung oder Bemerkung durchgeführt"/>
</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>
</DataGrid.Columns>
</DataGrid>
<ProgressBar x:Name="bar" Height="66" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" Width="100" IsIndeterminate="True" Visibility="Collapsed"/>
<TextBlock x:Name="lblBar" Visibility="Collapsed" Margin="0" TextAlignment="Center" FontWeight="Bold" Padding="0,8,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="66"><Run Text="Dieser Vorgang"/><LineBreak/><Run Text="kann einige"/><LineBreak/><Run Text="Sekunden dauern"/></TextBlock>
<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>
</Grid>
</StackPanel>
</Window>

2467
AV-ToolV3/MainWindow.xaml.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
<Window x:Name="newVersionMessageBox" x:Class="PEP_Tool.NewVersionMessageBox"
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="Neue Version" Width="398" WindowStyle="ToolWindow" Topmost="True" ResizeMode="NoResize" Icon="icon.ico" Height="170">
<Grid>
<TextBlock x:Name="lblMessage" HorizontalAlignment="Left" Margin="70,9,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="306"><Run Text="Es ist eine neue Version verfügbar!"/><LineBreak/><Run Text="Bis zur Aktualisierung kann die Anwendung nicht gestartet werden"/><LineBreak/><Run/><Run Foreground="#FFA31515" FontSize="12.6666666666667" FontFamily="Consolas"/><LineBreak/><Run Foreground="#FFA31515" FontSize="12.6666666666667" FontFamily="Consolas" Text="Die neue Version sollte in wenigen Minuten verfügbar sein."/></TextBlock>
<Button x:Name="btnNewVersionMessageBoxOK" Content="OK" Margin="0,0,10,10" Click="btnNewVersionMessageBoxOK_Click" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="77"/>
<Image HorizontalAlignment="Left" Height="40" Margin="13,11,0,0" VerticalAlignment="Top" Width="45" Source="Info.png"/>
</Grid>
</Window>

View File

@ -0,0 +1,64 @@
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 NewVersionMessageBox.xaml
/// </summary>
public partial class NewVersionMessageBox : Window
{
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
MainWindow mw = MainWindow.main;
public NewVersionMessageBox(string Message, int TimeOut, bool onStart)
{
InitializeComponent();
MainWindow.MessageShown = true;
lblMessage.Text = Message;
Time = TimeOut;
onStartup = onStart;
if (!onStartup) this.Height += 50;
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
Properties.Settings.Default.newVersionScreen = true;
Properties.Settings.Default.Save();
mw.newVersionCounter.Visibility = Visibility.Visible;
}
int versionCount = 0;
int Time = 0;
private void Timer_Tick(object sender, EventArgs e)
{
versionCount++;
btnNewVersionMessageBoxOK.Content = $"OK ({Time - versionCount})";
mw.newVersionCounter.Text = $"Achtung - Noch {Time - versionCount} Sekunden bis das Programm geschlossen wird...";
if (Time - versionCount <= 0) Application.Current.Shutdown();
}
bool onStartup = false;
private void btnNewVersionMessageBoxOK_Click(object sender, RoutedEventArgs e)
{
if (onStartup) Application.Current.Shutdown();
else this.Visibility = Visibility.Collapsed;
}
}
}

View File

@ -0,0 +1,14 @@
<Window x:Class="PEP_Tool.NewVersionScreen"
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="Neu in dieser Version" Height="526" Width="800" WindowStyle="ToolWindow" Closing="Window_Closing">
<Grid>
<Button Content="OK" Margin="0,0,10,10" Click="Button_Click" HorizontalAlignment="Right" Width="75" Height="20" VerticalAlignment="Bottom"/>
<ContentControl Content="{StaticResource rtbVersionInfo}" Margin="0,0,0,30"/>
</Grid>
</Window>

View File

@ -0,0 +1,40 @@
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 NewVersionScreen.xaml
/// </summary>
public partial class NewVersionScreen : Window
{
public NewVersionScreen()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Properties.Settings.Default.newVersionScreen = false;
Properties.Settings.Default.Save();
}
}
}

211
AV-ToolV3/PEP_Tool.csproj Normal file
View File

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4E161CEA-E5E0-4E4A-9923-64CD9D2BD1F0}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>PEP_Tool</RootNamespace>
<AssemblyName>PEP-Tool</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<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>
</Reference>
<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="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>
<Reference Include="ReachFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Printing" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</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="LogFile.cs" />
<Compile Include="NewVersionMessageBox.xaml.cs">
<DependentUpon>NewVersionMessageBox.xaml</DependentUpon>
</Compile>
<Compile Include="NewVersionScreen.xaml.cs">
<DependentUpon>NewVersionScreen.xaml</DependentUpon>
</Compile>
<Compile Include="Print.cs" />
<Compile Include="Reader.cs" />
<Compile Include="TableCreator.cs" />
<Compile Include="TableInfo.cs" />
<Compile Include="Tracker.cs" />
<Compile Include="ucSpinnerPiston.xaml.cs">
<DependentUpon>ucSpinnerPiston.xaml</DependentUpon>
</Compile>
<Compile Include="Writer.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="NewVersionMessageBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="NewVersionScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ucSpinnerPiston.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="icon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="Download.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="Info.png" />
</ItemGroup>
<ItemGroup>
<None Include="FodyWeavers.xml" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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\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>

480
AV-ToolV3/Print.cs Normal file
View File

@ -0,0 +1,480 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Printing;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Xps;
namespace PEP_Tool
{
class Print
{
public DataGrid CreatePrintGrid(List<TableInfo> List)
{
var aktuellesGrid = List;
DataGrid grid = new DataGrid();
DataGridTextColumn nameColumn = new DataGridTextColumn();
nameColumn.Header = "Name";
nameColumn.Binding = new Binding("Name");
nameColumn.Width = 180;
grid.Columns.Add(nameColumn);
DataGridTextColumn prenameColumn = new DataGridTextColumn();
prenameColumn.Header = "Vorname";
prenameColumn.Binding = new Binding("Vorname");
prenameColumn.Width = 180;
grid.Columns.Add(prenameColumn);
DataGridTextColumn dateColumn = new DataGridTextColumn();
dateColumn.Header = "Datum";
dateColumn.Binding = new Binding
{
Path = new PropertyPath("Datum"),
StringFormat = "dd.MM.yyyy"
};
dateColumn.Width = 100;
grid.Columns.Add(dateColumn);
DataGridTextColumn abtColumn = new DataGridTextColumn();
abtColumn.Header = "Abteilung";
abtColumn.Binding = new Binding
{
Path = new PropertyPath("Abteilung")
};
abtColumn.Width = 120;
grid.Columns.Add(abtColumn);
DataGridTextColumn zuweisungenColumn = new DataGridTextColumn();
zuweisungenColumn.Header = "Zuweisung";
zuweisungenColumn.Binding = new Binding("Zuweisung");
zuweisungenColumn.Width = 180;
grid.Columns.Add(zuweisungenColumn);
DataGridTextColumn bemerkungColumn = new DataGridTextColumn();
bemerkungColumn.Header = "Bemerkung";
bemerkungColumn.Binding = new Binding("Bemerkung");
bemerkungColumn.Width = 320;
grid.Columns.Add(bemerkungColumn);
grid.Width = nameColumn.Width.Value + prenameColumn.Width.Value + dateColumn.Width.Value + abtColumn.Width.Value + zuweisungenColumn.Width.Value + bemerkungColumn.Width.Value;
grid.ItemsSource = aktuellesGrid;
return grid;
}
public void printDG(DataGrid dataGridParam, string title)
{
var dataGrid = dataGridParam;
PrintDialog printDialog = new PrintDialog();
if (printDialog.ShowDialog() == true)
{
FlowDocument fd = new FlowDocument();
Paragraph p = new Paragraph(new Run(title));
p.FontStyle = dataGrid.FontStyle;
p.FontFamily = dataGrid.FontFamily;
p.FontSize = 18;
fd.Blocks.Add(p);
Table table = new Table();
TableRowGroup tableRowGroup = new TableRowGroup();
TableRow r = new TableRow();
fd.PageWidth = printDialog.PrintableAreaWidth;
fd.PageHeight = printDialog.PrintableAreaHeight;
fd.BringIntoView();
fd.TextAlignment = TextAlignment.Center;
fd.ColumnWidth = 500;
table.CellSpacing = 0;
var headerList = dataGrid.Columns.Select(e => e.Header.ToString()).ToList();
List<dynamic> bindList = new List<dynamic>();
for (int j = 0; j < headerList.Count; j++)
{
int span = 0;
switch (j)
{
case 0:
span = 4;
break;
case 1:
span = 4;
break;
case 2:
span = 3;
break;
case 3:
span = 4;
break;
case 4:
span = 4;
break;
case 5:
span = 5;
break;
default:
span = 4;
break;
}
r.Cells.Add(new TableCell(new Paragraph(new Run(headerList[j]))));
r.Cells[j].ColumnSpan = span;//4;
r.Cells[j].Padding = new Thickness(4);
r.Cells[j].BorderBrush = Brushes.Black;
r.Cells[j].FontWeight = FontWeights.Bold;
r.Cells[j].Background = Brushes.DarkGray;
r.Cells[j].Foreground = Brushes.White;
r.Cells[j].BorderThickness = new Thickness(1, 1, 1, 1);
var binding = (dataGrid.Columns[j] as DataGridBoundColumn).Binding as Binding;
bindList.Add(binding.Path.Path);
}
tableRowGroup.Rows.Add(r);
table.RowGroups.Add(tableRowGroup);
for (int i = 0; i < dataGrid.Items.Count; i++)
{
//System.Diagnostics.Debug.WriteLine(dataGrid.ItemsSource.ToString().ToLower());
dynamic row;
if (dataGrid.ItemsSource.ToString().ToLower() == "system.data.linqdataview")
{ row = (DataRowView)dataGrid.Items.GetItemAt(i); }
else
{
row = dataGrid.Items.GetItemAt(i);
}
table.BorderBrush = Brushes.Gray;
table.BorderThickness = new Thickness(1, 1, 0, 0);
table.FontStyle = dataGrid.FontStyle;
table.FontFamily = dataGrid.FontFamily;
table.FontSize = 13;
tableRowGroup = new TableRowGroup();
r = new TableRow();
for (int j = 1; j <= 6; j++)
{
if (row.GetType() == typeof(TableInfo))
{
var x = row.GetPropertyValueForID(j, row) != null ? row.GetPropertyValueForID(j, row).ToString() : "";
if (j == 3) x = x.ToString().Split(' ')[0];
r.Cells.Add(new TableCell(new Paragraph(new Run(x))));
int span = 0;
switch (j - 1)
{
case 0:
span = 4;
break;
case 1:
span = 4;
break;
case 2:
span = 3;
break;
case 3:
span = 4;
break;
case 4:
span = 4;
break;
case 5:
span = 5;
break;
default:
span = 4;
break;
}
r.Cells[j - 1].ColumnSpan = span;// 4;
r.Cells[j - 1].Padding = new Thickness(4);
r.Cells[j - 1].BorderBrush = Brushes.DarkGray;
r.Cells[j - 1].BorderThickness = new Thickness(0, 0, 1, 1);
}
}
tableRowGroup.Rows.Add(r);
table.RowGroups.Add(tableRowGroup);
}
fd.Blocks.Add(table);
printDialog.PrintDocument(((IDocumentPaginatorSource)fd).DocumentPaginator, "");
}
}
//public const double cm = 37;
//public double Margin = 0.5 * cm;
//public double PageWidth = 21 * cm;
//public double PageHeight = 29 * cm;
//public double RowHeight = 0.7 * cm;
//public bool PageNumberVisibility = true;
//public bool DateVisibility = true;
//public double FontSize = 14;
//public double HeaderFontSize = 14;
//public bool IsBold = false;
//public void PrintDataGrid(FrameworkElement header, DataGrid grid, FrameworkElement footer, PrintDialog printDialog)
//{
// if (header == null) { header = new FrameworkElement(); header.Width = 1; header.Height = 1; }
// if (footer == null) { footer = new FrameworkElement(); footer.Width = 1; footer.Height = 1; }
// if (grid == null) return;
// Size pageSize = new Size(PageWidth, PageHeight);
// FixedDocument fixedDoc = new FixedDocument();
// fixedDoc.DocumentPaginator.PageSize = pageSize;
// double GridActualWidth = grid.ActualWidth == 0 ? grid.Width : grid.ActualWidth;
// double PageWidthWithMargin = pageSize.Width - Margin * 2;
// double PageHeightWithMargin = pageSize.Height - Margin * 2;
// // scale the header
// double headerScale = (header?.Width ?? 0) / PageWidthWithMargin;
// double headerWidth = PageWidthWithMargin;
// double headerHeight = (header?.Height ?? 0) * headerScale;
// header.Height = headerHeight;
// header.Width = headerWidth;
// // scale the footer
// double footerScale = (footer?.Width ?? 0) / PageWidthWithMargin;
// double footerWidth = PageWidthWithMargin;
// double footerHeight = (footer?.Height ?? 0) * footerScale;
// footer.Height = footerHeight;
// footer.Width = footerWidth;
// int pageNumber = 1;
// string Now = DateTime.Now.ToShortDateString();
// //add the header
// FixedPage fixedPage = new FixedPage();
// fixedPage.Background = Brushes.White;
// fixedPage.Width = pageSize.Width;
// fixedPage.Height = pageSize.Height;
// FixedPage.SetTop(header, Margin);
// FixedPage.SetLeft(header, Margin);
// fixedPage.Children.Add(header);
// // its like cursor for current page Height to start add grid rows
// double CurrentPageHeight = headerHeight + 1 * cm;
// int lastRowIndex = 0;
// bool IsFooterAdded = false;
// for (; ; )
// {
// int AvaliableRowNumber;
// var SpaceNeededForRestRows = (CurrentPageHeight + (grid.Items.Count - lastRowIndex) * RowHeight);
// //To avoid printing the footer in a separate page
// if (SpaceNeededForRestRows > (pageSize.Height - footerHeight - Margin) && (SpaceNeededForRestRows < (pageSize.Height - Margin)))
// AvaliableRowNumber = (int)((pageSize.Height - CurrentPageHeight - Margin - footerHeight) / RowHeight);
// // calc the Avaliable Row acording to CurrentPageHeight
// else AvaliableRowNumber = (int)((pageSize.Height - CurrentPageHeight - Margin) / RowHeight);
// // create new page except first page cause we created it prev
// if (pageNumber > 1)
// {
// fixedPage = new FixedPage();
// fixedPage.Background = Brushes.White;
// fixedPage.Width = pageSize.Width;
// fixedPage.Height = pageSize.Height;
// }
// // create new data grid with columns width and binding
// DataGrid gridToAdd;
// gridToAdd = GetDataGrid(grid, GridActualWidth, PageWidthWithMargin);
// FixedPage.SetTop(gridToAdd, CurrentPageHeight); // top margin
// FixedPage.SetLeft(gridToAdd, Margin); // left margin
// // add the avaliable rows to the cuurent grid
// for (int i = lastRowIndex; i < grid.Items.Count && i < AvaliableRowNumber + lastRowIndex; i++)
// {
// gridToAdd.Items.Add(grid.Items[i]);
// }
// lastRowIndex += gridToAdd.Items.Count + 1;
// // add date
// TextBlock dateText = new TextBlock();
// if (DateVisibility) dateText.Visibility = Visibility.Visible;
// else dateText.Visibility = Visibility.Hidden;
// dateText.Text = Now;
// // add page number
// TextBlock PageNumberText = new TextBlock();
// if (PageNumberVisibility) PageNumberText.Visibility = Visibility.Visible;
// else PageNumberText.Visibility = Visibility.Hidden;
// PageNumberText.Text = "Page : " + pageNumber;
// FixedPage.SetTop(dateText, PageHeightWithMargin);
// FixedPage.SetLeft(dateText, Margin);
// FixedPage.SetTop(PageNumberText, PageHeightWithMargin);
// FixedPage.SetLeft(PageNumberText, PageWidthWithMargin - PageNumberText.Text.Length * 10);
// fixedPage.Children.Add(gridToAdd);
// fixedPage.Children.Add(dateText);
// fixedPage.Children.Add(PageNumberText);
// // calc Current Page Height to know the rest Height of this page
// CurrentPageHeight += gridToAdd.Items.Count * RowHeight;
// // all grid rows added
// if (lastRowIndex >= grid.Items.Count)
// {
// // if footer have space it will be added to the same page
// if (footerHeight < (PageHeightWithMargin - CurrentPageHeight))
// {
// FixedPage.SetTop(footer, CurrentPageHeight + Margin);
// FixedPage.SetLeft(footer, Margin);
// fixedPage.Children.Add(footer);
// IsFooterAdded = true;
// }
// }
// fixedPage.Measure(pageSize);
// fixedPage.Arrange(new Rect(new Point(), pageSize));
// fixedPage.UpdateLayout();
// PageContent pageContent = new PageContent();
// ((IAddChild)pageContent).AddChild(fixedPage);
// fixedDoc.Pages.Add(pageContent);
// pageNumber++;
// // go to start position : New page Top
// CurrentPageHeight = Margin;
// // this mean that lastRowIndex >= grid.Items.Count and the footer dont have enough space
// if (lastRowIndex >= grid.Items.Count && !IsFooterAdded)
// {
// FixedPage ffixedPage = new FixedPage();
// ffixedPage.Background = Brushes.White;
// ffixedPage.Width = pageSize.Width;
// ffixedPage.Height = pageSize.Height;
// FixedPage.SetTop(footer, Margin);
// FixedPage.SetLeft(footer, Margin);
// TextBlock fdateText = new TextBlock();
// if (DateVisibility) fdateText.Visibility = Visibility.Visible;
// else fdateText.Visibility = Visibility.Hidden;
// dateText.Text = Now;
// TextBlock fPageNumberText = new TextBlock();
// if (PageNumberVisibility) fPageNumberText.Visibility = Visibility.Visible;
// else fPageNumberText.Visibility = Visibility.Hidden;
// fPageNumberText.Text = "Page : " + pageNumber;
// FixedPage.SetTop(fdateText, PageHeightWithMargin);
// FixedPage.SetLeft(fdateText, Margin);
// FixedPage.SetTop(fPageNumberText, PageHeightWithMargin);
// FixedPage.SetLeft(fPageNumberText, PageWidthWithMargin - PageNumberText.ActualWidth);
// ffixedPage.Children.Add(footer);
// ffixedPage.Children.Add(fdateText);
// ffixedPage.Children.Add(fPageNumberText);
// ffixedPage.Measure(pageSize);
// ffixedPage.Arrange(new Rect(new Point(), pageSize));
// ffixedPage.UpdateLayout();
// PageContent fpageContent = new PageContent();
// ((IAddChild)fpageContent).AddChild(ffixedPage);
// fixedDoc.Pages.Add(fpageContent);
// IsFooterAdded = true;
// }
// if (IsFooterAdded)
// {
// break;
// }
// }
// PrintFixedDocument(fixedDoc, printDialog);
//}
//private DataGrid GetDataGrid(DataGrid grid, double GridActualWidth, double PageWidthWithMargin)
//{
// DataGrid printed = new DataGrid();
// // styling the grid
// Style rowStyle = new Style(typeof(DataGridRow));
// rowStyle.Setters.Add(new Setter(Control.BackgroundProperty, Brushes.White));
// rowStyle.Setters.Add(new Setter(Control.FontSizeProperty, FontSize));
// if (IsBold) rowStyle.Setters.Add(new Setter(Control.FontWeightProperty, FontWeights.Bold));
// rowStyle.Setters.Add(new Setter(Control.HeightProperty, RowHeight));
// Style columnStyle = new Style(typeof(DataGridColumnHeader));
// columnStyle.Setters.Add(new Setter(Control.FontSizeProperty, HeaderFontSize));
// columnStyle.Setters.Add(new Setter(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Center));
// columnStyle.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(0, 0.5, 0, 1.5)));
// columnStyle.Setters.Add(new Setter(Control.BackgroundProperty, Brushes.White));
// columnStyle.Setters.Add(new Setter(Control.BorderBrushProperty, Brushes.Black));
// columnStyle.Setters.Add(new Setter(Control.FontWeightProperty, FontWeights.SemiBold));
// printed.RowStyle = rowStyle;
// printed.VerticalGridLinesBrush = Brushes.Black;
// printed.HorizontalGridLinesBrush = Brushes.Black;
// printed.FontFamily = new FontFamily("Arial");
// printed.RowBackground = Brushes.White;
// printed.Background = Brushes.White;
// printed.Foreground = Brushes.Black;
// // get the columns of grid
// foreach (var column in grid.Columns)
// {
// if (column.Visibility != Visibility.Visible) continue;
// DataGridTextColumn textColumn = new DataGridTextColumn();
// textColumn.HeaderStyle = columnStyle;
// textColumn.Header = column.Header;
// textColumn.Width = column.ActualWidth / GridActualWidth * PageWidthWithMargin;
// textColumn.Binding = ((DataGridTextColumn)column).Binding;
// printed.Columns.Add(textColumn);
// }
// printed.BorderBrush = Brushes.Black;
// return printed;
//}
//public void PrintFixedDocument(FixedDocument fixedDoc, PrintDialog printDialog)
//{
// XpsDocumentWriter writer = PrintQueue.CreateXpsDocumentWriter(printDialog.PrintQueue);
// writer.Write(fixedDoc, printDialog.PrintTicket);
//}
}
}

View File

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("PEP-Tool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PEP-Tool")]
[assembly: AssemblyCopyright("Copyright © 2018 - 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
//<UICulture>ImCodeVerwendeteKultur</UICulture> in der .csproj-Datei
//in einer <PropertyGroup> fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
//(Deutschland) verwenden, legen Sie <UICulture> auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
// oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
// designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
)]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PEP_Tool.Properties {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PEP_Tool.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

278
AV-ToolV3/Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,278 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PEP_Tool.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string LizenzenPath {
get {
return ((string)(this["LizenzenPath"]));
}
set {
this["LizenzenPath"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string AbteilungsnamenPath {
get {
return ((string)(this["AbteilungsnamenPath"]));
}
set {
this["AbteilungsnamenPath"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ZuweisungenPath {
get {
return ((string)(this["ZuweisungenPath"]));
}
set {
this["ZuweisungenPath"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool newVersionScreen {
get {
return ((bool)(this["newVersionScreen"]));
}
set {
this["newVersionScreen"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1.0")]
public string newVersionString {
get {
return ((string)(this["newVersionString"]));
}
set {
this["newVersionString"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("2.0.4")]
public string Version {
get {
return ((string)(this["Version"]));
}
set {
this["Version"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double WindowPosLeft {
get {
return ((double)(this["WindowPosLeft"]));
}
set {
this["WindowPosLeft"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Windows.WindowState WindowState {
get {
return ((global::System.Windows.WindowState)(this["WindowState"]));
}
set {
this["WindowState"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double WindowPosTop {
get {
return ((double)(this["WindowPosTop"]));
}
set {
this["WindowPosTop"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("681")]
public double WindowHeight {
get {
return ((double)(this["WindowHeight"]));
}
set {
this["WindowHeight"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1323")]
public double WindowWidth {
get {
return ((double)(this["WindowWidth"]));
}
set {
this["WindowWidth"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthBemerkung {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthBemerkung"]));
}
set {
this["WidthBemerkung"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthZuweisung {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthZuweisung"]));
}
set {
this["WidthZuweisung"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthLizenzen {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthLizenzen"]));
}
set {
this["WidthLizenzen"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthAbteilung {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthAbteilung"]));
}
set {
this["WidthAbteilung"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthGehen {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthGehen"]));
}
set {
this["WidthGehen"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthKommen {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthKommen"]));
}
set {
this["WidthKommen"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthDatum {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthDatum"]));
}
set {
this["WidthDatum"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthVorname {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthVorname"]));
}
set {
this["WidthVorname"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthName {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthName"]));
}
set {
this["WidthName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public global::System.Windows.Controls.DataGridLength WidthTelefon {
get {
return ((global::System.Windows.Controls.DataGridLength)(this["WidthTelefon"]));
}
set {
this["WidthTelefon"] = value;
}
}
}
}

View File

@ -0,0 +1,69 @@
<?xml version='1.0' encoding='utf-8'?>
<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>
<Setting Name="ZuweisungenPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="newVersionScreen" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="newVersionString" Type="System.String" Scope="User">
<Value Profile="(Default)">1.0</Value>
</Setting>
<Setting Name="Version" Type="System.String" Scope="User">
<Value Profile="(Default)">2.0.4</Value>
</Setting>
<Setting Name="WindowPosLeft" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WindowState" Type="System.Windows.WindowState" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="WindowPosTop" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WindowHeight" Type="System.Double" Scope="User">
<Value Profile="(Default)">681</Value>
</Setting>
<Setting Name="WindowWidth" Type="System.Double" Scope="User">
<Value Profile="(Default)">1323</Value>
</Setting>
<Setting Name="WidthBemerkung" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthZuweisung" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthLizenzen" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthAbteilung" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthGehen" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthKommen" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthDatum" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthVorname" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthName" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="WidthTelefon" Type="System.Windows.Controls.DataGridLength" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

863
AV-ToolV3/Reader.cs Normal file
View File

@ -0,0 +1,863 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
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();
dialog.RestoreDirectory = true;
dialog.Title = $"{Dialogname} öffnen";
dialog.Filter = "Excel Arbeitsblatt CSV|*.csv";
dialog.ShowDialog();
var result = dialog.FileName;
if (string.IsNullOrEmpty(result))
return OpenFile(Dialogname);
else
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 = "";
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Zuweisungen.csv")) path = @"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\Zuweisungen.csv";
else
path = Properties.Settings.Default.ZuweisungenPath == "" ? OpenFile("Zuweisungen") : Properties.Settings.Default.ZuweisungenPath;
if (!File.Exists(path)) path = OpenFile("Zuweisungen");
if (!File.ReadAllText(path, Encoding.GetEncoding(1250)).Contains(";"))
{
if (path != Properties.Settings.Default.ZuweisungenPath)
{
Properties.Settings.Default.ZuweisungenPath = path;
Properties.Settings.Default.Save();
}
var list = File.ReadAllLines(path, Encoding.GetEncoding(1250)).ToList();
list.Insert(0, "");
return list;
}
else
{
MessageBox.Show("Keine korrekte Zuweisungen-Datei ausgewählt", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
return ReadZuweisungsMoeglichkeiten();
}
}
internal static Dictionary<string, Tuple<string, string>> ReadAbteilungsNamen()
{
var path = "";
if (File.Exists(@"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\DKEYS.csv")) path = @"\\bku.db.de\db\DB_006\GLW_11\ICE-Fertigung\M2\Personaleinsatzplanung\DKEYS.csv";
else
path = Properties.Settings.Default.AbteilungsnamenPath == "" ? OpenFile("Abteilungsnamen") : Properties.Settings.Default.AbteilungsnamenPath;
if (!File.Exists(path)) path = OpenFile("Abteilungsnamen");
if (File.ReadAllLines(path).First().StartsWith("Abteilung;"))
{
if (path != Properties.Settings.Default.AbteilungsnamenPath)
{
Properties.Settings.Default.AbteilungsnamenPath = path;
Properties.Settings.Default.Save();
}
Dictionary<string, Tuple<string, string>> list = new Dictionary<string, Tuple<string, string>>();
foreach (var line in File.ReadAllLines(path))
{
list.Add(line.Split(';')[0], new Tuple<string, string>(line.Split(';')[1], line.Split(';')[2]));
}
return list;
}
else
{
MessageBox.Show("Keine korrekte Abteilungsnamen-Datei ausgewählt", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
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
{
/// <summary>
/// Get the array slice between the two indexes.
/// ... Inclusive for start index, exclusive for end index.
/// </summary>
public static T[] Slice<T>(this T[] source, int start, int end)
{
// Handles negative ends.
if (end < 0)
{
end = source.Length + end;
}
int len = end - start;
// Return new array.
T[] res = new T[len];
for (int i = 0; i < len; i++)
{
res[i] = source[i + start];
}
return res;
}
}
}

127
AV-ToolV3/SQL.cs Normal file
View File

@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public static class SQL
{
private static SQLiteConnection dbConnection;
public static SQLiteConnection DBConnection
{
get
{
if (dbConnection == null) ConnectDB();
return dbConnection;
}
set
{
dbConnection = value;
}
}
public static async Task ConnectDB()
{
DBConnection = new SQLiteConnection("Data Source = PEP_DB.sqlite; Version = 3;");
DBConnection.Open();
}
public static async Task WriteDB(string WriteString)
{
if (DBConnection.State != System.Data.ConnectionState.Open) await ConnectDB();
SQLiteCommand command = new SQLiteCommand(WriteString, DBConnection);
await command.ExecuteNonQueryAsync();
}
public static void ReadDB()
{
}
public static void CloseDB()
{
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;
SQLiteCommand cmdc = new SQLiteCommand("select * from ZuweisungsMoeglichkeiten", con);
DataTable ZWDT = new DataTable();
using (SQLiteDataAdapter ac = new SQLiteDataAdapter(cmdc))
{
ac.Fill(ZWDT);
}
ZuweisungsMoeglichkeiten = ZWDT.DefaultView;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
}
}
}

82
AV-ToolV3/TableCreator.cs Normal file
View File

@ -0,0 +1,82 @@
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>();
}
}
}
}

226
AV-ToolV3/TableInfo.cs Normal file
View File

@ -0,0 +1,226 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public class TableInfo : INotifyPropertyChanged, IEquatable<TableInfo>
{
public event PropertyChangedEventHandler PropertyChanged;
private string filePath;
public string FilePath
{
get { return filePath; }
set {
filePath = value;
OnPropertyChanged();
}
}
//public string FilePath { get; set; }
public string Name { get; set; }
public string Vorname { get; set; }
public string Schicht { get; set; }
public DateTime Datum { get; set; }
public string PersNummer { get; set; }
public string Gehen { get; set; }
public string Abteilung { get; set; }
public string Tagescode { get; set; }
public string Arbeitsmuster { get; set; }
public string Beginn { get; set; }
public List<string> Lizenzen { get; set; }
private string zuweisung;
public string Zuweisung
{
get { return zuweisung; }
set
{
zuweisung = value;
OnPropertyChanged();
}
}
public List<string> ZuweisungsMoeglichkeiten { get; set; }
private string bemerkung;
public string Bemerkung
{
get { return bemerkung; }
set
{
bemerkung = value;
OnPropertyChanged();
}
}
private string telefon;
public string Telefon
{
get { return telefon; }
set
{
telefon = value;
OnPropertyChanged();
}
}
public void Clear()
{
FilePath = "";
//Count = 0;
//Row = 0;
//Column = 0;
Name = "";
Vorname = "";
Schicht = "";
Datum = DateTime.Parse("01.01.1900 00:00");
PersNummer = "0";
Gehen = "";
Abteilung = "";
Tagescode = "";
Arbeitsmuster = "";
Beginn = "";// TimeSpan.FromSeconds(0);
Lizenzen = null;
}
public object GetPropertyValueForID(int ID, TableInfo type)
{
//System.Diagnostics.Debug.WriteLine(type.GetType().GetProperty("Name").GetValue(type, null));
switch (ID)
{
case 1:
return type.GetType().GetProperty("Name").GetValue(type, null);
break;
case 2:
return type.GetType().GetProperty("Vorname").GetValue(type, null);
break;
case 3:
return type.GetType().GetProperty("Datum").GetValue(type, null);
break;
case 4:
return type.GetType().GetProperty("Abteilung").GetValue(type, null);
break;
case 5:
return type.GetType().GetProperty("Zuweisung").GetValue(type, null);
break;
case 6:
return type.GetType().GetProperty("Bemerkung").GetValue(type, null);
break;
case 7:
return type.GetType().GetProperty("FilePath").GetValue(type, null);
break;
case 8:
return type.GetType().GetProperty("Schicht").GetValue(type, null);
break;
case 9:
return type.GetType().GetProperty("PersNummer").GetValue(type, null);
break;
case 10:
return type.GetType().GetProperty("Gehen").GetValue(type, null);
break;
case 11:
return type.GetType().GetProperty("Tagescode").GetValue(type, null);
break;
case 12:
return type.GetType().GetProperty("Arbeitsmuster").GetValue(type, null);
break;
case 13:
return type.GetType().GetProperty("Beginn").GetValue(type, null);
break;
case 14:
return type.GetType().GetProperty("Lizenzen").GetValue(type, null);
break;
}
return null;
}
#region EqualityComparer
// Overriding Equals member method, which will call the IEquatable implementation
// if appropriate.
// This is the method that must be implemented to conform to the
// IEquatable contract
public bool Equals(TableInfo other)
{
if (other == null)
{
return false;
}
//if (ReferenceEquals(this, other))
//{
// return true;
//}
if (this.PersNummer != other.PersNummer)
return false;
if (this.Datum != other.Datum)
{
return false;
}
if (this.Zuweisung != other.Zuweisung)
{
return false;
}
if (this.Bemerkung != other.Bemerkung)
{
return false;
}
return true;
}
public override bool Equals(object obj) => Equals(obj as TableInfo);
public override int GetHashCode() => (PersNummer + Datum.ToString()).GetHashCode();
//public class TableInfoZuweisungComparer : IEqualityComparer<TableInfo>
//{
// public bool Equals(TableInfo x, TableInfo y)
// {
// if ((x.PersNummer == y.PersNummer)
// && (x.Datum == y.Datum)
// && (x.Zuweisung == y.Zuweisung))
// return true;
// else return false;
// }
// public int GetHashCode(TableInfo obj)
// {
// return obj.PersNummer.GetHashCode();
// }
//}
#endregion
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

81
AV-ToolV3/Tracker.cs Normal file
View File

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace PEP_Tool
{
class Tracker
{
static DispatcherTimer timer = new DispatcherTimer();
//public double time = 0;
static string client = "";
public static double time { get; set; }
private static int count = 0;
public static async void Init_Track()
{
client = await Crypto.EncryptString(Environment.MachineName);
time = await Reader.ReadTime(await Reader.ReadTimeJSON());
SaveTrack(true);
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
}
private static void Timer_Tick(object sender, EventArgs e)
{
//var t = time.Item1;
time += 1;
count++;
if(count >= 30)
{
SaveTrack(true);
count = 0;
}
}
public static async Task SaveTrack(bool Online)
{
var save = await Reader.ReadTimeJSON();
//var save = new Dictionary<string, double>();
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));
if (client == "") return;
try
{
var json = Newtonsoft.Json.JsonConvert.SerializeObject(save);
//json = await Crypto.EncryptString(json);
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
{
if (fs != null)
{
fs.SetLength(0);
await fs.WriteAsync(jsonB, 0, jsonB.Length);
}
else fs.Dispose();
}
}
catch (Exception ex)
{
LogFile.WriteLine(ex);
}
}
}
}

69
AV-ToolV3/Writer.cs Normal file
View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PEP_Tool
{
public static class Writer
{
static int errCount = 0;
public static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
var err = false;
FileStream fs = null;
for (int numTries = 0; numTries < 50; numTries++)
{
fs = null;
try
{
if(err && errCount > 5) LogFile.WriteLine(access.ToString() + "error #" + errCount + ": " + Path.GetFileName(fullPath));
fs = new FileStream(fullPath, mode, access, share);
if (err && errCount > 5) LogFile.WriteLine(access.ToString() + " done" + ": " + Path.GetFileName(fullPath));
err = false;
errCount = 0;
return fs;
}
catch (IOException ex)
{
errCount++;
//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);
//if(ex.InnerException != null) LogFile.WriteLine("InnerException: " + ex.InnerException);
err = true;
if (fs != null)
{
fs.Dispose();
}
System.Threading.Thread.Sleep(500);
}
catch(Exception exc)
{
//LogFile.WriteLine(Environment.MachineName + ": " + access.ToString() + " denied" + ": " + Path.GetFileName(fullPath));
//LogFile.WriteLine(exc.ToString());
//LogFile.WriteLine("Message: " + exc.Message);
//if (exc.InnerException != null) LogFile.WriteLine("InnerException: " + exc.InnerException);
err = true;
if (fs != null)
{
fs.Dispose();
}
System.Threading.Thread.Sleep(500);
}
}
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);
return null;
}
}
}

BIN
AV-ToolV3/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

11
AV-ToolV3/packages.config Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="1.6.2" targetFramework="net45" 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" />
</packages>

View File

@ -0,0 +1,83 @@
<UserControl
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"
mc:Ignorable="d"
x:Class="PEP_Tool.ucSpinnerPiston"
x:Name="UserControl"
d:DesignWidth="640" d:DesignHeight="480">
<UserControl.Resources>
<Storyboard x:Name="spinner" x:Key="spinner" RepeatBehavior="Forever" >
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.10" Value="-6.83251953125"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.20" Value="-14"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.30" Value="-13.94000244140625"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.40" Value="-13.875"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.10" Value="6.95452880859375"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.20" Value="14.25"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.30" Value="14.13"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.40" Value="14"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2440000" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.7400000" Value="-6.844"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.40" Value="-14"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.20" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.30" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.40" Value="6.65972900390625"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.50" Value="13.875"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.10" Value="0.5"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.20" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.30" Value="0.5"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.40" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse1" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.10" Value="0.5"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.20" Value="1"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.30" Value="0.5"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.40" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource spinner}"/>
</EventTrigger>
</UserControl.Triggers>
<Canvas>
<Ellipse x:Name="ellipse" Fill="#FF04A7D6" Height="6" Width="6" RenderTransformOrigin="0.5,0.5" Canvas.Left="16" Canvas.Top="2">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
<Ellipse x:Name="ellipse1" Fill="#FF04A7D6" Height="6" Width="6" Canvas.Top="16" RenderTransformOrigin="0.5,0.5" Canvas.Left="2">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
</Canvas></UserControl>

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PEP_Tool
{
/// <summary>
/// Interaction logic for ucSpinnerPiston.xaml
/// </summary>
public partial class ucSpinnerPiston : UserControl
{
public ucSpinnerPiston()
{
this.InitializeComponent();
}
}
}

25
PEP_ToolProject.sln Normal file
View File

@ -0,0 +1,25 @@

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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4E161CEA-E5E0-4E4A-9923-64CD9D2BD1F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E161CEA-E5E0-4E4A-9923-64CD9D2BD1F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E161CEA-E5E0-4E4A-9923-64CD9D2BD1F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E161CEA-E5E0-4E4A-9923-64CD9D2BD1F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3991FC1E-BC37-4EA1-9E13-6C8F3993AF15}
EndGlobalSection
EndGlobal