WohneinheitVM

+ Ebenen berücksichtigt:
- Verweise auf Parents: Oid
- Verweise auf Childs: Objekte
This commit is contained in:
2024-07-15 14:39:49 +02:00
parent 5f634b3790
commit e7e0396d3f
12 changed files with 330 additions and 65 deletions

View File

@@ -1039,6 +1039,8 @@
<Compile Include="ViewModel\AdditionalServiceGroupOfPeopleVM.cs" />
<Compile Include="ViewModel\AdditionalServiceRegionVM.cs" />
<Compile Include="ViewModel\AdditionalServiceVM.cs" />
<Compile Include="ViewModel\ListViewModel\WohneinheitListVM.cs" />
<Compile Include="ViewModel\WohneinheitVM.cs" />
<Compile Include="ViewModel\DienstInfoVM.cs" />
<Compile Include="ViewModel\BudgetVM.cs" />
<Compile Include="ViewModel\DocumentTreeItemVM.cs" />

View File

@@ -0,0 +1,15 @@
using System.Collections.Generic;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
namespace BeWo.ViewModel.ListViewModel
{
public class WohneinheitListVM : AbstractDCListMapperVM<WohneinheitDC, WohneinheitVM>
{
public WohneinheitListVM(List<WohneinheitDC> pDCs): base(pDCs)
{
}
}
}

View File

@@ -0,0 +1,279 @@
using BS.Shared;
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 WohneinheitVM : AbstractDCMapperVM<WohneinheitDC>
{
private long? _Oid;
private long? _Version;
private string _Notice;
private long _WohnheimOid;
private string _Wohnname;
private string _Zimmername;
private decimal _Miete;
private decimal _Heizung;
private decimal _Strom;
private decimal _Betriebskosten;
private decimal _SonstigeKosten;
private decimal _QM;
private int _Baujahr;
private string _Mobilierung;
private string _Zusatznotiz;
private string _Stock;
private List<WohneinheitBelegungDC> _Belegungen;
public WohneinheitVM(WohneinheitDC dc) : base(dc, dc.Oid == null)
{
}
public long WohnheimOid
{
get { return _WohnheimOid; }
set
{
if (AreDifferent(WohnheimOid, value))
{
_WohnheimOid = value;
StoreDirtyInformation(AreDifferent(DataContract.WohnheimOid, value), nameof(WohnheimOid));
FirePropertyChanged(nameof(WohnheimOid));
}
}
}
public string Wohnname
{
get { return _Wohnname; }
set
{
if (AreDifferent(Wohnname, value))
{
_Wohnname = value;
StoreDirtyInformation(AreDifferent(DataContract.Wohnname, value), nameof(Wohnname));
FirePropertyChanged(nameof(Wohnname));
}
}
}
public string Zimmername
{
get { return _Zimmername; }
set
{
if (AreDifferent(Zimmername, value))
{
_Zimmername = value;
StoreDirtyInformation(AreDifferent(DataContract.Zimmername, value), nameof(Zimmername));
FirePropertyChanged(nameof(Zimmername));
}
}
}
public decimal Miete
{
get { return _Miete; }
set
{
if (AreDifferent(Miete, value))
{
_Miete = value;
StoreDirtyInformation(AreDifferent(DataContract.Miete, value), nameof(Miete));
FirePropertyChanged(nameof(Miete));
}
}
}
public decimal Heizung
{
get { return _Heizung; }
set
{
if (AreDifferent(Heizung, value))
{
_Heizung = value;
StoreDirtyInformation(AreDifferent(DataContract.Heizung, value), nameof(Heizung));
FirePropertyChanged(nameof(Heizung));
}
}
}
public decimal Strom
{
get { return _Strom; }
set
{
if (AreDifferent(Strom, value))
{
_Strom = value;
StoreDirtyInformation(AreDifferent(DataContract.Strom, value), nameof(Strom));
FirePropertyChanged(nameof(Strom));
}
}
}
public decimal Betriebskosten
{
get { return _Betriebskosten; }
set
{
if (AreDifferent(Betriebskosten, value))
{
_Betriebskosten = value;
StoreDirtyInformation(AreDifferent(DataContract.Betriebskosten, value), nameof(Betriebskosten));
FirePropertyChanged(nameof(Betriebskosten));
}
}
}
public decimal SonstigeKosten
{
get { return _SonstigeKosten; }
set
{
if (AreDifferent(SonstigeKosten, value))
{
_SonstigeKosten = value;
StoreDirtyInformation(AreDifferent(DataContract.SonstigeKosten, value), nameof(SonstigeKosten));
FirePropertyChanged(nameof(SonstigeKosten));
}
}
}
public decimal QM
{
get { return _QM; }
set
{
if (AreDifferent(QM, value))
{
_QM = value;
StoreDirtyInformation(AreDifferent(DataContract.QM, value), nameof(QM));
FirePropertyChanged(nameof(QM));
}
}
}
public int Baujahr
{
get { return _Baujahr; }
set
{
if (AreDifferent(Baujahr, value))
{
_Baujahr = value;
StoreDirtyInformation(AreDifferent(DataContract.Baujahr, value), nameof(Baujahr));
FirePropertyChanged(nameof(Baujahr));
}
}
}
public string Mobilierung
{
get { return _Mobilierung; }
set
{
if (AreDifferent(Mobilierung, value))
{
_Mobilierung = value;
StoreDirtyInformation(AreDifferent(DataContract.Mobilierung, value), nameof(Mobilierung));
FirePropertyChanged(nameof(Mobilierung));
}
}
}
public string Zusatznotiz
{
get { return _Zusatznotiz; }
set
{
if (AreDifferent(Zusatznotiz, value))
{
_Zusatznotiz = value;
StoreDirtyInformation(AreDifferent(DataContract.Zusatznotiz, value), nameof(Zusatznotiz));
FirePropertyChanged(nameof(Zusatznotiz));
}
}
}
public string Stock
{
get { return _Stock; }
set
{
if (AreDifferent(Stock, value))
{
_Stock = value;
StoreDirtyInformation(AreDifferent(DataContract.Stock, value), nameof(Stock));
FirePropertyChanged(nameof(Stock));
}
}
}
public List<WohneinheitBelegungDC> Belegungen
{
get { return _Belegungen; }
set
{
if (AreDifferent(Belegungen, value))
{
_Belegungen = value;
StoreDirtyInformation(AreDifferent(DataContract.Belegungen, value), nameof(Belegungen));
FirePropertyChanged(nameof(Belegungen));
}
}
}
protected override void InitByDataContract(WohneinheitDC pDataContract)
{
_Oid = pDataContract.Oid;
_Version = pDataContract.Version;
_Notice = pDataContract.Notice;
_Wohnname = pDataContract.Wohnname;
_Zimmername = pDataContract.Zimmername;
_Miete = pDataContract.Miete;
_Heizung = pDataContract.Heizung;
_Strom = pDataContract.Strom;
_Betriebskosten = pDataContract.Betriebskosten;
_SonstigeKosten = pDataContract.SonstigeKosten;
_QM = pDataContract.QM;
_Baujahr = pDataContract.Baujahr;
_Mobilierung = pDataContract.Mobilierung;
_Zusatznotiz = pDataContract.Zusatznotiz;
_Stock = pDataContract.Stock;
_WohnheimOid = pDataContract.WohnheimOid;
_Belegungen = pDataContract.Belegungen;
}
protected override WohneinheitDC MapToDataContract(WohneinheitDC bDataContract, bool doCommit)
{
bDataContract.Oid = _Oid;
bDataContract.Notice = _Notice;
bDataContract.Version = _Version;
bDataContract.Wohnname = _Wohnname;
bDataContract.Zimmername = _Zimmername;
bDataContract.Miete = _Miete;
bDataContract.Heizung = _Heizung;
bDataContract.Strom = _Strom;
bDataContract.Betriebskosten = _Betriebskosten;
bDataContract.SonstigeKosten = _SonstigeKosten;
bDataContract.QM = _QM;
bDataContract.Baujahr = _Baujahr;
bDataContract.Mobilierung = _Mobilierung;
bDataContract.Zusatznotiz = _Zusatznotiz;
bDataContract.Stock = _Stock;
bDataContract.WohnheimOid = _WohnheimOid;
bDataContract.Belegungen = _Belegungen;
return bDataContract;
}
}
}

