public ReportsGrandGridProjectsView GroupByProjects(string userName, RequestReportsGrid reportsGridData) { var reportsGridProjects = new ReportsGrandGridProjectsView { ReportsGridView = new List <ReportGridProjectView> { new ReportGridProjectView { Items = new List <ReportsGridItemsView>() } } }; var timeEntriesForGrouping = GetTimeEntriesForGrouping(userName, reportsGridData); if (!timeEntriesForGrouping.Any()) { return(reportsGridProjects); } var timeEntriesGroupByProjects = timeEntriesForGrouping .GroupBy(i => i.Project) .OrderBy(x => x.Key.Name) .ToDictionary(key => key.Key, key => key.Select(value => value)); var result = reportsGridProjects.GetViewReportsGrandGridClients(timeEntriesGroupByProjects, Mapper); return(result); }
public ReportsGrandGridProjectsView ReportsGridGroupByProjects(ReportsGridView reportsGridData) { var reportsGridProjects = new ReportsGrandGridProjectsView { ReportsGridView = new List <ReportGridProjectView> { new ReportGridProjectView { Items = new List <ReportsGridItemsView>() } } }; var timeEntriesForGrouping = GetTimeEntriesForGrouping(reportsGridData); if (!timeEntriesForGrouping.Any()) { return(reportsGridProjects); } var timeEntriesGroupByProjects = timeEntriesForGrouping.ToList() .GroupBy(i => i.Project) .OrderBy(x => x.Key.Name) .ToDictionary(key => key.Key, key => key.OrderBy(value => value.Date).AsEnumerable()); var result = reportsGridProjects.GetViewReportsGrandGridClients(timeEntriesGroupByProjects, Mapper); return(result); }
public static ReportsGrandGridProjectsView GetViewReportsGrandGridClients(this ReportsGrandGridProjectsView reportsGridEntitiesProjects, Dictionary <Project, IEnumerable <TimeEntry> > timeEntries, IMapper _mapper) { var reportGridProjectView = timeEntries.Select(x => x.GetViewReportGridProject(_mapper)); foreach (var groupingTimeEntries in reportGridProjectView) { reportsGridEntitiesProjects.GrandActualTime += groupingTimeEntries.TotalActualTime; reportsGridEntitiesProjects.GrandEstimatedTime += groupingTimeEntries.TotalEstimatedTime; } reportsGridEntitiesProjects.ReportsGridView = reportGridProjectView; return(reportsGridEntitiesProjects); }