Example #1
0
        public override object Clone()
        {
            var result = base.Clone() as Shipment;

            result.Price                 = Price?.Clone() as Money;
            result.PriceWithTax          = PriceWithTax?.Clone() as Money;
            result.DiscountAmount        = DiscountAmount?.Clone() as Money;
            result.DiscountAmountWithTax = DiscountAmountWithTax?.Clone() as Money;
            result.Total                 = Total?.Clone() as Money;
            result.TotalWithTax          = TotalWithTax?.Clone() as Money;
            result.TaxTotal              = TaxTotal?.Clone() as Money;


            if (Discounts != null)
            {
                result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount));
            }
            if (TaxDetails != null)
            {
                result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail));
            }
            if (Items != null)
            {
                result.Items = new List <CartShipmentItem>(Items.Select(x => x.Clone() as CartShipmentItem));
            }
            if (ValidationErrors != null)
            {
                result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError));
            }

            return(result);
        }
Example #2
0
        public override object Clone()
        {
            var result = base.Clone() as LineItem;

            result.ListPrice             = ListPrice?.Clone() as Money;
            result.SalePrice             = SalePrice?.Clone() as Money;
            result.DiscountAmount        = DiscountAmount?.Clone() as Money;
            result.DiscountAmountWithTax = DiscountAmountWithTax?.Clone() as Money;
            result.DiscountTotal         = DiscountTotal?.Clone() as Money;
            result.DiscountTotalWithTax  = DiscountTotalWithTax?.Clone() as Money;
            result.ListPriceWithTax      = ListPriceWithTax?.Clone() as Money;
            result.SalePriceWithTax      = SalePriceWithTax?.Clone() as Money;
            result.PlacedPrice           = PlacedPrice?.Clone() as Money;
            result.PlacedPriceWithTax    = PlacedPriceWithTax?.Clone() as Money;
            result.ExtendedPrice         = ExtendedPrice?.Clone() as Money;
            result.ExtendedPriceWithTax  = ExtendedPriceWithTax?.Clone() as Money;
            result.TaxTotal = TaxTotal?.Clone() as Money;

            if (Discounts != null)
            {
                result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount));
            }
            if (TaxDetails != null)
            {
                result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail));
            }
            if (DynamicProperties != null)
            {
                result.DynamicProperties = new MutablePagedList <DynamicProperty>(DynamicProperties.Select(x => x.Clone() as DynamicProperty));
            }
            if (ValidationErrors != null)
            {
                result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError));
            }

            return(result);
        }