From 515d1fb3999c5d6ddec05ca8fd1d45ec272bc035 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 24 Jul 2024 17:57:39 +0200 Subject: [PATCH 1/6] String Trim --- Dakota/DakotaValidator.cs | 4 +++- Dakota/Models/Daten/Datenelement.cs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dakota/DakotaValidator.cs b/Dakota/DakotaValidator.cs index 622ba6b0b..abae6914b 100644 --- a/Dakota/DakotaValidator.cs +++ b/Dakota/DakotaValidator.cs @@ -12,12 +12,14 @@ namespace Dakota { public static class DakotaValidator { - public static void ClearTextString(string input) + public static string ClearTextString(string input) { foreach (var specialChar in DakotaConfig.SpecialCollection) { input = input.Replace(specialChar, DakotaConfig.Aufhebungszeichen + specialChar); } + + return input.Trim(); } /// diff --git a/Dakota/Models/Daten/Datenelement.cs b/Dakota/Models/Daten/Datenelement.cs index 7cc3e3dac..70c1818ab 100644 --- a/Dakota/Models/Daten/Datenelement.cs +++ b/Dakota/Models/Daten/Datenelement.cs @@ -97,9 +97,9 @@ namespace Dakota.Models.Daten throw new DakotaException($"Das Feld \"{Title}\" hat bei der Erstellung {_Value.Length} Stellen ergeben! Nach Vorgabe darf es jedoch maximal {MaxStellen} Stellen haben"); } - DakotaValidator.ClearTextString(value); + var mod_value = DakotaValidator.ClearTextString(value); - _Value = value; + _Value = mod_value; } } } From 02d71f09efdac0c9395f1d8a1059a530b5e9a3cd Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 24 Jul 2024 18:56:50 +0200 Subject: [PATCH 2/6] Dakota Sender erkennt Datenannahmestellen Fehler und verschiebt in Failed Ordner -> Automatische Fehlererkennung --- DakotaSender/Program.cs | 114 ++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/DakotaSender/Program.cs b/DakotaSender/Program.cs index f362a86ca..3562388a4 100644 --- a/DakotaSender/Program.cs +++ b/DakotaSender/Program.cs @@ -59,7 +59,8 @@ namespace DakotaSender PrintLine("-------------------"); } - static void PrintLine(string line = null) + static void PrintLine() => PrintLine(null); + static void PrintLine(string line) { PrintWithTime(line + "\n", !time_in_line); @@ -78,6 +79,13 @@ namespace DakotaSender else Console.Write(line); } + static void PrintFileInfo(DakotaSystemFile file) + { + PrintLine($"Verarbeite Datei: {file.SourceNutzdatendatei.Name}"); + PrintLine($"- Tenant: {file.Tenant}"); + PrintLine($"- Protokoll Oid: {file.ProtokollOid}"); + PrintLine($"- Datenannahmestelle: {file.Datenannahmestelle}"); + } static void CheckDakotaStatus() { @@ -176,64 +184,65 @@ namespace DakotaSender return toCheck.Any() ? toCheck : null; } + static void TryProcessFile(DakotaSystemFile file) { + string error; bool copied = false; try { - var protokoll_oid = file.ProtokollOid; - - PrintLine($"Verarbeite Datei: {file.SourceNutzdatendatei.Name}"); - PrintLine($"- Tenant: {file.Tenant}"); - PrintLine($"- Protokoll Oid: {protokoll_oid}"); - PrintLine($"- Datenannahmestelle: {file.Datenannahmestelle}"); - - copied = true; - CopyFileToDestination(file); - - Print("Sende via Dakota. "); - - var code = ExecuteDakota("-x"); - - if (AcceptSendCodes.Contains(code)) - { - PrintLine($"Ok."); - - DeleteQueueFile(file); - } - else - { - if(code == RC_DAKOTA_ALREADY_LOADED) - { - PrintLine($"Verarbeitung fehlgeschlagen. Dakota läuft bereits."); - - PrintLine("Ignoriere Verarbeitung aktuell. Versuche im nächsten Programm Aufruf erneut."); - - DeleteDakotaFile(file); - } - else - { - var error = $"Verarbeitung fehlgeschlagen. Statuscode {code} wird nicht akzeptiert."; - - PrintLine(error); - - MoveQueueToFailed(file); - - DeleteDakotaFile(file); - - CreateResultXmlFile(file, error); - } - } + error = ProcessFile(file, out copied); } catch (Exception e) { - PrintLine($"Verarbeitung fehlgeschlagen. Exception: {e}"); + error = e.ToString(); + } + + if (error is string) + { + PrintLine(error); + MoveQueueToFailed(file); if (copied) DeleteDakotaFile(file); + + CreateResultXmlFile(file, error); } } + static string ProcessFile(DakotaSystemFile file, out bool copied) + { + copied = false; + PrintFileInfo(file); + + if (!IsDakotaFolderDatenannahmestelleValid(file.Datenannahmestelle)) + return "Datenannahmestelle unbekannt."; + + CopyFileToDestination(file); + copied = true; + + Print("Sende via Dakota. "); + + var code = ExecuteDakota("-x"); + + if (code == RC_DAKOTA_ALREADY_LOADED) + { + PrintLine($"Verarbeitung fehlgeschlagen. Dakota läuft bereits."); + + PrintLine("Ignoriere Verarbeitung aktuell. Versuche im nächsten Programm Aufruf erneut."); + + DeleteDakotaFile(file); + + return null; + } + + if (!AcceptSendCodes.Contains(code)) + return $"Verarbeitung fehlgeschlagen. Statuscode {code} wird nicht akzeptiert."; + + PrintLine($"Ok."); + DeleteQueueFile(file); + return null; + } static void CreateResultXmlFile(DakotaSystemFile file, string error) { Print("Speichere Fehler als Xml. "); @@ -338,6 +347,19 @@ namespace DakotaSender } } + static bool IsDakotaFolderDatenannahmestelleValid(string datenannahmestelle) + { + try + { + _ = GetDakotaFolderDatenannahmestelle(datenannahmestelle); + + return true; + } + catch (Exception e) + { + return false; + } + } static DirectoryInfo GetDakotaFolderDatenannahmestelle(string datenannahmestelle) { var folder = new DirectoryInfo(Path.Combine(GetDakotaFolder().FullName, "TP5Daten", datenannahmestelle)); @@ -359,7 +381,7 @@ namespace DakotaSender return dirinfo; } - + static string GetLogPath() => ConfigurationManager.AppSettings.Get("LogPath") ?? @"C:\GkvAbrechnung\Sender\log.txt"; static int GetProcessWaitForExitMs() From 1854205b02c854cd3723d08c11b402f96c2a1d43 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Thu, 12 Sep 2024 11:58:29 +0200 Subject: [PATCH 3/6] Debug Config -> Bug bei Wohneinheit gefunden --- BeWo/DebugConfig.cs | 12 +- BeWo/LoginControl.xaml.cs | 545 +++++++++--------- BeWo/MainControl.xaml.cs | 8 +- .../Accounting/GkvAbrechnungOverview.xaml | 295 ++++++++-- .../Accounting/GkvAbrechnungOverview.xaml.cs | 11 +- BeWo/View/Master/FinanceView.xaml | 6 +- BeWo/View/Master/FinanceView.xaml.cs | 34 +- .../ListViewModel/GkvAbrechnungListVM.cs | 4 + 8 files changed, 558 insertions(+), 357 deletions(-) diff --git a/BeWo/DebugConfig.cs b/BeWo/DebugConfig.cs index 904ee51c2..9aee9086d 100644 --- a/BeWo/DebugConfig.cs +++ b/BeWo/DebugConfig.cs @@ -9,7 +9,8 @@ namespace BeWo public enum DebugConfigMode { SimpleAutoLogin, - FeatureWohnhilfe + FeatureWohnhilfe, + FeatureDakota } public class DebugConfig @@ -21,7 +22,7 @@ namespace BeWo { #if DEBUG - return _CurrentConfig ?? (_CurrentConfig = SimpleAutoLogin); + return _CurrentConfig ?? (_CurrentConfig = FeatureDakota); #endif @@ -47,5 +48,12 @@ namespace BeWo AutoLogin = true, SelectView = UIContext.Customer }; + + public static DebugConfig FeatureDakota => new DebugConfig() + { + DebugConfigMode = DebugConfigMode.FeatureDakota, + AutoLogin = true, + SelectView = UIContext.Finance + }; } } diff --git a/BeWo/LoginControl.xaml.cs b/BeWo/LoginControl.xaml.cs index 957917225..1a3069b74 100644 --- a/BeWo/LoginControl.xaml.cs +++ b/BeWo/LoginControl.xaml.cs @@ -61,7 +61,7 @@ namespace BeWo //proxy anmeldedaten public string proxyname; public string proxyUsername; - public string proxypasswd; + public string proxypasswd; private List _ProfileList; public List ProfileList @@ -69,7 +69,7 @@ namespace BeWo get { return _ProfileList; } set { _ProfileList = value; } } - + public LoginControl() { InitializeComponent(); @@ -77,24 +77,24 @@ namespace BeWo DateTime dt = new DateTime(2017, 1, 1); if (DateTime.Now > dt) dt = DateTime.Now; - + txtCopyright.Text = String.Format("Copyright {0:yyyy} | ownSoft GmbH", dt); - + var checkPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\profiles.txt"; - if (File.Exists(checkPath)) - { - //Nimm lokalen Profilpfad wenn er existiert. Wird z.B. bei Kunden mit Citrix Server genutzt, die keine Clickonce Installation vornehmen - _ProfilesFilePath = checkPath; - } - else - { - _ProfilesFilePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "profiles.txt"); - } + if (File.Exists(checkPath)) + { + //Nimm lokalen Profilpfad wenn er existiert. Wird z.B. bei Kunden mit Citrix Server genutzt, die keine Clickonce Installation vornehmen + _ProfilesFilePath = checkPath; + } + else + { + _ProfilesFilePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "profiles.txt"); + } _ConfigFilePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "bwp.config"); ProfileList = new List(); - BeWoProfile selectedProfile = null; + BeWoProfile selectedProfile = null; HeightFrom = gridLogin.Height; HeightTo = gridLogin.Height + 64; LineYCoordFrom = linkLine.Y1; @@ -102,31 +102,31 @@ namespace BeWo DataContext = this; - + ReadProxyName(); try { - ReadProfileList(); - + ReadProfileList(); + #if DEBUG var uri = new Uri("https://localhost/Host/?k=demo&s=localhost/service"); - var paramDic = BeWoUtils.ParseQuery(uri.Query); - string v1, v2; - paramDic.TryGetValue("k", out v1); - paramDic.TryGetValue("s", out v2); - BeWoApp.Tenant = v1; - BeWoApp.ServerName = v2; - if (ProfileList.Count > 0) - ProfileList.Insert(0, new BeWoProfile(v1, v2, BeWoApp.Tenant)); - else - ProfileList.Add(new BeWoProfile(v1, v2, BeWoApp.Tenant)); - SaveProfileListToFile(); + var paramDic = BeWoUtils.ParseQuery(uri.Query); + string v1, v2; + paramDic.TryGetValue("k", out v1); + paramDic.TryGetValue("s", out v2); + BeWoApp.Tenant = v1; + BeWoApp.ServerName = v2; + if (ProfileList.Count > 0) + ProfileList.Insert(0, new BeWoProfile(v1, v2, BeWoApp.Tenant)); + else + ProfileList.Add(new BeWoProfile(v1, v2, BeWoApp.Tenant)); + SaveProfileListToFile(); + - #else @@ -171,29 +171,29 @@ namespace BeWo } #endif - } + } catch (Exception ex) { - - } - - - //string ipaddress = ""; - // -------------- + } + + + //string ipaddress = ""; + + // -------------- if (ProfileList.Count == 0 || String.IsNullOrEmpty(ProfileList[0].Tenant)) - ShowEnterTenantDialog(); + ShowEnterTenantDialog(); //if (ProfileList.Count == 0) - //ProfileList.Add(new BeWoProfile("Ungültiges Profil", "Bitte geben Sie hier einen gültigen Server an. Z.B. app1", "Kundennummer")); - BeWoProfile firstProfile = null; - if (ProfileList.Count > 0) - firstProfile = ProfileList[0]; - ProfileList.Sort((a, b) => a.Name.CompareTo(b.Name)); - profileSelectionComboBox.ItemsSource = ProfileList; + //ProfileList.Add(new BeWoProfile("Ungültiges Profil", "Bitte geben Sie hier einen gültigen Server an. Z.B. app1", "Kundennummer")); + BeWoProfile firstProfile = null; + if (ProfileList.Count > 0) + firstProfile = ProfileList[0]; + ProfileList.Sort((a, b) => a.Name.CompareTo(b.Name)); + profileSelectionComboBox.ItemsSource = ProfileList; + - if (ProfileList.Count > 0) { #if DEBUG @@ -207,10 +207,10 @@ namespace BeWo selectedProfile = firstProfile; } } - - + + //if (profileSelectionComboBox.SelectedItem == null) - profileSelectionComboBox.SelectedItem = selectedProfile; + profileSelectionComboBox.SelectedItem = selectedProfile; TextBox_Username.Focus(); @@ -218,9 +218,9 @@ namespace BeWo { TextBox_Username.Text = "demo"; PasswordBox_Password.Password = "demo"; - + } - + //this.lblTenant.Content = BeWoApp.Tenant; lblVersion.Content = BeWoApp.Version; @@ -233,9 +233,9 @@ namespace BeWo //linkLine.Margin = new Thickness(linkLine.Margin.Left, linkLine.Margin.Top + 25, linkLine.Margin.Right, linkLine.Margin.Bottom); //gridLogin.Height += 25; - + } - + private void PinCertificate() { @@ -265,7 +265,7 @@ namespace BeWo { if (certificate == null || chain == null) return false; - + bool chainContainsPk = false; foreach (var element in chain.ChainElements) @@ -458,7 +458,7 @@ namespace BeWo while (!myFile.EndOfStream) { var data = myFile.ReadLine(); - + if (!String.IsNullOrEmpty(data)) { if (data.Contains("selected")) @@ -484,65 +484,65 @@ namespace BeWo } catch (Exception e) { - + } - + return null; } private void ReadProfileList() - { - try - { - if (File.Exists(_ProfilesFilePath)) - { - var myFile = new StreamReader(_ProfilesFilePath, Encoding.Default); + { + try + { + if (File.Exists(_ProfilesFilePath)) + { + var myFile = new StreamReader(_ProfilesFilePath, Encoding.Default); - while (!myFile.EndOfStream) - { - var data = myFile.ReadLine()?.Split('|'); + while (!myFile.EndOfStream) + { + var data = myFile.ReadLine()?.Split('|'); - if (data?.Length >= 3) - { - if (!String.IsNullOrEmpty(data[1]) && !String.IsNullOrEmpty(data[2])) - ProfileList.Add(new BeWoProfile(data[0], data[1], data[2])); - } - } - myFile.Close(); - } + if (data?.Length >= 3) + { + if (!String.IsNullOrEmpty(data[1]) && !String.IsNullOrEmpty(data[2])) + ProfileList.Add(new BeWoProfile(data[0], data[1], data[2])); + } + } + myFile.Close(); + } } - catch (Exception e) - { - } - } + catch (Exception e) + { + } + } - private string GetNumericServerName(string serverName) - { - if (!String.IsNullOrEmpty(serverName)) - { - int snOut = 0; - if (!Int32.TryParse(serverName, out snOut)) - { - String nname = serverName.Replace("app", ""); - if (nname.IndexOf('.') > 0) - { - return nname.Substring(0, nname.IndexOf('.')); - } - } - } - return serverName; - } + private string GetNumericServerName(string serverName) + { + if (!String.IsNullOrEmpty(serverName)) + { + int snOut = 0; + if (!Int32.TryParse(serverName, out snOut)) + { + String nname = serverName.Replace("app", ""); + if (nname.IndexOf('.') > 0) + { + return nname.Substring(0, nname.IndexOf('.')); + } + } + } + return serverName; + } private void ShowEnterTenantDialog() { BeWoProfile p = null; - + var cancel = false; var tenant = String.Empty; while (p == null && !cancel) { - var dlg = new EnterTenantDialog {Tenant = tenant}; + var dlg = new EnterTenantDialog { Tenant = tenant }; var result = dlg.ShowDialog(); if (result.HasValue && result.Value) { @@ -551,14 +551,14 @@ namespace BeWo { tenant = tenant.Trim(); } - var server = GetServerFromTenant(tenant); + var server = GetServerFromTenant(tenant); if (!String.IsNullOrEmpty(server)) { p = new BeWoProfile(tenant, server, tenant); - if (ProfileList.Count > 0) - ProfileList.Insert(0, p); - else - ProfileList.Add(p); + if (ProfileList.Count > 0) + ProfileList.Insert(0, p); + else + ProfileList.Add(p); SaveProfileListToFile(); } else @@ -574,14 +574,14 @@ namespace BeWo } - private string GetServerFromTenant(string tenant) - { - try - { - if (tenant == "demo") - { - return "app1.bewoplaner.de"; - } + private string GetServerFromTenant(string tenant) + { + try + { + if (tenant == "demo") + { + return "app1.bewoplaner.de"; + } //Server URL über Kundennummer: //https://bewoplaner.beyondsoft.de/getserver.php?CustomerID=1234567890 @@ -590,28 +590,28 @@ namespace BeWo //https://bewoplaner.beyondsoft.de/getcontractstate.php?CustomerID=1234567890 - + String url = String.Format(GETSERVER_URL, tenant); - using (WebClient client = new WebClient()) - { - //MessageBox.Show(hostAddress); - byte[] response = client.UploadValues(url, "POST", new NameValueCollection()); + using (WebClient client = new WebClient()) + { + //MessageBox.Show(hostAddress); + byte[] response = client.UploadValues(url, "POST", new NameValueCollection()); - String server = System.Text.Encoding.ASCII.GetString(response); + String server = System.Text.Encoding.ASCII.GetString(response); - return server; - } - } - catch (Exception ex) - { - //MessageBox.Show(String.Format("Fehler beim Prüfen der Kundennummer: {0}\n\n{1}", ex.Message, ex.StackTrace)); - return null; - } + return server; + } + } + catch (Exception ex) + { + //MessageBox.Show(String.Format("Fehler beim Prüfen der Kundennummer: {0}\n\n{1}", ex.Message, ex.StackTrace)); + return null; + } + + return null; + } - return null; - } - private BeWoProfile GenerateProfileFromUri(Uri uri) { @@ -711,10 +711,12 @@ namespace BeWo TextBox_Username.Focus(); } - if(DebugConfig.CurrentConfig is object && DebugConfig.CurrentConfig.AutoLogin) +#if DEBUG + if (DebugConfig.CurrentConfig is object && DebugConfig.CurrentConfig.AutoLogin) { button_login_Click(this, new RoutedEventArgs()); } +#endif } private void ShowModalBackground() @@ -732,43 +734,43 @@ namespace BeWo private void button_login_Click(object sender, RoutedEventArgs e) { - if (!String.IsNullOrEmpty(proxyname)) - { - var webProxy = WebProxy.GetDefaultProxy(); - webProxy.UseDefaultCredentials = true; - System.Net.WebRequest.DefaultWebProxy = new WebProxy(proxyname, true); + if (!String.IsNullOrEmpty(proxyname)) + { + var webProxy = WebProxy.GetDefaultProxy(); + webProxy.UseDefaultCredentials = true; + System.Net.WebRequest.DefaultWebProxy = new WebProxy(proxyname, true); - if (String.IsNullOrEmpty(proxyUsername)) - { - WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials; - } - else - { - WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(proxyUsername, proxypasswd); - } - } + if (String.IsNullOrEmpty(proxyUsername)) + { + WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials; + } + else + { + WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(proxyUsername, proxypasswd); + } + } - if (ProfileList.Count == 0 || profileSelectionComboBox.SelectedItem == null) - { - MessageBox.Show( - "Es wurde kein gültiges Profil gefunden. Bitte erstellen Sie zunächst ein Profil. Klicken Sie dazu auf 'Erweitert' und anschließend auf den Button 'Profile bearbeiten'", - "Ungültiges Profil", MessageBoxButton.OK, MessageBoxImage.Warning); - } - else - { - var profile = profileSelectionComboBox.SelectedItem as BeWoProfile; + if (ProfileList.Count == 0 || profileSelectionComboBox.SelectedItem == null) + { + MessageBox.Show( + "Es wurde kein gültiges Profil gefunden. Bitte erstellen Sie zunächst ein Profil. Klicken Sie dazu auf 'Erweitert' und anschließend auf den Button 'Profile bearbeiten'", + "Ungültiges Profil", MessageBoxButton.OK, MessageBoxImage.Warning); + } + else + { + var profile = profileSelectionComboBox.SelectedItem as BeWoProfile; - isNet45OrNewer = IsNet45OrNewer(); + isNet45OrNewer = IsNet45OrNewer(); - if (!isNet45OrNewer) - { - if (!CheckStatusMessage(String.Format(GETNETMESSAGE_URL, profile.Tenant, BeWoApp.ShortVersion))) - { - return; - } - } + if (!isNet45OrNewer) + { + if (!CheckStatusMessage(String.Format(GETNETMESSAGE_URL, profile.Tenant, BeWoApp.ShortVersion))) + { + return; + } + } #if DEBUG if (!CheckStatusMessage(String.Format(GETSTATUSMESSAGE_URL + "&pre", profile.Tenant, BeWoApp.ShortVersion))) @@ -784,30 +786,30 @@ namespace BeWo ChangeServerAndTenant(profile); - var lWaitLayer = new WaitLayer2(); - grid_root.Children.Add(lWaitLayer); + var lWaitLayer = new WaitLayer2(); + grid_root.Children.Add(lWaitLayer); - string lUserName = TextBox_Username.Text; - string lPassword = PasswordBox_Password.Password; - string lPIN = PINTextBox.Text; - string lTenant = BeWoApp.Tenant; - - - if (!String.IsNullOrEmpty(lPIN)) - { - lPIN += "_" + System.Environment.MachineName; - } - Action action = Login; - action.BeginInvoke(lWaitLayer, lUserName, lPassword, lTenant, lPIN, cb => {}, null); - } + string lUserName = TextBox_Username.Text; + string lPassword = PasswordBox_Password.Password; + string lPIN = PINTextBox.Text; + string lTenant = BeWoApp.Tenant; + + + if (!String.IsNullOrEmpty(lPIN)) + { + lPIN += "_" + System.Environment.MachineName; + } + Action action = Login; + action.BeginInvoke(lWaitLayer, lUserName, lPassword, lTenant, lPIN, cb => { }, null); + } } - + private void Login(WaitLayer2 lWaitLayer, String lUserName, String lPassword, String lTenant, String lPIN) - { + { try { //1. Versuch - UserValidationResult result = TryLogin(lWaitLayer, lUserName, lPassword, lTenant, lPIN ); + UserValidationResult result = TryLogin(lWaitLayer, lUserName, lPassword, lTenant, lPIN); //2. Versuch if (result == UserValidationResult.UnkownError) @@ -815,7 +817,7 @@ namespace BeWo ServiceFacade.DoOperationsServiceAsync(op => op.ResetTenant(lTenant), delegate { - result = TryLogin(lWaitLayer ,lUserName, lPassword, lTenant, lPIN); + result = TryLogin(lWaitLayer, lUserName, lPassword, lTenant, lPIN); if (result == UserValidationResult.UnkownError) { @@ -823,7 +825,7 @@ namespace BeWo ServiceFacade.DoOperationsServiceAsync(op => op.ResetAllTenants(), delegate { - result = TryLogin(lWaitLayer,lUserName, lPassword, lTenant, lPIN); + result = TryLogin(lWaitLayer, lUserName, lPassword, lTenant, lPIN); if (result == UserValidationResult.UnkownError) { @@ -862,37 +864,37 @@ namespace BeWo MessageBox.Show("Die Kundennummer '" + lTenant + "' ist ungültig.", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); }); } - String pin = lPIN; - - if (!String.IsNullOrEmpty(lPIN) && lPIN.IndexOf('_') >= 0) - { - pin = lPIN.Substring(0, lPIN.IndexOf('_')); - } + String pin = lPIN; - if (result == UserValidationResult.IncorrectPin) - { - this.Dispatch(delegate - { - grid_root.Children.Remove(lWaitLayer); - MessageBox.Show("Die Pin '" + pin + "' ist unbekannt!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); - }); - } - if (result == UserValidationResult.PinAlreadyUsed) - { - this.Dispatch(delegate - { - grid_root.Children.Remove(lWaitLayer); - MessageBox.Show("Die Pin '" + pin + "' wurde bereits verwendet!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); - }); - } - if (result == UserValidationResult.PinExpired) - { - this.Dispatch(delegate - { - grid_root.Children.Remove(lWaitLayer); - MessageBox.Show("Die Pin '" + pin + "' ist bereits abgelaufen!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); - }); - } + if (!String.IsNullOrEmpty(lPIN) && lPIN.IndexOf('_') >= 0) + { + pin = lPIN.Substring(0, lPIN.IndexOf('_')); + } + + if (result == UserValidationResult.IncorrectPin) + { + this.Dispatch(delegate + { + grid_root.Children.Remove(lWaitLayer); + MessageBox.Show("Die Pin '" + pin + "' ist unbekannt!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); + }); + } + if (result == UserValidationResult.PinAlreadyUsed) + { + this.Dispatch(delegate + { + grid_root.Children.Remove(lWaitLayer); + MessageBox.Show("Die Pin '" + pin + "' wurde bereits verwendet!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); + }); + } + if (result == UserValidationResult.PinExpired) + { + this.Dispatch(delegate + { + grid_root.Children.Remove(lWaitLayer); + MessageBox.Show("Die Pin '" + pin + "' ist bereits abgelaufen!", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); + }); + } if (result == UserValidationResult.PasswordExpired) { //this.Dispatch(delegate @@ -919,7 +921,7 @@ namespace BeWo private UserValidationResult TryLogin(WaitLayer2 lWaitLayer, string lUserName, string lPassword, string tenant, string lPin) { UserValidationResult? result = null; - + if (!string.IsNullOrEmpty(lUserName) && !string.IsNullOrEmpty(lPassword)) { String tempUsername = lUserName; @@ -945,7 +947,7 @@ namespace BeWo clr = e.Message; } - + tempUsername = String.Format("{0}//Version={1};CLRVersion={2};BeWoVersion={3};IsNet45OrNewer={4}", lUserName, version, clr, bewoVersion, isNet45OrNewer); try { @@ -953,7 +955,7 @@ namespace BeWo { try { - return s.IsUserValid(tempUsername, lPassword, lPin); + return s.IsUserValid(tempUsername, lPassword, lPin); } catch (Exception) { @@ -969,7 +971,7 @@ namespace BeWo LoginResult(lWaitLayer, r, lUserName, lPassword, tenant, lPin); }); - + }, true); } catch (FaultException) @@ -979,7 +981,7 @@ namespace BeWo } else { - if(result == null) + if (result == null) result = UserValidationResult.UserUnknown; } @@ -991,9 +993,9 @@ namespace BeWo return result.Value; } - private void LoginResult( WaitLayer2 lWaitLayer, UserValidationResult result, String lUserName, String lPassword, String tenant, String lPIN) + private void LoginResult(WaitLayer2 lWaitLayer, UserValidationResult result, String lUserName, String lPassword, String tenant, String lPIN) { - + if (result == UserValidationResult.UserValid || result == UserValidationResult.UserValidTwoFactorAuthenticationNeeded || result == UserValidationResult.TwoFactorAuthenticationFailedNoChatCodeAllowLogin) { if (result == UserValidationResult.UserValidTwoFactorAuthenticationNeeded || result == UserValidationResult.TwoFactorAuthenticationFailedNoChatCodeAllowLogin) @@ -1010,7 +1012,7 @@ namespace BeWo message = Translator.Translate("Kein Chat Code für die Zwei Faktor Authentifizierung gefunden"); dlg.ShowCodeField = false; } - + if (message.Contains("<") && message.Contains(">")) { dlg.SetXaml(message); @@ -1036,14 +1038,14 @@ namespace BeWo BeWoApp.UserName = lUserName; BeWoApp.UserPassword = lPassword; - + BeWoApp.PasswortStrength = BeWoUtils.CheckPasswordSecurity(lPassword); ServiceFacade.DoUserServiceAsync(s2 => s2.LoadUserByNameAndPassword(lUserName, lPassword), r2 => { BeWoApp.LoggedOnUser = r2; - + ServiceFacade.DoOperationsServiceAsync(s => s.GetMandator(), m => { @@ -1078,7 +1080,7 @@ namespace BeWo } grid_root.Children.Remove(lWaitLayer); MessageBox.Show(msg, "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation); - + var pav = new PasswortAenderungsView(); pav.ShowDialog(); @@ -1086,7 +1088,8 @@ namespace BeWo { } - else { + else + { LoginSuccessful?.Invoke(this, new EventArgs()); } }); @@ -1153,14 +1156,14 @@ namespace BeWo } - private void button_configureProxy_Click(object sender, RoutedEventArgs rea) - { + private void button_configureProxy_Click(object sender, RoutedEventArgs rea) + { ProxyLoginView proxyLogin = new ProxyLoginView(); - proxyLogin.WindowStartupLocation = WindowStartupLocation.CenterScreen; - - proxyLogin.ShowDialog(); - ReadProxyName(); - } + proxyLogin.WindowStartupLocation = WindowStartupLocation.CenterScreen; + + proxyLogin.ShowDialog(); + ReadProxyName(); + } // TODO: Verschlüsselung einbauen! private void ReadProxyName() @@ -1171,15 +1174,15 @@ namespace BeWo try { - var filePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\proxy.dat"; - if (!File.Exists(filePath)) - { - filePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "proxy.dat"); - } + var filePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\proxy.dat"; + if (!File.Exists(filePath)) + { + filePath = Path.Combine(BeWoApp.GetAndCreateUserAppDataPath(), "proxy.dat"); + } var allLines = File.ReadAllLines(filePath); - foreach(var linex in allLines) + foreach (var linex in allLines) { var decryptedLine = EncryptionUtils.DecryptString(linex); datai[counter] = decryptedLine; @@ -1195,20 +1198,22 @@ namespace BeWo //} //file.Close(); - + proxyname = datai[0]; proxyUsername = datai[1]; proxypasswd = datai[2]; proxyTextBox.Text = proxyname; - }catch(IOException i){ + } + catch (IOException i) + { //Fehlermeldung } - + } - + private void SaveSelectedProfile(BeWoProfile profile) { try @@ -1217,7 +1222,7 @@ namespace BeWo { #if DEBUG sw.WriteLine("selected={0}|{1}|{2}", profile.Name, profile.Server, profile.Tenant); - + #else if (profile.Tenant != "demo") { @@ -1297,26 +1302,26 @@ namespace BeWo } profile.Tenant = profile.Tenant.Trim(); - - //if (BeWoApp.Tenant == "7635986435") - //{ - // if (profile.Server != "3") - // { - // profile.Server = "3"; - // SaveProfileListToFile(); - // } - //} + //if (BeWoApp.Tenant == "7635986435") + //{ + // if (profile.Server != "3") + // { + // profile.Server = "3"; + // SaveProfileListToFile(); + // } - var server = GetServerFromTenant(profile.Tenant); - if (!String.IsNullOrEmpty(server) && server != profile.Server) - { - profile.Server = server; - SaveProfileListToFile(); - } + //} - BeWoApp.Tenant = profile.Tenant; - BeWoApp.ServerName = GetNumericServerName(profile.Server); + var server = GetServerFromTenant(profile.Tenant); + if (!String.IsNullOrEmpty(server) && server != profile.Server) + { + profile.Server = server; + SaveProfileListToFile(); + } + + BeWoApp.Tenant = profile.Tenant; + BeWoApp.ServerName = GetNumericServerName(profile.Server); BeWoApp.ServerAddress = profile.Server; #if DEBUG @@ -1337,15 +1342,15 @@ namespace BeWo "Ungültiges Profil", MessageBoxButton.OK, MessageBoxImage.Warning); } } - + private void ShowProfileStackPanel(object sender, RoutedEventArgs e) { if (profileLabel.Visibility == Visibility.Visible) { profileLabel.Visibility = Visibility.Collapsed; profileStackPanel.Visibility = Visibility.Collapsed; - proxyLabel.Visibility = Visibility.Collapsed; - proxyStackPanel.Visibility = Visibility.Collapsed; + proxyLabel.Visibility = Visibility.Collapsed; + proxyStackPanel.Visibility = Visibility.Collapsed; } } @@ -1401,8 +1406,8 @@ namespace BeWo showProfileSelectionBtn.Content = "Ausblenden"; profileLabel.Visibility = Visibility.Visible; profileStackPanel.Visibility = Visibility.Visible; - proxyLabel.Visibility = Visibility.Visible; - proxyStackPanel.Visibility = Visibility.Visible; + proxyLabel.Visibility = Visibility.Visible; + proxyStackPanel.Visibility = Visibility.Visible; } else { @@ -1425,17 +1430,17 @@ namespace BeWo if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } - private bool pwvViewOffen; - private void PasswortVergessenLinkOnRequestNavigate(object sender, RequestNavigateEventArgs e) - { - if (pwvViewOffen) return; + private bool pwvViewOffen; + private void PasswortVergessenLinkOnRequestNavigate(object sender, RequestNavigateEventArgs e) + { + if (pwvViewOffen) return; - var p = new PwVergessenView(); - p.Closed += (s, ex) => { pwvViewOffen = false; }; - p.Show(); + var p = new PwVergessenView(); + p.Closed += (s, ex) => { pwvViewOffen = false; }; + p.Show(); - pwvViewOffen = true; - } + pwvViewOffen = true; + } private void UIElement_OnKeyDown(object sender, KeyEventArgs e) { @@ -1445,7 +1450,7 @@ namespace BeWo { PinEinblenden(); } - + } } @@ -1476,8 +1481,8 @@ namespace BeWo Name = pname; Server = pserver; Tenant = ptenant; - if (Name == null) - Name = String.Empty; + if (Name == null) + Name = String.Empty; if (!String.IsNullOrEmpty(Tenant)) { Tenant = Tenant.Trim(); diff --git a/BeWo/MainControl.xaml.cs b/BeWo/MainControl.xaml.cs index 5ed0b587e..36edd416c 100644 --- a/BeWo/MainControl.xaml.cs +++ b/BeWo/MainControl.xaml.cs @@ -50,7 +50,8 @@ namespace BeWo Wohnheim, Vertretungen, CustomerTeam, - Scheduling + Scheduling, + Finance } public partial class MainControl @@ -295,6 +296,9 @@ namespace BeWo case UIContext.Scheduling: view = new SchedulingMasterView(); break; + case UIContext.Finance: + view = new FinanceView(); + break; } _Views[uiContext] = view; } @@ -901,7 +905,7 @@ namespace BeWo { if (DoSaveCheck()) { - NavigateTo(new FinanceView()); + NavigateTo(GetViewForUIContext(UIContext.Finance)); } } diff --git a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml index 5193e2929..23b23de00 100644 --- a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml +++ b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml @@ -1,102 +1,281 @@ - + - - + + - - - + + + - - - - + + - + + + - - - - + + + + - - - + + + - + + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo/View/Detail/OrganisationView.xaml b/BeWo/View/Detail/OrganisationView.xaml index b6ea9cd47..1cd2b851a 100644 --- a/BeWo/View/Detail/OrganisationView.xaml +++ b/BeWo/View/Detail/OrganisationView.xaml @@ -1,59 +1,130 @@ - + - - - - - - - - - - - - - + + + + + + - + - + - - + + - + - + - - - - - - - - - - - - + + + + + + + + + + + + - + - - - - - - + + + + + + - + - - + + - + diff --git a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml index 877153d1f..8aace39ea 100644 --- a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml +++ b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml @@ -149,20 +149,6 @@ FontSize="11" Foreground="#ffffff" ToolTip="Senden" /> -