/// <summary> /// Patch CatalogBase type /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this OperationEntity source, OperationEntity target) { if (target == null) throw new ArgumentNullException("target"); var patchInjectionPolicy = new PatchInjection<OperationEntity>(x => x.Comment, x => x.Currency, x => x.Number, x => x.Status, x => x.IsCancelled, x => x.CancelledDate, x => x.CancelReason, x => x.Tax, x => x.TaxIncluded, x => x.IsApproved, x => x.Sum); target.InjectFrom(patchInjectionPolicy, source); }
public override void Patch(OperationEntity operation) { var target = operation as CustomerOrderEntity; if (target == null) { throw new ArgumentException(@"operation argument must be of type CustomerOrderEntity", nameof(operation)); } target.CustomerId = CustomerId; target.CustomerName = CustomerName; target.StoreId = StoreId; target.StoreName = StoreName; target.OrganizationId = OrganizationId; target.OrganizationName = OrganizationName; target.EmployeeId = EmployeeId; target.EmployeeName = EmployeeName; target.DiscountAmount = DiscountAmount; target.Total = Total; target.SubTotal = SubTotal; target.SubTotalWithTax = SubTotalWithTax; target.ShippingTotal = ShippingTotal; target.ShippingTotalWithTax = ShippingTotalWithTax; target.PaymentTotal = PaymentTotal; target.PaymentTotalWithTax = PaymentTotalWithTax; target.HandlingTotal = HandlingTotal; target.HandlingTotalWithTax = HandlingTotalWithTax; target.DiscountTotal = DiscountTotal; target.DiscountTotalWithTax = DiscountTotalWithTax; target.DiscountAmount = DiscountAmount; target.TaxTotal = TaxTotal; target.IsPrototype = IsPrototype; target.SubscriptionNumber = SubscriptionNumber; target.SubscriptionId = SubscriptionId; target.LanguageCode = LanguageCode; target.TaxPercentRate = TaxPercentRate; if (!Addresses.IsNullCollection()) { Addresses.Patch(target.Addresses, (sourceItem, targetItem) => sourceItem.Patch(targetItem)); } if (!Shipments.IsNullCollection()) { Shipments.Patch(target.Shipments, (sourceShipment, targetShipment) => sourceShipment.Patch(targetShipment)); } if (!Items.IsNullCollection()) { Items.Patch(target.Items, (sourceItem, targetItem) => sourceItem.Patch(targetItem)); } if (!InPayments.IsNullCollection()) { InPayments.Patch(target.InPayments, (sourcePayment, targetPayment) => sourcePayment.Patch(targetPayment)); } if (!Discounts.IsNullCollection()) { var discountComparer = AnonymousComparer.Create((DiscountEntity x) => x.PromotionId); Discounts.Patch(target.Discounts, discountComparer, (sourceDiscount, targetDiscount) => sourceDiscount.Patch(targetDiscount)); } if (!TaxDetails.IsNullCollection()) { var taxDetailComparer = AnonymousComparer.Create((TaxDetailEntity x) => x.Name); TaxDetails.Patch(target.TaxDetails, taxDetailComparer, (sourceTaxDetail, targetTaxDetail) => sourceTaxDetail.Patch(targetTaxDetail)); } base.Patch(operation); }