public JsonResult DataGridApp() { bool visible = UserRole.Check("DETAIL", SessionHelper.Role); int ec = int.Parse(Request.QueryString["sEcho"]); int take = int.Parse(Request.QueryString["iDisplayLength"]); int skip = int.Parse(Request.QueryString["iDisplayStart"]); if (take == -1) { take = 100000000; skip = 0; } int?srcId = null; try { //srcId = Convert.ToInt32(Request.QueryString["ContentTypeId1"]); } catch { } int?disId = null; try { //disId = Convert.ToInt32(Request.QueryString["ContentTypeId2"]); } catch { } int?upzId = null; try { //upzId = Convert.ToInt32(Request.QueryString["ContentTypeId3"]); } catch { } DateTime FromDate = Convert.ToDateTime(Request.QueryString["FromDate"]); DateTime ToDate = Convert.ToDateTime(Request.QueryString["ToDate"]); int count = 0; IEnumerable <DetailData> dataList = sunDataService.GetAppData(srcId, disId, upzId, FromDate, ToDate, skip, take, out count); var obj = (from c in dataList select new object[] { //c.StandingData.Name //,c.StandingData1.Name //,c.StandingData2.Name String.Format("{0:dd MMM, yyyy}", c.Date) //,c.Name //,c.Age , c.IsFever == true?"<span style=\"color:#FF0000\">হ্যা</span>":"না" , c.IsDryCough == true?"<span style=\"color:#FF0000\">হ্যা</span>":"না" , c.IsBreadth == true?"<span style=\"color:#FF0000\">হ্যা</span>":"না" , c.IsContact == true?"<span style=\"color:#FF0000\">হ্যা</span>":"না" //,c.StandingData3.Name , c.CollectedBy , c.Phone , c.Description //,c.UserProfile.UserName , new GridButtonModel[] { new GridButtonModel { U = Url.Action("Edit", new { Id = c.Id }), T = "Edit", D = GridButtonDialog.dialig1.ToString(), H = "Edit", M = "class=\"btn btn-mini btn-warning\"", V = visible } } }).ToArray(); JQueryDataTable js = new JQueryDataTable(); js.sEcho = ec; js.iTotalDisplayRecords = count.ToString(); js.iTotalRecords = js.iTotalDisplayRecords; js.aaData = obj; return(Json(js, JsonRequestBehavior.AllowGet)); }
public JsonResult DataGridReleif() { bool visible = UserRole.Check("DISTRICT", SessionHelper.Role); int ec = int.Parse(Request.QueryString["sEcho"]); int take = int.Parse(Request.QueryString["iDisplayLength"]); int skip = int.Parse(Request.QueryString["iDisplayStart"]); //bool isSum = bool.Parse(Request.QueryString["isSum"]); //if (take == -1 || isSum) { take = 1000000000; skip = 0; } int?divId = null; try { divId = Convert.ToInt32(Request.QueryString["ContentTypeId1"]); } catch { } int?disId = null; try { disId = Convert.ToInt32(Request.QueryString["ContentTypeId2"]); } catch { } DateTime FromDate = Convert.ToDateTime(Request.QueryString["FromDate"]); DateTime ToDate = Convert.ToDateTime(Request.QueryString["ToDate"]); int count = 0; List <DistrictData> dataList = disDataService.Get(divId, disId, FromDate, ToDate, skip, take, out count).ToList(); //List<DistrictData> dl = new List<DistrictData>(); /* * if (skip<=0 && dataList.Count()>0) * { * IEnumerable<DistrictData> dataListSum = disDataService.Get(divId, disId, FromDate, ToDate, skip, 1000000000, out count); * * DistrictData tot = dataListSum.GroupBy(q => 1) * .Select(g => new DistrictData * { * Id = 0 * , * Date = ToDate * , * StandingData = new StandingData { Name = "<span style=\"color:#ff6a00; font-size:14px;\">Total</span>" } * , * DivisionId = -1 * , * StandingData1 = new StandingData { Name = " " } * , * DistrictId = -1 * , * NewQuarantine = g.Sum(c => c.NewQuarantine) * , * Death = g.Sum(c => c.Death) * , * DoTestOn = g.Sum(c => c.DoTestOn) * , * ReleasedQuarantine = g.Sum(c => c.ReleasedQuarantine) * //, * //TillCurrentQuarantine = g.Sum(c => c.TillCurrentQuarantine) * //, * //TillDeath = g.Sum(c => c.TillDeath) * //, * //TillDoTestOn = g.Sum(c => c.TillDoTestOn) * //, * //TillQuarantine = g.Sum(c => c.TillQuarantine) * //, * //TillReleasedQuarantine = g.Sum(c => c.TillReleasedQuarantine) * , * ReliefFamily = g.Sum(c => c.ReliefFamily) * //, * // ReliefPerson = g.Sum(c => c.ReliefPerson) * , * Rice = g.Sum(c => c.Rice) * , * Dal = g.Sum(c => c.Dal) * , * Potato = g.Sum(c => c.Potato) * , * Money = g.Sum(c => c.Money) * //, * // Onion = g.Sum(c => c.Onion) * //, * // Salt = g.Sum(c => c.Salt) * //, * // Oil = g.Sum(c => c.Oil) * //, * // Soap = g.Sum(c => c.Soap) * , * InsertedById = -1 * , * UserProfile = new UserProfile { UserName = "" } * } * ).Single(); * * dataList.Insert(0, tot); * } */ if (FromDate == ToDate && divId == null && disId == null) { IEnumerable <StandingData> districts = standingDataService.GetDistricts(); List <int> all = districts.Select(c => c.Id).ToList(); List <int> used = dataList.Select(c => c.DistrictId).ToList(); List <int> notused = all.Except(used).ToList(); List <StandingData> add = districts.Where(c => notused.Contains(c.Id)).ToList(); foreach (var v in add) { dataList.Add(new DistrictData { Id = 0 , Date = ToDate , StandingData = new StandingData { Name = "<span style=\"color:#0000ff;\">তথ্য দেয়া হয়নি</span>" } , DivisionId = v.ParentId.Value , StandingData1 = new StandingData { Name = v.Name } , DistrictId = v.Id , InsertedById = -1 , UserProfile = new UserProfile { UserName = "" } }); } } var obj = (from c in dataList select new object[] { c.StandingData.Name , c.StandingData1.Name , String.Format("{0:dd MMM, yyyy}", c.Date) , c.NewQuarantine , c.ReleasedQuarantine , c.DoTestOn , c.Death , c.TillQuarantine , c.TillReleasedQuarantine , c.TillDoTestOn , c.TillDeath , c.TillCurrentQuarantine , c.ReliefFamily //,c.ReliefPerson , c.Rice , c.Dal , c.Potato , c.Money , c.ReliefRemarks //,c.Onion //,c.Salt //,c.Oil //,c.Soap //,c.UserProfile.UserName //,new GridButtonModel[] // { // new GridButtonModel{U=Url.Action("Edit",new {Id=c.Id}), T="Edit", D = GridButtonDialog.dialig1.ToString(), H="Edit", M="class=\"btn btn-mini btn-warning\"", V = visible} // } }).ToArray(); JQueryDataTable js = new JQueryDataTable(); js.sEcho = ec; js.iTotalDisplayRecords = count.ToString(); js.iTotalRecords = js.iTotalDisplayRecords; js.aaData = obj; return(Json(js, JsonRequestBehavior.AllowGet)); }
public JsonResult DataGrid() { bool visible = UserRole.Check("DISTRICT", SessionHelper.Role); int ec = int.Parse(Request.QueryString["sEcho"]); int take = int.Parse(Request.QueryString["iDisplayLength"]); int skip = int.Parse(Request.QueryString["iDisplayStart"]); //bool isSum = bool.Parse(Request.QueryString["isSum"]); //if (take == -1 || isSum) { take = 1000000000; skip = 0; } int?divId = null; try { divId = Convert.ToInt32(Request.QueryString["ContentTypeId1"]); } catch { } int?disId = null; try { disId = Convert.ToInt32(Request.QueryString["ContentTypeId2"]); } catch { } DateTime FromDate = Convert.ToDateTime(Request.QueryString["FromDate"]); DateTime ToDate = Convert.ToDateTime(Request.QueryString["ToDate"]); int count = 0; List <DistrictData> dataList = disDataService.Get(divId, disId, FromDate, ToDate, skip, take, out count).ToList(); /* * if (skip <= 0 && dataList.Count()>0) * { * IEnumerable<DistrictData> dataListSum = disDataService.Get(divId, disId, FromDate, ToDate, 0, 10000000, out count); * * DistrictData tot = dataListSum.GroupBy(q => 1) * .Select(g => new DistrictData * { * Id = 0 * , * Date = ToDate * , * StandingData = new StandingData { Name = " Total" } * , * DivisionId = -1 * , * StandingData1 = new StandingData { Name = " " } * , * DistrictId = -1 * , * NewQuarantine = g.Sum(c => c.NewQuarantine) * , * Death = g.Sum(c => c.Death) * , * DoTestOn = g.Sum(c => c.DoTestOn) * , * ReleasedQuarantine = g.Sum(c => c.ReleasedQuarantine) * , * InsertedById = -1 * , * UserProfile = new UserProfile { UserName = "" } * } * ).Single(); * * dataList.Insert(0, tot); * } */ if (FromDate == ToDate && divId == null && disId == null) { IEnumerable <StandingData> districts = standingDataService.GetDistricts(); List <int> all = districts.Select(c => c.Id).ToList(); List <int> used = dataList.Select(c => c.DistrictId).ToList(); List <int> notused = all.Except(used).ToList(); List <StandingData> add = districts.Where(c => notused.Contains(c.Id)).ToList(); foreach (var v in add) { dataList.Add(new DistrictData { Id = 0 , Date = ToDate , StandingData = new StandingData { Name = "<span style=\"color:#0000ff;\">তথ্য দেয়া হয়নি</span>" } , DivisionId = v.ParentId.Value , StandingData1 = new StandingData { Name = v.Name } , DistrictId = v.Id , InsertedById = -1 , UserProfile = new UserProfile { UserName = "" } }); } } var obj = (from c in dataList select new object[] { "⇒" + c.StandingData.Name + "<br/>⇒" + c.StandingData1.Name + "<br/>⇒" + String.Format("{0:dd MMM, yyyy}", c.Date) + "<br/>⇒ D (" + c.MemberCount + ") U(" + c.MemberUpazillaCount + ")" //,c.NewQuarantine //,c.ReleasedQuarantine //,c.DoTestOn //,c.Death , c.LocalAdminMeasure , c.Demand , c.Panic , c.SocialIssue , c.BracThink , c.NgoDoing , c.NeedyPeople , c.BracDo , c.Remarks //,c.UserProfile.UserName //,new GridButtonModel[] // { // new GridButtonModel{U=Url.Action("Edit",new {Id=c.Id}), T="Edit", D = GridButtonDialog.dialig1.ToString(), H="Edit", M="class=\"btn btn-mini btn-warning\"", V = visible} // } }).ToArray(); JQueryDataTable js = new JQueryDataTable(); js.sEcho = ec; js.iTotalDisplayRecords = count.ToString(); js.iTotalRecords = js.iTotalDisplayRecords; js.aaData = obj; return(Json(js, JsonRequestBehavior.AllowGet)); }
public JsonResult DataGrid() { int count = 0; bool visible = UserRole.Check("HNPP", SessionHelper.Role); int ec = int.Parse(Request.QueryString["sEcho"]); int take = int.Parse(Request.QueryString["iDisplayLength"]); int skip = int.Parse(Request.QueryString["iDisplayStart"]); //bool isSum = bool.Parse(Request.QueryString["isSum"]); //if (take == -1 || isSum) { take = 1000000000; skip = 0; } int?disId = null; try { disId = Convert.ToInt32(Request.QueryString["ContentTypeId2"]); } catch { } int?upzId = null; try { upzId = Convert.ToInt32(Request.QueryString["ContentTypeId3"]); } catch { } DateTime FromDate = Convert.ToDateTime(Request.QueryString["FromDate"]); DateTime ToDate = Convert.ToDateTime(Request.QueryString["ToDate"]); List <HnppData> dataList = sunDataService.Get(disId, upzId, FromDate, ToDate, skip, take, out count).ToList(); //List<HnppData> dl = new List<HnppData>(); if (skip <= 0 && dataList.Count() > 0) { IEnumerable <HnppData> dataListSum = sunDataService.Get(disId, upzId, FromDate, ToDate, skip, 1000000000, out count); HnppData tot = dataListSum.GroupBy(q => 1) .Select(g => new HnppData { Id = 0 , Date = ToDate , DistrictId = -1 , StandingData = new StandingData { Name = "<span style=\"color:#ff6a00; font-size:14px;\">Total</span>" } , UpazillaId = -1 , StandingData1 = new StandingData { Name = " " } , RiskByAM = g.Sum(c => c.RiskByAM) , RiskByPA = g.Sum(c => c.RiskByPA) , RiskByPK = g.Sum(c => c.RiskByPK) , RiskBySK = g.Sum(c => c.RiskBySK) , RiskBySS = g.Sum(c => c.RiskBySS) , CaseCnt = g.Sum(c => c.CaseCnt) , BracMeeting = g.Sum(c => c.BracMeeting) , BracParticipant = g.Sum(c => c.BracParticipant) , GovtMeeting = g.Sum(c => c.GovtMeeting) , GovtParticipant = g.Sum(c => c.GovtParticipant) , Leaflet = g.Sum(c => c.Leaflet) , Sticker = g.Sum(c => c.Sticker) , InsertedById = -1 , UserProfile = new UserProfile { UserName = "" } }) .Single(); //dataList.Add(tot); dataList.Insert(0, tot); } //List<HnppData> dataListSorted = dataList // .OrderBy(c => c.StandingData.Name) // .ThenBy(c => c.StandingData1.Name) // .ToList(); var obj = (from c in dataList select new object[] { c.StandingData.Name , c.StandingData1.Name , String.Format("{0:dd MMM, yyyy}", c.Date) , c.RiskBySS , c.RiskBySK , c.RiskByPK , c.RiskByPA , c.RiskByAM , c.Leaflet , c.Sticker , c.CaseCnt , c.BracMeeting , c.BracParticipant , c.GovtMeeting , c.GovtParticipant , c.UserProfile.UserName , new GridButtonModel[] { new GridButtonModel { U = Url.Action("Edit", new { Id = c.Id }), T = "Edit", D = GridButtonDialog.dialig1.ToString(), H = "Edit", M = "class=\"btn btn-mini btn-warning\"" , V = (visible && c.Id != 0) } } }).ToArray(); JQueryDataTable js = new JQueryDataTable(); js.sEcho = ec; js.iTotalDisplayRecords = count.ToString(); js.iTotalRecords = js.iTotalDisplayRecords; js.aaData = obj; return(Json(js, JsonRequestBehavior.AllowGet)); }