58 lines
2.4 KiB
C#
58 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using System.Linq;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class CompactVertreterEmployeeDC_VertreterEmployee : AbstractIDCEntityMapper<Employee, CompactVertreterEmployeeDC>
|
|
{
|
|
public override CompactVertreterEmployeeDC MergeWithDC(Employee pEntity, CompactVertreterEmployeeDC 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.Geschlecht = pEntity.Person.Sex;
|
|
|
|
if (pEntity.Person.Address != null)
|
|
{
|
|
pDataContract.PersonAdressStr = pEntity.Person.Address.Street;
|
|
pDataContract.PersonAdressPLZ = pEntity.Person.Address.PostalCode;
|
|
pDataContract.PersonAdressStadt = pEntity.Person.Address.Town;
|
|
|
|
}
|
|
|
|
pDataContract.Arbeitszeit = new List<ArbeitszeitDC>();
|
|
if (pEntity.Arbeitszeiten != null)
|
|
{
|
|
|
|
//pDataContract.Arbeitszeit = MapperFactory.ArbeitszeitDC_Arbeitszeit.MapToNewDCs(pEntity.Arbeitszeiten);
|
|
}
|
|
|
|
|
|
pDataContract.CompactEmployee = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(pEntity);
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
// COMPACT EMPLOYEES ARE NOT EDITABLE
|
|
public override Employee MergeWithEntity(CompactVertreterEmployeeDC pDataContract, Employee pEntity)
|
|
{
|
|
return DAOFactory.GenericDAO.LoadByID<Employee>(pDataContract.EmployeeOid);
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(CompactVertreterEmployeeDC pDC, Employee pEntity)
|
|
{
|
|
return pDC.EmployeeOid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |