public double GetSaleQuantityForProduct(Guid productId, int year = 0, Month month = Month.None) { Dictionary <int, Dictionary <Month, double> > TurnoverReport = new Dictionary <int, Dictionary <Month, double> >(); TransactionsForProduct SalesRecords = GetTransactionsForProduct(productId, out TurnoverReport); TransactionsForProductInYear SalesRecordForYear = SalesRecords.TransactionsForProductInYear.FirstOrDefault(x => x.Year == year); return(year == 0 ? SalesRecords.TransactionsForProductInYear.Sum(x => x.TransactionsPerMonth.Sum(y => y.Value)) : (month == Month.None ? SalesRecordForYear.TransactionsPerMonth.Sum(x => x.Value) : SalesRecordForYear.TransactionsPerMonth[month])); }
public Dictionary <string, double> AnnualAuctionForProduct(Guid productId, int year) { Dictionary <int, Dictionary <Month, double> > TurnoverRecords; Dictionary <string, double> Report = new Dictionary <string, double>(); TransactionsForProductInYear AuctionRecord = AuctionLogic.GetAuctionsForProduct(productId).TransactionsForProductInYear .FirstOrDefault(x => x.Year == year); if (AuctionRecord != null) { AuctionRecord.TransactionsPerMonth.Keys.ToList().ForEach(x => { Report.Add(x.ToString(), AuctionRecord.TransactionsPerMonth[x]); }); } return(Report); }