public static string GetChartTimeSpan(ChartTimeSpan value) { if (value == ChartTimeSpan.cMax) { return("my"); } else { return(value.ToString().Replace("c", "").ToLower()); } }
public static string GetChartTimeSpan(ChartTimeSpan value) { if (value == ChartTimeSpan.cMax) { return "my"; } else { return value.ToString().Replace("c", "").ToLower(); } }
public List <Models.Presentation.HighChartsDataModel> GetJusticeCenterCalls(ChartTimeSpan timeSpan) { List <Models.Presentation.HighChartsDataModel> chartData = new List <Models.Presentation.HighChartsDataModel>(); switch (timeSpan) { case ChartTimeSpan.Month: DateTime today = DateTime.Today; DateTime monthStart = new DateTime(today.Year, today.Month, 1); DateTime monthEnd = monthStart.AddMonths(1).AddDays(-1); List <object> categoryDataValues = new List <object>(); List <object> incidentCountsByDay = new List <object>(); var calls = (from i in this._db.IncidentReports join n in this._db.Notifications on i.incidentId equals n.incidentId where (i.incidentDate >= monthStart && i.incidentDate <= monthEnd) && n.notifyPartyId == 8 && i.statusId != 7 // NOT VOIDED select n.notifyDateTime).ToList(); for (var day = monthStart.Date; day <= monthEnd; day = day.AddDays(1)) { categoryDataValues.Add(day.Day); var incidentsOnDate = calls.Where(i => i.Date == day.Date).Count(); incidentCountsByDay.Add(incidentsOnDate); } chartData.Add(new Models.Presentation.HighChartsDataModel() { name = "Day of Month", data = categoryDataValues }); chartData.Add(new Models.Presentation.HighChartsDataModel() { name = "Justice Center Calls", data = incidentCountsByDay }); break; case ChartTimeSpan.NinetyDays: chartData.Add(new Models.Presentation.HighChartsDataModel() { name = "Last Ninety Days" }); break; case ChartTimeSpan.YTD: chartData.Add(new Models.Presentation.HighChartsDataModel() { name = "Year-to-Date" }); break; } return(chartData); }