53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using System.IO;
|
|
using BeWo.Data.Entities;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class TokenDC_Token : AbstractIDCEntityMapper<Token, TokenDC>
|
|
{
|
|
public override TokenDC MergeWithDC(Token pEntity, TokenDC pDataContract)
|
|
{
|
|
pDataContract.RelatedEmployees = MapperFactory.EmployeeTokenRelationDC_Employee2Token.MapToNewDCs(pEntity.Employee2TokenList);
|
|
pDataContract.RelatedCustomers = MapperFactory.CustomerTokenRelationDC_Customer2Token.MapToNewDCs(pEntity.Customer2TokenList);
|
|
|
|
|
|
pDataContract.TokenOid = pEntity.Oid;
|
|
pDataContract.Beschreibung = pEntity.Beschreibung;
|
|
|
|
if (pEntity.TokenTyp != null)
|
|
{
|
|
pDataContract.TokenTyp = pEntity.TokenTyp;
|
|
}
|
|
|
|
pDataContract.MemberOid = pEntity.MemberOid;
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
public override Token MergeWithEntity(TokenDC pDataContract, Token pEntity)
|
|
{
|
|
pEntity.Oid = pDataContract.TokenOid;
|
|
pEntity.Beschreibung = pDataContract.Beschreibung;
|
|
pEntity.TokenTyp = pDataContract.TokenTyp;
|
|
|
|
MapperFactory.EmployeeTokenRelationDC_Employee2Token.MergeWithEntitys(pDataContract.RelatedEmployees, pEntity.Employee2TokenList);
|
|
MapperFactory.CustomerTokenRelationDC_Customer2Token.MergeWithEntitys(pDataContract.RelatedCustomers, pEntity.Customer2TokenList);
|
|
|
|
|
|
return pEntity;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(TokenDC pDC, Token pEntity)
|
|
{
|
|
|
|
if (pDC.TokenOid == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return pDC.TokenOid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |