98 lines
4.1 KiB
C#
98 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class WohneinheitDC_Wohneinheit : AbstractIDCEntityMapper<Wohneinheit, WohneinheitDC>
|
|
{
|
|
public override void MergeWithEntitys(IList<WohneinheitDC> pDataContractList, IList<Wohneinheit> pEntityList)
|
|
{
|
|
throw new NotImplementedException("Falscher Aufruf.");
|
|
}
|
|
|
|
public void MergeWithEntitys(IList<WohneinheitDC> pDataContractList, IList<Wohneinheit> pEntityList, Wohnheim parent)
|
|
{
|
|
base.MergeWithEntitys(pDataContractList, pEntityList);
|
|
|
|
pEntityList.DoForEach(x => x.Wohnheim = parent);
|
|
}
|
|
|
|
public override WohneinheitDC MergeWithDC(Wohneinheit pEntity, WohneinheitDC pDataContract)
|
|
{
|
|
pDataContract.Oid = pEntity.Oid;
|
|
pDataContract.Notice = pEntity.Notice;
|
|
pDataContract.Version = pEntity.Version;
|
|
|
|
pDataContract.Wohnname = pEntity.Wohnname;
|
|
pDataContract.Zimmername = pEntity.Zimmername;
|
|
pDataContract.Miete = pEntity.Miete;
|
|
pDataContract.Heizung = pEntity.Heizung;
|
|
pDataContract.Strom = pEntity.Strom;
|
|
pDataContract.Betriebskosten = pEntity.Betriebskosten;
|
|
pDataContract.SonstigeKosten = pEntity.SonstigeKosten;
|
|
pDataContract.Kaution = pEntity.Kaution;
|
|
pDataContract.QM = pEntity.QM;
|
|
pDataContract.Baujahr = pEntity.Baujahr;
|
|
pDataContract.Mobilierung = pEntity.Mobilierung;
|
|
pDataContract.Zusatznotiz = pEntity.Zusatznotiz;
|
|
pDataContract.Stock = pEntity.Stock;
|
|
|
|
if (pEntity.Belegungen is object && pEntity.Belegungen.Any())
|
|
pDataContract.Belegungen = MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MapToNewDCs(pEntity.Belegungen);
|
|
|
|
if (pEntity.Grundrisse is object && pEntity.Grundrisse.Any())
|
|
pDataContract.Grundrisse = MapperFactory.ImageDC_Image.MapToNewDCs(pEntity.Grundrisse);
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
public override Wohneinheit MergeWithEntity(WohneinheitDC pDataContract, Wohneinheit pEntity)
|
|
{
|
|
pEntity.Oid = pDataContract.Oid;
|
|
pEntity.Notice = pDataContract.Notice;
|
|
pEntity.Version = pDataContract.Version;
|
|
|
|
pEntity.Wohnname = pDataContract.Wohnname;
|
|
pEntity.Zimmername = pDataContract.Zimmername;
|
|
pEntity.Miete = pDataContract.Miete;
|
|
pEntity.Heizung = pDataContract.Heizung;
|
|
pEntity.Strom = pDataContract.Strom;
|
|
pEntity.Betriebskosten = pDataContract.Betriebskosten;
|
|
pEntity.SonstigeKosten = pDataContract.SonstigeKosten;
|
|
pEntity.Kaution = pDataContract.Kaution;
|
|
pEntity.QM = pDataContract.QM;
|
|
pEntity.Baujahr = pDataContract.Baujahr;
|
|
pEntity.Mobilierung = pDataContract.Mobilierung;
|
|
pEntity.Zusatznotiz = pDataContract.Zusatznotiz;
|
|
pEntity.Stock = pDataContract.Stock;
|
|
|
|
if (pEntity.Belegungen is null)
|
|
pEntity.Belegungen = new List<WohneinheitBelegung>();
|
|
|
|
MapperFactory.WohneinheitBelegungDC_WohneinheitBelegung.MergeWithEntitys(pDataContract.Belegungen, pEntity.Belegungen, pEntity);
|
|
|
|
if (pEntity.Grundrisse is null)
|
|
pEntity.Grundrisse = new List<Image>();
|
|
|
|
MapperFactory.ImageDC_Image.MergeWithEntitys(pDataContract.Grundrisse, pEntity.Grundrisse);
|
|
|
|
return pEntity;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(WohneinheitDC pDC, Wohneinheit pEntity)
|
|
{
|
|
if (pDC.Oid == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return pDC.Oid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |