158 lines
4.3 KiB
C#
158 lines
4.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
using BeWo.Core;
|
|
using BeWo.Validation;
|
|
using BeWo.ViewModel.ListViewModel;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.ViewModel
|
|
{
|
|
public class AppointmentVM : AbstractDCMapperVM<AppointmentDC>
|
|
{
|
|
|
|
public static string PropertyName_Subject = "Subject";
|
|
|
|
public static string PropertyName_Description = "Description";
|
|
|
|
public static string PropertyName_StartDate = "StartDate";
|
|
|
|
public static string PropertyName_EndDate = "EndDate";
|
|
|
|
public static string PropertyName_LabelId = "LabelId";
|
|
|
|
|
|
private string _Subject;
|
|
|
|
private string _Description;
|
|
|
|
private int _LabelId;
|
|
|
|
private DateTime _StartDate;
|
|
|
|
private DateTime _EndDate;
|
|
|
|
|
|
|
|
public AppointmentVM(AppointmentDC pAppointmentDC)
|
|
: base(pAppointmentDC, pAppointmentDC.AppointmentOid == null)
|
|
{
|
|
|
|
}
|
|
|
|
public string Subject
|
|
{
|
|
get { return this._Subject; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._Subject, value))
|
|
{
|
|
this._Subject = value;
|
|
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Subject, value), PropertyName_Subject);
|
|
|
|
this.FirePropertyChanged(PropertyName_Subject);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Description
|
|
{
|
|
get { return this._Description; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._Description, value))
|
|
{
|
|
this._Description = value;
|
|
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Description, value), PropertyName_Description);
|
|
|
|
this.FirePropertyChanged(PropertyName_Description);
|
|
}
|
|
}
|
|
}
|
|
|
|
public int LabelId
|
|
{
|
|
get { return this._LabelId; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._LabelId, value))
|
|
{
|
|
this._LabelId = value;
|
|
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.LabelId, value), PropertyName_LabelId);
|
|
|
|
this.FirePropertyChanged(PropertyName_LabelId);
|
|
}
|
|
}
|
|
}
|
|
|
|
public DateTime StartDate
|
|
{
|
|
get { return this._StartDate; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._StartDate, value))
|
|
{
|
|
this._StartDate = value;
|
|
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.StartDate, value), PropertyName_StartDate);
|
|
|
|
this.FirePropertyChanged(PropertyName_StartDate);
|
|
}
|
|
}
|
|
}
|
|
|
|
public DateTime EndDate
|
|
{
|
|
get { return this._EndDate; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._EndDate, value))
|
|
{
|
|
this._EndDate = value;
|
|
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.EndDate, value), PropertyName_EndDate);
|
|
|
|
this.FirePropertyChanged(PropertyName_EndDate);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
protected override void InitByDataContract(AppointmentDC pDataContract)
|
|
{
|
|
|
|
this._StartDate = pDataContract.StartDate;
|
|
this._EndDate = pDataContract.EndDate;
|
|
this._Subject = pDataContract.Subject;
|
|
this._Description = pDataContract.Description;
|
|
this._LabelId = pDataContract.LabelId;
|
|
|
|
}
|
|
|
|
protected override AppointmentDC MapToDataContract(AppointmentDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.StartDate = this._StartDate;
|
|
pDataContract.EndDate = this._EndDate;
|
|
pDataContract.Subject = this._Subject;
|
|
pDataContract.Description = this._Description;
|
|
pDataContract.LabelId = pDataContract.LabelId;
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
|
|
}
|
|
} |