public ReportsGrandGridDatesView ReportsGridGroupByDates(ReportsGridView reportsGridData) { var reportsGridDates = new ReportsGrandGridDatesView { ReportsGridView = new List <ReportGridDateView> { new ReportGridDateView { Items = new List <ReportsGridItemsView>() } } }; var timeEntriesForGrouping = GetTimeEntriesForGrouping(reportsGridData); if (!timeEntriesForGrouping.Any()) { return(reportsGridDates); } var timeEntriesGroupByDate = timeEntriesForGrouping.ToList() .GroupBy(i => i.Date) .OrderBy(x => x.Key.Date) .ToDictionary(key => key.Key, key => key.OrderBy(value => value.Date).AsEnumerable()); var result = reportsGridDates.GetViewReportsGrandGridClients(timeEntriesGroupByDate, Mapper); return(result); }
public ReportsGrandGridDatesView GroupByDates(string userName, RequestReportsGrid reportsGridData) { var reportsGridDates = new ReportsGrandGridDatesView { ReportsGridView = new List <ReportGridDateView> { new ReportGridDateView { Items = new List <ReportsGridItemsView>() } } }; var timeEntriesForGrouping = GetTimeEntriesForGrouping(userName, reportsGridData); if (!timeEntriesForGrouping.Any()) { return(reportsGridDates); } var timeEntriesGroupByDate = timeEntriesForGrouping .GroupBy(i => i.Date) .ToDictionary(key => key.Key, key => key.Select(value => value)); var result = reportsGridDates.GetViewReportsGrandGridClients(timeEntriesGroupByDate, Mapper); return(result); }
public static ReportsGrandGridDatesView GetViewReportsGrandGridClients(this ReportsGrandGridDatesView reportsGridEntitiesClients, Dictionary <DateTime, IEnumerable <TimeEntry> > timeEntries, IMapper _mapper) { var reportGridDateView = timeEntries.Select(x => x.GetViewReportGridDate(_mapper)); foreach (var groupingTimeEntries in reportGridDateView) { reportsGridEntitiesClients.GrandActualTime += groupingTimeEntries.TotalActualTime; reportsGridEntitiesClients.GrandEstimatedTime += groupingTimeEntries.TotalEstimatedTime; } reportsGridEntitiesClients.ReportsGridView = reportGridDateView; return(reportsGridEntitiesClients); }