Files
BeWoPlaner/BeWo/Scheduler/Utils/AppointmentExtensions.cs
Lyndon Jetten 57b1e3d93a .
2020-08-04 12:45:46 +02:00

178 lines
6.1 KiB
C#

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
{
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<Employee2SchedulerAppointmentDC> CF_EmployeeList(this Appointment appointment)
{
return appointment.GetCustomFieldStorage()?.EmployeeList ?? new ObservableCollection<Employee2SchedulerAppointmentDC>();
}
public static List<CompactCustomerDC> CF_CustomerList(this Appointment appointment)
{
return appointment.GetCustomFieldStorage()?.CustomerList ?? new List<CompactCustomerDC>();
}
public static List<ResourceDC> CF_ResourceList(this Appointment appointment)
{
return appointment.GetCustomFieldStorage()?.ResourceList ?? new List<ResourceDC>();
}
public static List<CompactSupportConceptDC> CF_SupportConceptList(this Appointment appointment)
{
return appointment.GetCustomFieldStorage()?.SupportConceptList ?? new List<CompactSupportConceptDC>();
}
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 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_EmployeeList(this Appointment appointment, ObservableCollection<Employee2SchedulerAppointmentDC> pEmployeeList)
{
appointment.GetCustomFieldStorage().EmployeeList = pEmployeeList;
}
public static void CF_ResourceList(this Appointment appointment, List<ResourceDC> pResourceList)
{
appointment.GetCustomFieldStorage().ResourceList = pResourceList;
}
public static void CF_CustomerList(this Appointment appointment, List<CompactCustomerDC> pCustomerList)
{
appointment.GetCustomFieldStorage().CustomerList = pCustomerList;
}
public static void CF_SupportConceptList(this Appointment appointment, List<CompactSupportConceptDC> 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;
}
}
}