public double CalcBalance(EZInvoiceDB context)
        {
            /* Iterate through all invoices with this client
             * and return total value (positive or negative)
             * of this client's invoices*/

            var invoices = context.Invoices
                           .Include(i => i.Client)
                           .Include(i => i.InvoiceItems)
                           .Where(i => i.Client.Id == this.Id).ToList();

            double total = 0;

            foreach (var invoice in invoices)
            {
                total += invoice.Total();
            }
            return(total);
        }
Exemple #2
0
 public FinancialStatistics(EZInvoiceDB context, int year)
 {
     this._context = context;
     this.year     = year;
 }