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

137 lines
4.6 KiB
C#

using BeWo.Validation;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
namespace BeWo.ViewModel
{
public class WohnheimCustomerRelationVM : AbstractDCMapperVM<WohnheimCustomerRelationDC>
{
public static string PropertyName_Wohnheim = "Wohnheim";
public static string PropertyName_WohnheimString = "WohnheimString";
public static string PropertyName_Customer = "Customer";
public static string PropertyName_CustomerString = "CustomerString";
public static string PropertyName_Notice = "Notice";
public static string PropertyName_Role = "Role";
private CompactWohnheimDC _Wohnheim;
private CompactCustomerDC _Customer;
private string _Notice;
private ValueListEntryDC _Role;
public WohnheimCustomerRelationVM(WohnheimCustomerRelationDC pDC)
: base(pDC, pDC.Customer2WohnheimOid == null)
{
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public CompactWohnheimDC Wohnheim
{
get { return this._Wohnheim; }
set
{
if (this.AreDifferent(this._Wohnheim, value))
{
this._Wohnheim = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Wohnheim, value), PropertyName_Wohnheim);
this.FirePropertyChanged(PropertyName_Wohnheim);
this.FirePropertyChanged(PropertyName_WohnheimString);
}
}
}
[ValidationAttribute(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string WohnheimString
{
get { return this._Wohnheim.ToStringNullCheck(); } // Validation Workaround
set { }
}
[ValidationAttribute(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public CompactCustomerDC Customer
{
get { return this._Customer; }
set
{
if (this.AreDifferent(this._Customer, value))
{
this._Customer = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Customer, value), PropertyName_Customer);
this.FirePropertyChanged(PropertyName_Customer);
this.FirePropertyChanged(PropertyName_CustomerString);
}
}
}
[ValidationAttribute(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string CustomerString
{
get { return this._Customer.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 ValueListEntryDC Role
{
get { return this._Role; }
set
{
if (this.AreDifferent(this._Role, value))
{
this._Role = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.RelationRole, value), PropertyName_Role);
this.FirePropertyChanged(PropertyName_Role);
}
}
}
protected override void InitByDataContract(WohnheimCustomerRelationDC pDataContract)
{
if (!this.IsNew)
{
this._Customer = pDataContract.Customer;
this._Wohnheim = pDataContract.Wohnheim;
this._Role = pDataContract.RelationRole;
this._Notice = pDataContract.Notice;
}
}
protected override WohnheimCustomerRelationDC MapToDataContract(WohnheimCustomerRelationDC pDataContract, bool doCommit)
{
pDataContract.Customer = this._Customer;
pDataContract.Wohnheim = this._Wohnheim;
pDataContract.RelationRole = this._Role;
pDataContract.Notice = this._Notice;
return pDataContract;
}
}
}