using System; using System.Collections.Generic; using System.Collections.ObjectModel; using BeWo.Scheduler.ViewModel; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; using DevExpress.XtraScheduler; 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; } public static bool CF_IsTask(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.IsTask ?? false; } public static bool CF_IsAbsenceTime(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.IsAbsenceTime ?? false; } public static bool CF_IsPrivate(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.IsPrivate ?? false; } public static bool CF_IsAllDay(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.IsAllDay ?? false; } public static ObservableCollection CF_EmployeeList(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.EmployeeList ?? new ObservableCollection(); } public static List CF_CustomerList(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.CustomerList ?? new List(); } public static List CF_ResourceList(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.ResourceList ?? new List(); } public static List CF_SupportConceptList(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.SupportConceptList ?? new List(); } public static DateTime? CF_DueDate(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.DueDate; } public static DateTime? CF_CompletedDate(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.CompletedDate; } public static string CF_CompletedNotice(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.CompletedNotice; } public static string CF_TaskDescription(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.TaskDescription; } public static CompactEmployeeDC CF_Originator(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.Originator; } public static long? CF_SchedulerAppointmentOid(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.SchedulerAppointmentOid; } public static bool CF_HasServiceRecordEntry(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.HasServiceRecordEntry ?? false; } public static bool CF_CanBeEdited(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.CanBeEdited ?? false; } public static long? CF_AbsenceTimeOid(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.AbsenceTimeOid; } public static bool CF_IsCustomerAbsenceTime(this Appointment appointment) { return appointment.GetCustomFieldStorage()?.IsCustomerAbsenceTime ?? false; } public static List CF_ServiceRecordList(this Appointment appointment) { 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) { appointment.GetCustomFieldStorage().IsTask = pIsTask; } public static void CF_IsAbsenceTime(this Appointment appointment, bool pIsAbsenceTime) { appointment.GetCustomFieldStorage().IsAbsenceTime = pIsAbsenceTime; } public static void CF_IsPrivate(this Appointment appointment, bool pIsPrivate) { appointment.GetCustomFieldStorage().IsPrivate = pIsPrivate; } public static void CF_IsAllDay(this Appointment appointment, bool pIsAllDay) { appointment.GetCustomFieldStorage().IsAllDay = pIsAllDay; } public static void CF_AbsenceTimeOid(this Appointment appointment, long? absenceTimeOid) { appointment.GetCustomFieldStorage().AbsenceTimeOid = absenceTimeOid; } public static void CF_IsCustomerAbsenceTime(this Appointment appointment, bool isCustomerAbsenceTime) { appointment.GetCustomFieldStorage().IsCustomerAbsenceTime = isCustomerAbsenceTime; } public static void CF_EmployeeList(this Appointment appointment, ObservableCollection pEmployeeList) { appointment.GetCustomFieldStorage().EmployeeList = pEmployeeList; } public static void CF_ResourceList(this Appointment appointment, List pResourceList) { appointment.GetCustomFieldStorage().ResourceList = pResourceList; } public static void CF_CustomerList(this Appointment appointment, List pCustomerList) { appointment.GetCustomFieldStorage().CustomerList = pCustomerList; } public static void CF_SupportConceptList(this Appointment appointment, List pSupportConceptList) { 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; } public static void CF_CompletedDate(this Appointment appointment, DateTime? pCompletedDate) { appointment.GetCustomFieldStorage().CompletedDate = pCompletedDate; } public static void CF_CompletedNotice(this Appointment appointment, string pCompletedNotice) { appointment.GetCustomFieldStorage().CompletedNotice = pCompletedNotice; } public static void CF_TaskDescription(this Appointment appointment, string pTaskDescription) { appointment.GetCustomFieldStorage().TaskDescription = pTaskDescription; } public static void CF_HasServiceRecordEntry(this Appointment appointment, bool hasServiceRecordEntry) { appointment.GetCustomFieldStorage().HasServiceRecordEntry = hasServiceRecordEntry; } public static void CF_ServiceRecordList(this Appointment appointment, List serviceRecords) { appointment.GetCustomFieldStorage().ServiceRecordList = serviceRecords; } public static void CF_CompletedUser(this Appointment appointment, string completedUser) { appointment.GetCustomFieldStorage().CompletedUser = completedUser; } #endregion } }