diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index c649cfd05..c2e0e7f7d 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -2511,6 +2511,15 @@ + + + + + + + + + diff --git a/BeWo/Ressources/Icons/DocumentWithAdd.png b/BeWo/Ressources/Icons/DocumentWithAdd.png new file mode 100644 index 000000000..184b22700 Binary files /dev/null and b/BeWo/Ressources/Icons/DocumentWithAdd.png differ diff --git a/BeWo/Ressources/Icons/DocumentWithAdd2.png b/BeWo/Ressources/Icons/DocumentWithAdd2.png new file mode 100644 index 000000000..21a36eb6e Binary files /dev/null and b/BeWo/Ressources/Icons/DocumentWithAdd2.png differ diff --git a/BeWo/Ressources/Icons/adobe-pdf-icon.png b/BeWo/Ressources/Icons/adobe-pdf-icon.png new file mode 100644 index 000000000..e694647f5 Binary files /dev/null and b/BeWo/Ressources/Icons/adobe-pdf-icon.png differ diff --git a/BeWo/ServiceProxy/Generated.cs b/BeWo/ServiceProxy/Generated.cs index c3872f444..2c3c5c4fd 100644 --- a/BeWo/ServiceProxy/Generated.cs +++ b/BeWo/ServiceProxy/Generated.cs @@ -1372,6 +1372,11 @@ namespace BeWo.ServiceProxy [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/ICustomerService/SetBenutzerPasswortChatAppCodeBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] void SetBenutzerPasswortChatAppCode(long pCustomerOid, string benutzerName, string passwort); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICustomerService/PruefeObBenutzerKontoSchonVorhanden", ReplyAction="http://tempuri.org/ICustomerService/PruefeObBenutzerKontoSchonVorhandenResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/ICustomerService/PruefeObBenutzerKontoSchonVorhandenBeWoFaultF" + + "ault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + bool PruefeObBenutzerKontoSchonVorhanden(long customerOid, string benutzername); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICustomerService/ArchiveCustomer", ReplyAction="http://tempuri.org/ICustomerService/ArchiveCustomerResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/ICustomerService/ArchiveCustomerBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] void ArchiveCustomer(long pOid, long pVersion); @@ -2186,6 +2191,11 @@ namespace BeWo.ServiceProxy base.Channel.SetBenutzerPasswortChatAppCode(pCustomerOid, benutzerName, passwort); } + public bool PruefeObBenutzerKontoSchonVorhanden(long customerOid, string benutzername) + { + return base.Channel.PruefeObBenutzerKontoSchonVorhanden(customerOid, benutzername); + } + public void ArchiveCustomer(long pOid, long pVersion) { base.Channel.ArchiveCustomer(pOid, pVersion); diff --git a/BeWo/View/ChatServiceCustomer.xaml b/BeWo/View/ChatServiceCustomer.xaml index 42901261d..49e89b545 100644 --- a/BeWo/View/ChatServiceCustomer.xaml +++ b/BeWo/View/ChatServiceCustomer.xaml @@ -25,6 +25,7 @@ + @@ -36,12 +37,17 @@ - + + + @@ -50,7 +56,7 @@ - + @@ -116,8 +122,8 @@ - diff --git a/BeWo/View/ChatServiceCustomer.xaml.cs b/BeWo/View/ChatServiceCustomer.xaml.cs index 81374bd18..d70355b0b 100644 --- a/BeWo/View/ChatServiceCustomer.xaml.cs +++ b/BeWo/View/ChatServiceCustomer.xaml.cs @@ -5,12 +5,14 @@ using System.IO; using System.Linq; using System.Net; using System.Windows; +using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Forms.VisualStyles; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Threading; @@ -153,39 +155,38 @@ namespace BeWo.View //#else - //Abfrage mit null catchen - + //Abfrage mit null catchen if (!GeneratetTexfield.Text.Equals("") && BeWoApp.Tenant != null && BeWoApp.Mandator.Apikey != null) { - if (MessageBox.Show("Wollen Sie wirklich den Code ändern?", "Achtung", MessageBoxButton.YesNo, + if (MessageBox.Show("Wollen Sie wirklich den Chat-Code ändern?\nAlle Daten auf Mobilgeräte werden gelöscht.", "Achtung", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { StartWaiting(); var result = - ServiceFacade.DoOperationsServiceSync(s => s.CreateNewCustomerAPPCodeDC(customerOid.Value, BeWoApp.Tenant, BeWoApp.Mandator.Apikey,personOid.Value)); // die useroid muss noch rausgeholt werden + ServiceFacade.DoOperationsServiceSync(s => s.CreateNewCustomerAPPCodeDC(customerOid.Value, BeWoApp.Tenant, BeWoApp.Mandator.Apikey,personOid.Value)); EndWaiting(); if(result != null){ GeneratetTexfield.Text = result.CustomerCode; }else{ - MessageBox.Show("Beim Erstellen eines neuen Chatcodes ist ein Fehler aufgetreten."); + MessageBox.Show("Beim erstellen eines neuen Chat-Codes ist ein Fehler aufgetreten."); } //GeneratetTexfield.Text = result.CustomerCode; } } else if (BeWoApp.Tenant != null && BeWoApp.Mandator.Apikey != null) - { + { StartWaiting(); - var result = ServiceFacade.DoOperationsServiceSync(s => s.CreateNewCustomerAPPCodeDC(customerOid.Value, BeWoApp.Tenant, BeWoApp.Mandator.Apikey, personOid.Value));// die useroid muss noch rausgeholt werden + var result = ServiceFacade.DoOperationsServiceSync(s => s.CreateNewCustomerAPPCodeDC(customerOid.Value, BeWoApp.Tenant, BeWoApp.Mandator.Apikey, personOid.Value)); EndWaiting(); if(result != null){ GeneratetTexfield.Text = result.CustomerCode; }else{ - MessageBox.Show("Beim Erstellen eines neuen Chatcodes ist ein Fehler aufgetreten."); + MessageBox.Show("Beim Erstellen eines neuen Chat-Codes ist ein Fehler aufgetreten."); } - //GeneratetTexfield.Text = result.CustomerCode; + //GeneratetTexfield.Text = result.CustomerCode; } else { @@ -195,15 +196,15 @@ namespace BeWo.View } - private void CheckBox_Checked(object sender, RoutedEventArgs e) - { - ServiceFacade.DoOperationsServiceSync(s => s.UpdateIsChatActiveCustomerAPPCodeDC(customerOid.Value, 1)); - } + //private void CheckBox_Checked(object sender, RoutedEventArgs e) + //{ + // ServiceFacade.DoOperationsServiceSync(s => s.UpdateIsChatActiveCustomerAPPCodeDC(customerOid.Value, 1)); + //} - private void CheckBox_Unchecked(object sender, RoutedEventArgs e) - { - ServiceFacade.DoOperationsServiceSync(s => s.UpdateIsChatActiveCustomerAPPCodeDC(customerOid.Value, 0)); - } + //private void CheckBox_Unchecked(object sender, RoutedEventArgs e) + //{ + // ServiceFacade.DoOperationsServiceSync(s => s.UpdateIsChatActiveCustomerAPPCodeDC(customerOid.Value, 0)); + //} private void LaodInfostoView() @@ -220,9 +221,22 @@ namespace BeWo.View GeneratetTexfield.Text = getCustomerAppCode[getCustomerAppCode.Count - 1].CustomerCode; } - if (!GeneratetTexfield.Text.Equals("")) { - GenerateButon.Content = "Chat-Code erneuern"; + if (!GeneratetTexfield.Text.Equals("")) { + //lblGenerateCode.Content = "Chat-Code erneuern"; RemoveButton.Visibility = Visibility.Visible; + CustomerHandoutButton.Visibility = Visibility.Visible; + CustomerBenutzerKontoGroupBox.Visibility = Visibility.Visible; + ButtonGenerateCode.ToolTip = "Chat-Code erneuern"; + + var image = new Image + { + Source = new BitmapImage( + new Uri( + "pack://application:,,,/ChatController;component/Ressourcen/SymbolRefresh32.png")) + }; + + ImageGenerateCode.Source = image.Source; + } //else // x = 0; @@ -278,15 +292,34 @@ namespace BeWo.View // } //#endregion + //Genauer bearbeiten private void SpeicherButton_OnClick(object sender, RoutedEventArgs e) { if (BeWoApp.AppSettings.IsPasswordSecurityActiv) { if (TXTPasswort.Text.Length >= 8) { + StartWaiting(); - ServiceFacade.DoCustomerServiceSync(s => s.SetBenutzerPasswortChatAppCode(customerOid.Value, TXTBenutzerName.Text, TXTPasswort.Text)); - EndWaiting(); + + var isBenutzerNameVorhanden = ServiceFacade.DoCustomerServiceSync(r => r.PruefeObBenutzerKontoSchonVorhanden(customerOid.Value, TXTBenutzerName.Text)); + + if (!isBenutzerNameVorhanden) + { + ServiceFacade.DoCustomerServiceSync( + s => + s.SetBenutzerPasswortChatAppCode(customerOid.Value, TXTBenutzerName.Text, + TXTPasswort.Text)); + EndWaiting(); + MessageBox.Show("Speichern Erfolgreich.", "Info"); + } + else + { + EndWaiting(); + + MessageBox.Show("Dieser Benutzername ist bereits vergeben.\nBitte ändern sie den Benutzernamen.", "Achtung"); + } + } else { @@ -296,8 +329,22 @@ namespace BeWo.View else { StartWaiting(); - ServiceFacade.DoCustomerServiceSync(s => s.SetBenutzerPasswortChatAppCode(customerOid.Value, TXTBenutzerName.Text, TXTPasswort.Text)); - EndWaiting(); + var isBenutzerNameVorhanden = ServiceFacade.DoCustomerServiceSync(r => r.PruefeObBenutzerKontoSchonVorhanden(customerOid.Value, TXTBenutzerName.Text)); + + if (!isBenutzerNameVorhanden) + { + + ServiceFacade.DoCustomerServiceSync(s => s.SetBenutzerPasswortChatAppCode(customerOid.Value, TXTBenutzerName.Text, TXTPasswort.Text)); + EndWaiting(); + MessageBox.Show("Speichern Erfolgreich.", "Info"); + } + else + { + EndWaiting(); + + MessageBox.Show("Dieser Benutzername ist bereits vergeben.\nBitte ändern sie den Benutzernamen.", "Achtung"); + } + } } @@ -305,17 +352,19 @@ namespace BeWo.View { if (!GeneratetTexfield.Text.Equals("")) { - StartWaiting(); - var isdeletet = ServiceFacade.DoOperationsServiceSync(r => r.DeletCustomerChatCode(BeWoApp.Mandator.Apikey, BeWoApp.Tenant, personOid.Value)); - EndWaiting(); + if (MessageBox.Show("Wollen Sie den Chat-Code wirklich löschen?\nAlle Daten auf Mobilgeräte werden gelöscht.", "Achtung", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { + StartWaiting(); + var isdeletet = ServiceFacade.DoOperationsServiceSync(r => r.DeletCustomerChatCode(BeWoApp.Mandator.Apikey, BeWoApp.Tenant, personOid.Value)); + EndWaiting(); - if (isdeletet) - { - GeneratetTexfield.Text = ""; - } - else - { - MessageBox.Show("Löschen des ChatCodes Fehlgeschlagen.", "Fehler"); + if (isdeletet) + { + GeneratetTexfield.Text = ""; + } + else + { + MessageBox.Show("Löschen des Chat-Codes Fehlgeschlagen.", "Fehler"); + } } } else @@ -339,7 +388,7 @@ namespace BeWo.View SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Title = "PDF Speichern"; - saveFileDialog1.FileName = Path.GetFileName("ownChatHandoutCustomer.pdf"); + saveFileDialog1.FileName = Path.GetFileName("ownChat-Kurzanleitung.pdf"); saveFileDialog1.ShowDialog(); wc.DownloadFile(handout.File, saveFileDialog1.FileName); diff --git a/BeWo/View/ChatServiceEmployee.xaml b/BeWo/View/ChatServiceEmployee.xaml index 69ec765a4..dad9a7261 100644 --- a/BeWo/View/ChatServiceEmployee.xaml +++ b/BeWo/View/ChatServiceEmployee.xaml @@ -26,6 +26,7 @@ + @@ -36,12 +37,16 @@ - + + @@ -57,8 +62,8 @@ diff --git a/BeWo/View/ChatServiceEmployee.xaml.cs b/BeWo/View/ChatServiceEmployee.xaml.cs index de1585908..49a896a66 100644 --- a/BeWo/View/ChatServiceEmployee.xaml.cs +++ b/BeWo/View/ChatServiceEmployee.xaml.cs @@ -12,6 +12,7 @@ using System.Windows.Controls.Primitives; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Threading; @@ -78,7 +79,7 @@ namespace BeWo.View { if (!GeneratetTexfield.Text.Equals("") && BeWoApp.Tenant != null && BeWoApp.Mandator.Apikey != null) { - if (MessageBox.Show("Wollen Sie wirklich den Code ändern?", "Achtung", MessageBoxButton.YesNo, + if (MessageBox.Show("Wollen Sie wirklich den Chat-Code ändern?\nAlle Daten auf Mobilgeräte werden gelöscht.", "Achtung", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { StartWaiting(); @@ -88,7 +89,7 @@ namespace BeWo.View if(result != null){ GeneratetTexfield.Text = result.EmployeeCode; }else{ - MessageBox.Show("Beim Erstellen eines neuen Chatcodes ist ein Fehler aufgetreten."); + MessageBox.Show("Beim Erstellen eines neuen Chat-Codes ist ein Fehler aufgetreten."); //result.Result mit switc case Fehler ausgabe } } @@ -110,7 +111,7 @@ namespace BeWo.View if(result != null){ GeneratetTexfield.Text = result.EmployeeCode; }else{ - MessageBox.Show("Beim Erstellen eines neuen Chatcodes ist ein Fehler aufgetreten."); + MessageBox.Show("Beim erstellen eines neuen Chat-Codes ist ein Fehler aufgetreten."); //result.Result mit switc case Fehler ausgabe } } @@ -156,11 +157,26 @@ namespace BeWo.View if (!GeneratetTexfield.Text.Equals("")) { - GenerateButon.Content = "Chat-Code erneuern"; + //lblGenerateCode.Content = "Chat-Code erneuern"; RemoveButton.Visibility = Visibility.Visible; + EmployeeHandoutButton.Visibility = Visibility.Visible; + + ButtonGenerateCode.ToolTip = "Chat-Code erneuern"; + + var image = new Image + { + Source = new BitmapImage( + new Uri( + "pack://application:,,,/ChatController;component/Ressourcen/SymbolRefresh32.png")) + }; + + ImageGenerateCode.Source = image.Source; + } -#region Nicht mehr gebrauchter Code + + + #region Nicht mehr gebrauchter Code /* String a = ""; String b = ""; @@ -190,7 +206,7 @@ namespace BeWo.View // ChatServiceBuilder builder = new ChatServiceBuilder(c,b,a); -#endregion + #endregion } private void ZeigePDF_OnClick(object sender, RoutedEventArgs e) @@ -208,7 +224,7 @@ namespace BeWo.View SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Title = "PDF Speichern"; - saveFileDialog1.FileName = Path.GetFileName("ownChatHandoutEmployee.pdf"); + saveFileDialog1.FileName = Path.GetFileName("ownChat-Kurzanleitung.pdf"); saveFileDialog1.ShowDialog(); wc.DownloadFile(handout.File, saveFileDialog1.FileName);//@"c:\temp\ownChatHandoutEmployee.pdf" @@ -245,18 +261,20 @@ namespace BeWo.View StartWaiting(); if (!GeneratetTexfield.Text.Equals("")) { - var isdeletet = ServiceFacade.DoOperationsServiceSync(r => r.DeletEmloyeeChatCode(BeWoApp.Mandator.Apikey, BeWoApp.Tenant, personOid.Value)); - - - EndWaiting(); - - if (isdeletet) + if (MessageBox.Show("Wollen Sie den Chat-Code wirklich löschen?\nAlle Daten auf Mobilgeräte werden gelöscht.", "Achtung", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { - GeneratetTexfield.Text = ""; - } - else - { - MessageBox.Show("Löschen des ChatCodes Fehlgeschlagen.", "Fehler"); + var isdeletet = ServiceFacade.DoOperationsServiceSync(r => r.DeletEmloyeeChatCode(BeWoApp.Mandator.Apikey, BeWoApp.Tenant, personOid.Value)); + + EndWaiting(); + + if (isdeletet) + { + GeneratetTexfield.Text = ""; + } + else + { + MessageBox.Show("Löschen des Chat-Codes Fehlgeschlagen.", "Fehler"); + } } } else diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index d247d4466..442f83077 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -1796,6 +1796,15 @@ namespace BeWo.Data.Access return c.List(); } + public IEnumerable FindAllCustomerAppCodeBenutzer(string benutzername) + { + var c = + CreateCriteriaIsActive() + .Add(Restrictions.Eq(CustomerAPPCode.PropertyName_Benutzername, benutzername)); + + return c.List(); + } + public IEnumerable FindAllChatMessagesForAndroid(long pSenderOid, long pRecipientOid, List pExceptions, bool pForTeam) { var c = CreateCriteriaIsActive() diff --git a/Service/ServiceContracts/ICustomerService.cs b/Service/ServiceContracts/ICustomerService.cs index f25a03b30..3fc94b290 100644 --- a/Service/ServiceContracts/ICustomerService.cs +++ b/Service/ServiceContracts/ICustomerService.cs @@ -680,5 +680,9 @@ namespace BeWo.Service.ServiceContracts [FaultContract(typeof(BeWoFault))] [OperationContract] void SetBenutzerPasswortChatAppCode(long pCustomerOid, string benutzerName, string passwort); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + bool PruefeObBenutzerKontoSchonVorhanden(long customerOid, string benutzername); } } \ No newline at end of file diff --git a/Service/ServiceImplementations/CustomerServiceImp.cs b/Service/ServiceImplementations/CustomerServiceImp.cs index 6fca40dc6..25b5c74fb 100644 --- a/Service/ServiceImplementations/CustomerServiceImp.cs +++ b/Service/ServiceImplementations/CustomerServiceImp.cs @@ -3735,6 +3735,40 @@ namespace BeWo.Service.ServiceImplementations } } + public bool PruefeObBenutzerKontoSchonVorhanden(long customerOid,string benutzername) + { + try + { + var cusappcode = DAOFactory.SearchDAO.FindAllCustomerAppCodeBenutzer(benutzername); + + if (cusappcode != null) { + var count = cusappcode.Count(); + if (count > 0) + { + foreach (var item in cusappcode) + { + if (item.CustomerOid != null && customerOid == item.CustomerOid.Value) + { + return false; + } + } + + return true; + } + else + { + return false; + } + } + + return true; + } + catch (Exception e) + { + return true; + } + } + } internal struct WohnheimbuchungsIntervallStruct