public IPageViewModel GetReportViewModel(Period period, DateTime startDate) { IEnumerable <IDaySummary> days = _modelProvider.GetDaySummaries().Where(d => d.Date <= startDate); switch (period) { case Period.Week: return(new ReportsViewModel <IWeekReport>(_reportProvider.GetWeekSummary(days, Period.Week))); case Period.Month: return(new ReportsViewModel <IMonthReport>(_reportProvider.GetMonthSummary(days, Period.Month))); case Period.Quater: return(new ReportsViewModel <IQuaterReport>(_reportProvider.GetQuaterSummary(days, Period.Quater))); case Period.HalfYear: return(new ReportsViewModel <IHalfYearReport>(_reportProvider.GetHalfYearSummary(days, Period.HalfYear))); case Period.Year: return(new ReportsViewModel <IYearReport>(_reportProvider.GetYearSummary(days, Period.Year))); default: return(null); } }
public IPageViewModel GetReportViewModel(List <IDaySummaryViewModel> days, Period period, DateTime startDate, DateTime endDate) { var daymodels = _modelProvider.GetDaySummaries(days.Where(d => d != null).Select(d => _modelProvider.GetDaySummary(d.Date, d.TimeAvailable, d.TimeSpent, d.Tasks.Select(t => t.Task).ToList())), startDate, endDate); switch (period) { case Period.Week: return(new ReportsViewModel <IWeekReport>(_reportProvider.GetWeekSummary(daymodels, startDate, endDate), Period.Week)); case Period.Month: return(new ReportsViewModel <IMonthReport>(_reportProvider.GetMonthSummary(daymodels, startDate, endDate), Period.Month)); case Period.Quater: return(new ReportsViewModel <IQuaterReport>(_reportProvider.GetQuaterSummary(daymodels, startDate, endDate), Period.Quater)); case Period.HalfYear: return(new ReportsViewModel <IHalfYearReport>(_reportProvider.GetHalfYearSummary(daymodels, startDate, endDate), Period.Quater)); case Period.Year: return(new ReportsViewModel <IYearReport>(_reportProvider.GetYearSummary(daymodels, startDate, endDate), Period.Quater)); default: return(null); } }