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

            return
                ((
                     AdditionalData == other.AdditionalData ||
                     AdditionalData != null &&
                     AdditionalData.Equals(other.AdditionalData)
                     ) &&
                 (
                     InvoiceDate == other.InvoiceDate ||
                     InvoiceDate != null &&
                     InvoiceDate.Equals(other.InvoiceDate)
                 ) &&
                 (
                     InvoiceNumber == other.InvoiceNumber ||
                     InvoiceNumber != null &&
                     InvoiceNumber.Equals(other.InvoiceNumber)
                 ) &&
                 (
                     TextQualifiers == other.TextQualifiers ||
                     TextQualifiers != null &&
                     TextQualifiers.SequenceEqual(other.TextQualifiers)
                 ));
        }
예제 #2
0
        private bool Equals(IInvoice other)
        {
            if (!(InvoiceId == other.InvoiceId && InvoiceNumber == other.InvoiceNumber && InvoiceNumberAsString == other.InvoiceNumberAsString && Total.Equals(other.Total) &&
                  Subtotal.Equals(other.Subtotal) && Nullable.Equals(Tax, other.Tax) && Nullable.Equals(TaxPercentage, other.TaxPercentage) && InvoiceDate.Equals(other.InvoiceDate) &&
                  ContractName == other.ContractName && PeriodStartDate.Equals(other.PeriodStartDate) && PeriodEndDate.Equals(other.PeriodEndDate) && Currency == other.Currency &&
                  Equals(From, other.From) && Equals(To, other.To)))
            {
                return(false);
            }

            if (LineItems is null && other.LineItems is null)
            {
                return(true);
            }
            if (LineItems is null || other.LineItems is null)
            {
                return(false);
            }
            return(LineItems.OrderBy(x => x.LineIdx).SequenceEqual(other.LineItems.OrderBy(x => x.LineIdx)));
        }