private List <DashboardGraph> GetDahboardGraph(DateTime?dts, DateTime?dte, List <ViewAttData> ViewAttDataListGH) { List <DashboardGraph> vmList = new List <DashboardGraph>(); while (dts < dte) { if (ViewAttDataListGH.Where(aa => aa.AttDate >= dts && aa.AttDate <= dte && aa.StatusP == true).Count() > 0) { DashboardGraph obj = new DashboardGraph(); obj.XAxis = dts.Value.ToString("dd-MMM-yyyy"); obj.YAxis = ViewAttDataListGH.Where(aa => aa.AttDate == dts && aa.StatusP == true).Count(); vmList.Add(obj); } dts = dts.Value.AddDays(1); } return(vmList); }
public ActionResult GetDahboardGraph() { DateTime dtE = new DateTime(2016,02,02); //DateTime dtE = DateTime.Today.AddDays(-1); DateTime dtS = dtE.AddDays(-31); TAS2013Entities db = new TAS2013Entities(); List<DailySummary> ds = new List<DailySummary>(); List<DailySummary> dsTemp = new List<DailySummary>(); DashboardGraph dg = new DashboardGraph(); ds = db.DailySummaries.Where(aa => aa.Date >= dtS && aa.Date<=dtE && aa.Criteria == "C").ToList(); if (ds.Count > 0) { dg.DateTime1 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn1 = (int)ds[0].LIEmps; dg.DateTime2 = ds[2].Date.Value.ToString("dd-MMM"); dg.LateIn2 = (int)ds[2].LIEmps; dg.DateTime3 = ds[4].Date.Value.ToString("dd-MMM"); dg.LateIn3 = (int)ds[4].LIEmps; dg.DateTime4 = ds[7].Date.Value.ToString("dd-MMM"); dg.LateIn4 = (int)ds[7].LIEmps; dg.DateTime5 = ds[10].Date.Value.ToString("dd-MMM"); dg.LateIn5 = (int)ds[10].LIEmps; dg.DateTime6 = ds[12].Date.Value.ToString("dd-MMM"); dg.LateIn6 = (int)ds[12].LIEmps; dg.DateTime7 = ds[15].Date.Value.ToString("dd-MMM"); dg.LateIn7 = (int)ds[15].LIEmps; dg.DateTime8 = ds[17].Date.Value.ToString("dd-MMM"); dg.LateIn8 = (int)ds[17].LIEmps; dg.DateTime9 = ds[19].Date.Value.ToString("dd-MMM"); dg.LateIn9 = (int)ds[19].LIEmps; dg.DateTime10 = ds[ds.Count-1].Date.Value.ToString("dd-MMM"); dg.LateIn10 = (int)ds[ds.Count - 1].LIEmps; } else { } if (HttpContext.Request.IsAjaxRequest()) return Json(dg , JsonRequestBehavior.AllowGet); return RedirectToAction("Index"); }
public ActionResult GetDahboardGraph() { //DateTime dtE = new DateTime(2016,02,02); DateTime dtE = DateTime.Today.AddDays(-1); DateTime dtS = dtE.AddDays(-31); TAS2013Entities db = new TAS2013Entities(); List <DailySummary> ds = new List <DailySummary>(); List <DailySummary> dsTemp = new List <DailySummary>(); DashboardGraph dg = new DashboardGraph(); ds = db.DailySummaries.Where(aa => aa.Date >= dtS && aa.Date <= dtE && aa.Criteria == "C").ToList(); if (ds.Count > 0) { dg.DateTime1 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn1 = (int)ds[0].LIEmps; if (ds.Count > 1) { dg.DateTime2 = ds[2].Date.Value.ToString("dd-MMM"); dg.LateIn2 = (int)ds[2].LIEmps; } else { dg.DateTime2 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn2 = (int)ds[0].LIEmps; } if (ds.Count > 2) { dg.DateTime3 = ds[4].Date.Value.ToString("dd-MMM"); dg.LateIn3 = (int)ds[4].LIEmps; } else { dg.DateTime3 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn3 = (int)ds[0].LIEmps; } if (ds.Count > 3) { dg.DateTime4 = ds[7].Date.Value.ToString("dd-MMM"); dg.LateIn4 = (int)ds[7].LIEmps; } else { dg.DateTime4 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn4 = (int)ds[0].LIEmps; } if (ds.Count > 4) { dg.DateTime5 = ds[10].Date.Value.ToString("dd-MMM"); dg.LateIn5 = (int)ds[10].LIEmps; } else { dg.DateTime5 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn5 = (int)ds[0].LIEmps; } if (ds.Count > 5) { dg.DateTime6 = ds[12].Date.Value.ToString("dd-MMM"); dg.LateIn6 = (int)ds[12].LIEmps; } else { dg.DateTime6 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn6 = (int)ds[0].LIEmps; } if (ds.Count > 6) { dg.DateTime7 = ds[15].Date.Value.ToString("dd-MMM"); dg.LateIn7 = (int)ds[15].LIEmps; } else { dg.DateTime7 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn7 = (int)ds[0].LIEmps; } if (ds.Count > 7) { dg.DateTime8 = ds[17].Date.Value.ToString("dd-MMM"); dg.LateIn8 = (int)ds[17].LIEmps; } else { dg.DateTime8 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn8 = (int)ds[0].LIEmps; } if (ds.Count > 8) { dg.DateTime9 = ds[19].Date.Value.ToString("dd-MMM"); dg.LateIn9 = (int)ds[19].LIEmps; } else { dg.DateTime9 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn9 = (int)ds[0].LIEmps; } if (ds.Count > 9) { dg.DateTime10 = ds[ds.Count - 1].Date.Value.ToString("dd-MMM"); dg.LateIn10 = (int)ds[ds.Count - 1].LIEmps; } else { dg.DateTime10 = ds[0].Date.Value.ToString("dd-MMM"); dg.LateIn10 = (int)ds[0].LIEmps; } } else { } if (HttpContext.Request.IsAjaxRequest()) { return(Json(dg , JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Index")); }