155 lines
5.3 KiB
C#
155 lines
5.3 KiB
C#
using BeWo.Validation;
|
|
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.ViewModel
|
|
{
|
|
public class CustomerEmployeeRelationVM : AbstractDCMapperVM<CustomerEmployeeRelationDC>
|
|
{
|
|
public static string PropertyName_Customer = "Customer";
|
|
|
|
public static string PropertyName_CustomerString = "CustomerString";
|
|
|
|
public static string PropertyName_Employee = "Employee";
|
|
|
|
public static string PropertyName_EmployeeString = "EmployeeString";
|
|
|
|
public static string PropertyName_Notice = "Notice";
|
|
|
|
public static string PropertyName_Role = "Role";
|
|
|
|
public static string PropertyName_Chatpartner = "Chatpartner";
|
|
|
|
private CompactCustomerDC _Customer;
|
|
|
|
private CompactEmployeeDC _Employee;
|
|
|
|
private string _Notice;
|
|
|
|
private ValueListEntryDC _Role;
|
|
|
|
private bool _Chatpartner;
|
|
|
|
public CustomerEmployeeRelationVM(CustomerEmployeeRelationDC pDC) : base(pDC, pDC.Employee2CustomerOid == null)
|
|
{
|
|
}
|
|
|
|
[Validation(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 { }
|
|
}
|
|
|
|
[ValidationAttribute(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public CompactEmployeeDC Employee
|
|
{
|
|
get { return this._Employee; }
|
|
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._Employee, value))
|
|
{
|
|
this._Employee = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Employee, value), PropertyName_Employee);
|
|
this.FirePropertyChanged(PropertyName_Employee);
|
|
this.FirePropertyChanged(PropertyName_EmployeeString);
|
|
}
|
|
}
|
|
}
|
|
|
|
[ValidationAttribute(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public string EmployeeString
|
|
{
|
|
get { return this._Employee.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);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool Chatpartner
|
|
{
|
|
get { return _Chatpartner; }
|
|
set
|
|
{
|
|
if (this.AreDifferent(this._Chatpartner, value))
|
|
{
|
|
_Chatpartner = value;
|
|
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Chatpartner, value), PropertyName_Chatpartner);
|
|
this.FirePropertyChanged(PropertyName_Chatpartner);
|
|
}
|
|
}
|
|
}
|
|
|
|
[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(CustomerEmployeeRelationDC pDataContract)
|
|
{
|
|
if (!this.IsNew)
|
|
{
|
|
this._Employee = pDataContract.Employee;
|
|
this._Customer = pDataContract.Customer;
|
|
this._Role = pDataContract.RelationRole;
|
|
this._Notice = pDataContract.Notice;
|
|
_Chatpartner = pDataContract.Chatpartner;
|
|
}
|
|
}
|
|
|
|
protected override CustomerEmployeeRelationDC MapToDataContract(CustomerEmployeeRelationDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.Employee = this._Employee;
|
|
pDataContract.Customer = this._Customer;
|
|
pDataContract.RelationRole = this._Role;
|
|
pDataContract.Notice = this._Notice;
|
|
pDataContract.Chatpartner = _Chatpartner;
|
|
|
|
return pDataContract;
|
|
}
|
|
}
|
|
} |