53 lines
2.0 KiB
C#
53 lines
2.0 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class WohnheimCustomerRelDC_Customer2WohnheimMapper : AbstractIDCEntityMapper<Customer2Wohnheim, WohnheimCustomerRelationDC>
|
|
{
|
|
public override WohnheimCustomerRelationDC MergeWithDC(Customer2Wohnheim pEntity, WohnheimCustomerRelationDC pDataContract)
|
|
{
|
|
pDataContract.Customer = MapperFactory.CompactCustomerDC_Customer.MapToNewDC(pEntity.Customer);
|
|
pDataContract.Wohnheim = MapperFactory.CompactWohnheimDC_Wohnheim.MapToNewDC(pEntity.Wohnheim);
|
|
pDataContract.Customer2WohnheimOid = pEntity.Oid;
|
|
pDataContract.Customer2WohnheimVersion = pEntity.Version;
|
|
pDataContract.Notice = pEntity.Notice;
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
public override Customer2Wohnheim MergeWithEntity(WohnheimCustomerRelationDC pDataContract, Customer2Wohnheim pEntity)
|
|
{
|
|
this.ConcurrencyCheck(pDataContract.Customer2WohnheimVersion, pEntity);
|
|
|
|
|
|
if (pDataContract.Customer != null)
|
|
{
|
|
pEntity.Customer = DAOFactory.GenericDAO.LoadByID<Customer>(pDataContract.Customer.CustomerOid);
|
|
}
|
|
|
|
if (pDataContract.Wohnheim != null)
|
|
{
|
|
pEntity.Wohnheim = DAOFactory.GenericDAO.LoadByID<Wohnheim>(pDataContract.Wohnheim.WohnheimOid);
|
|
}
|
|
|
|
pEntity.Oid = pDataContract.Customer2WohnheimOid;
|
|
pEntity.Notice = pDataContract.Notice;
|
|
|
|
return pEntity;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(WohnheimCustomerRelationDC pDC, Customer2Wohnheim pEntity)
|
|
{
|
|
if (pDC.Customer2WohnheimOid == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return pDC.Customer2WohnheimOid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |