102 lines
3.5 KiB
C#
102 lines
3.5 KiB
C#
using BeWo.Validation;
|
|
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.ViewModel
|
|
{
|
|
public class CustomerCostBearerRealtionVM : AbstractDCMapperVM<CustomerCostBearerRelationDC>
|
|
{
|
|
public static string PropertyName_CostBearer = "CostBearer";
|
|
|
|
public static string PropertyName_CostBearerString = "CostBearerString";
|
|
|
|
public static string PropertyName_Notice = "Notice";
|
|
|
|
public static string PropertyName_ReferenceNumber = "ReferenceNumber";
|
|
|
|
private CompactOrganisationDC _CostBearer;
|
|
|
|
private string _Notice;
|
|
|
|
private string _ReferenceNumber;
|
|
|
|
public CustomerCostBearerRealtionVM(CustomerCostBearerRelationDC pDC) : base(pDC, pDC.Customer2CostBearerOid == null)
|
|
{
|
|
}
|
|
|
|
public CompactOrganisationDC CostBearer
|
|
{
|
|
get { return this._CostBearer; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._CostBearer, value))
|
|
{
|
|
this._CostBearer = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.CostBearer, value), PropertyName_CostBearer);
|
|
this.FirePropertyChanged(PropertyName_CostBearer);
|
|
this.FirePropertyChanged(PropertyName_CostBearerString);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public string CostBearerString
|
|
{
|
|
get { return this._CostBearer.ToStringNullCheck(); } // validation workaround
|
|
set { }
|
|
}
|
|
|
|
public string Notice
|
|
{
|
|
get { return this._Notice; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._Notice, value))
|
|
{
|
|
this._Notice = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Notice, value), PropertyName_Notice);
|
|
this.FirePropertyChanged(PropertyName_Notice);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public string ReferenceNumber
|
|
{
|
|
get { return this._ReferenceNumber; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._ReferenceNumber, value))
|
|
{
|
|
this._ReferenceNumber = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.ReferenceNumber, value), PropertyName_ReferenceNumber);
|
|
this.FirePropertyChanged(PropertyName_ReferenceNumber);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void InitByDataContract(CustomerCostBearerRelationDC pDataContract)
|
|
{
|
|
if (!this.IsNew)
|
|
{
|
|
this._CostBearer = pDataContract.CostBearer;
|
|
this._Notice = pDataContract.Notice;
|
|
this._ReferenceNumber = pDataContract.ReferenceNumber;
|
|
}
|
|
}
|
|
|
|
protected override CustomerCostBearerRelationDC MapToDataContract(CustomerCostBearerRelationDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.CostBearer = this._CostBearer;
|
|
pDataContract.Notice = this._Notice;
|
|
pDataContract.ReferenceNumber = this._ReferenceNumber;
|
|
|
|
return pDataContract;
|
|
}
|
|
}
|
|
} |