Esempio n. 1
0
 public static List <DataEntryInfo> GetRevenueChartData()
 {
     if (!useCache || rChartData == null)
     {
         rChartData = OrderItems.GroupBy(i => i.Product.Category).Select(g => new DataEntryInfo()
         {
             Name = g.Key.ToString(), Value = g.Sum(i => i.Total)
         }).ToList();
     }
     return(rChartData);
 }
Esempio n. 2
0
 static Dictionary <long, List <DataEntryInfo> > CreateProductSalesChartData()
 {
     return(OrderItems.GroupBy(q => q.ProductId)
            .Select(g => new {
         K = g.Key.Value,
         V = g.GroupBy(q => q.Order.OrderDate.Year)
             .Select(yg => new { Year = yg.Key, Total = yg.Sum(i => i.Total) }).OrderBy(i => i.Year).ToList()
     }).ToDictionary(i => i.K, i => i.V.Select(e => new DataEntryInfo()
     {
         Name = e.Year.ToString(), Value = e.Total
     }).ToList()));
 }