51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class EmployeeTokenRelationDC_Employee2Token : AbstractIDCEntityMapper<Employee2Token, EmployeeTokenRelationDC>
|
|
{
|
|
public override EmployeeTokenRelationDC MergeWithDC(Employee2Token pEntity, EmployeeTokenRelationDC pDataContract)
|
|
{
|
|
//pDataContract.Customer2TokenNotice = pEntity.Notice;
|
|
pDataContract.Employee2TokenOid = pEntity.Oid;
|
|
|
|
pDataContract.Token = MapperFactory.CompactTokenDC_Token.MapToNewDC(pEntity.Token);
|
|
pDataContract.Employee = MapperFactory.EmployeeDC_Employee.MapToNewDC(pEntity.Employee);
|
|
|
|
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
public override Employee2Token MergeWithEntity(EmployeeTokenRelationDC pDataContract, Employee2Token pEntity)
|
|
{
|
|
pEntity.Oid = pDataContract.Employee2TokenOid;
|
|
|
|
if (pDataContract.Token != null)
|
|
{
|
|
pEntity.Token = DAOFactory.GenericDAO.LoadByID<Token>(pDataContract.Token.TokenOid.Value);
|
|
}
|
|
|
|
if (pDataContract.Employee != null)
|
|
{
|
|
pEntity.Employee = DAOFactory.GenericDAO.LoadByID<Employee>(pDataContract.Employee.EmployeeOid.Value);
|
|
}
|
|
|
|
return pEntity;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(EmployeeTokenRelationDC pDC, Employee2Token pEntity)
|
|
{
|
|
if (pDC.Employee2TokenOid == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return pDC.Employee2TokenOid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |