Files
BeWoPlaner/Service/DCEntityMapper/BankAccountDC_BankAccount.cs

55 lines
1.3 KiB
C#

using BeWo.Data.Entities;
using BS.Shared.DataContracts.Invoicing;
using BS.Shared.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.DCEntityMapper
{
public class BankAccountDC_BankAccount : AbstractIDCEntityMapper<BankAccount, BankAccountDC>
{
public override BankAccountDC MergeWithDC(BankAccount from, BankAccountDC to)
{
to.AccountNumber = from.AccountNumber;
to.BankCode = from.BankCode;
to.BankName = from.BankName;
to.Bic = from.Bic;
to.IBAN = from.IBAN;
to.Notice = from.Notice;
to.Oid = from.Oid;
to.Version = from.Version;
return to;
}
public override BankAccount MergeWithEntity(BankAccountDC from, BankAccount to)
{
ConcurrencyCheck(from.Version, to);
to.AccountNumber = from.AccountNumber.ToNullIfEmpty();
to.BankCode = from.BankCode.ToNullIfEmpty();
to.BankName = from.BankName.ToNullIfEmpty();
to.Bic = from.Bic.ToNullIfEmpty();
to.IBAN = from.IBAN.ToNullIfEmpty();
to.Notice = from.Notice;
to.Oid = from.Oid;
to.Version = from.Version;
return to;
}
protected override bool AreDCAndEntityEqual(BankAccountDC pDC, BankAccount pEntity)
{
if (pDC.Oid == null)
{
return false;
}
return pDC.Oid == pEntity.Oid;
}
}
}