From f99d674f8c9d7bf4833189caee79e337e0e03589 Mon Sep 17 00:00:00 2001 From: Lyndon Jetten Date: Fri, 3 Mar 2023 21:54:36 +0100 Subject: [PATCH] =?UTF-8?q?FaC:=20NullPointerException=20bei=20Zusagen/Abs?= =?UTF-8?q?agen=20von=20Serienterminen=20gefixt.=20Terminanzeige=20im=20Ho?= =?UTF-8?q?meView=20hat=20"In=20Zeiterfassung=20=C3=BCbertragen"-Icons=20T?= =?UTF-8?q?erminanzeige=20Termine=20werden=20wie=20folgt=20dargestellt:=20?= =?UTF-8?q?[Datum]:=20[Betreff]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MoK: Auswahl des Ladeintervalls der Zeiterfassungseinträge ist standardmäßig auf "Letzte 7 Tage" und die Änderung wird nur in der Session gespeichert. Termine in die Zeiterfassung übertragen --- BeWo/BeWoApp.xaml.cs | 7 + BeWo/Scheduler/Utils/AppointmentExtensions.cs | 23 +- BeWo/Scheduler/View/NewSchedulerView.xaml.cs | 100 +++++-- BeWo/Scheduler/View/RequestAnswerView.xaml.cs | 3 +- .../View/SchedulerAppointmentEditForm.xaml.cs | 7 +- .../Scheduler/ViewModel/CustomFieldStorage.cs | 5 +- .../ViewModel/SchedulerAppointmentListVM.cs | 15 +- BeWo/View/HomeView.xaml | 49 +++- BeWo/View/HomeView.xaml.cs | 52 +++- BeWo/ownChat/ChatDokumentationsView.xaml.cs | 30 +- BeWo/ownChat/ChatView.xaml.cs | 63 +++-- BeWoPlanerMobil/BeWoPlanerMobil.csproj | 10 +- BeWoPlanerMobil/BeWoPlanerMobil.csproj.user | 2 +- BeWoPlanerMobil/Controllers/MainController.cs | 266 +++++++++++++++--- .../Controllers/SchedulerController.cs | 214 +++++++++----- BeWoPlanerMobil/Models/MainModel.cs | 2 +- BeWoPlanerMobil/Models/SchedulerModel.cs | 13 +- .../Scripts/jquery.validate-vsdoc.js | 6 +- BeWoPlanerMobil/Scripts/jquery.validate.js | 16 +- .../Scripts/jquery.validate.min.js | 6 +- BeWoPlanerMobil/Util/AppointmentListItem.cs | 10 +- .../Util/FormCollectionConstants.cs | 18 +- .../Views/Customer/Customer.cshtml | 59 ++-- .../Views/Main/GroupBookingPartial.cshtml | 16 +- BeWoPlanerMobil/Views/Main/Main.cshtml | 2 +- .../Views/Main/SingleBookingPartial.cshtml | 47 ++-- .../Scheduler/AppointmentFormPartial.cshtml | 2 +- .../Scheduler/OneDaySchedulerPartial.cshtml | 146 +++++++--- BeWoPlanerMobil/Views/Shared/_Layout.cshtml | 1 + BeWoPlanerMobil/Web.config | 2 +- BeWoPlanerMobil/packages.config | 4 +- .../Service/CustomAccountingService.cs | 4 +- Service/Plugins/PluginLoader.cs | 2 +- .../ServiceContracts/IOperationsService.cs | 4 + .../OperationsServiceImp.cs | 19 ++ .../ResourceServiceImp.cs | 4 +- Shared/Core/SchedulerUtils.cs | 4 +- .../DataContracts/SchedulerAppointmentDC.cs | 84 ++++-- Shared/Extensions/IListTExtensions.cs | 2 +- 39 files changed, 975 insertions(+), 344 deletions(-) diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index 11dc207b1..fad867a8d 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -6,6 +6,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Reflection; +using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; @@ -794,6 +795,12 @@ namespace BeWo RenderTier = RenderCapability.Tier >> 16; + // Die Sprache für alle Threads auf Deutsch stellen. + var cultureInfo = CultureInfo.CreateSpecificCulture("de-DE"); + Thread.CurrentThread.CurrentUICulture = cultureInfo; + Thread.CurrentThread.CurrentCulture = cultureInfo; + CultureInfo.DefaultThreadCurrentCulture = cultureInfo; + CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; base.OnStartup(e); //AppDomain.CurrentDomain.UnhandledException += (s, ex) => ShowError(null, ex.ExceptionObject as Exception, true); diff --git a/BeWo/Scheduler/Utils/AppointmentExtensions.cs b/BeWo/Scheduler/Utils/AppointmentExtensions.cs index 8ae1a489b..4897b5fbd 100644 --- a/BeWo/Scheduler/Utils/AppointmentExtensions.cs +++ b/BeWo/Scheduler/Utils/AppointmentExtensions.cs @@ -13,6 +13,8 @@ namespace BeWo.Scheduler.Utils { public static class AppointmentExtensions { + #region CustomField Getters + public static CustomFieldStorage GetCustomFieldStorage(this Appointment appointment) { return appointment.CustomFields[nameof(CustomFieldStorage)] as CustomFieldStorage; @@ -37,7 +39,6 @@ namespace BeWo.Scheduler.Utils { return appointment.GetCustomFieldStorage()?.IsAllDay ?? false; } - public static ObservableCollection CF_EmployeeList(this Appointment appointment) { @@ -116,6 +117,15 @@ namespace BeWo.Scheduler.Utils return appointment.GetCustomFieldStorage()?.ServiceRecordList ?? new List(); } + public static string CF_CompletedUser(this Appointment appointment) + { + return appointment.GetCustomFieldStorage()?.CompletedUser; + } + + #endregion + + + #region CustomField Setters public static void CF_IsTask(this Appointment appointment, bool pIsTask) { @@ -167,15 +177,11 @@ namespace BeWo.Scheduler.Utils appointment.GetCustomFieldStorage().SupportConceptList = pSupportConceptList; } - public static void CF_Originator(this Appointment appointment, CompactEmployeeDC pOriginator) { appointment.GetCustomFieldStorage().Originator = pOriginator; } - - - public static void CF_DueDate(this Appointment appointment, DateTime? pDueDate) { appointment.GetCustomFieldStorage().DueDate = pDueDate; @@ -205,5 +211,12 @@ namespace BeWo.Scheduler.Utils { appointment.GetCustomFieldStorage().ServiceRecordList = serviceRecords; } + + public static void CF_CompletedUser(this Appointment appointment, string completedUser) + { + appointment.GetCustomFieldStorage().CompletedUser = completedUser; + } + + #endregion } } diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index 59458fce2..931e9629a 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -1246,7 +1246,7 @@ namespace BeWo.Scheduler.View stringBuilder.AppendLine($"\tOid:\t\t{oid}\r\n\tBetreff: {appointment.Subject}\r\n\tStart:\t\t{start:dd.MM.yyyy HH:mm}\r\n\tEnde:\t\t{end:dd.MM.yyyy HH:mm}\r\n\tTyp:\t\t{type}\r\n"); } - BeWoApp.LogMessage($"DeleteAppointments aufgerufen. Es {(_AppointmentsToDelete.Count == 1 ? "wird" : "werden")} {_AppointmentsToDelete.Count} {(_AppointmentsToDelete.Count == 1 ? "Termin" : "Termine")} gelöscht\n{stringBuilder}", Colors.Red); + //BeWoApp.LogMessage($"DeleteAppointments aufgerufen. Es {(_AppointmentsToDelete.Count == 1 ? "wird" : "werden")} {_AppointmentsToDelete.Count} {(_AppointmentsToDelete.Count == 1 ? "Termin" : "Termine")} gelöscht\n{stringBuilder}", Colors.Red); var idList = (from item in _AppointmentsToDelete where item.SchedulerAppointmentOid.HasValue && item.SchedulerAppointmentOid.Value > 0 select item.SchedulerAppointmentOid.Value).ToList(); @@ -1825,9 +1825,9 @@ namespace BeWo.Scheduler.View ZusageAendern(ParticipationAnswer.Absage, Scheduler.SelectedAppointments[0]); } - private void ZusageAendern(ParticipationAnswer antwort, Appointment sa) + private void ZusageAendern(ParticipationAnswer antwort, Appointment selectedAppointment) { - var el = sa.CF_EmployeeList(); + var el = selectedAppointment.CF_EmployeeList(); var neu = new ObservableCollection(el.DoForEach(dfe => { if(!dfe.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)) @@ -1838,11 +1838,71 @@ namespace BeWo.Scheduler.View dfe.ParticipationAnswer = antwort; dfe.IsPC_CheckedTs = null; }).ToList()); - sa.CF_EmployeeList(neu); + selectedAppointment.CF_EmployeeList(neu); - var appointment = (SchedulerAppointmentVM) sa.GetSourceObject(Scheduler.GetCoreStorage()); + // ToDo: Ausnahme erstellen und als abgesagt speichern - ServiceFacade.DoResourceServiceAsync(s => s.UpdateSchedulerAppointments(new List {appointment.CommitToDataContract()}), delegate { this.Dispatch(() => { ReloadVM(true); }); }); + if(selectedAppointment.Type == AppointmentType.Occurrence) + { + var id = selectedAppointment.RecurrenceInfo.Id.ToString(); + var index = selectedAppointment.RecurrenceIndex; + + ServiceFacade.DoResourceServiceAsync(s => s.FindRootAppointmentByRecurrenceId(id), rootAppointment => + { + this.Dispatch(() => + { + var changedOccurrence = new SchedulerAppointmentDC + { + ActivationType = ActivationTypeId.Active, + AllDay = selectedAppointment.AllDay, + CanBeEdited = rootAppointment.CanBeEdited, + CompletedDate = selectedAppointment.CF_CompletedDate(), + CompletedNotice = selectedAppointment.CF_CompletedNotice(), + CompletedUser = selectedAppointment.CF_CompletedUser(), + CustomerList = selectedAppointment.CF_CustomerList() ?? new List(), + Description = selectedAppointment.Description, + DueDate = selectedAppointment.CF_DueDate(), + EmployeeList = selectedAppointment.CF_EmployeeList()?.ToList() ?? new List(), + EndDate = selectedAppointment.End, + FormerBookingSequenceOid = rootAppointment.FormerBookingSequenceOid, + FormerTaskOid = rootAppointment.FormerTaskOid, + HasServiceRecordEntry = selectedAppointment.CF_HasServiceRecordEntry(), + IsPrivate = rootAppointment.IsPrivate, + IsTask = rootAppointment.IsTask, + IsTeilnahmeBestaetigung = rootAppointment.IsTeilnahmeBestaetigung, + LabelKey = rootAppointment.LabelKey, + Location = rootAppointment.Location, + Originator = selectedAppointment.CF_Originator() ?? BeWoApp.CompactLoggedOnEmployee, + RecurrenceInfo = $"", + ReminderInfo = rootAppointment.ReminderInfo, + ResourceList = selectedAppointment.CF_ResourceList() ?? new List(), + ServiceRecordList = new List(), + StartDate = selectedAppointment.Start, + Status = rootAppointment.Status, + Subject = selectedAppointment.Subject, + SupportConceptList = new List(), + TaskDescription = rootAppointment.TaskDescription, + Type = (int) AppointmentType.ChangedOccurrence + }; + + ServiceFacade.DoResourceServiceAsync(s2 => s2.InsertSchedulerAppointments(new List{changedOccurrence}), () => + { + this.Dispatch(() => + { + ReloadVM(true); + }); + }); + }); + }); + + + } + else + { + var appointment = (SchedulerAppointmentVM)selectedAppointment.GetSourceObject(Scheduler.GetCoreStorage()); + + ServiceFacade.DoResourceServiceAsync(s => s.UpdateSchedulerAppointments(new List { appointment.CommitToDataContract() }), delegate { this.Dispatch(() => { ReloadVM(true); }); }); + } } private void ZeiterfassungButtonItem_OnItemClick(object sender, ItemClickEventArgs e) @@ -2315,7 +2375,9 @@ namespace BeWo.Scheduler.View LabelKey = (long?) appointment.LabelKey, Type = (int)appointment.Type, Originator = basistermin.Originator, - RecurrenceInfo = appointment.RecurrenceInfo.ToXml() + RecurrenceInfo = appointment.RecurrenceInfo.ToXml(), + ServiceRecordList = basistermin.ServiceRecordList, + SupportConceptList = basistermin.SupportConceptList }); } } @@ -2337,13 +2399,13 @@ namespace BeWo.Scheduler.View if(sourceObject is SchedulerAppointmentVM vm) { mehrTaegigeTermine.Add(vm.CommitToDataContract()); - BeWoApp.LogMessage($"{vm.Subject}: {vm.Start:dd.MM.yyyy HH:mm} - {vm.End:dd.MM.yyyy HH:mm}; {(AppointmentType) vm.EventType}", Colors.Green); + //BeWoApp.LogMessage($"{vm.Subject}: {vm.Start:dd.MM.yyyy HH:mm} - {vm.End:dd.MM.yyyy HH:mm}; {(AppointmentType) vm.EventType}", Colors.Green); } else { var occurrenceVM = new SchedulerAppointmentVM(app); mehrTaegigeTermine.Add(occurrenceVM.CommitToDataContract()); - BeWoApp.LogMessage($"{occurrenceVM.Subject}: {occurrenceVM.Start:dd.MM.yyyy HH:mm} - {occurrenceVM.End:dd.MM.yyyy HH:mm}; {(AppointmentType)occurrenceVM.EventType}", Colors.Purple); + //BeWoApp.LogMessage($"{occurrenceVM.Subject}: {occurrenceVM.Start:dd.MM.yyyy HH:mm} - {occurrenceVM.End:dd.MM.yyyy HH:mm}; {(AppointmentType)occurrenceVM.EventType}", Colors.Purple); } } @@ -3001,18 +3063,18 @@ namespace BeWo.Scheduler.View farbe = Color.FromRgb(59, 119, 153); } - var aptCustomers = customFieldStorage.CustomerList; - var aptResources = customFieldStorage.ResourceList; + var appointmentCustomers = customFieldStorage.CustomerList; + var appointmentResources = customFieldStorage.ResourceList; var gradientCollection = new GradientStopCollection(); var farbKollektion = new List(); - if(selectedItems.Any(aptCustomers.Contains)) + if(selectedItems.Any(appointmentCustomers.Contains)) { farbKollektion.Add(Color.FromRgb(59, 119, 153)); } - if(selectedItems.Any(aptResources.Contains)) + if(selectedItems.Any(appointmentResources.Contains)) { farbKollektion.Add(Color.FromRgb(4, 180, 208)); } @@ -3020,13 +3082,13 @@ namespace BeWo.Scheduler.View switch(farbKollektion.Count) { case 1: - if (BeWoApp.AppSettings.ShowMultipleResourceColors) + if(BeWoApp.AppSettings.ShowMultipleResourceColors) { - AddResourceColors(gradientCollection, aptResources, false); + AddResourceColors(gradientCollection, appointmentResources, appointmentCustomers.Any()); } - else + //else { - var first = aptResources.FirstOrDefault(); + var first = appointmentResources.FirstOrDefault(); gradientCollection.Add(first != null ? new GradientStop((Color)(ColorConverter.ConvertFromString(first.Color) ?? Color.FromRgb(4, 180, 208)), 1) : new GradientStop(farbKollektion[0], 1)); } @@ -3039,11 +3101,11 @@ namespace BeWo.Scheduler.View // 2. Resourcenfarben if(BeWoApp.AppSettings.ShowMultipleResourceColors) { - AddResourceColors(gradientCollection, aptResources, true); + AddResourceColors(gradientCollection, appointmentResources, true); } else { - var first2 = aptResources.FirstOrDefault(); + var first2 = appointmentResources.FirstOrDefault(); if (first2 != null) { diff --git a/BeWo/Scheduler/View/RequestAnswerView.xaml.cs b/BeWo/Scheduler/View/RequestAnswerView.xaml.cs index ccd758abc..c4962c046 100644 --- a/BeWo/Scheduler/View/RequestAnswerView.xaml.cs +++ b/BeWo/Scheduler/View/RequestAnswerView.xaml.cs @@ -110,7 +110,8 @@ namespace BeWo.Scheduler.View Originator = customFieldStorage.Originator, IsTeilnahmeBestaetigung = true, SupportConceptList = customFieldStorage.SupportConceptList, - ActivationType = dc.ActivationType + ActivationType = dc.ActivationType, + ServiceRecordList = customFieldStorage.ServiceRecordList }) { CustomFields = item.CustomFields, LabelKey = emp2AppOid diff --git a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs index ca80f37c5..12f4f593a 100644 --- a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs +++ b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs @@ -495,8 +495,11 @@ namespace BeWo.Scheduler.View ViewModel.ShouldLockOverlappingAppointmentCheck = Appointment.Type == AppointmentType.ChangedOccurrence; if (Appointment.RecurrenceInfo != null) - { - ViewModel.ApplyChangesToChangedOccurencyCustomFields(employees, customers, resources, originator, isPrivate, Appointment.RecurrenceIndex.ToString(), new Guid(Appointment.RecurrenceInfo.Id.ToString()), isTask, taskDescription, completedDate, dueDate, completedNotice, supportConceptList, Appointment.Subject, Appointment.AllDay); + { + var customFieldStorage = Appointment.GetCustomFieldStorage(); + var serviceRecords = customFieldStorage?.ServiceRecordList ?? new List(); + + ViewModel.ApplyChangesToChangedOccurencyCustomFields(employees, customers, resources, originator, isPrivate, Appointment.RecurrenceIndex.ToString(), new Guid(Appointment.RecurrenceInfo.Id.ToString()), isTask, taskDescription, completedDate, dueDate, completedNotice, supportConceptList, Appointment.Subject, Appointment.AllDay, serviceRecords); var oldRecurrenceInfo = Appointment.RecurrenceInfo.ToXml(); var newRecurrenceInfo = ViewModel.NewVM.RecurrenceInfo; diff --git a/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs b/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs index d2254fcc3..a51b94dea 100644 --- a/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs +++ b/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs @@ -132,6 +132,7 @@ namespace BeWo.Scheduler.ViewModel CustomerList = pAppointment.CustomerList; ResourceList = pAppointment.ResourceList; SupportConceptList = pAppointment.SupportConceptList; + ServiceRecordList = pAppointment.ServiceRecordList; DueDate = pAppointment.DueDate; CompletedDate = pAppointment.CompletedDate; @@ -151,7 +152,7 @@ namespace BeWo.Scheduler.ViewModel CanBeEdited = pAppointment.CanBeEdited; } - public CustomFieldStorage(ObservableCollection pEmployees, List pCustomers, List pResources, CompactEmployeeDC pOriginator, bool pIsPrivate, bool pIsTask, string pTaskDescription, DateTime? pDueDate, DateTime? pCompletedDate, string pCompletedNotice, List pSupportConcepts, string pSubject, bool pIsAllDay) + public CustomFieldStorage(ObservableCollection pEmployees, List pCustomers, List pResources, CompactEmployeeDC pOriginator, bool pIsPrivate, bool pIsTask, string pTaskDescription, DateTime? pDueDate, DateTime? pCompletedDate, string pCompletedNotice, List pSupportConcepts, string pSubject, bool pIsAllDay, List serviceRecords) { IsTask = pIsTask; IsPrivate = pIsPrivate; @@ -160,7 +161,9 @@ namespace BeWo.Scheduler.ViewModel EmployeeList = pEmployees; CustomerList = pCustomers; ResourceList = pResources; + SupportConceptList = pSupportConcepts; + ServiceRecordList = serviceRecords; DueDate = pDueDate; CompletedDate = pCompletedDate; diff --git a/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs b/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs index fb1c60f5f..4f76bd6b1 100644 --- a/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs +++ b/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs @@ -75,10 +75,12 @@ namespace BeWo.Scheduler.ViewModel { var dc = new SchedulerAppointmentDC { - EmployeeList = new List(), - CustomerList = new List(), - ResourceList = new List(), - Status = 0 + EmployeeList = new List(), + CustomerList = new List(), + ResourceList = new List(), + ServiceRecordList = new List(), + SupportConceptList = new List(), + Status = 0 }; var neu = new SchedulerAppointmentVM(dc); @@ -265,6 +267,7 @@ namespace BeWo.Scheduler.ViewModel EmployeeList = item.CF_EmployeeList().ToList(), ResourceList = item.CF_ResourceList(), SupportConceptList = item.CF_SupportConceptList(), + ServiceRecordList = item.CF_ServiceRecordList(), RecurrenceIndex = item.RecurrenceIndex, RecurrenceId = item.RecurrenceInfo.Id.ToString(), HasServiceRecordEntry = item.CF_HasServiceRecordEntry() @@ -432,14 +435,14 @@ namespace BeWo.Scheduler.ViewModel return new SchedulerAppointmentEditForm(this, control, appointment, AllEmployees, AllCustomers, Categories2Resources, isTask); } - public void ApplyChangesToChangedOccurencyCustomFields(ObservableCollection employees, List customers, List resources, CompactEmployeeDC originator, bool isPrivate, string index, Guid id, bool isTask, string taskDescription, DateTime? completedDate, DateTime? dueDate, string completedNotice, List supportConcepts, string subject, bool isAllDay) + public void ApplyChangesToChangedOccurencyCustomFields(ObservableCollection employees, List customers, List resources, CompactEmployeeDC originator, bool isPrivate, string index, Guid id, bool isTask, string taskDescription, DateTime? completedDate, DateTime? dueDate, string completedNotice, List supportConcepts, string subject, bool isAllDay, List serviceRecords) { if (!_ChangedOccurenceCustomFields.ContainsKey(id) || !_ChangedOccurenceCustomFields[id].ContainsKey(index)) { return; } - _ChangedOccurenceCustomFields[id][index][nameof(CustomFieldStorage)] = new CustomFieldStorage(employees, customers, resources, originator, isPrivate, isTask, taskDescription, dueDate, completedDate, completedNotice, supportConcepts, subject, isAllDay); + _ChangedOccurenceCustomFields[id][index][nameof(CustomFieldStorage)] = new CustomFieldStorage(employees, customers, resources, originator, isPrivate, isTask, taskDescription, dueDate, completedDate, completedNotice, supportConcepts, subject, isAllDay, serviceRecords); } public void AddCustomFieldsMapping(SchedulerStorage schedulerStorage) diff --git a/BeWo/View/HomeView.xaml b/BeWo/View/HomeView.xaml index 7bc111166..4dd5a4e3c 100644 --- a/BeWo/View/HomeView.xaml +++ b/BeWo/View/HomeView.xaml @@ -12,6 +12,7 @@ xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxpbars="http://schemas.devexpress.com/winfx/2008/xaml/printing/bars" + xmlns:converter="clr-namespace:BeWo.Scheduler.Converter" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True"> @@ -23,6 +24,8 @@ + + @@ -195,6 +198,7 @@ +
diff --git a/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml index 679492c51..1e5b3da51 100644 --- a/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/GroupBookingPartial.cshtml @@ -1,4 +1,5 @@ @using BeWoPlanerMobil.Models +@using BeWoPlanerMobil.Util @model BeWoPlanerMobil.Models.MainModel + + + @* Ganztagestermine in eine Liste mit weniger Margin und Padding *@
@if(Model.AppointmentListItems.Any(a => a.AllDay)) @@ -95,19 +145,35 @@
} - @if(Model.HasRightToEditAppointment(appointment.Oid) && !appointment.IsTask && appointment.Oid.HasValue && appointment.CanBeEdited) + @if(Model.HasRightToEditAppointment(appointment.Identifier) && !appointment.IsTask && appointment.CanBeEdited) { - using(Html.BeginForm("SelectAppointmentToEdit", "Scheduler", FormMethod.Post)) - { -
-
- - -
+
+
+ @if(appointment.Oid.HasValue) + { + using(Html.BeginForm("SelectAppointmentToEdit", "Scheduler", FormMethod.Post)) + { + + + } + }
- } +
+ +
+ + @using(Html.BeginForm("TransformAppointmentToServiceRecord", "Scheduler", FormMethod.Post, new {id="transformAppToServiceRecForm-" + appointment.Identifier})) + { + + } +
}

