Files
BeWoPlaner/BeWo/ViewModel/EmploymentTypeVM.cs
2016-06-27 01:45:38 +02:00

51 lines
1.4 KiB
C#

using BeWo.Core.Service;
using BeWo.Validation;
using BS.Shared;
using BS.Shared.DataContracts;
namespace BeWo.ViewModel
{
public class EmploymentTypeVM : AbstractDCMapperVM<EmploymentTypeDC>
{
public static string PropertyName_Name = "Name";
private string _Name;
public EmploymentTypeVM(EmploymentTypeDC pDC) : base(pDC, pDC.EmploymentTypeOid == null)
{
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string Name
{
get { return this._Name; }
set
{
if (this.AreDifferent(this._Name, value))
{
this._Name = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Name, value), PropertyName_Name);
this.FirePropertyChanged(PropertyName_Name);
}
}
}
protected override void InitByDataContract(EmploymentTypeDC pDataContract)
{
if (!this.IsNew)
{
this._Name = pDataContract.Name;
}
}
protected override EmploymentTypeDC MapToDataContract(EmploymentTypeDC pDataContract, bool doCommit)
{
pDataContract.Name = this._Name;
return pDataContract;
}
}
}