Beispiel #1
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 (ReferenceNumber != null)
         {
             hashCode = hashCode * 59 + ReferenceNumber.GetHashCode();
         }
         if (ItemNumber != null)
         {
             hashCode = hashCode * 59 + ItemNumber.GetHashCode();
         }
         if (Quantity != null)
         {
             hashCode = hashCode * 59 + Quantity.GetHashCode();
         }
         if (UnitSellPrice != null)
         {
             hashCode = hashCode * 59 + UnitSellPrice.GetHashCode();
         }
         if (UnitItemTaxPrice != null)
         {
             hashCode = hashCode * 59 + UnitItemTaxPrice.GetHashCode();
         }
         if (UnitShippingPrice != null)
         {
             hashCode = hashCode * 59 + UnitShippingPrice.GetHashCode();
         }
         if (UnitShippingTaxPrice != null)
         {
             hashCode = hashCode * 59 + UnitShippingTaxPrice.GetHashCode();
         }
         if (Coupons != null)
         {
             hashCode = hashCode * 59 + Coupons.GetHashCode();
         }
         if (LinkedFees != null)
         {
             hashCode = hashCode * 59 + LinkedFees.GetHashCode();
         }
         if (DeliveryDetail != null)
         {
             hashCode = hashCode * 59 + DeliveryDetail.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Returns true if LineItem instances are equal
        /// </summary>
        /// <param name="other">Instance of LineItem to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LineItem other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ReferenceNumber == other.ReferenceNumber ||
                     ReferenceNumber != null &&
                     ReferenceNumber.Equals(other.ReferenceNumber)
                     ) &&
                 (
                     ItemNumber == other.ItemNumber ||
                     ItemNumber != null &&
                     ItemNumber.Equals(other.ItemNumber)
                 ) &&
                 (
                     Quantity == other.Quantity ||
                     Quantity != null &&
                     Quantity.Equals(other.Quantity)
                 ) &&
                 (
                     UnitSellPrice == other.UnitSellPrice ||
                     UnitSellPrice != null &&
                     UnitSellPrice.Equals(other.UnitSellPrice)
                 ) &&
                 (
                     UnitItemTaxPrice == other.UnitItemTaxPrice ||
                     UnitItemTaxPrice != null &&
                     UnitItemTaxPrice.Equals(other.UnitItemTaxPrice)
                 ) &&
                 (
                     UnitShippingPrice == other.UnitShippingPrice ||
                     UnitShippingPrice != null &&
                     UnitShippingPrice.Equals(other.UnitShippingPrice)
                 ) &&
                 (
                     UnitShippingTaxPrice == other.UnitShippingTaxPrice ||
                     UnitShippingTaxPrice != null &&
                     UnitShippingTaxPrice.Equals(other.UnitShippingTaxPrice)
                 ) &&
                 (
                     Coupons == other.Coupons ||
                     Coupons != null &&
                     Coupons.SequenceEqual(other.Coupons)
                 ) &&
                 (
                     LinkedFees == other.LinkedFees ||
                     LinkedFees != null &&
                     LinkedFees.SequenceEqual(other.LinkedFees)
                 ) &&
                 (
                     DeliveryDetail == other.DeliveryDetail ||
                     DeliveryDetail != null &&
                     DeliveryDetail.Equals(other.DeliveryDetail)
                 ));
        }