@appointment.Description

@@ -188,33 +254,39 @@
} - @if(Model.HasRightToEditAppointment(appointment.Oid) && !appointment.IsTask && appointment.Oid.HasValue && appointment.CanBeEdited) + @if(Model.HasRightToEditAppointment(appointment.Identifier) && !appointment.IsTask && appointment.CanBeEdited) + { +
+ + @if(appointment.Oid.HasValue) { using(Html.BeginForm("SelectAppointmentToEdit", "Scheduler", FormMethod.Post)) { -
-
- - -
-
- -
- @*
- -
*@ +
+ +
} - using(Html.BeginForm("TransformAppointmentToServiceRecord", "Scheduler", FormMethod.Post, new {id="transformAppToServiceRecForm"})) + } + +
+ +
+
+ +
+
+ + using(Html.BeginForm("TransformAppointmentToServiceRecord", "Scheduler", FormMethod.Post, new {id="transformAppToServiceRecForm-" + appointment.Identifier})) { } diff --git a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml index 8b54fc2cb..d8adf058e 100644 --- a/BeWoPlanerMobil/Views/Shared/_Layout.cshtml +++ b/BeWoPlanerMobil/Views/Shared/_Layout.cshtml @@ -16,6 +16,7 @@ + diff --git a/BeWoPlanerMobil/Web.config b/BeWoPlanerMobil/Web.config index bbd3642d5..aef5927d6 100644 --- a/BeWoPlanerMobil/Web.config +++ b/BeWoPlanerMobil/Web.config @@ -1,4 +1,4 @@ - + diff --git a/BeWoPlanerMobil/packages.config b/BeWoPlanerMobil/packages.config index 8bb25c4bc..f66c7cc55 100644 --- a/BeWoPlanerMobil/packages.config +++ b/BeWoPlanerMobil/packages.config @@ -5,8 +5,8 @@ - - + + diff --git a/ReportImp/CaritasKleve/Service/CustomAccountingService.cs b/ReportImp/CaritasKleve/Service/CustomAccountingService.cs index 959159a46..6114a49b6 100644 --- a/ReportImp/CaritasKleve/Service/CustomAccountingService.cs +++ b/ReportImp/CaritasKleve/Service/CustomAccountingService.cs @@ -107,7 +107,9 @@ namespace CaritasKleve.Service Subject = booking.Notice, Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(originator), Type = 0, - FormerBookingSequenceOid = booking.Sequence.Oid + FormerBookingSequenceOid = booking.Sequence.Oid, + ServiceRecordList = new List(), + SupportConceptList = new List() }; if (kvp.Value.Count > 1 && booking.SequencePosition > 0) diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index 706380227..2ce815186 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -338,7 +338,7 @@ namespace BeWo.Service.Plugins //t = "2986016022"; // Ev Verein für Wohnraumhilfe Frankfurt a.M. //t = "2181497347"; // BetreuungsserviceFuerAlltagUndWohnen //t = "5433105975"; // aha e.V. - //t = "7396826106"; // SKF Sozialdienst katholischer Frauen e.V. Leverkusen + t = "7396826106"; // SKF Sozialdienst katholischer Frauen e.V. Leverkusen //t = "4748304562"; // BeWo Darmstadt //t = "5315865694"; // Wismarer Werkstätten GmbH diff --git a/Service/ServiceContracts/IOperationsService.cs b/Service/ServiceContracts/IOperationsService.cs index 237cabf7b..06bd6acb2 100644 --- a/Service/ServiceContracts/IOperationsService.cs +++ b/Service/ServiceContracts/IOperationsService.cs @@ -1295,5 +1295,9 @@ namespace BeWo.Service.ServiceContracts [FaultContract(typeof(BeWoFault))] [OperationContract] List GetConfirmationReceiptSignatures(List oids); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + SchedulerAppointmentDC GetRootAppointment(string recurrenceId); } } \ No newline at end of file diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index e5bfc6ab0..953af043e 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -7673,5 +7673,24 @@ namespace BeWo.Service.ServiceImplementations throw Utils.CreateBeWoFaultException(e); } } + + public SchedulerAppointmentDC GetRootAppointment(string recurrenceId) + { + try + { + if(Guid.TryParse(recurrenceId, out var guid)) + { + var rootAppointment = DAOFactory.SearchDAO.FindRootAppointmentByRecurrenceId(recurrenceId); + + return MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDC(rootAppointment); + } + + return null; + } + catch(Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } + } } } diff --git a/Service/ServiceImplementations/ResourceServiceImp.cs b/Service/ServiceImplementations/ResourceServiceImp.cs index 0fefade49..26fc90e09 100644 --- a/Service/ServiceImplementations/ResourceServiceImp.cs +++ b/Service/ServiceImplementations/ResourceServiceImp.cs @@ -403,7 +403,9 @@ namespace BeWo.Service.ServiceImplementations Subject = booking.Notice, Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(originator), Type = 0, - FormerBookingSequenceOid = booking.Sequence.Oid + FormerBookingSequenceOid = booking.Sequence.Oid, + ServiceRecordList = new List(), + SupportConceptList = new List() }; if(kvp.Value.Count > 1 && booking.SequencePosition > 0) diff --git a/Shared/Core/SchedulerUtils.cs b/Shared/Core/SchedulerUtils.cs index f341dbf70..a293f26bb 100644 --- a/Shared/Core/SchedulerUtils.cs +++ b/Shared/Core/SchedulerUtils.cs @@ -95,7 +95,9 @@ namespace BS.Shared.Core StartDate = startDate, Status = appointment.Status, Subject = appointment.Subject, - Type = appointment.Type + Type = appointment.Type, + ServiceRecordList = appointment.ServiceRecordList, + SupportConceptList = appointment.SupportConceptList }; } } diff --git a/Shared/DataContracts/SchedulerAppointmentDC.cs b/Shared/DataContracts/SchedulerAppointmentDC.cs index e94ee2a3c..2d1ce0b3e 100644 --- a/Shared/DataContracts/SchedulerAppointmentDC.cs +++ b/Shared/DataContracts/SchedulerAppointmentDC.cs @@ -5,6 +5,7 @@ using System.Runtime.Serialization; using System.Text.RegularExpressions; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; +using DevExpress.XtraScheduler; namespace BS.Shared.DataContracts { @@ -104,20 +105,23 @@ namespace BS.Shared.DataContracts { get { - if (!(RecurrenceInfo is null)) + if(RecurrenceInfo is null) { - var match = RecurrenceIdRegex.Match(RecurrenceInfo); - - if (match.Success) - { - var matchValue = match.Value; - var idValue = matchValue.Split("\""); - - return idValue[1]; - } + return null; } - return null; + var match = RecurrenceIdRegex.Match(RecurrenceInfo); + + if(!match.Success) + { + return null; + } + + var matchValue = match.Value; + var idValue = matchValue.Split("\""); + + return idValue[1]; + } } @@ -127,20 +131,22 @@ namespace BS.Shared.DataContracts { get { - if (!(RecurrenceInfo is null)) + if(RecurrenceInfo is null) { - var match = RecurrenceIndexRegex.Match(RecurrenceInfo); - - if (match.Success) - { - var matchValue = match.Value; - var indexValue = matchValue.Split("\""); - - return int.TryParse(indexValue[1], out var indexInt) ? (int?)indexInt : null; - } + return null; } - return null; + var match = RecurrenceIndexRegex.Match(RecurrenceInfo); + + if(!match.Success) + { + return null; + } + + var matchValue = match.Value; + var indexValue = matchValue.Split("\""); + + return int.TryParse(indexValue[1], out var indexInt) ? (int?)indexInt : null; } } @@ -163,14 +169,37 @@ namespace BS.Shared.DataContracts return false; } - if (SchedulerAppointmentOid is null && schedulerAppointmentDC.SchedulerAppointmentOid is null) + var oidEqualsValue = false; + + if(SchedulerAppointmentOid is null && schedulerAppointmentDC.SchedulerAppointmentOid is null) { - return GetHashCode() == schedulerAppointmentDC.GetHashCode(); + // Prüfen, ob es sich um einen Serientermin handelt und index und id vergleichen + + var appointmentType1 = (AppointmentType)Type; + var appointmentType2 = (AppointmentType)schedulerAppointmentDC.Type; + + if(appointmentType1.Equals(AppointmentType.Occurrence) && appointmentType2.Equals(AppointmentType.Occurrence)) + { + var recurrenceId1 = RecurrenceIdReference; + var recurrenceIndex1 = RecurrenceIndex; + + var recurrenceId2 = schedulerAppointmentDC.RecurrenceIdReference; + var recurrenceIndex2 = schedulerAppointmentDC.RecurrenceIndex; + + if(!(recurrenceId1 is null || recurrenceId2 is null)) + { + oidEqualsValue = recurrenceId1.Equals(recurrenceId2) && recurrenceIndex1.Equals(recurrenceIndex2); + } + } + else + { + oidEqualsValue = GetHashCode() == schedulerAppointmentDC.GetHashCode(); + } } - if (SchedulerAppointmentOid != null && schedulerAppointmentDC.SchedulerAppointmentOid != null) + if(SchedulerAppointmentOid != null && schedulerAppointmentDC.SchedulerAppointmentOid != null) { - return SchedulerAppointmentOid == schedulerAppointmentDC.SchedulerAppointmentOid; + oidEqualsValue = SchedulerAppointmentOid == schedulerAppointmentDC.SchedulerAppointmentOid; } var value = StartDate == schedulerAppointmentDC.StartDate && EndDate == schedulerAppointmentDC.EndDate && Type == schedulerAppointmentDC.Type && Description == schedulerAppointmentDC.Description && @@ -178,7 +207,8 @@ namespace BS.Shared.DataContracts ResourceList.SequenceEqual(schedulerAppointmentDC.ResourceList) && CustomerList.SequenceEqual(schedulerAppointmentDC.CustomerList) && ServiceRecordList.SequenceEqual(schedulerAppointmentDC.ServiceRecordList) && - SupportConceptList.SequenceEqual(schedulerAppointmentDC.SupportConceptList); + SupportConceptList.SequenceEqual(schedulerAppointmentDC.SupportConceptList) && + oidEqualsValue; return value; } diff --git a/Shared/Extensions/IListTExtensions.cs b/Shared/Extensions/IListTExtensions.cs index c717ef597..7a412a6f4 100644 --- a/Shared/Extensions/IListTExtensions.cs +++ b/Shared/Extensions/IListTExtensions.cs @@ -129,7 +129,7 @@ namespace BS.Shared.Extensions return false; } - return list1.Count == list2.Count && list1.All(list2.Contains); + return list1.Count == list2.Count && list1.All(list2.Contains) && list2.All(list1.Contains); } } } \ No newline at end of file