Exemple #1
0
        public ActionResult ReportsRun(DateTime startDate, DateTime endDate)
        {
            MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel reportData =
                GetChartViewModel("Reports Run", "ReportsRun", "# of Reports Run", "bar");
            MOE.Common.Models.Repositories.IApplicationEventRepository eventRepository =
                MOE.Common.Models.Repositories.ApplicationEventRepositoryFactory.Create();
            var           metrics      = metricTypeRepository.GetAllToDisplayMetrics();
            List <string> descriptions = new List <string>();

            foreach (MetricType m in metrics)
            {
                descriptions.Add(m.ChartName + " Executed");
                reportData.ChartData.Add(new MOE.Common.Business.ActionLog.ChartData {
                    Description = m.ChartName, Value = 0
                });
            }
            var events = eventRepository.GetEventsByDateDescriptions(startDate, endDate, descriptions);

            foreach (ApplicationEvent ae in events)
            {
                var chartData = reportData.ChartData.Where(r => ae.Description == r.Description + " Executed").FirstOrDefault();
                chartData.Value++;
            }
            SetColors(reportData);
            return(PartialView("Chart", reportData));
        }