From ce057451e852bdadc62dcfb39e3adaf16d8a6a66 Mon Sep 17 00:00:00 2001 From: Waldi Date: Thu, 1 Sep 2016 14:37:20 +0200 Subject: [PATCH] =?UTF-8?q?Status=20Projekt=20noch=20vor=20Architektur=20?= =?UTF-8?q?=C3=A4nderungen=2001.09.2016?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/BeWo.csproj | 4 +- BeWo/MainWindow.xaml.cs | 6 +- BeWo/View/ChatDokumentationsView.xaml.cs | 187 ++++++++------- BeWo/View/ChatView.xaml | 14 +- BeWo/View/ChatView.xaml.cs | 215 ++++++------------ .../View/Detail/ServiceRecordEditView.xaml.cs | 44 ++-- BeWo/View/HomeDragPanelView.xaml.cs | 70 +++--- 7 files changed, 253 insertions(+), 287 deletions(-) diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index e578cd2ca..3443b90cb 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -2386,12 +2386,14 @@ - + + + diff --git a/BeWo/MainWindow.xaml.cs b/BeWo/MainWindow.xaml.cs index 7ea221032..590d61053 100644 --- a/BeWo/MainWindow.xaml.cs +++ b/BeWo/MainWindow.xaml.cs @@ -82,11 +82,11 @@ namespace BeWo try { - if (BeWoApp.MainControl.HomeView.clientSocket.Connected) - { + // if (BeWoApp.MainControl.HomeView.clientSocket.Connected) + // { BeWoApp.MainControl.HomeView.CloseServerConnection(); - } + // } } catch (Exception edf) { diff --git a/BeWo/View/ChatDokumentationsView.xaml.cs b/BeWo/View/ChatDokumentationsView.xaml.cs index f208654cc..5d82ae403 100644 --- a/BeWo/View/ChatDokumentationsView.xaml.cs +++ b/BeWo/View/ChatDokumentationsView.xaml.cs @@ -21,7 +21,9 @@ using System.Text; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Media.Imaging; +using BeWo.Core.Service; using BeWo.View.Detail; +using BeWo.ViewModel.ListViewModel; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; @@ -40,14 +42,14 @@ namespace BeWo.View private ServiceRecordVM serviceRecord; - public ChatDokumentationsView(List _listarray, long? _loggedOnMitarbeiter,long _customerPersonOid) + public ChatDokumentationsView(List _listarray, long? _loggedOnMitarbeiter,long _customerPersonOid,CompactCustomerDC _compactCustomer) { InitializeComponent(); listarray = _listarray; loggedOnMitarbeiter = _loggedOnMitarbeiter; - ServiceRecordEditView newView = new ServiceRecordEditView(); + long? customerOid = _customerPersonOid; string message = ""; @@ -71,91 +73,89 @@ namespace BeWo.View dt = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0); return dt; }); + CompactCustomerDC customerCompact = _compactCustomer; + + Cache.GetInstance().GetActiveSupportConceptCostbearer(scList => + VMFactory.CreateServiceRecordVMAsync( + BeWoApp.LoggedOnUser.Employee.EmployeeOid, + vm => this.Dispatch( + delegate + { + ServiceRecordEditView newView = new ServiceRecordEditView(); + + vm.DispatcherObject = this; + + var dc = new ServiceRecordDC(); + dc.Start = firstTime; + dc.End = lastTime; + dc.Employee = BeWoApp.LoggedOnUser.Employee; + dc.Customer = customerCompact; + dc.SupportConcept = HoleHilfeplanAusListe(scList, customerCompact, firstTime, lastTime); + + 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(""); + } + + 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; + + + + //newView.SetStartTimeEndTime(first, last); + //newView.SetLoggedOnEmployee(); + + }))); - 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; @@ -170,7 +170,24 @@ namespace BeWo.View SetChatSetting();*/ } + private CompactSupportConceptDC HoleHilfeplanAusListe(List scList, CompactCustomerDC customerCompact, DateTime firstTime, DateTime lastTime) + { + foreach (var sc in scList) + { + if (sc.Customer.Oid == customerCompact.Oid) + { + if (sc.StartDate.HasValue && sc.EndDate.HasValue && sc.StartDate <= lastTime && + sc.EndDate >= firstTime) + { + return sc; + } + } + } + return null; + } + + private void RootGroupBox_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { diff --git a/BeWo/View/ChatView.xaml b/BeWo/View/ChatView.xaml index 81f5a9b90..99f7ba591 100644 --- a/BeWo/View/ChatView.xaml +++ b/BeWo/View/ChatView.xaml @@ -18,8 +18,8 @@ - +