167 lines
5.0 KiB
C#
167 lines
5.0 KiB
C#
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BeWo.Validation;
|
|
using BS.Shared.DataContracts.Compact;
|
|
|
|
namespace BeWo.ViewModel
|
|
{
|
|
public class ArbeitszeitEintragVM : AbstractDCMapperVM<ArbeitszeitEintragDC>
|
|
{
|
|
public static string PropertyName_UhrzeitVon = "UhrzeitVon";
|
|
|
|
public static string PropertyName_UhrzeitBis = "UhrzeitBis";
|
|
|
|
public static string PropertyName_Tag = "Tag";
|
|
|
|
public static string PropertyName_Notice = "Notice";
|
|
|
|
public static string PropertyName_Klient = "Klient";
|
|
|
|
public static string PropertyName_CompactCustomer = "CompactCustomer";
|
|
|
|
public static string PropertyName_CompactEmployee = "Employee";
|
|
|
|
private string _UhrzeitVon;
|
|
|
|
private string _UhrzeitBis;
|
|
|
|
private AppointmentDayOfWeek _Tag;
|
|
|
|
private string _Notice;
|
|
|
|
private CompactCustomerDC _CompactCustomer;
|
|
|
|
private CompactEmployeeDC _CompactEmployee;
|
|
|
|
public ArbeitszeitEintragVM(ArbeitszeitEintragDC pDC) : base(pDC, pDC.ArbeitszeitEintragOid == null)
|
|
{
|
|
}
|
|
|
|
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public string UhrzeitVon
|
|
{
|
|
get => _UhrzeitVon;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_UhrzeitVon, value))
|
|
{
|
|
_UhrzeitVon = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.UhrzeitVon, value), PropertyName_UhrzeitVon);
|
|
FirePropertyChanged(PropertyName_UhrzeitVon);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
|
|
public string UhrzeitBis
|
|
{
|
|
get => _UhrzeitBis;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_UhrzeitBis, value))
|
|
{
|
|
_UhrzeitBis = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.UhrzeitBis, value), PropertyName_UhrzeitBis);
|
|
FirePropertyChanged(PropertyName_UhrzeitBis);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public AppointmentDayOfWeek Tag
|
|
{
|
|
get => _Tag;
|
|
|
|
set
|
|
{
|
|
if(AreDifferent(_Tag, value))
|
|
{
|
|
_Tag = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Tag, value), PropertyName_Tag);
|
|
FirePropertyChanged(PropertyName_Tag);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Notice
|
|
{
|
|
get => _Notice;
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_Notice, value))
|
|
{
|
|
_Notice = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Notice, value), PropertyName_Notice);
|
|
|
|
FirePropertyChanged(PropertyName_Notice);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Klient => _CompactCustomer?.FullName;
|
|
|
|
public CompactCustomerDC CompactCustomer
|
|
{
|
|
get => _CompactCustomer;
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_CompactCustomer, value))
|
|
{
|
|
_CompactCustomer = value;
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.CustomerOid, value.CustomerOid), PropertyName_CompactCustomer);
|
|
|
|
FirePropertyChanged(nameof(CompactCustomer));
|
|
FirePropertyChanged(nameof(Klient));
|
|
}
|
|
}
|
|
}
|
|
|
|
public CompactEmployeeDC Employee
|
|
{
|
|
get => _CompactEmployee;
|
|
|
|
set
|
|
{
|
|
if (AreDifferent(_CompactEmployee, value))
|
|
{
|
|
_CompactEmployee = value;
|
|
StoreDirtyInformation(AreDifferent(DataContract.Employee, value), PropertyName_CompactEmployee);
|
|
FirePropertyChanged(PropertyName_CompactEmployee);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
protected override void InitByDataContract(ArbeitszeitEintragDC pDataContract)
|
|
{
|
|
_Tag = pDataContract.Tag;
|
|
_UhrzeitVon = pDataContract.UhrzeitVon;
|
|
_UhrzeitBis = pDataContract.UhrzeitBis;
|
|
_Notice = pDataContract.Notice;
|
|
_CompactEmployee = pDataContract.Employee;
|
|
_CompactCustomer = pDataContract.Customer;
|
|
}
|
|
|
|
protected override ArbeitszeitEintragDC MapToDataContract(ArbeitszeitEintragDC pDataContract, bool doCommit)
|
|
{
|
|
pDataContract.UhrzeitVon = _UhrzeitVon;
|
|
pDataContract.UhrzeitBis = _UhrzeitBis;
|
|
pDataContract.Tag = _Tag;
|
|
pDataContract.Notice = _Notice;
|
|
pDataContract.Employee = _CompactEmployee;
|
|
pDataContract.Customer = _CompactCustomer;
|
|
|
|
if(_CompactCustomer != null)
|
|
{
|
|
pDataContract.CustomerOid = _CompactCustomer.CustomerOid;
|
|
}
|
|
|
|
return pDataContract;
|
|
}
|
|
}
|
|
} |