View File

@@ -8,7 +8,7 @@ namespace BeWo.Data.Entities
{
public class Wohneinheit : BeWoEntityBase
{
public static string PropertyName_Wohnheim = nameof(Wohnheim);
public static string PropertyName_Wohnheim = nameof(WohnheimOid);
public static string PropertyName_Wohnname = nameof(Wohnname);
public static string PropertyName_Zimmername = nameof(Zimmername);
public static string PropertyName_Miete = nameof(Miete);
@@ -23,7 +23,7 @@ namespace BeWo.Data.Entities
public static string PropertyName_Stock = nameof(Stock);
public static string PropertyName_Belegungen = nameof(Belegungen);
private Wohnheim _Wohnheim;
private long _WohnheimOid;
private string _Wohnname;
private string _Zimmername;
private decimal _Miete;
@@ -43,18 +43,18 @@ namespace BeWo.Data.Entities
_Tid = BS.Shared.TableID.Wohneinheit;
}
public virtual Wohnheim Wohnheim
public virtual long WohnheimOid
{
get
{
return this._Wohnheim;
return _WohnheimOid;
}
set
{
if (this.AreDifferent(this._Wohnheim, value))
if (AreDifferent(this._WohnheimOid, value))
{
this._Wohnheim = value;
_WohnheimOid = value;
}
}
}

View File

@@ -8,14 +8,14 @@ namespace BeWo.Data.Entities
{
public class WohneinheitBelegung : BeWoEntityBase
{
public static string PropertyName_Customer = nameof(Customer);
public static string PropertyName_Wohneinheit = nameof(Wohneinheit);
public static string PropertyName_Customer = nameof(CustomerOid);
public static string PropertyName_Wohneinheit = nameof(WohneinheitOid);
public static string PropertyName_StartDate = nameof(StartDate);
public static string PropertyName_EndDate = nameof(EndDate);
public static string PropertyName_Kommentar = nameof(Kommentar);
private Customer _Customer;
private Wohneinheit _Wohneinheit;
private long _CustomerOid;
private long _WohneinheitOid;
private DateTime _StartDate;
private DateTime? _EndDate;
private string _Kommentar;
@@ -25,33 +25,33 @@ namespace BeWo.Data.Entities
_Tid = BS.Shared.TableID.WohneinheitBelegung;
}
public virtual Customer Customer
public virtual long CustomerOid
{
get
{
return this._Customer;
return this._CustomerOid;
}
set
{
if (this.AreDifferent(this._Customer, value))
if (this.AreDifferent(this._CustomerOid, value))
{
this._Customer = value;
this._CustomerOid = value;
}
}
}
public virtual Wohneinheit Wohneinheit
public virtual long WohneinheitOid
{
get
{
return this._Wohneinheit;
return this._WohneinheitOid;
}
set
{
if (this.AreDifferent(this._Wohneinheit, value))
if (this.AreDifferent(this._WohneinheitOid, value))
{
this._Wohneinheit = value;
this._WohneinheitOid = value;
}
}
}

View File

@@ -25,7 +25,9 @@
<property name="Mobilierung"/>
<property name="Zusatznotiz"/>
<property name="Stock"/>
<many-to-one name="Wohnheim" column="WohnheimOid" class="BeWo.Data.Entities.Wohnheim,BeWo.Data" cascade="all-delete-orphan" fetch="join"/>
<property name="WohnheimOid"/>
<!--<many-to-one name="Wohnheim" column="WohnheimOid" class="BeWo.Data.Entities.Wohnheim,BeWo.Data" cascade="all-delete-orphan" fetch="join"/>-->
<bag name="Belegungen" table="Wohneinheitbelegung" generic="true" cascade="all-delete-orphan" batch-size="250">
<key column="WohneinheitOid" />
<one-to-many class="BeWo.Data.Entities.WohneinheitBelegung,BeWo.Data" />

View File

@@ -16,7 +16,9 @@
<property name="StartDate"/>
<property name="EndDate"/>
<property name="Kommentar"/>
<many-to-one name="Wohneinheit" column="WohneinheitOid" class="BeWo.Data.Entities.Wohneinheit,BeWo.Data" cascade="none" fetch="join"/>
<many-to-one name="Customer" column="CustomerOid" class="BeWo.Data.Entities.Customer,BeWo.Data" cascade="none" fetch="join"/>
<property name="WohneinheitOid"/>
<property name="CustomerOid"/>
<!--<many-to-one name="Wohneinheit" column="WohneinheitOid" class="BeWo.Data.Entities.Wohneinheit,BeWo.Data" cascade="none" fetch="join"/>
<many-to-one name="Customer" column="CustomerOid" class="BeWo.Data.Entities.Customer,BeWo.Data" cascade="none" fetch="join"/>-->
</class>
</hibernate-mapping>

View File

@@ -13,17 +13,12 @@ namespace BeWo.Service.DCEntityMapper
{
public override WohneinheitBelegungDC MergeWithDC(WohneinheitBelegung pEntity, WohneinheitBelegungDC pDataContract)
{
pDataContract.Customer = MapperFactory.CustomerDC_Customer.MapToNewDC(pEntity.Customer);
pDataContract.Wohneinheit = pEntity.Wohneinheit.Oid.Value;
pDataContract.CustomerOid = pEntity.CustomerOid;
pDataContract.WohneinheitOid = pEntity.WohneinheitOid;
pDataContract.Oid = pEntity.Oid;
pDataContract.IsActive = pEntity.IsActive;
pDataContract.Notice = pEntity.Notice;
pDataContract.InsTs = pEntity.InsTs;
pDataContract.InsUser = pEntity.InsUser;
pDataContract.Version = pEntity.Version;
pDataContract.UdpUser = pEntity.UdpUser;
pDataContract.SystemEntryID = pEntity.SystemEntryID;
pDataContract.StartDate = pEntity.StartDate;
pDataContract.EndDate = pEntity.EndDate;
pDataContract.Kommentar = pEntity.Kommentar;
@@ -34,19 +29,14 @@ namespace BeWo.Service.DCEntityMapper
public override WohneinheitBelegung MergeWithEntity(WohneinheitBelegungDC pDataContract, WohneinheitBelegung pEntity)
{
pEntity.Oid = pDataContract.Oid;
pEntity.IsActive = pDataContract.IsActive;
pEntity.Notice = pDataContract.Notice;
pEntity.InsTs = pDataContract.InsTs;
pEntity.InsUser = pDataContract.InsUser;
pEntity.Version = pDataContract.Version;
pEntity.UdpUser = pDataContract.UdpUser;
pEntity.SystemEntryID = pDataContract.SystemEntryID;
pEntity.StartDate = pDataContract.StartDate;
pEntity.EndDate = pDataContract.EndDate;
pEntity.Kommentar = pDataContract.Kommentar;
pEntity.Customer = DAOFactory.GenericDAO.GetByID<Customer>(pDataContract.Customer.CustomerOid.Value);
pEntity.Wohneinheit = DAOFactory.GenericDAO.GetByID<Wohneinheit>(pDataContract.Wohneinheit);
pEntity.CustomerOid = pDataContract.CustomerOid;
pEntity.WohneinheitOid = pDataContract.WohneinheitOid;
return pEntity;
}

View File

@@ -13,13 +13,8 @@ namespace BeWo.Service.DCEntityMapper
public override WohneinheitDC MergeWithDC(Wohneinheit pEntity, WohneinheitDC pDataContract)
{
pDataContract.Oid = pEntity.Oid;
pDataContract.IsActive = pEntity.IsActive;
pDataContract.Notice = pEntity.Notice;
pDataContract.InsTs = pEntity.InsTs;
pDataContract.InsUser = pEntity.InsUser;
pDataContract.Version = pEntity.Version;
pDataContract.UdpUser = pEntity.UdpUser;
pDataContract.SystemEntryID = pEntity.SystemEntryID;
pDataContract.Wohnname = pEntity.Wohnname;
pDataContract.Zimmername = pEntity.Zimmername;
@@ -34,7 +29,7 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.Zusatznotiz = pEntity.Zusatznotiz;
pDataContract.Stock = pEntity.Stock;
pDataContract.Wohnheim = MapperFactory.WohnheimDC_Wohnheim.MapToNewDC(pEntity.Wohnheim);
pDataContract.WohnheimOid = pEntity.WohnheimOid;
if (pEntity.Belegungen is object && pEntity.Belegungen.Any())
pDataContract.Belegungen = MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MapToNewDCs(pEntity.Belegungen);
@@ -45,13 +40,8 @@ namespace BeWo.Service.DCEntityMapper
public override Wohneinheit MergeWithEntity(WohneinheitDC pDataContract, Wohneinheit pEntity)
{
pEntity.Oid = pDataContract.Oid;
pEntity.IsActive = pDataContract.IsActive;
pEntity.Notice = pDataContract.Notice;
pEntity.InsTs = pDataContract.InsTs;
pEntity.InsUser = pDataContract.InsUser;
pEntity.Version = pDataContract.Version;
pEntity.UdpUser = pDataContract.UdpUser;
pEntity.SystemEntryID = pDataContract.SystemEntryID;
pEntity.Wohnname = pDataContract.Wohnname;
pEntity.Zimmername = pDataContract.Zimmername;
@@ -66,7 +56,7 @@ namespace BeWo.Service.DCEntityMapper
pEntity.Zusatznotiz = pDataContract.Zusatznotiz;
pEntity.Stock = pDataContract.Stock;
pEntity.Wohnheim = DAOFactory.GenericDAO.LoadByID<Wohnheim>(pDataContract.Wohnheim.WohnheimOid.Value);
pEntity.WohnheimOid =pDataContract.WohnheimOid;
if (pEntity.Belegungen is null)
pEntity.Belegungen = new List<WohneinheitBelegung>();

View File

@@ -12,25 +12,10 @@ namespace BS.Shared.DataContracts
[DataMember]
public long? Oid { get; set; }
[DataMember]
public ActivationTypeId IsActive { get; set; }
[DataMember]
public string Notice { get; set; }
[DataMember]
public DateTime? InsTs { get; set; }
[DataMember]
public string InsUser { get; set; }
[DataMember]
public long? Version { get; set; }
[DataMember]
public string UdpUser { get; set; }
[DataMember]
public SystemEntryID? SystemEntryID { get; set; }
}
}

View File

@@ -9,8 +9,8 @@ namespace BS.Shared.DataContracts
{
public class WohneinheitBelegungDC : DataContract
{
[DataMember] public long Wohneinheit { get; set; }
[DataMember] public CustomerDC Customer { get; set; }
[DataMember] public long WohneinheitOid { get; set; }
[DataMember] public long CustomerOid { get; set; }
[DataMember] public DateTime StartDate { get; set; }
[DataMember] public DateTime? EndDate { get; set; }
[DataMember] public string Kommentar { get; set; }

View File

@@ -9,7 +9,7 @@ namespace BS.Shared.DataContracts
{
public class WohneinheitDC : DataContract
{
[DataMember] public WohnheimDC Wohnheim { get; set; }
[DataMember] public long WohnheimOid { get; set; }
[DataMember] public string Wohnname { get; set; }
[DataMember] public string Zimmername { get; set; }
[DataMember] public decimal Miete { get; set; }