예제 #1
0
 private static IEnumerable CalculateExcelSummaries(EmployeeMenu[] choices)
 {
     return
         (from ChoiceEnum option in Enum.GetValues(typeof(ChoiceEnum))
          select new
          {
              SummaryMark = option,
              MondaySummary = choices.Where(it => it.MondayChoice == option).Count(),
              TuesdaySummary = choices.Where(it => it.TuesdayChoice == option).Count(),
              WednesdaySummary = choices.Where(it => it.WednesdayChoice == option).Count(),
              ThursdaySummary = choices.Where(it => it.ThursdayChoice == option).Count(),
              FridaySummary = choices.Where(it => it.FridayChoice == option).Count()
          }).ToList();
 }
예제 #2
0
 private static IEnumerable CalculateWordSummaries(EmployeeMenu[] choices)
 {
     var fromDay = GetFirstDayOfNextWeek(DateTime.Today);
     return
         (from cnt in Enumerable.Range(0, 5)
          let day = fromDay.AddDays(cnt)
          select new
          {
              Day = day.DayOfWeek,
              Menu =
                 from menu in WeeklyMenus
                 select new
                 {
                     Name = menu.GetType().GetProperty(day.DayOfWeek + "Menu").GetValue(menu, null),
                     TotalOrders =
                         choices.Where(it => it.GetType().GetProperty(day.DayOfWeek + "Choice")
                                                 .GetValue(it, null).Equals(menu.MenuMark))
                         .Count()
                 }
          }).ToList();
 }