Пример #1
0
 //returns the total amount for a given year, month and type
 public double getAmount(Invoice.InvoiceType type, int year, int month)
 {
     if (contains(type, year, month))
     {
         MonthlyInvoice mInvoice = this.MonthlyInvoices.Find(m => m.Month == month && m.Year == year && m.Type == type);
         return(mInvoice.Amount);
     }
     else
     {
         return(0);
     }
 }
Пример #2
0
 public void addInvoice(Invoice.InvoiceType type, int year, int month, double amount)
 {
     lock (this.MonthlyInvoices)
     {
         if (contains(type, year, month))
         {
             MonthlyInvoice mInvoice = this.MonthlyInvoices.Find(m => m.Month == month && m.Year == year && m.Type == type);
             mInvoice.Amount += amount;
         }
         else
         {
             MonthlyInvoice mInvoice = new MonthlyInvoice(type, year, month, amount);
             this.MonthlyInvoices.Add(mInvoice);
         }
     }
 }
Пример #3
0
 public void addInvoice(Invoice.InvoiceType type, int year, int month, double amount)
 {
     lock (this.MonthlyInvoices)
     {
         if (contains(type, year, month))
         {
             MonthlyInvoice mInvoice = this.MonthlyInvoices.Find(m => m.Month == month && m.Year == year && m.Type == type);
             mInvoice.Amount += amount;
         }
         else
         {
             MonthlyInvoice mInvoice = new MonthlyInvoice(type, year, month, amount);
             this.MonthlyInvoices.Add(mInvoice);
         }
     }
 }