67 lines
2.9 KiB
C#
67 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BS.Shared.DataContracts;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class CompactOrganisationDC_Organisation : AbstractIDCEntityMapper<Organisation, CompactOrganisationDC>
|
|
{
|
|
public override CompactOrganisationDC MergeWithDC(Organisation pEntity, CompactOrganisationDC pDataContract)
|
|
{
|
|
pDataContract.OrganisationOid = pEntity.Oid.Value;
|
|
pDataContract.OrganisationVersion = pEntity.Version.Value;
|
|
pDataContract.Name = pEntity.Name;
|
|
pDataContract.Name2 = pEntity.Name2;
|
|
pDataContract.ActivationType = pEntity.IsActive;
|
|
pDataContract.DebitorNumber = pEntity.DebitorNumber;
|
|
pDataContract.BusinessPartnerId = pEntity.BusinessPartnerId;
|
|
pDataContract.IKDatenannahmestelle = pEntity.IKDatenannahmestelle;
|
|
pDataContract.IKKostentrager = pEntity.IKKostentrager;
|
|
pDataContract.IKKrankenkasse = pEntity.IKKrankenkasse;
|
|
|
|
if (pEntity.CostBearer != null)
|
|
{
|
|
pDataContract.CostBearerID = pEntity.CostBearer.ID;
|
|
pDataContract.CostBearerOid = pEntity.CostBearer.Oid;
|
|
pDataContract.CostBearerVersion = pEntity.CostBearer.Version;
|
|
|
|
pDataContract.CostRatePeriods = pEntity.CostBearer.CostRatePeriods.MapToNewDCs();
|
|
|
|
pDataContract.ActualHourlyRate = pDataContract.CostRatePeriods.GetCurrentlyValidRateValue(CostRatePeriodType.HourlyRate) ?? 0m;
|
|
pDataContract.ActualRateFactor = pDataContract.CostRatePeriods.GetCurrentlyValidRateValue(CostRatePeriodType.RateFactor) ?? 0m;
|
|
pDataContract.ActualMinuteIntervall = Convert.ToInt32(pDataContract.CostRatePeriods.GetCurrentlyValidRateValue(CostRatePeriodType.MinutesIntervall) ?? 0m);
|
|
|
|
pDataContract.IsCalculatingWithFactor = pEntity.CostBearer.IsCalculatingWithFactor;
|
|
}
|
|
if (pEntity.Function != null)
|
|
{
|
|
pDataContract.Function = pEntity.Function.Value;
|
|
}
|
|
return pDataContract;
|
|
}
|
|
|
|
// Compact Organisations are readonly
|
|
public override Organisation MergeWithEntity(CompactOrganisationDC pDataContract, Organisation pEntity)
|
|
{
|
|
return DAOFactory.GenericDAO.LoadByID<Organisation>(pDataContract.OrganisationOid);
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(CompactOrganisationDC pDC, Organisation pEntity)
|
|
{
|
|
return pDC.OrganisationOid == pEntity.Oid;
|
|
}
|
|
|
|
//public override CompactOrganisationDC CreateNewDC()
|
|
//{
|
|
// CompactOrganisationDC dc = new CompactOrganisationDC();
|
|
// dc.CostRatePeriods = new List<CostRatePeriodDC>();
|
|
// return dc;
|
|
//}
|
|
}
|
|
} |