예제 #1
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);
        }
예제 #2
0
        public override object Clone()
        {
            var result = base.Clone() as ShoppingCart;

            result.HandlingTotal        = HandlingTotal?.Clone() as Money;
            result.HandlingTotalWithTax = HandlingTotalWithTax?.Clone() as Money;
            result.DiscountAmount       = DiscountAmount?.Clone() as Money;
            result.Total                = Total?.Clone() as Money;
            result.SubTotal             = SubTotal?.Clone() as Money;
            result.SubTotalWithTax      = SubTotalWithTax?.Clone() as Money;
            result.ShippingPrice        = ShippingPrice?.Clone() as Money;
            result.ShippingPriceWithTax = ShippingPriceWithTax?.Clone() as Money;
            result.ShippingTotal        = ShippingTotal?.Clone() as Money;
            result.ShippingTotalWithTax = ShippingTotalWithTax?.Clone() as Money;
            result.PaymentPrice         = PaymentPrice?.Clone() as Money;
            result.PaymentPriceWithTax  = PaymentPriceWithTax?.Clone() as Money;
            result.PaymentTotal         = PaymentTotal?.Clone() as Money;
            result.PaymentTotalWithTax  = PaymentTotalWithTax?.Clone() as Money;
            result.HandlingTotal        = HandlingTotal?.Clone() as Money;
            result.HandlingTotalWithTax = HandlingTotalWithTax?.Clone() as Money;
            result.DiscountTotal        = DiscountTotal?.Clone() as Money;
            result.DiscountTotalWithTax = DiscountTotalWithTax?.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 List <DynamicProperty>(DynamicProperties.Select(x => x.Clone() as DynamicProperty));
            }
            if (ValidationErrors != null)
            {
                result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError));
            }
            if (Addresses != null)
            {
                result.Addresses = new List <Address>(Addresses.Select(x => x.Clone() as Address));
            }
            if (Items != null)
            {
                result.Items = new List <LineItem>(Items.Select(x => x.Clone() as LineItem));
            }
            if (Payments != null)
            {
                result.Payments = new List <Payment>(Payments.Select(x => x.Clone() as Payment));
            }
            if (Shipments != null)
            {
                result.Shipments = new List <Shipment>(Shipments.Select(x => x.Clone() as Shipment));
            }
            if (Coupons != null)
            {
                result.Coupons = new List <Coupon>(Coupons.Select(x => x.Clone() as Coupon));
            }
            if (AvailablePaymentMethods != null)
            {
                result.AvailablePaymentMethods = new List <PaymentMethod>(AvailablePaymentMethods.Select(x => x.Clone() as PaymentMethod));
            }

            return(result);
        }