From 3d59ab4793d3db3fc7820b4910a05ca9b18dc853 Mon Sep 17 00:00:00 2001 From: Waldi Date: Wed, 31 Aug 2016 10:47:33 +0200 Subject: [PATCH] =?UTF-8?q?update=206.0=20Dokumentation=20wurde=20erm?= =?UTF-8?q?=C3=B6glicht.=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWo.csproj | 7 + BeWo/View/ChatDokumentationsView.xaml | 14 ++ BeWo/View/ChatDokumentationsView.xaml.cs | 199 ++++++++++++++++++ BeWo/View/ChatView.xaml | 6 +- BeWo/View/ChatView.xaml.cs | 169 +++++++++++++-- .../View/Detail/ServiceRecordEditView.xaml.cs | 41 +++- BeWo/View/HomeDragPanelView.xaml.cs | 10 +- 7 files changed, 418 insertions(+), 28 deletions(-) create mode 100644 BeWo/View/ChatDokumentationsView.xaml create mode 100644 BeWo/View/ChatDokumentationsView.xaml.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 3cbd04235..f0e79da65 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -401,6 +401,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -759,6 +763,9 @@ ChatServiceEmployee.xaml + + ChatDokumentationsView.xaml + MiniChatView.xaml diff --git a/BeWo/View/ChatDokumentationsView.xaml b/BeWo/View/ChatDokumentationsView.xaml new file mode 100644 index 000000000..50e109198 --- /dev/null +++ b/BeWo/View/ChatDokumentationsView.xaml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/BeWo/View/ChatDokumentationsView.xaml.cs b/BeWo/View/ChatDokumentationsView.xaml.cs new file mode 100644 index 000000000..f208654cc --- /dev/null +++ b/BeWo/View/ChatDokumentationsView.xaml.cs @@ -0,0 +1,199 @@ +using System; +using System.Linq; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; + +using BeWo.ServiceProxy; +using BeWo.ViewModel; + +using BS.Shared.Extensions; +using System.Windows.Controls; +using System.Net.Sockets; +using System.Threading; +using System.Windows.Threading; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.IO; +using System.Text; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Media.Imaging; +using BeWo.View.Detail; +using BS.Shared; +using BS.Shared.DataContracts; +using BS.Shared.DataContracts.Compact; +using DevExpress.Xpf.Core; +using DevExpress.XtraPrinting.Native; +using DevExpress.XtraPrinting.XamlExport; +using Microsoft.Office.Interop.Word; +using Color = System.Drawing.Color; + +namespace BeWo.View +{ + public partial class ChatDokumentationsView + { + protected List listarray; + protected long? loggedOnMitarbeiter; + + private ServiceRecordVM serviceRecord; + + public ChatDokumentationsView(List _listarray, long? _loggedOnMitarbeiter,long _customerPersonOid) + { + InitializeComponent(); + + listarray = _listarray; + loggedOnMitarbeiter = _loggedOnMitarbeiter; + + ServiceRecordEditView newView = new ServiceRecordEditView(); + + long? customerOid = _customerPersonOid; + string message = ""; + + + listarray.Sort((a, b) => a.SendTime.CompareTo(b.SendTime)); //-> Sortiere nach datum / hätte auch ein order by geholfen? + + foreach (var ita in listarray) + { + message += ita.SendTime + " - "+ ita.Username + ": " + ita.UserMessage + "\n"; + } + var firstTime = listarray.Min(r => + { + var dt = DateTime.Parse(r.SendTime); + dt = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0); + return dt; + }); + var lastTime = listarray.Max(r => + { + var dt = DateTime.Parse(r.SendTime); + dt = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0); + return dt; + }); + + + CustomerDC customer; + CompactCustomerDC customerCompact = null; + + if (customerOid.HasValue) + { + customer = ServiceFacade.DoCustomerServiceSync(s => s.GetCustomerWithPersonOid(customerOid.Value)); + + customerCompact = + ServiceFacade.DoCustomerServiceSync(s => s.GetCompactCustomerDC(customer.CustomerOid.Value)); + } + + VMFactory.CreateServiceRecordVMAsync( + BeWoApp.LoggedOnUser.Employee.EmployeeOid, + vm => this.Dispatch( + delegate + { + vm.DispatcherObject = this; + + var dc = new ServiceRecordDC(); + dc.Start = firstTime; + dc.End = lastTime; + dc.Employee = BeWoApp.LoggedOnUser.Employee; + dc.Customer = customerCompact; + + if (vm.PrototypeVM.SortedCategories != null && vm.PrototypeVM.SortedCategories.Count > 0) + { + var cat1 = vm.PrototypeVM.SortedCategories[0]; + + dc.ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0]; + } + serviceRecord = new ServiceRecordVM(dc, vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals); + serviceRecord.Notice = message; + + newView.InitView(vm, serviceRecord,false); + if (customerCompact != null) + { + newView.SetSearchText(customerCompact.LastName); + } + else + { + newView.SetSearchText(""); + } + + //newView.SetStartTimeEndTime(first, last); + newView.SetLoggedOnEmployee(); + })); + + if (newView.CommandBindings.Count == 0) + { + newView.CommandBindings.Add( + new CommandBinding( + ApplicationCommands.Close, + (s, e) => + { + if (!newView.DoSaveCheck()) + { + return; + } + + Close(); + })); + newView.CommandBindings.Add( + new CommandBinding( + ApplicationCommands.Save, + (s, e) => + { + bool save = newView.IsValid(); + + if (!save) + { + return; + } + + newView.SaveData(); + Close(); + + })); + } + + + popup_contentChat.Child = newView; + + popup_contentChat.Visibility = Visibility.Visible; + + + + /* + //rootGroupBox.Header = nameinf; + + this.tcpClient = tcpClient; + + closeWindow(); + LoadallChatKontakts(); + ErstelleContextMenue(); + SetChatSetting();*/ + } + + + + private void RootGroupBox_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + try + { + DragMove(); + } + catch (Exception) + { + } + } + + + private DateTime ConvertToDateTimeStart(string startTime) + { + + return DateTime.Parse(startTime); + } + + private DateTime ConvertToDateTimeEnd(string endTime) + { + return DateTime.Parse(endTime); + } + + } +} diff --git a/BeWo/View/ChatView.xaml b/BeWo/View/ChatView.xaml index f994a9741..81f5a9b90 100644 --- a/BeWo/View/ChatView.xaml +++ b/BeWo/View/ChatView.xaml @@ -59,7 +59,7 @@ - --> + MouseRightButtonDown="OnRightClickEvent" MouseLeftButtonDown="OnLeftClickEvent" --> @@ -169,8 +169,8 @@ - - + + diff --git a/BeWo/View/ChatView.xaml.cs b/BeWo/View/ChatView.xaml.cs index 0bccb6f17..e77427054 100644 --- a/BeWo/View/ChatView.xaml.cs +++ b/BeWo/View/ChatView.xaml.cs @@ -21,6 +21,7 @@ using System.Text; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Media.Imaging; +using BeWo.View.Detail; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; @@ -46,6 +47,8 @@ namespace BeWo.View protected List teamdc = new List(); protected PropertyGroupDescription groupDescription;// = new PropertyGroupDescription("TypeChat"); + protected ContextMenu context; + public ChatView(String nameinf, String Chatinf, TcpClient tcpClient) { InitializeComponent(); @@ -649,8 +652,8 @@ namespace BeWo.View list.Lastms = "Beschäftigt"; else if (type == DataIdentifier.StatusNotificationOnline) list.Lastms = "Online"; - //else if (type == DataIdentifier.StatusNotificationOffline) - // list.Lastms = "Offline"; //<--- Muss noch überdacht werden villeicht bei offlien ein Dellet LoggedOffUser oder so + else if (type == DataIdentifier.StatusNotificationOffline) + list.Lastms = "Offline"; //<--- Muss noch überdacht werden villeicht bei offlien ein Dellet LoggedOffUser oder so } } @@ -663,14 +666,11 @@ namespace BeWo.View { try { - ContextMenu context = new ContextMenu(); + context = new ContextMenu(); MenuItem item1 = new MenuItem(); - //MenuItem item2 = new MenuItem(); - - context.Items.Add(item1); - //context.Items.Add(item2); + context.Items.Add(item1); item1.Header = "Dokumentieren"; item1.Visibility = Visibility.Visible; @@ -681,10 +681,11 @@ namespace BeWo.View icon.SetSize(new Size(16, 16)); item1.Icon = icon; - //item2.Header = "Klick"; - //item2.Visibility = Visibility.Visible; + // context.StaysOpen = false; + //context.StaysOpen Chat.ContextMenu = context; + } catch (Exception edf) { @@ -696,12 +697,49 @@ namespace BeWo.View private void OnChatRightClickMenue(object sender, RoutedEventArgs e) { + List itemListe = new List(); + + // bool ungelesenachricht = false; + KontakMessageBuilder Item; foreach (Object selecteditem in Chat.SelectedItems) { Item = selecteditem as KontakMessageBuilder; - Console.WriteLine(Item.UserMessage + " Oid: " + Item.MessagePersonOid); // <---- Gibt die UserMessages in der Console aus. + + if (Item.MessagePersonOid != 0) + { + //ungelesenachricht = true; + itemListe.Add(Item); + } + } + + if(itemListe.Count !=0 /*&& ungelesenachricht == false*/){ + KontaktlistBuilder curItem = (KontaktlistBuilder)AktChatUser.Items[0]; + + if (curItem.TypeChat != ChatType.Team && curItem.TypeChat != ChatType.Mitarbeiter) + { + ChatDokumentationsView newView = new ChatDokumentationsView(itemListe, BeWoApp.LoggedOnUser.Employee.PersonOid, curItem.EmpfaengerOid); + + newView.Visibility = Visibility.Visible; + newView.Activate(); + + Chat.SelectedIndex = -1; + } + else + { + MessageBox.Show("Sie können nur Klienten Nachrichten Dokumentieren.", "Info", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + } + else + { + /*if(ungelesenachricht) + { + MessageBox.Show("Die Info - Ungelesene Nachrichten - kann nicht mit in die Dokumentation eingebunden werden. Bitte wählen sie diese ab.", "Info", MessageBoxButton.OK, MessageBoxImage.Exclamation); + }else*/ + MessageBox.Show("Sie müssen für diese art von Dokumentation Chat-Nachrichten auswählen.", "Info", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + itemListe.Clear(); } @@ -709,8 +747,6 @@ namespace BeWo.View { try { - // string value = StatusSetting.SelectedItem as string; - switch (StatusSetting.SelectedIndex) { case 0: @@ -723,8 +759,7 @@ namespace BeWo.View StatusSetting.SelectedIndex = 1; } else - { - //Console.WriteLine("Ich bin bei Online"); + { SendUserStatus(DataIdentifier.StatusNotificationOnline); } @@ -740,8 +775,7 @@ namespace BeWo.View StatusSetting.SelectedIndex = 1; } else - { - //Console.WriteLine("Ich bin bei Offline"); + { SendUserStatus(DataIdentifier.StatusNotificationOffline); } @@ -758,7 +792,6 @@ namespace BeWo.View } else { - //Console.WriteLine("Ich bin bei Beschäftigt"); SendUserStatus(DataIdentifier.StatusNotificationBeschäftigt); } @@ -796,7 +829,9 @@ namespace BeWo.View public void SetListBoxSelection(long personoid, ChatType type) { try - { + { + context.IsOpen = false; + foreach (var blub in ita) { if (blub.EmpfaengerOid == personoid && blub.TypeChat == type) @@ -804,15 +839,30 @@ namespace BeWo.View AktChatUser.Items.Clear(); Chat.Items.Clear(); blub.Receivems = ""; - //Clientlist.Items[] // setze die selektion auf den aktuellen chatuser weil das fehlt noch ?! AktChatUser.Items.Add(new KontaktlistBuilder(blub.Name, blub.Lastms, blub.Image, blub.EmpfaengerOid, blub.TypeChat)); LoadChatMessagefromDB(BeWoApp.LoggedOnEmployee.PersonOid.Value, blub.EmpfaengerOid, blub); + + + + if (blub.TypeChat == ChatType.Klienten) + { + context.Visibility = Visibility.Visible; + Chat.SelectionMode = SelectionMode.Multiple; + Chat.Focusable = true; + } + else + { + context.Visibility = Visibility.Collapsed; + Chat.SelectionMode = SelectionMode.Single; + Chat.Focusable = false; + } } } Chat.Items.MoveCurrentToLast(); Chat.ScrollIntoView(Chat.Items.CurrentItem); + } catch (Exception edf) { @@ -825,7 +875,9 @@ namespace BeWo.View { KontaktlistBuilder curItem; try - { + { + context.IsOpen = false; + if (!Clientlist.Items.IsEmpty) { curItem = (KontaktlistBuilder)Clientlist.SelectedItem; @@ -839,7 +891,6 @@ namespace BeWo.View curItem.Receivems = ""; } - ChatType a = curItem.TypeChat; AktChatUser.Items.Add(new KontaktlistBuilder(curItem.Name, curItem.Lastms, curItem.Image, curItem.EmpfaengerOid, curItem.TypeChat)); @@ -849,6 +900,21 @@ namespace BeWo.View Chat.Items.MoveCurrentToLast(); Chat.ScrollIntoView(Chat.Items.CurrentItem); view.Refresh(); + + + if (curItem.TypeChat == ChatType.Klienten) + { + context.Visibility = Visibility.Visible; + Chat.SelectionMode = SelectionMode.Multiple; + Chat.Focusable = true; + } + else + { + context.Visibility = Visibility.Collapsed; + Chat.SelectionMode = SelectionMode.Single; + Chat.Focusable = false; + } + } } catch (Exception s) @@ -1127,6 +1193,67 @@ namespace BeWo.View } }*/ + + //Rechte Maus Taste an dem Chat + /* public void OnRightClickEvent(object sender, RoutedEventArgs e) + { + + if (AktChatUser.Items.Count != 0) + { + KontaktlistBuilder vv = (KontaktlistBuilder)AktChatUser.Items[0]; + + if (vv.TypeChat == ChatType.Mitarbeiter) + { + context.Visibility = Visibility.Collapsed; + Chat.SelectionMode = SelectionMode.Single; + Chat.Focusable = false; + } + else if (vv.TypeChat == ChatType.Team) + { + context.Visibility = Visibility.Collapsed; + Chat.SelectionMode = SelectionMode.Single; + Chat.Focusable = false; + }else + { + context.Visibility = Visibility.Visible; + Chat.SelectionMode = SelectionMode.Multiple; + Chat.Focusable = true; + } + } + else + { + context.Visibility = Visibility.Collapsed; + } + } + + //Linke Maustaste an dem Chat + public void OnLeftClickEvent(object sender, RoutedEventArgs e) + { + if (AktChatUser.Items.Count != 0) + { + KontaktlistBuilder vv = (KontaktlistBuilder)AktChatUser.Items[0]; + + if (vv.TypeChat == ChatType.Mitarbeiter) + { + context.Visibility = Visibility.Collapsed; + Chat.SelectionMode = SelectionMode.Single; + Chat.Focusable = false; + } + else if (vv.TypeChat == ChatType.Team) + { + context.Visibility = Visibility.Collapsed; + Chat.SelectionMode = SelectionMode.Single; + Chat.Focusable = false; + } + else + { + context.Visibility = Visibility.Visible; + Chat.SelectionMode = SelectionMode.Multiple; + Chat.Focusable = true; + } + } + }*/ + } //KontaklisteFormat und KontaktMessageBuilder Klasse diff --git a/BeWo/View/Detail/ServiceRecordEditView.xaml.cs b/BeWo/View/Detail/ServiceRecordEditView.xaml.cs index b6afdfac6..796f9069c 100644 --- a/BeWo/View/Detail/ServiceRecordEditView.xaml.cs +++ b/BeWo/View/Detail/ServiceRecordEditView.xaml.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Windows; using System.Windows.Input; @@ -113,7 +114,7 @@ namespace BeWo.View.Detail FlatSupportConceptTreeNodeDC node = SupportConceptService.CreateFlatSupportConceptItem(pSCViewModel.SupportConcept, pSCViewModel.CostBearer); _OriginalNode = node; _ServiceRecordVM.ChoosenNode = node; - supportConceptSelectionControl.SearchText = node.CustomerName; + SetSearchText(node.CustomerName); } if (BeWoApp.AppSettings.ShowMarker) @@ -165,6 +166,24 @@ namespace BeWo.View.Detail isEndDateVisible(); } + public void SetSearchText(string text) + { + supportConceptSelectionControl.SearchText = text; + } + + //public void SetStartTimeEndTime(DateTime start, DateTime end) + //{ + // startTime.Text = start.TimeOfDay.ToString(); + // endTime.Text = end.TimeOfDay.ToString(); + // //popupedit_employee + + //} + + public void SetLoggedOnEmployee() + { + popupedit_employee.Text = BeWoApp.LoggedOnUser.Employee.ToString(); + } + private void isEndDateVisible() { @@ -426,5 +445,23 @@ namespace BeWo.View.Detail } } + + //public void initViewforChat(/*long? employeeOid*/long? mitoid,string stime) + //{ + // InitializeComponent(); + + // //ServiceRecordVM SRVM; + + + + // // ita.SingleOrDefault(r => r.EmpfaengerOid == idKlientspeicher[0] && r.TypeChat == ChatType.Klienten + // //popupedit_employee.; + // popupedit_employee.Text = BeWoApp.LoggedOnUser.Employee.ToString(); + + // // supportConceptSelectionControl.SetValue(); + // // startTime.Text = stime; + // //SetSelectedSupportConceptOid(21); + + //} } } \ No newline at end of file diff --git a/BeWo/View/HomeDragPanelView.xaml.cs b/BeWo/View/HomeDragPanelView.xaml.cs index 96ecea5fe..9815dba3d 100644 --- a/BeWo/View/HomeDragPanelView.xaml.cs +++ b/BeWo/View/HomeDragPanelView.xaml.cs @@ -1189,9 +1189,15 @@ namespace BeWo.View private void ChatLinkOnRequestNavigate(object sender, RequestNavigateEventArgs e) { + if(chatpav.Visibility == Visibility.Collapsed){ chatpav.Visibility = Visibility.Visible; - chatpav.AktualisiereChatKontakt(); - + chatpav.AktualisiereChatKontakt(); + chatpav.Activate(); + } + else + { + chatpav.Visibility = Visibility.Collapsed; + } }