Files
BeWoPlaner/BeWo/ViewModel/RegelmaessigerDienstVM.cs

164 lines
5.6 KiB
C#

using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.ViewModel
{
public class RegelmaessigerDienstVM : AbstractDCMapperVM<RegelmaessigerDienstDC>
{
private long _EmployeeOid;
private long _WohnheimOid;
private DienstInfoDC _Dienst;
private int _Zeile;
private string _Wochentag;
private string _Startzeit;
private string _Endzeit;
private double _DauerInStunden;
public RegelmaessigerDienstVM(RegelmaessigerDienstDC regelmaessigerDienstDC) : base(regelmaessigerDienstDC, regelmaessigerDienstDC.Oid == null)
{ }
public long EmployeeOid
{
get { return _EmployeeOid; }
set
{
if (this.AreDifferent(this._EmployeeOid, value))
{
this._EmployeeOid = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.EmployeeOid, value), nameof(_EmployeeOid));
this.FirePropertyChanged(nameof(_EmployeeOid));
}
}
}
public long WohnheimOid
{
get { return _WohnheimOid; }
set
{
if (this.AreDifferent(this._WohnheimOid, value))
{
this._WohnheimOid = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.WohnheimOid, value), nameof(_WohnheimOid));
this.FirePropertyChanged(nameof(_WohnheimOid));
}
}
}
public DienstInfoDC Dienst
{
get { return _Dienst; }
set
{
if (this.AreDifferent(this._Dienst, value))
{
this._Dienst = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.DienstOid, value.Oid), nameof(_Dienst.Oid));
this.FirePropertyChanged(nameof(_Dienst));
}
}
}
public int Zeile
{
get { return _Zeile; }
set
{
if (this.AreDifferent(this._Zeile, value))
{
this._Zeile = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Zeile, value), nameof(_Zeile));
this.FirePropertyChanged(nameof(_Zeile));
}
}
}
public string Wochentag
{
get { return _Wochentag; }
set
{
if (this.AreDifferent(this._Wochentag, value))
{
this._Wochentag = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Wochentag, value), nameof(_Wochentag));
this.FirePropertyChanged(nameof(_Wochentag));
}
}
}
public string Startzeit
{
get { return _Startzeit; }
set
{
if (this.AreDifferent(this._Startzeit, value))
{
this._Startzeit = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Startzeit, value), nameof(_Startzeit));
this.FirePropertyChanged(nameof(_Startzeit));
}
}
}
public string Endzeit
{
get { return _Endzeit; }
set
{
if (this.AreDifferent(this._Endzeit, value))
{
this._Endzeit = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Endzeit, value), nameof(_Endzeit));
this.FirePropertyChanged(nameof(_Endzeit));
}
}
}
public double DauerInStunden
{
get { return _DauerInStunden; }
set
{
if (this.AreDifferent(this._DauerInStunden, value))
{
this._DauerInStunden = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.DauerInStunden, value), nameof(_DauerInStunden));
this.FirePropertyChanged(nameof(_DauerInStunden));
}
}
}
protected override void InitByDataContract(RegelmaessigerDienstDC pDataContract)
{
EmployeeOid = pDataContract.EmployeeOid;
WohnheimOid = pDataContract.WohnheimOid;
//Dienst.Oid = pDataContract.DienstOid;
Zeile = pDataContract.Zeile;
Wochentag = pDataContract.Wochentag;
Startzeit = pDataContract.Startzeit;
Endzeit = pDataContract.Endzeit;
DauerInStunden = pDataContract.DauerInStunden;
}
protected override RegelmaessigerDienstDC MapToDataContract(RegelmaessigerDienstDC pDataContract, bool doCommit)
{
pDataContract.EmployeeOid = EmployeeOid;
pDataContract.WohnheimOid = WohnheimOid;
pDataContract.DienstOid = Dienst.Oid.Value;
pDataContract.Zeile = Zeile;
pDataContract.Wochentag = Wochentag;
pDataContract.Startzeit = Startzeit;
pDataContract.Endzeit = Endzeit;
pDataContract.DauerInStunden = DauerInStunden;
return pDataContract;
}
public string DarstellungInPopUp
{
get
{
return Startzeit + " Uhr - " + Endzeit + " Uhr (" + Wochentag + "s)";
}
}
}
}