Beispiel #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);
        }
        /// <summary>
        /// this method does has
        /// no arguments
        /// </summary>

        private void CalculateTotal()
        {
            try
            {
                //read values
                double       SubTotal;
                double       DiscountAmount;
                double       Total;
                const double DiscountPercent = 0.1;
                //convert string to double
                SubTotal = Convert.ToDouble(Sub_Total_TextBox.Text);
                //DiscountAmount=Subtotal*0.1
                DiscountAmount = SubTotal * DiscountPercent;
                //Total= Subtotal-DiscountAmount
                Total = SubTotal - DiscountAmount;
                //Display DiscountAmount in proper Textbox
                DiscountAmount_TextBox.Text = DiscountAmount.ToString("C2");
                //display total in proper Textbox
                Total_TextBox.Text = Total.ToString("C2");
            }
            catch (Exception)
            {
                //throw;
                MessageBox.Show("Please Enter a number", "Input Error");
                ResetSubTotalTextBox();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Returns true if Level3SummaryData instances are equal
        /// </summary>
        /// <param name="other">Instance of Level3SummaryData to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Level3SummaryData other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     DiscountAmount == other.DiscountAmount ||
                     DiscountAmount != null &&
                     DiscountAmount.Equals(other.DiscountAmount)
                     ) &&
                 (
                     DutyAmount == other.DutyAmount ||
                     DutyAmount != null &&
                     DutyAmount.Equals(other.DutyAmount)
                 ) &&
                 (
                     ShippingAmount == other.ShippingAmount ||
                     ShippingAmount != null &&
                     ShippingAmount.Equals(other.ShippingAmount)
                 ));
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            double Subtotal;
            double DiscountPercent;
            double DiscountAmount;
            double InvoiceTotal;

            Subtotal = double.Parse(txtSubtotal.Text);
            if (Subtotal >= 500)
            {
                DiscountPercent = 0.2;
            }
            else if (Subtotal >= 250 && Subtotal < 500)
            {
                DiscountPercent = 0.15;
            }
            else if (Subtotal >= 100 && Subtotal < 250)
            {
                DiscountPercent = 0.1;
            }
            else
            {
                DiscountPercent = 0.0;
            }
            DiscountAmount          = Subtotal * DiscountPercent;
            InvoiceTotal            = Subtotal - DiscountAmount;
            txtDiscountPercent.Text = DiscountPercent.ToString("p1"); //p1 means percentage
            txtDiscountAmount.Text  = "$" + DiscountAmount.ToString();
            txtTotal.Text           = "$" + InvoiceTotal.ToString();
            txtResult.Text          = "Dear Customer you have to pay: $" + InvoiceTotal.ToString();
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderDiscount"/> class.
        /// </summary>
        /// <param name="orderDiscount">The order discount.</param>
        /// <param name="orderInfo">The order information.</param>
        internal OrderDiscount(IOrderDiscount orderDiscount, OrderInfo orderInfo)
        {
            var discountOrder = orderDiscount as DiscountOrder;

            if (discountOrder == null)
            {
                discountOrder = IO.Container.Resolve <IOrderDiscountService>().GetAll(orderInfo.Localization).FirstOrDefault(discount => discount.OriginalId == orderDiscount.OriginalId) as DiscountOrder;
            }

            if (discountOrder != null)
            {
                Title       = discountOrder.Title;
                Description = discountOrder.Description;
            }
            //orderInfo.OrderLines.ForEach(line => line.OrderDiscountInCents = 0); // reset hmm
            DiscountAmount = new DiscountAmount(IO.Container.Resolve <IDiscountCalculationService>().DiscountAmountForOrder(orderDiscount, orderInfo), orderInfo.PricesAreIncludingVAT, orderInfo.AverageOrderVatPercentage);

            OriginalDiscountId     = orderDiscount.OriginalId;
            DiscountType           = orderDiscount.DiscountType;
            DiscountValue          = orderDiscount.DiscountValue;
            Condition              = orderDiscount.Condition;
            NumberOfItemsCondition = orderDiscount.NumberOfItemsCondition;
            MinimalOrderAmount     = orderDiscount.MinimumOrderAmount.ValueInCents();
            CouponCode             = orderDiscount.CouponCode;
        }
Beispiel #6
0
        /// <summary>
        /// Calculating total after discount 0.1%
        /// </summary>
        private void CalculateTotal()
        {
            const double DiscountPercent = 0.1;
            double       SubTotal;
            double       DiscountAmount;
            double       Total;

            try
            {
                SubTotal       = Convert.ToDouble(subTotalTextBox);
                DiscountAmount = SubTotal * DiscountPercent;
                Total          = SubTotal - DiscountAmount;


                discountAmountTextBox.Text = DiscountAmount.ToString("C2");
                totalTextBox.Text          = Total.ToString("C2");
            }
            catch (Exception exception)
            {
                MessageBox.Show("Invalid Data Entered", "Input Error");
                Debug.WriteLine(exception.Message);
                subTotalTextBox.Focus();
                subTotalTextBox.SelectAll();
                ResetSubTotalMethod();
            }
        }
        public override object Clone()
        {
            var result = base.Clone() as ShippingMethod;

            result.Price          = Price?.Clone() as Money;
            result.DiscountAmount = DiscountAmount?.Clone() as Money;
            return(result);
        }
        public override object Clone()
        {
            var result = MemberwiseClone() as TierPrice;

            result.Currency       = Currency?.Clone() as Currency;
            result.DiscountAmount = DiscountAmount?.Clone() as Money;
            result.Price          = Price?.Clone() as Money;
            result.TaxDetails     = TaxDetails?.Select(x => x.Clone() as TaxDetail).ToList();

            return(result);
        }
Beispiel #9
0
        /// <summary>
        /// Convert current product price to other currency using currency exchange rate
        /// </summary>
        /// <param name="currency"></param>
        /// <returns></returns>
        public ProductPrice ConvertTo(Currency currency)
        {
            var retVal = new ProductPrice(currency);

            retVal.ListPrice      = ListPrice.ConvertTo(currency);
            retVal.SalePrice      = SalePrice.ConvertTo(currency);
            retVal.DiscountAmount = DiscountAmount.ConvertTo(currency);
            retVal.ProductId      = ProductId;

            return(retVal);
        }
        /// <summary>
        /// Formatted amount Decimal(15,2) with sign
        /// </summary>
        /// <returns>
        /// Formatted amount
        /// </returns>
        private string FormattedDiscountAmount()
        {
            const string fmt             = "0000000000000.##";
            string       formattedAmount = DiscountAmount.ToString(fmt);

            if (DiscountAmount > 0)
            {
                formattedAmount = "+" + formattedAmount;
            }
            return(formattedAmount);
        }
Beispiel #11
0
        /// <summary>
        /// Returns true if LineItemLevel3InterchangeInformation instances are equal
        /// </summary>
        /// <param name="other">Instance of LineItemLevel3InterchangeInformation to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LineItemLevel3InterchangeInformation other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     DiscountAmount == other.DiscountAmount ||
                     DiscountAmount != null &&
                     DiscountAmount.Equals(other.DiscountAmount)
                     ) &&
                 (
                     LineAmountTotal == other.LineAmountTotal ||
                     LineAmountTotal != null &&
                     LineAmountTotal.Equals(other.LineAmountTotal)
                 ) &&
                 (
                     ProductCode == other.ProductCode ||
                     ProductCode != null &&
                     ProductCode.Equals(other.ProductCode)
                 ) &&
                 (
                     ProductPrice == other.ProductPrice ||
                     ProductPrice != null &&
                     ProductPrice.Equals(other.ProductPrice)
                 ) &&
                 (
                     ProductType == other.ProductType ||
                     ProductType != null &&
                     ProductType.Equals(other.ProductType)
                 ) &&
                 (
                     Quantity == other.Quantity ||
                     Quantity != null &&
                     Quantity.Equals(other.Quantity)
                 ) &&
                 (
                     TaxAmount == other.TaxAmount ||
                     TaxAmount != null &&
                     TaxAmount.Equals(other.TaxAmount)
                 ) &&
                 (
                     Unit == other.Unit ||
                     Unit != null &&
                     Unit.Equals(other.Unit)
                 ));
        }
Beispiel #12
0
 public int GetIdempotentKey()
 {
     unchecked
     {
         int hashCode = Currency?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ DiscountAmount.GetHashCode();
         hashCode = (hashCode * 397) ^ Items.GetIdempotentListKey();
         hashCode = (hashCode * 397) ^ TotalGrossAmount.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalNetAmount.GetHashCode();
         return(hashCode);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (DiscountAmount != null)
         {
             hashCode = hashCode * 59 + DiscountAmount.GetHashCode();
         }
         if (GoogleProductCategoryId != null)
         {
             hashCode = hashCode * 59 + GoogleProductCategoryId.GetHashCode();
         }
         if (LineAmountTotal != null)
         {
             hashCode = hashCode * 59 + LineAmountTotal.GetHashCode();
         }
         if (ProductCategory != null)
         {
             hashCode = hashCode * 59 + ProductCategory.GetHashCode();
         }
         if (ProductCode != null)
         {
             hashCode = hashCode * 59 + ProductCode.GetHashCode();
         }
         if (ProductName != null)
         {
             hashCode = hashCode * 59 + ProductName.GetHashCode();
         }
         if (ProductPrice != null)
         {
             hashCode = hashCode * 59 + ProductPrice.GetHashCode();
         }
         if (ProductType != null)
         {
             hashCode = hashCode * 59 + ProductType.GetHashCode();
         }
         if (Quantity != null)
         {
             hashCode = hashCode * 59 + Quantity.GetHashCode();
         }
         if (TaxAmount != null)
         {
             hashCode = hashCode * 59 + TaxAmount.GetHashCode();
         }
         if (Unit != null)
         {
             hashCode = hashCode * 59 + Unit.GetHashCode();
         }
         return(hashCode);
     }
 }
        public override object Clone()
        {
            var result = MemberwiseClone() as ProductPrice;

            result.Currency       = Currency?.Clone() as Currency;
            result.DiscountAmount = DiscountAmount?.Clone() as Money;
            result.ListPrice      = ListPrice?.Clone() as Money;
            result.SalePrice      = SalePrice?.Clone() as Money;
            result.TierPrices     = TierPrices?.Select(x => x.Clone() as TierPrice).ToList();
            result.Discounts      = Discounts?.Select(x => x.Clone() as Discount).ToList();

            return(result);
        }
Beispiel #15
0
        public override int GetHashCode()
        {
            var hashCode = -536786706;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(discountCode);

            hashCode = hashCode * -1521134295 + discountType.GetHashCode();
            hashCode = hashCode * -1521134295 + startDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EndDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DiscountAmount.GetHashCode();
            hashCode = hashCode * -1521134295 + Percentages.GetHashCode();
            return(hashCode);
        }
