38 lines
1.7 KiB
C#
38 lines
1.7 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using System.Linq;
|
|
using BS.Shared.DataContracts.Compact;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class CompactEmployeeDC_Employee : AbstractIDCEntityMapper<Employee, CompactEmployeeDC>
|
|
{
|
|
public override CompactEmployeeDC MergeWithDC(Employee pEntity, CompactEmployeeDC pDataContract)
|
|
{
|
|
pDataContract.EmployeeOid = pEntity.Oid.Value;
|
|
pDataContract.PersonOid = pEntity.Person.Oid.Value;
|
|
pDataContract.EmployeeVersion = pEntity.Version.Value;
|
|
pDataContract.FirstName = pEntity.Person.FirstName;
|
|
pDataContract.LastName = pEntity.Person.LastName;
|
|
pDataContract.PersonnelNumber = pEntity.PersonnelNumber;
|
|
//pDataContract.FLSPerWeek = pEntity.WeeklyFLS;
|
|
pDataContract.ActivationType = pEntity.IsActive;
|
|
pDataContract.ValueListEntries = pEntity.ValueList.ToDictionary(i => i.Entry.Oid.Value, i => i.Entry.Type);
|
|
pDataContract.EmployeeColor = pEntity.EmployeeColor;
|
|
pDataContract.RelatedCustomerOIDList = pEntity.Employee2CustomerList.Where(w => w.CustomerOid.HasValue).Select(s => s.CustomerOid.Value).ToList();
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
// COMPACT EMPLOYEES ARE NOT EDITABLE
|
|
public override Employee MergeWithEntity(CompactEmployeeDC pDataContract, Employee pEntity)
|
|
{
|
|
return DAOFactory.GenericDAO.LoadByID<Employee>(pDataContract.EmployeeOid);
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(CompactEmployeeDC pDC, Employee pEntity)
|
|
{
|
|
return pDC.EmployeeOid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |