Beispiel #1
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)
                 ));
        }
Beispiel #2
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);
     }
 }