Esempio n. 1
0
        public ActionResult GetActionsByMetric(DateTime startDate, DateTime endDate)
        {
            var metrics    = metricTypeRepository.GetAllToDisplayMetrics();
            var actionLogs = actionLogRepository.GetAllByDate(startDate, endDate);

            MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel reportData = GetChartViewModel("Actions By Metric",
                                                                                                  "ActionsByMetric", "# of Actions", "bar");
            List <string> descriptions = new List <string>();

            foreach (MetricType m in metrics)
            {
                int value = 0;
                foreach (ActionLog al in actionLogs)
                {
                    foreach (MetricType mt in al.MetricTypes)
                    {
                        if (m.MetricID == mt.MetricID)
                        {
                            value += al.Actions.Count;
                        }
                    }
                }
                reportData.ChartData.Add(new MOE.Common.Business.ActionLog.ChartData {
                    Description = m.ChartName,
                    Value       = value
                });
            }
            SetColors(reportData);
            return(PartialView("Chart", reportData));
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public ActionResult GetActionsByMetricID(DateTime startDate, DateTime endDate, int metricTypeID)
        {
            var metric     = metricTypeRepository.GetMetricsByID(metricTypeID);
            var actionLogs = actionLogRepository.GetAllByDate(startDate, endDate);
            var actions    = actionRepository.GetAll();

            MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel reportData = GetChartViewModel(metric.ChartName,
                                                                                                  metric.Abbreviation, "# of Actions", "bar");
            foreach (MOE.Common.Models.Action a in actions)
            {
                reportData.ChartData.Add(new MOE.Common.Business.ActionLog.ChartData
                {
                    Description = a.Description,
                    Value       = 0
                });
            }
            foreach (MOE.Common.Models.ActionLog al in actionLogs)
            {
                foreach (MOE.Common.Models.MetricType mt in al.MetricTypes)
                {
                    if (mt.MetricID == metric.MetricID)
                    {
                        foreach (MOE.Common.Models.Action a in al.Actions)
                        {
                            var chartData = reportData.ChartData
                                            .Where(cd => cd.Description == a.Description)
                                            .FirstOrDefault();
                            chartData.Value++;
                        }
                    }
                }
            }
            SetColors(reportData);
            return(PartialView("Chart", reportData));
        }
Esempio n. 4
0
        private void SetColors(MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel reportData)
        {
            List <string> colors = reportData.GetColorList();

            for (int i = 0; i < reportData.ChartData.Count && i < colors.Count; i++)
            {
                reportData.ChartData[i].Color = colors[i];
            }
        }
Esempio n. 5
0
 private MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel GetChartViewModel(string title, string canvasName,
                                                                                  string yAxisDescription, string chartType)
 {
     MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel reportData =
         new MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel();
     reportData.CanvasName       = canvasName;
     reportData.ReportTitle      = title;
     reportData.YAxisDescription = yAxisDescription;
     reportData.ChartType        = chartType;
     reportData.ChartData        = new List <MOE.Common.Business.ActionLog.ChartData>();
     return(reportData);
 }
Esempio n. 6
0
        public ActionResult GetAgencyUsage(DateTime startDate, DateTime endDate)
        {
            var actionLogs = actionLogRepository.GetAllByDate(startDate, endDate);
            var agencies   = agencyRepository.GetAll();

            MOE.Common.Models.ViewModel.MetricUsage.ChartViewModel reportData = GetChartViewModel("Agency Usage",
                                                                                                  "AgencyUsage", "# of Logs by Agency", "pie");
            List <string> descriptions = new List <string>();

            foreach (MOE.Common.Models.Agency a in agencies)
            {
                reportData.ChartData.Add(new MOE.Common.Business.ActionLog.ChartData
                {
                    Description = a.Description,
                    Value       = actionLogs.Where(al => al.AgencyID == a.AgencyID).ToList().Count
                });
            }
            SetColors(reportData);
            return(PartialView("Chart", reportData));
        }