77 lines
3.8 KiB
C#
77 lines
3.8 KiB
C#
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 WohnheimDC_Wohnheim : AbstractIDCEntityMapper<Wohnheim, WohnheimDC>
|
|
{
|
|
public override WohnheimDC MergeWithDC(Wohnheim pEntity, WohnheimDC pDataContract)
|
|
{
|
|
pDataContract.WohnheimOid = pEntity.Oid;
|
|
pDataContract.WohnheimName = pEntity.WohnheimName;
|
|
pDataContract.Strasse = pEntity.Strasse;
|
|
pDataContract.PLZ = pEntity.PLZ;
|
|
pDataContract.Ort = pEntity.Ort;
|
|
pDataContract.Bemerkung = pEntity.Bemerkung;
|
|
pDataContract.PflichtbesetzungStart = pEntity.PflichtbesetzungStart;
|
|
pDataContract.PflichtbesetzungEnde = pEntity.PflichtbesetzungEnde;
|
|
pDataContract.PflichtbesetzungEinblenden = pEntity.PflichtbesetzungEinblenden;
|
|
pDataContract.StandardZeilenanzahl = pEntity.StandardZeilenanzahl;
|
|
pDataContract.Sortierungsart = pEntity.Sortierungsart;
|
|
pDataContract.AbsteigendeSortierung = pEntity.AbsteigendeSortierung;
|
|
|
|
pDataContract.ActivationType = pEntity.IsActive;
|
|
|
|
pDataContract.RelatedEmployees = MapperFactory.EmployeeWohnheimRelDC_Employee2WohnheimMapper.MapToNewDCs(pEntity.Employee2WohnheimList);
|
|
pDataContract.RelatedCustomers = MapperFactory.CustomerWohnheimRelDC_Customer2WohnheimMapper.MapToNewDCs(pEntity.Customer2WohnheimList);
|
|
pDataContract.Wohneinheiten = MapperFactory.WohneinheitDC_Wohneinheit.MapToNewDCs(pEntity.Wohneinheiten);
|
|
|
|
var defs = DAOFactory.SearchDAO.GetVarFieldDefs(TableID.Wohnheim);
|
|
pDataContract.VarFields = MapperFactory.VarFieldDC_VarField.VarFieldMapToDCs(defs, pEntity.VarFieldValueList);
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
public override Wohnheim MergeWithEntity(WohnheimDC pDataContract, Wohnheim pEntity)
|
|
{
|
|
pEntity.Oid = pDataContract.WohnheimOid;
|
|
pEntity.WohnheimName = pDataContract.WohnheimName;
|
|
pEntity.Strasse = pDataContract.Strasse;
|
|
pEntity.PLZ = pDataContract.PLZ;
|
|
pEntity.Ort = pDataContract.Ort;
|
|
pEntity.Bemerkung = pDataContract.Bemerkung;
|
|
pEntity.IsActive = pDataContract.ActivationType;
|
|
pEntity.PflichtbesetzungStart = pDataContract.PflichtbesetzungStart;
|
|
pEntity.PflichtbesetzungEnde = pDataContract.PflichtbesetzungEnde;
|
|
pEntity.PflichtbesetzungEinblenden = pDataContract.PflichtbesetzungEinblenden;
|
|
pEntity.StandardZeilenanzahl = pDataContract.StandardZeilenanzahl;
|
|
pEntity.Sortierungsart = pDataContract.Sortierungsart;
|
|
pEntity.AbsteigendeSortierung = pDataContract.AbsteigendeSortierung;
|
|
|
|
pEntity.VarFieldValueList = MapperFactory.VarFieldDC_VarField.VarFieldMergeToEntity(pEntity.VarFieldValueList, pDataContract.VarFields, pEntity);
|
|
|
|
MapperFactory.EmployeeWohnheimRelDC_Employee2WohnheimMapper.MergeWithEntitys(pDataContract.RelatedEmployees, pEntity.Employee2WohnheimList);
|
|
MapperFactory.CustomerWohnheimRelDC_Customer2WohnheimMapper.MergeWithEntitys(pDataContract.RelatedCustomers, pEntity.Customer2WohnheimList);
|
|
MapperFactory.WohneinheitDC_Wohneinheit.MergeWithEntitys(pDataContract.Wohneinheiten, pEntity.Wohneinheiten, pEntity);
|
|
|
|
|
|
return pEntity;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(WohnheimDC pDC, Wohnheim pEntity)
|
|
{
|
|
if (pDC.WohnheimOid == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return pDC.WohnheimOid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |