Exemplo n.º 1
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Billing != null?Billing.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (CartHash != null ? CartHash.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CartTax != null ? CartTax.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CreatedVia != null ? CreatedVia.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Currency != null ? Currency.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ CustomerId;
                hashCode = (hashCode * 397) ^ (CustomerIpAddress != null ? CustomerIpAddress.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CustomerNote != null ? CustomerNote.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CustomerUserAgent != null ? CustomerUserAgent.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (DiscountTax != null ? DiscountTax.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (DiscountTotal != null ? DiscountTotal.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Id;
                hashCode = (hashCode * 397) ^ (Number != null ? Number.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (OrderKey != null ? OrderKey.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ ParentId;
                hashCode = (hashCode * 397) ^ (PaymentMethod != null ? PaymentMethod.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (PaymentMethodTitle != null ? PaymentMethodTitle.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ PricesIncludeTax.GetHashCode();
                hashCode = (hashCode * 397) ^ (Shipping != null ? Shipping.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ShippingTax != null ? ShippingTax.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ShippingTotal != null ? ShippingTotal.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Total != null ? Total.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (TotalTax != null ? TotalTax.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (TransactionId != null ? TransactionId.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0);
                return(hashCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true if OrderSummary instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderSummary to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderSummary other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     PartnerOrderNumber == other.PartnerOrderNumber ||
                     PartnerOrderNumber != null &&
                     PartnerOrderNumber.Equals(other.PartnerOrderNumber)
                     ) &&
                 (
                     PlaceOrderTime == other.PlaceOrderTime ||
                     PlaceOrderTime != null &&
                     PlaceOrderTime.Equals(other.PlaceOrderTime)
                 ) &&
                 (
                     Currency == other.Currency ||
                     Currency != null &&
                     Currency.Equals(other.Currency)
                 ) &&
                 (
                     SubTotal == other.SubTotal ||
                     SubTotal != null &&
                     SubTotal.Equals(other.SubTotal)
                 ) &&
                 (
                     TaxTotal == other.TaxTotal ||
                     TaxTotal != null &&
                     TaxTotal.Equals(other.TaxTotal)
                 ) &&
                 (
                     ShippingTotal == other.ShippingTotal ||
                     ShippingTotal != null &&
                     ShippingTotal.Equals(other.ShippingTotal)
                 ) &&
                 (
                     Channel == other.Channel ||
                     Channel != null &&
                     Channel.Equals(other.Channel)
                 ));
        }
Exemplo n.º 3
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 (PartnerOrderNumber != null)
         {
             hashCode = hashCode * 59 + PartnerOrderNumber.GetHashCode();
         }
         if (PlaceOrderTime != null)
         {
             hashCode = hashCode * 59 + PlaceOrderTime.GetHashCode();
         }
         if (Currency != null)
         {
             hashCode = hashCode * 59 + Currency.GetHashCode();
         }
         if (SubTotal != null)
         {
             hashCode = hashCode * 59 + SubTotal.GetHashCode();
         }
         if (TaxTotal != null)
         {
             hashCode = hashCode * 59 + TaxTotal.GetHashCode();
         }
         if (ShippingTotal != null)
         {
             hashCode = hashCode * 59 + ShippingTotal.GetHashCode();
         }
         if (Channel != null)
         {
             hashCode = hashCode * 59 + Channel.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 4
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);
        }