Ejemplo n.º 1
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)));
        }
Ejemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (InvoiceId != null ? InvoiceId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ InvoiceNumber;
         hashCode = (hashCode * 397) ^ (InvoiceNumberAsString != null ? InvoiceNumberAsString.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Total.GetHashCode();
         hashCode = (hashCode * 397) ^ Subtotal.GetHashCode();
         hashCode = (hashCode * 397) ^ Tax.GetHashCode();
         hashCode = (hashCode * 397) ^ TaxPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ InvoiceDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (ContractName != null ? ContractName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PeriodStartDate.GetHashCode();
         hashCode = (hashCode * 397) ^ PeriodEndDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (Currency != null ? Currency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (From != null ? From.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (To != null ? To.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LineItems?.Sum(x => x.GetHashCode()) ?? 0);
         return(hashCode);
     }
 }
Ejemplo n.º 3
0
 public override string ToString()
 {
     return(Policy.PolicyNumber + ", premium: " + Premium.ToString() + ", " + PeriodStartDate.ToString() + " - " + PeriodEndDate.ToString());
 }
Ejemplo n.º 4
0
 public override string ToString()
 {
     return("[" + ID + "] " + PeriodStartDate.ToString() + ", " + PeriodEndDate.ToString());
 }