102 lines
3.4 KiB
C#
102 lines
3.4 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using System;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class MandatorDC_Mandator : AbstractIDCEntityMapper<Mandator, MandatorDC>
|
|
{
|
|
public override MandatorDC MergeWithDC(Mandator from, MandatorDC to)
|
|
{
|
|
to.MandatorOid = from.Oid;
|
|
to.MandatorVersion = from.Version;
|
|
to.Website = from.Website;
|
|
to.Name = from.Name;
|
|
to.ClientId = from.ClientId;
|
|
to.BeWoClientType = from.BeWoClientType;
|
|
to.Country = from.Country;
|
|
to.State = from.State;
|
|
to.Town = from.Town;
|
|
to.PostalCode = from.PostalCode;
|
|
to.Street = from.Street;
|
|
to.Settings = from.Settings;
|
|
to.RssFeedUrl = from.RssFeedUrl;
|
|
to.IsSchedulerAllowed = from.IsSchedulerAllowed;
|
|
to.IsMedicationAllowed = from.IsMedicationAllowed;
|
|
|
|
to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MapToNewDC(from.BankAccount, false);
|
|
|
|
to.AllowSbd = !string.IsNullOrEmpty(to.ClientId) && to.ClientId == "SBD";
|
|
|
|
to.ShowGkvBzEinzel = from.ShowGkvBzEinzel ?? true;
|
|
to.ShowGkvBzUrbelege = from.ShowGkvBzUrbelege ?? true;
|
|
to.ColorSendUrbelege = from.ColorSendUrbelege;
|
|
to.ColorWaitTooLong = from.ColorWaitTooLong;
|
|
|
|
#if DEBUG
|
|
//pDataContract.AllowSbd = true;
|
|
#endif
|
|
to.Apikey = from.Apikey;
|
|
to.IKLeistungserbringer = from.IKLeistungserbringer;
|
|
|
|
to.CanEditIKLeistungserbringer = from.CanEditIKLeistungserbringer;
|
|
|
|
if (from.SoziotherapieAnsprechpartner is object)
|
|
to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(from.SoziotherapieAnsprechpartner);
|
|
|
|
if (from.Logo is object)
|
|
to.Logo = MapperFactory.ImageDC_Image.MapToNewDC(from.Logo);
|
|
|
|
return to;
|
|
}
|
|
|
|
public override Mandator MergeWithEntity(MandatorDC from, Mandator to)
|
|
{
|
|
this.ConcurrencyCheck(from.MandatorVersion, to);
|
|
|
|
to.Name = from.Name;
|
|
to.Website = from.Website.ToNullIfEmpty();
|
|
to.ClientId = from.ClientId;
|
|
to.BeWoClientType = from.BeWoClientType;
|
|
to.Country = from.Country;
|
|
to.State = from.State;
|
|
to.Town = from.Town;
|
|
to.PostalCode = from.PostalCode;
|
|
to.Street = from.Street;
|
|
to.Settings = from.Settings;
|
|
to.RssFeedUrl = from.RssFeedUrl;
|
|
to.IsSchedulerAllowed = from.IsSchedulerAllowed;
|
|
to.IsMedicationAllowed = from.IsMedicationAllowed;
|
|
to.Apikey = from.Apikey;
|
|
to.IKLeistungserbringer = from.IKLeistungserbringer.ToNullIfEmpty();
|
|
|
|
// HACK: BankAccount ist neu, alte Clients: from.BankAccount null
|
|
if (from.BankAccount is object)
|
|
{
|
|
to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MergeWithEntity(from.BankAccount, to.BankAccount, false);
|
|
to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MergeWithEntity(from.SoziotherapieAnsprechpartner, to.SoziotherapieAnsprechpartner, false);
|
|
to.Logo = MapperFactory.ImageDC_Image.MergeWithEntity(from.Logo, to.Logo, false);
|
|
|
|
to.ShowGkvBzEinzel = from.ShowGkvBzEinzel;
|
|
to.ShowGkvBzUrbelege = from.ShowGkvBzUrbelege;
|
|
to.ColorSendUrbelege = from.ColorSendUrbelege;
|
|
to.ColorWaitTooLong = from.ColorWaitTooLong;
|
|
}
|
|
|
|
return to;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(MandatorDC pDC, Mandator pEntity)
|
|
{
|
|
if (pDC.MandatorOid == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return pDC.MandatorOid == pEntity.Oid;
|
|
}
|
|
}
|
|
} |