271 lines
6.7 KiB
C#
271 lines
6.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using BeWo.ViewModel;
|
|
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
|
|
namespace BeWo.Scheduler.ViewModel
|
|
{
|
|
public class ResourceAppointmentVM : AbstractDCMapperVM<ResourceAppointmentDC>, IBeWoAppointment
|
|
{
|
|
public static string PropertyName_Resource = "Resource";
|
|
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_Employee = "Employee";
|
|
|
|
|
|
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> mCustomFields;
|
|
|
|
private ResourceDC _Resource;
|
|
public ResourceDC Resource
|
|
{
|
|
get { return _Resource; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Resource, value))
|
|
{
|
|
_Resource = value;
|
|
StoreDirtyInformation(!AreEqual(value, DataContract.Resource), PropertyName_Resource);
|
|
FirePropertyChanged(PropertyName_Resource);
|
|
}
|
|
}
|
|
}
|
|
|
|
public BeWoAppointmentCategory AppointmentCategory { get; set; }
|
|
public object Id { get; set; }
|
|
|
|
public DateTime Start
|
|
{
|
|
get { return _Start; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Start, value))
|
|
{
|
|
_Start = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.StartDate, value), PropertyName_Start);
|
|
FirePropertyChanged(PropertyName_Start);
|
|
}
|
|
}
|
|
}
|
|
|
|
public DateTime End
|
|
{
|
|
get { return _End; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_End, value))
|
|
{
|
|
_End = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.EndDate, value), PropertyName_End);
|
|
FirePropertyChanged(PropertyName_End);
|
|
}
|
|
}
|
|
}
|
|
|
|
public int LabelId { get; set; }
|
|
|
|
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 Description
|
|
{
|
|
get { return _Description; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Description, value))
|
|
{
|
|
_Description = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Description, value), PropertyName_Description);
|
|
FirePropertyChanged(PropertyName_Description);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 Location
|
|
{
|
|
get { return _Location; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Location, value))
|
|
{
|
|
_Location = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Location, value), PropertyName_Location);
|
|
FirePropertyChanged(PropertyName_Location);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool AllDay
|
|
{
|
|
get { return _AllDay; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_AllDay, value))
|
|
{
|
|
_AllDay = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.AllDay, value), PropertyName_AllDay);
|
|
FirePropertyChanged(PropertyName_AllDay);
|
|
}
|
|
}
|
|
}
|
|
|
|
public int EventType
|
|
{
|
|
get { return _Type; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Type, value))
|
|
{
|
|
_Type = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Type, value), PropertyName_Type);
|
|
FirePropertyChanged(PropertyName_Type);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 object ResourceId { get; set; }
|
|
|
|
private CompactEmployeeDC _Employee;
|
|
public CompactEmployeeDC Employee
|
|
{
|
|
get { return _Employee; }
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Employee, value))
|
|
{
|
|
_Employee = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Employee, value), PropertyName_Employee);
|
|
FirePropertyChanged(PropertyName_Employee);
|
|
}
|
|
}
|
|
}
|
|
|
|
public Dictionary<string, object> CustomFields { get { return mCustomFields ?? (mCustomFields = new Dictionary<String, object>()); } }
|
|
|
|
|
|
public ResourceAppointmentVM(ResourceAppointmentDC pDC) : base(pDC, pDC.ResourceAppointmentOid == null)
|
|
{
|
|
}
|
|
|
|
|
|
protected override void InitByDataContract(ResourceAppointmentDC pDataContract)
|
|
{
|
|
_AllDay = pDataContract.AllDay;
|
|
_Resource = pDataContract.Resource;
|
|
_Description = pDataContract.Description;
|
|
_End = pDataContract.EndDate ?? DateTime.Now;
|
|
_Location = pDataContract.Location;
|
|
_RecurrenceInfo = pDataContract.RecurrenceInfo;
|
|
_ReminderInfo = pDataContract.ReminderInfo;
|
|
_Start = pDataContract.StartDate ?? DateTime.Now;
|
|
_Status = pDataContract.Status;
|
|
_Subject = pDataContract.Subject;
|
|
_Type = pDataContract.Type;
|
|
_Employee = pDataContract.Employee;
|
|
}
|
|
|
|
protected override ResourceAppointmentDC MapToDataContract(ResourceAppointmentDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.AllDay = _AllDay;
|
|
pDataContract.Resource = _Resource;
|
|
pDataContract.Description = _Description;
|
|
pDataContract.Employee = _Employee;
|
|
pDataContract.EndDate = _End;
|
|
pDataContract.Location = _Location;
|
|
pDataContract.RecurrenceInfo = _RecurrenceInfo;
|
|
pDataContract.ReminderInfo = _ReminderInfo;
|
|
pDataContract.StartDate = _Start;
|
|
pDataContract.Status = _Status;
|
|
pDataContract.Subject = _Subject;
|
|
pDataContract.Type = _Type;
|
|
|
|
return pDataContract;
|
|
}
|
|
}
|
|
}
|