Esempio n. 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 (TransactionID != null)
         {
             hashCode = hashCode * 59 + TransactionID.GetHashCode();
         }
         if (BuyerFirstName != null)
         {
             hashCode = hashCode * 59 + BuyerFirstName.GetHashCode();
         }
         if (BuyerLastName != null)
         {
             hashCode = hashCode * 59 + BuyerLastName.GetHashCode();
         }
         if (BuyerAddress != null)
         {
             hashCode = hashCode * 59 + BuyerAddress.GetHashCode();
         }
         if (BuyerCity != null)
         {
             hashCode = hashCode * 59 + BuyerCity.GetHashCode();
         }
         if (BuyerEmail != null)
         {
             hashCode = hashCode * 59 + BuyerEmail.GetHashCode();
         }
         if (BuyerUserId != null)
         {
             hashCode = hashCode * 59 + BuyerUserId.GetHashCode();
         }
         if (PaymentStatus != null)
         {
             hashCode = hashCode * 59 + PaymentStatus.GetHashCode();
         }
         if (PaymentReferenceId != null)
         {
             hashCode = hashCode * 59 + PaymentReferenceId.GetHashCode();
         }
         if (TotalAmount != null)
         {
             hashCode = hashCode * 59 + TotalAmount.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Returns true if Transaction instances are equal
        /// </summary>
        /// <param name="other">Instance of Transaction to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Transaction other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TransactionID == other.TransactionID ||
                     TransactionID != null &&
                     TransactionID.Equals(other.TransactionID)
                     ) &&
                 (
                     BuyerFirstName == other.BuyerFirstName ||
                     BuyerFirstName != null &&
                     BuyerFirstName.Equals(other.BuyerFirstName)
                 ) &&
                 (
                     BuyerLastName == other.BuyerLastName ||
                     BuyerLastName != null &&
                     BuyerLastName.Equals(other.BuyerLastName)
                 ) &&
                 (
                     BuyerAddress == other.BuyerAddress ||
                     BuyerAddress != null &&
                     BuyerAddress.Equals(other.BuyerAddress)
                 ) &&
                 (
                     BuyerCity == other.BuyerCity ||
                     BuyerCity != null &&
                     BuyerCity.Equals(other.BuyerCity)
                 ) &&
                 (
                     BuyerEmail == other.BuyerEmail ||
                     BuyerEmail != null &&
                     BuyerEmail.Equals(other.BuyerEmail)
                 ) &&
                 (
                     BuyerUserId == other.BuyerUserId ||
                     BuyerUserId != null &&
                     BuyerUserId.Equals(other.BuyerUserId)
                 ) &&
                 (
                     PaymentStatus == other.PaymentStatus ||
                     PaymentStatus != null &&
                     PaymentStatus.Equals(other.PaymentStatus)
                 ) &&
                 (
                     PaymentReferenceId == other.PaymentReferenceId ||
                     PaymentReferenceId != null &&
                     PaymentReferenceId.Equals(other.PaymentReferenceId)
                 ) &&
                 (
                     TotalAmount == other.TotalAmount ||
                     TotalAmount != null &&
                     TotalAmount.Equals(other.TotalAmount)
                 ));
        }