diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj
index d1e40ce56..daab167c0 100644
--- a/BeWo/BeWo.csproj
+++ b/BeWo/BeWo.csproj
@@ -806,6 +806,7 @@
ProxyLoginView.xaml
+
diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs
index 02e3bd137..18886ec3f 100644
--- a/BeWo/Core/BeWoUtils.cs
+++ b/BeWo/Core/BeWoUtils.cs
@@ -2060,16 +2060,16 @@ namespace BeWo.Core
}
}
- public static void CreateZeiterfassung(DateTime start, DateTime end, List customer, List employees, String notice, Appointment appointment, Action schedulerCallback)
+ public static void CreateZeiterfassung(DateTime start, DateTime end, List customer, List employees, string notice, Appointment appointment, Action> schedulerCallback)
{
ChatDokumentationsView newView;
- if (customer.Count == 0)
+ if(customer.Count == 0)
{
// Normale Buchung
newView = new ChatDokumentationsView(notice, null, start, end, null, schedulerCallback, appointment);
}
- else if (customer.Count == 1 && employees.Count < 2)
+ else if(customer.Count == 1 && employees.Count < 2)
{
var compactKlient = ServiceFacade.DoCustomerServiceSync(s => s.GetCompactCustomerDC(customer[0].CustomerOid));
@@ -2079,7 +2079,7 @@ namespace BeWo.Core
}
else
{
- if (employees.Count == 0)
+ if(employees.Count == 0)
{
employees.Add(BeWoApp.CompactLoggedOnEmployee);
}
diff --git a/BeWo/Scheduler/Converter/AptToServRecsIconVisibilityConverter.cs b/BeWo/Scheduler/Converter/AptToServRecsIconVisibilityConverter.cs
new file mode 100644
index 000000000..6790251df
--- /dev/null
+++ b/BeWo/Scheduler/Converter/AptToServRecsIconVisibilityConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Windows;
+using System.Windows.Data;
+using BS.Shared.DataContracts;
+
+namespace BeWo.Scheduler.Converter
+{
+ public class AptToServRecsIconVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if(value is List serviceRecordList)
+ {
+ return serviceRecordList.Any() ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ return Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/BeWo/Scheduler/Utils/AppointmentExtensions.cs b/BeWo/Scheduler/Utils/AppointmentExtensions.cs
index 4718321b1..8ae1a489b 100644
--- a/BeWo/Scheduler/Utils/AppointmentExtensions.cs
+++ b/BeWo/Scheduler/Utils/AppointmentExtensions.cs
@@ -111,6 +111,12 @@ namespace BeWo.Scheduler.Utils
return appointment.GetCustomFieldStorage()?.IsCustomerAbsenceTime ?? false;
}
+ public static List CF_ServiceRecordList(this Appointment appointment)
+ {
+ return appointment.GetCustomFieldStorage()?.ServiceRecordList ?? new List();
+ }
+
+
public static void CF_IsTask(this Appointment appointment, bool pIsTask)
{
appointment.GetCustomFieldStorage().IsTask = pIsTask;
@@ -194,5 +200,10 @@ namespace BeWo.Scheduler.Utils
{
appointment.GetCustomFieldStorage().HasServiceRecordEntry = hasServiceRecordEntry;
}
+
+ public static void CF_ServiceRecordList(this Appointment appointment, List serviceRecords)
+ {
+ appointment.GetCustomFieldStorage().ServiceRecordList = serviceRecords;
+ }
}
}
diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml b/BeWo/Scheduler/View/NewSchedulerView.xaml
index 504797863..c68ec66c4 100644
--- a/BeWo/Scheduler/View/NewSchedulerView.xaml
+++ b/BeWo/Scheduler/View/NewSchedulerView.xaml
@@ -26,6 +26,7 @@
+
@@ -145,7 +146,8 @@
-
+
+
@@ -1020,19 +1022,19 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs
index 5f60c6a16..59458fce2 100644
--- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs
+++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs
@@ -37,7 +37,6 @@ using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.Reporting;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Compatibility;
-using DevExpress.XtraScheduler.Forms;
using DevExpress.XtraScheduler.iCalendar;
using DevExpress.XtraScheduler.Services;
using Microsoft.Win32;
@@ -45,7 +44,6 @@ using Appointment = DevExpress.XtraScheduler.Appointment;
using AppointmentViewInfoCustomizingEventArgs = DevExpress.Xpf.Scheduler.AppointmentViewInfoCustomizingEventArgs;
using ColorConverter = System.Windows.Media.ColorConverter;
using DateTime = System.DateTime;
-using DeleteRecurrentAppointmentFormEventArgs = DevExpress.Xpf.Scheduler.DeleteRecurrentAppointmentFormEventArgs;
using InplaceEditorEventArgs = DevExpress.Xpf.Scheduler.InplaceEditorEventArgs;
using SchedulerControl = DevExpress.Xpf.Scheduler.SchedulerControl;
@@ -1856,7 +1854,7 @@ namespace BeWo.Scheduler.View
var appointment = Scheduler.SelectedAppointments.FirstOrDefault();
- if(appointment == null)
+ if(appointment is null)
{
return;
}
@@ -1866,7 +1864,7 @@ namespace BeWo.Scheduler.View
var employeeList = employee2SchedulerAppointmentList.Select(employee2SchedulerAppointment => employee2SchedulerAppointment.Employee).ToList();
- BeWoUtils.CreateZeiterfassung(appointment.Start, appointment.End, customerList, employeeList, appointment.Subject, appointment, () =>
+ BeWoUtils.CreateZeiterfassung(appointment.Start, appointment.End, customerList, employeeList, appointment.Subject, appointment, serviceRecords =>
{
try
{
@@ -1874,12 +1872,13 @@ namespace BeWo.Scheduler.View
IgnoreChangeEvents = true;
var schedulerAppointment = (SchedulerAppointmentVM) appointment.GetSourceObject(Scheduler.GetCoreStorage());
+ schedulerAppointment?.ServiceRecordList.AddRange(serviceRecords);
var appointmentOid = schedulerAppointment?.CommitToDataContract().SchedulerAppointmentOid;
if(appointmentOid.HasValue)
{
- appointment.CF_HasServiceRecordEntry(true);
+ appointment.CF_ServiceRecordList(serviceRecords);
ViewModel.ActiveAppointmentViewModel.SaveAppointments(Scheduler, new List {appointment});
@@ -1895,18 +1894,17 @@ namespace BeWo.Scheduler.View
var apt = appointment.RecurrencePattern.CreateException(AppointmentType.ChangedOccurrence, appointment.RecurrenceIndex);
- apt.Duration = appointment.Duration;
- apt.End = apt.Start.Add(appointment.Duration);
-
- apt.Subject = appointment.Subject;
- apt.Location = appointment.Location;
+ apt.Duration = appointment.Duration;
+ apt.End = apt.Start.Add(appointment.Duration);
+ apt.Subject = appointment.Subject;
+ apt.Location = appointment.Location;
apt.Description = appointment.Description;
Scheduler.Storage.AppointmentStorage.CreateCustomFields(apt);
apt.CustomFields[nameof(CustomFieldStorage)] = appointment.CustomFields[nameof(CustomFieldStorage)];
- apt.CF_HasServiceRecordEntry(true);
+ appointment.CF_ServiceRecordList(serviceRecords);
ViewModel.ActiveAppointmentViewModel.InsertAppointments(Scheduler, new List {apt});
diff --git a/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs b/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs
index 6ebf30ec5..d2254fcc3 100644
--- a/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs
+++ b/BeWo/Scheduler/ViewModel/CustomFieldStorage.cs
@@ -118,6 +118,7 @@ namespace BeWo.Scheduler.ViewModel
AbsenceTimeOid = pAppointment.AbsenceTimeOid;
IsCustomerAbsenceTime = pAppointment.IsCustomerAbsenceTime;
+ ServiceRecordList = pAppointment.ServiceRecordList;
}
public CustomFieldStorage(SchedulerAppointmentDC pAppointment)
@@ -183,6 +184,8 @@ namespace BeWo.Scheduler.ViewModel
public Visibility ToolTipZusageVisibility => IsTask ? Visibility.Collapsed : Visibility.Visible;
public bool HasServiceRecordEntry { get; set; }
+
+ public List ServiceRecordList { get; set; } = new List();
}
public class InternalInfo
diff --git a/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs b/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs
index 34c8d52c7..a9e3a59a3 100644
--- a/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs
+++ b/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs
@@ -64,6 +64,7 @@ namespace BeWo.Scheduler.ViewModel
private bool _IsArchived;
private long? _AbsenceTimeOid;
private bool _IsCustomerAbsenceTime;
+ private List _ServiceRecordList;
public bool HasServiceRecordEntry
@@ -119,19 +120,19 @@ namespace BeWo.Scheduler.ViewModel
var customFieldStorage = (CustomFieldStorage) value[nameof(CustomFieldStorage)];
- EmployeeList = customFieldStorage.EmployeeList;
- CustomerList = customFieldStorage.CustomerList;
- ResourceList = customFieldStorage.ResourceList;
- Originator = customFieldStorage.Originator;
- IsPrivate = customFieldStorage.IsPrivate;
- IsTask = customFieldStorage.IsTask;
- DueDate = customFieldStorage.DueDate;
- TaskDescription = customFieldStorage.TaskDescription;
- CompletedDate = customFieldStorage.CompletedDate;
- CompletedNotice = customFieldStorage.CompletedNotice;
- CompletedUser = customFieldStorage.CompletedUser;
- SupportConceptList = customFieldStorage.SupportConceptList;
- AbsenceTimeOid = customFieldStorage.AbsenceTimeOid;
+ EmployeeList = customFieldStorage.EmployeeList;
+ CustomerList = customFieldStorage.CustomerList;
+ ResourceList = customFieldStorage.ResourceList;
+ Originator = customFieldStorage.Originator;
+ IsPrivate = customFieldStorage.IsPrivate;
+ IsTask = customFieldStorage.IsTask;
+ DueDate = customFieldStorage.DueDate;
+ TaskDescription = customFieldStorage.TaskDescription;
+ CompletedDate = customFieldStorage.CompletedDate;
+ CompletedNotice = customFieldStorage.CompletedNotice;
+ CompletedUser = customFieldStorage.CompletedUser;
+ SupportConceptList = customFieldStorage.SupportConceptList;
+ AbsenceTimeOid = customFieldStorage.AbsenceTimeOid;
IsCustomerAbsenceTime = customFieldStorage.IsCustomerAbsenceTime;
}
}
@@ -620,16 +621,16 @@ namespace BeWo.Scheduler.ViewModel
// Wird für Abwesenheiten genutzt
public SchedulerAppointmentVM(bool pAllDay, string pSubject, DateTime pStart, DateTime pEnd, CompactEmployeeDC pOriginator, DateTime? absenceTimeStart, DateTime? absenceTimeEnd, long absenceTimeOid, bool isCustomerAbsenceTime)
{
- _AllDay = pAllDay;
- _Subject = pSubject;
- _Start = pStart;
- _End = pEnd;
+ _AllDay = pAllDay;
+ _Subject = pSubject;
+ _Start = pStart;
+ _End = pEnd;
_Originator = pOriginator;
AbsenceTimeStart = absenceTimeStart;
- AbsenceTimeEnd = absenceTimeEnd;
- IsAbsenceTime = true;
- AbsenceTimeOid = absenceTimeOid;
+ AbsenceTimeEnd = absenceTimeEnd;
+ IsAbsenceTime = true;
+ AbsenceTimeOid = absenceTimeOid;
IsCustomerAbsenceTime = isCustomerAbsenceTime;
@@ -663,10 +664,11 @@ namespace BeWo.Scheduler.ViewModel
_IsTask = pDataContract.IsTask;
_TaskDescription = pDataContract.TaskDescription;
_CompletedNotice = pDataContract.CompletedNotice;
- _CompletedUser = pDataContract.CompletedUser;
+ _CompletedUser = pDataContract.CompletedUser;
_CompletedDate = pDataContract.CompletedDate;
_SupportConceptList = pDataContract.SupportConceptList ?? new List();
_HasServiceRecordEntry = pDataContract.HasServiceRecordEntry;
+ _ServiceRecordList = pDataContract.ServiceRecordList ?? new List();
_IsArchived = pDataContract.ActivationType == ActivationTypeId.Archived;
CanBeEdited = pDataContract.CanBeEdited;
@@ -698,11 +700,12 @@ namespace BeWo.Scheduler.ViewModel
pDataContract.IsTask = _IsTask;
pDataContract.TaskDescription = _TaskDescription;
pDataContract.CompletedNotice = _CompletedNotice;
- pDataContract.CompletedUser = _CompletedUser;
+ pDataContract.CompletedUser = _CompletedUser;
pDataContract.CompletedDate = _CompletedDate;
pDataContract.SupportConceptList = _SupportConceptList;
pDataContract.HasServiceRecordEntry = _HasServiceRecordEntry;
pDataContract.ActivationType = _IsArchived ? ActivationTypeId.Archived : ActivationTypeId.Active;
+ pDataContract.ServiceRecordList = _ServiceRecordList;
if(_DueDate.HasValue && _DueTime.HasValue)
{
@@ -811,5 +814,28 @@ namespace BeWo.Scheduler.ViewModel
}
public long? LabelKey { get; set; }
- }
+
+ public List ServiceRecordList
+ {
+ get => _ServiceRecordList ?? (ServiceRecordList = new List());
+
+ set
+ {
+ if(!AreDifferent(_ServiceRecordList, value))
+ {
+ return;
+ }
+
+ _ServiceRecordList = value;
+
+ if(IsAbsenceTime)
+ {
+ return;
+ }
+
+ StoreDirtyInformation(AreDifferent(DataContract.ServiceRecordList, value), nameof(ServiceRecordList));
+ FirePropertyChanged(nameof(ServiceRecordList));
+ }
+ }
+ }
}
diff --git a/BeWo/View/Detail/Zeiterfassung/ServiceRecordEditView.xaml b/BeWo/View/Detail/Zeiterfassung/ServiceRecordEditView.xaml
index 26c90e619..067b27a6f 100644
--- a/BeWo/View/Detail/Zeiterfassung/ServiceRecordEditView.xaml
+++ b/BeWo/View/Detail/Zeiterfassung/ServiceRecordEditView.xaml
@@ -63,7 +63,7 @@
-