307 lines
8.7 KiB
C#
307 lines
8.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.ViewModel;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
|
|
namespace BeWo.Scheduler.ViewModel
|
|
{
|
|
public class NewSchedulerAppointmentVM : AbstractDCMapperVM<NewSchedulerAppointmentDC>, IBeWoAppointment
|
|
{
|
|
public static string PropertyName_Type = "Type";
|
|
public static string PropertyName_Start = "Start";
|
|
public static string PropertyName_End = "End";
|
|
public static string PropertyName_AllDay = "AllDay";
|
|
public static string PropertyName_Subject = "Subject";
|
|
public static string PropertyName_Location = "Location";
|
|
public static string PropertyName_Status = "Status";
|
|
public static string PropertyName_RecurrenceInfo = "RecurrenceInfo";
|
|
public static string PropertyName_ReminderInfo = "ReminderInfo";
|
|
public static string PropertyName_Description = "Description";
|
|
public static string PropertyName_EmployeeList = "EmployeeList";
|
|
public static string PropertyName_CustomerList = "CustomerList";
|
|
public static string PropertyName_ResourceList = "ResourceList";
|
|
public static string PropertyName_IsPrivate = "IsPrivate";
|
|
public static string PropertyName_Originator = "Originator";
|
|
|
|
|
|
private bool _AllDay;
|
|
private String _Description;
|
|
private DateTime _End;
|
|
private String _Location;
|
|
private String _RecurrenceInfo;
|
|
private String _ReminderInfo;
|
|
private DateTime _Start;
|
|
private int _Status;
|
|
private String _Subject;
|
|
private int _Type;
|
|
private Dictionary<string, object> _CustomFields;
|
|
private bool _IsPrivate;
|
|
private Dictionary<CompactEmployeeDC, ParticipationAnswer> _EmployeeList;
|
|
private List<CompactCustomerDC> _CustomerList;
|
|
private List<ResourceDC> _ResourceList;
|
|
private CompactEmployeeDC _Originator;
|
|
|
|
public BeWoAppointmentCategory AppointmentCategory { get; set; }
|
|
public object Id { get; set; }
|
|
public int LabelId { get; set; }
|
|
public object ResourceId { get; set; }
|
|
public Dictionary<string, object> CustomFields
|
|
{
|
|
get { return _CustomFields ?? (_CustomFields = new Dictionary<String, object>()); }
|
|
}
|
|
|
|
public int EventType
|
|
{
|
|
get { return _Type; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Type, value))
|
|
{
|
|
_Type = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Type, value), PropertyName_Type);
|
|
FirePropertyChanged(PropertyName_Type);
|
|
}
|
|
}
|
|
}
|
|
public DateTime End
|
|
{
|
|
get { return _End; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_End, value))
|
|
{
|
|
_End = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.EndDate, value), PropertyName_End);
|
|
FirePropertyChanged(PropertyName_End);
|
|
}
|
|
}
|
|
}
|
|
public DateTime Start
|
|
{
|
|
get { return _Start; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Start, value))
|
|
{
|
|
_Start = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.StartDate, value), PropertyName_Start);
|
|
FirePropertyChanged(PropertyName_Start);
|
|
}
|
|
}
|
|
}
|
|
public bool AllDay
|
|
{
|
|
get { return _AllDay; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_AllDay, value))
|
|
{
|
|
_AllDay = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.AllDay, value), PropertyName_AllDay);
|
|
FirePropertyChanged(PropertyName_AllDay);
|
|
}
|
|
}
|
|
}
|
|
public String Subject
|
|
{
|
|
get { return _Subject; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Subject, value))
|
|
{
|
|
_Subject = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Subject, value), PropertyName_Subject);
|
|
FirePropertyChanged(PropertyName_Subject);
|
|
}
|
|
}
|
|
}
|
|
public String Location
|
|
{
|
|
get { return _Location; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Location, value))
|
|
{
|
|
_Location = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Location, value), PropertyName_Location);
|
|
FirePropertyChanged(PropertyName_Location);
|
|
}
|
|
}
|
|
}
|
|
public int Status
|
|
{
|
|
get { return _Status; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Status, value))
|
|
{
|
|
_Status = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Status, value), PropertyName_Status);
|
|
FirePropertyChanged(PropertyName_Status);
|
|
}
|
|
}
|
|
}
|
|
public String RecurrenceInfo
|
|
{
|
|
get { return _RecurrenceInfo; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_RecurrenceInfo, value))
|
|
{
|
|
_RecurrenceInfo = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.RecurrenceInfo, value), PropertyName_RecurrenceInfo);
|
|
FirePropertyChanged(PropertyName_RecurrenceInfo);
|
|
}
|
|
}
|
|
}
|
|
public String ReminderInfo
|
|
{
|
|
get { return _ReminderInfo; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_ReminderInfo, value))
|
|
{
|
|
_ReminderInfo = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.ReminderInfo, value), PropertyName_ReminderInfo);
|
|
FirePropertyChanged(PropertyName_ReminderInfo);
|
|
}
|
|
}
|
|
}
|
|
public String Description
|
|
{
|
|
get { return _Description; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Description, value))
|
|
{
|
|
_Description = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Description, value), PropertyName_Description);
|
|
FirePropertyChanged(PropertyName_Description);
|
|
}
|
|
}
|
|
}
|
|
public Dictionary<CompactEmployeeDC, ParticipationAnswer> EmployeeList
|
|
{
|
|
get { return _EmployeeList ?? (_EmployeeList = new Dictionary<CompactEmployeeDC, ParticipationAnswer>()); }
|
|
set
|
|
{
|
|
if (AreDifferent(_EmployeeList, value))
|
|
{
|
|
_EmployeeList = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.EmployeeList, value), PropertyName_EmployeeList);
|
|
FirePropertyChanged(PropertyName_EmployeeList);
|
|
}
|
|
}
|
|
}
|
|
public List<CompactCustomerDC> CustomerList
|
|
{
|
|
get { return _CustomerList ?? (_CustomerList = new List<CompactCustomerDC>()); }
|
|
set
|
|
{
|
|
if (AreDifferent(_CustomerList, value))
|
|
{
|
|
_CustomerList = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.CustomerList, value), PropertyName_CustomerList);
|
|
FirePropertyChanged(PropertyName_CustomerList);
|
|
}
|
|
}
|
|
}
|
|
public List<ResourceDC> ResourceList
|
|
{
|
|
get { return _ResourceList ?? (ResourceList = new List<ResourceDC>()); }
|
|
set
|
|
{
|
|
if (AreDifferent(_ResourceList, value))
|
|
{
|
|
_ResourceList = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.ResourceList, value), PropertyName_ResourceList);
|
|
FirePropertyChanged(PropertyName_ResourceList);
|
|
}
|
|
}
|
|
}
|
|
public bool IsPrivate
|
|
{
|
|
get { return _IsPrivate; }
|
|
set
|
|
{
|
|
if (AreDifferent(_IsPrivate, value))
|
|
{
|
|
_IsPrivate = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.IsPrivate,value), PropertyName_IsPrivate);
|
|
FirePropertyChanged(PropertyName_IsPrivate);
|
|
}
|
|
}
|
|
}
|
|
public CompactEmployeeDC Originator
|
|
{
|
|
get { return _Originator; }
|
|
set
|
|
{
|
|
if (AreDifferent(_Originator, value))
|
|
{
|
|
_Originator = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Originator, value), PropertyName_Originator);
|
|
FirePropertyChanged(PropertyName_Originator);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void InitByDataContract(NewSchedulerAppointmentDC pDataContract)
|
|
{
|
|
_Description = pDataContract.Description;
|
|
_End = pDataContract.EndDate.Value;
|
|
_Location = pDataContract.Location;
|
|
_RecurrenceInfo = pDataContract.RecurrenceInfo;
|
|
_ReminderInfo = pDataContract.ReminderInfo;
|
|
_Start = pDataContract.StartDate.Value;
|
|
_Status = pDataContract.Status;
|
|
_Subject = pDataContract.Subject;
|
|
_Type = pDataContract.Type;
|
|
|
|
_IsPrivate = pDataContract.IsPrivate;
|
|
_Originator = pDataContract.Originator;
|
|
_CustomerList = pDataContract.CustomerList;
|
|
_EmployeeList = pDataContract.EmployeeList;
|
|
_ResourceList = pDataContract.ResourceList;
|
|
|
|
_CustomFields = new Dictionary<string, object> { { "Originator", Originator }, { "CustomerList", CustomerList }, { "EmployeeList", EmployeeList }, { "ResourceList", ResourceList } };
|
|
}
|
|
|
|
protected override NewSchedulerAppointmentDC MapToDataContract(NewSchedulerAppointmentDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.AllDay = _AllDay;
|
|
pDataContract.Description = _Description;
|
|
pDataContract.EndDate = _End;
|
|
pDataContract.Location = _Location;
|
|
pDataContract.RecurrenceInfo = _RecurrenceInfo;
|
|
pDataContract.ReminderInfo = _ReminderInfo;
|
|
pDataContract.StartDate = _Start;
|
|
pDataContract.Status = _Status;
|
|
pDataContract.Subject = _Subject;
|
|
pDataContract.Type = _Type;
|
|
|
|
pDataContract.IsPrivate = _IsPrivate;
|
|
pDataContract.Originator = _Originator;
|
|
pDataContract.CustomerList = _CustomerList;
|
|
pDataContract.EmployeeList = _EmployeeList;
|
|
pDataContract.ResourceList = _ResourceList;
|
|
|
|
return pDataContract;
|
|
}
|
|
}
|
|
}
|