예제 #1
0
        public JsonResult SummeryData()
        {
            var dis = disDataService.GetSummery();



            var obj = new
            {
                suspect = detDataService.GetCount()
                ,
                app = detDataService.GetAppCount()
                ,
                femaleSuspect = detDataService.GetCountFemale()
                ,
                reach = sumDataService.GetReachCount()
                ,
                feverBreadth = detDataService.GetCountFeverBreadth()
                ,
                vulnarable = detDataService.Vulnarable(5)
                ,
                district = disDataService.GetSummery()
                           .GroupBy(q => 1)
                           .Select(g => new
                {
                    hospital = g.Sum(c => c.HospitalCount)
                    ,
                    bed = g.Sum(c => c.BedCount)
                    ,
                    curquarantine = g.Sum(c => c.CurrentQuarantine)
                    ,
                    quarantine = g.Sum(c => c.TotalQuarantine)
                    ,
                    released = g.Sum(c => c.TotalReleased)
                    ,
                    death = g.Sum(c => c.TotalDeath)
                    ,
                    test = g.Sum(c => c.TotalDoTestOn)
                           //,
                           //oil = g.Sum(c => c.TotalOil)
                           //,
                           //soap = g.Sum(c => c.TotalSoap)
                           //,
                           //onion = g.Sum(c => c.TotalOnion)
                           //,
                           //salt = g.Sum(c => c.TotalSalt)
                    ,
                    family = g.Sum(c => c.TotalReliefFamily)
                             //,
                             //person = g.Sum(c => c.TotalReliefPerson)
                    ,
                    rice = g.Sum(c => c.TotalRice)
                    ,
                    dal = g.Sum(c => c.TotalDal)
                    ,
                    potato = g.Sum(c => c.TotalPotato)
                    ,
                    money = g.Sum(c => c.TotalMoney)
                }).Single()
                ,
                hnpp = hnppDataService.Get()
                       .GroupBy(q => 1)
                       .Select(g => new
                {
                    govtMeet = g.Sum(c => c.GovtMeeting)
                    ,
                    bracMeet = g.Sum(c => c.BracMeeting)
                    ,
                    leaf = g.Sum(c => c.Leaflet)
                    ,
                    stic = g.Sum(c => c.Sticker)
                }).Single()
            };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
        public JsonResult DataGridSum()
        {
            //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"]);

            //if (take == -1) { take = 100000000; 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 <DistrictSummery> dataList = disDataService.GetSummery(divId, disId, skip, take, out count).ToList();

            if (dataList.Count() > 0)
            {
                DistrictSummery tot = dataList.GroupBy(q => 1)
                                      .Select(g => new DistrictSummery
                {
                    Id = 0
                    ,
                    StandingData = new StandingData {
                        Name = "<span style=\"color:#ff6a00; font-size:14px;\">Total</span>"
                    }
                    ,
                    DivisionId = -1
                    ,
                    StandingData1 = new StandingData {
                        Name = " "
                    }
                    ,
                    DistrictId = -1
                    ,
                    HospitalCount = g.Sum(c => c.HospitalCount)
                    ,
                    BedCount = g.Sum(c => c.BedCount)
                    ,
                    CurrentQuarantine = g.Sum(c => c.CurrentQuarantine)
                    ,
                    TotalDeath = g.Sum(c => c.TotalDeath)
                    ,
                    TotalDoTestOn = g.Sum(c => c.TotalDoTestOn)
                    ,
                    TotalQuarantine = g.Sum(c => c.TotalQuarantine)
                    ,
                    TotalReleased = g.Sum(c => c.TotalReleased)
                    ,
                    TotalReliefFamily = g.Sum(c => c.TotalReliefFamily)
                                        //,
                                        //TotalReliefPerson = g.Sum(c => c.TotalReliefPerson)
                    ,
                    TotalRice = g.Sum(c => c.TotalRice)
                    ,
                    TotalDal = g.Sum(c => c.TotalDal)
                    ,
                    TotalMoney = g.Sum(c => c.TotalMoney)
                    ,
                    TotalPotato = g.Sum(c => c.TotalPotato)
                                  //,
                                  //TotalOil = g.Sum(c => c.TotalOil)
                                  //,
                                  //TotalOnion = g.Sum(c => c.TotalOnion)
                                  //,
                                  //TotalSalt = g.Sum(c => c.TotalSalt)
                                  //,
                                  //TotalSoap = g.Sum(c => c.TotalSoap)
                    ,
                    InsertedById = -1
                    ,
                    UserProfile = new UserProfile {
                        UserName = ""
                    }
                }
                                              ).Single();

                dataList.Insert(0, tot);
            }

            var obj = (from c in dataList
                       select new object[] { c.StandingData.Name
                                             , c.StandingData1.Name
                                             , c.HospitalCount
                                             , c.BedCount
                                             , c.CurrentQuarantine
                                             , c.TotalQuarantine
                                             , c.TotalReleased
                                             , c.TotalDeath
                                             , c.TotalDoTestOn
                                             //,c.Remarks
                                             , c.TotalReliefFamily
                                             //,c.TotalReliefPerson
                                             , c.TotalRice
                                             , c.TotalDal
                                             , c.TotalPotato
                                             , c.TotalMoney
                                             //,c.TotalOnion
                                             //,c.TotalSalt
                                             //,c.TotalOil
                                             //,c.TotalSoap
                                             //,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));
        }