Beispiel #16
0
 public int GetIdempotentKey()
 {
     unchecked
     {
         int hashCode = Currency?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ DiscountAmount.GetHashCode();
         hashCode = (hashCode * 397) ^ (ImageUrl?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ LineItems.GetIdempotentListKey();
         hashCode = (hashCode * 397) ^ (MerchantImageUrl?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Number?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ TotalGrossAmount.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalNetAmount.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #17
0
        void ToggleDiscountType()
        {
            BunifuElipse DiscountTypeImgElipse = new BunifuElipse {
                ElipseRadius = 5
            };
            Image ColoredImgCashDiscountType = ImageUtil.ColorImage(imgbtnCashDiscountType.Image, SoftColor);
            Image ColoredImgPtgDiscountType  = ImageUtil.ColorImage(imgbtnPtgDiscountType.Image, SoftColor);
            Image ImgCashDiscountType        = ImageUtil.ColorImage(imgbtnCashDiscountType.Image, Color.White);
            Image ImgPtgDiscountType         = ImageUtil.ColorImage(imgbtnPtgDiscountType.Image, Color.White);

            txtDiscountValue.Text = "";

            if (IsCashDiscount)
            {
                //Cash
                lblDiscountType.Text      = StringAmount;
                txtDiscountValue.HintText = (DiscountAmount == 0) ? "00,00" : DiscountAmount.ToString();
                lblUnit.Text          = Currency;
                txtDiscountValue.Text = DiscountAmount.ToString();

                // Change Both Control Color, Image Oppositely
                imgbtnCashDiscountType.BackColor = SoftColor;
                imgbtnCashDiscountType.Image     = ImgCashDiscountType;

                imgbtnPtgDiscountType.BackColor = Color.White;
                imgbtnPtgDiscountType.Image     = ColoredImgPtgDiscountType;

                DiscountTypeImgElipse.TargetControl = imgbtnCashDiscountType;
            }
            else
            {
                // Percentage
                lblDiscountType.Text      = stringPercentage;
                txtDiscountValue.HintText = DiscountPercentage.ToString();
                txtDiscountValue.Text     = DiscountPercentage.ToString();
                lblUnit.Text = "%";

                //Refresh UI  : Change Both Control Color, Image Oppositely
                imgbtnCashDiscountType.BackColor = Color.White;
                imgbtnCashDiscountType.Image     = ColoredImgCashDiscountType;

                imgbtnPtgDiscountType.BackColor = SoftColor;
                imgbtnPtgDiscountType.Image     = ImgPtgDiscountType;

                DiscountTypeImgElipse.TargetControl = imgbtnPtgDiscountType;
            }
            txtDiscountName.Text = DiscountName;
        }
 public int GetIdempotentKey()
 {
     unchecked
     {
         int hashCode = Description?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ DiscountAmount.GetHashCode();
         hashCode = (hashCode * 397) ^ GrossUnitPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LineNumber;
         hashCode = (hashCode * 397) ^ NetUnitPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProductId?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ VatAmount.GetHashCode();
         hashCode = (hashCode * 397) ^ VatPercent.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #19
0
        public override object Clone()
        {
            var result = base.Clone() as PaymentMethod;

            result.Price          = Price?.Clone() as Money;
            result.DiscountAmount = DiscountAmount?.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));
            }
            return(result);
        }
Beispiel #20
0
            public XElement ToQBXML(string name)
            {
                XElement xElement = new XElement(name);

                xElement.Add(TxnID.ToQBXML(nameof(TxnID)));
                xElement.Add(TxnType.ToQBXML(nameof(TxnType)));
                xElement.Add(TxnDate?.ToQBXML(nameof(TxnDate)));
                xElement.Add(RefNumber.ToQBXML(nameof(RefNumber)));
                xElement.Add(BalanceRemaining?.ToQBXML(nameof(BalanceRemaining)));
                xElement.Add(Amount?.ToQBXML(nameof(Amount)));
                xElement.Add(DiscountAmount?.ToQBXML(nameof(DiscountAmount)));
                xElement.Add(DiscountAccountRef.ToQBXML(nameof(DiscountAccountRef)));
                xElement.Add(DiscountClassRef.ToQBXML(nameof(DiscountClassRef)));
                xElement.Add(LinkedTxnList.ToQBXML(nameof(LinkedTxn)));
                return(xElement);
            }
Beispiel #21
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = CollectionId.GetHashCode();
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ DiscountAmount.GetHashCode();
         hashCode = (hashCode * 397) ^ (DiscountType != null ? DiscountType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Images != null ? Images.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ (SubscriptionDefaults != null ? SubscriptionDefaults.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #22
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (DiscountAmount != null)
         {
             hashCode = hashCode * 59 + DiscountAmount.GetHashCode();
         }
         if (DutyAmount != null)
         {
             hashCode = hashCode * 59 + DutyAmount.GetHashCode();
         }
         if (ShippingAmount != null)
         {
             hashCode = hashCode * 59 + ShippingAmount.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #23
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);
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="OrderDiscount"/> class.
		/// </summary>
		/// <param name="orderDiscount">The order discount.</param>
		/// <param name="orderInfo">The order information.</param>
		internal OrderDiscount(IOrderDiscount orderDiscount, OrderInfo orderInfo)
		{
			var discountOrder = orderDiscount as DiscountOrder;
			if (discountOrder == null)
			{
				discountOrder = IO.Container.Resolve<IOrderDiscountService>().GetAll(orderInfo.Localization).FirstOrDefault(discount => discount.OriginalId == orderDiscount.OriginalId) as DiscountOrder;
			}

			if (discountOrder != null)
			{
				Title = discountOrder.Title;
				Description = discountOrder.Description;
			}
			//orderInfo.OrderLines.ForEach(line => line.OrderDiscountInCents = 0); // reset hmm
			DiscountAmount = new DiscountAmount(IO.Container.Resolve<IDiscountCalculationService>().DiscountAmountForOrder(orderDiscount, orderInfo), orderInfo.PricesAreIncludingVAT, orderInfo.AverageOrderVatPercentage);

			OriginalDiscountId = orderDiscount.OriginalId;
			DiscountType = orderDiscount.DiscountType;
			DiscountValue = orderDiscount.DiscountValue;
			Condition = orderDiscount.Condition;
			NumberOfItemsCondition = orderDiscount.NumberOfItemsCondition;
			MinimalOrderAmount = orderDiscount.MinimumOrderAmount.ValueInCents();
			CouponCode = orderDiscount.CouponCode;
		}
Beispiel #25
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);
        }
Beispiel #26
0
 public string GetDiscountAmount()
 {
     return(DiscountAmount.ToString("C"));
 }
        /// <summary>
        /// Returns true if OrderLineDetails instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderLineDetails to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderLineDetails other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     DiscountAmount == other.DiscountAmount ||
                     DiscountAmount != null &&
                     DiscountAmount.Equals(other.DiscountAmount)
                     ) &&
                 (
                     GoogleProductCategoryId == other.GoogleProductCategoryId ||
                     GoogleProductCategoryId != null &&
                     GoogleProductCategoryId.Equals(other.GoogleProductCategoryId)
                 ) &&
                 (
                     LineAmountTotal == other.LineAmountTotal ||
                     LineAmountTotal != null &&
                     LineAmountTotal.Equals(other.LineAmountTotal)
                 ) &&
                 (
                     ProductCategory == other.ProductCategory ||
                     ProductCategory != null &&
                     ProductCategory.Equals(other.ProductCategory)
                 ) &&
                 (
                     ProductCode == other.ProductCode ||
                     ProductCode != null &&
                     ProductCode.Equals(other.ProductCode)
                 ) &&
                 (
                     ProductName == other.ProductName ||
                     ProductName != null &&
                     ProductName.Equals(other.ProductName)
                 ) &&
                 (
                     ProductPrice == other.ProductPrice ||
                     ProductPrice != null &&
                     ProductPrice.Equals(other.ProductPrice)
                 ) &&
                 (
                     ProductType == other.ProductType ||
                     ProductType != null &&
                     ProductType.Equals(other.ProductType)
                 ) &&
                 (
                     Quantity == other.Quantity ||
                     Quantity != null &&
                     Quantity.Equals(other.Quantity)
                 ) &&
                 (
                     TaxAmount == other.TaxAmount ||
                     TaxAmount != null &&
                     TaxAmount.Equals(other.TaxAmount)
                 ) &&
                 (
                     Unit == other.Unit ||
                     Unit != null &&
                     Unit.Equals(other.Unit)
                 ));
        }