Пример #1
0
        public JsonResult DataGrid()
        {
            int ec     = int.Parse(Request.QueryString["sEcho"]);
            int skp    = int.Parse(Request.QueryString["iDisplayLength"]);
            int tke    = int.Parse(Request.QueryString["iDisplayStart"]);
            int roleId = int.Parse(Request.QueryString["roleId"]);

            var projList = roleFeatureService.GetFeaturesByRoleID(roleId).OrderBy(r => r.Name);

            var obj = (from c in projList
                       select new object[] { c.Description
                                             , new GridButtonModel[]
                                             {
                                                 new GridButtonModel {
                                                     U = Url.Action("Delete", new { id = c.Id }), T = "Delete", D = GridButtonDialog.dialig1.ToString(), H = "Delete Feature", M = "class=\"btn btn-info btn-mini\""
                                                 }
                                             } }).Skip(tke).Take(skp).ToArray();

            JQueryDataTable js = new JQueryDataTable();

            js.sEcho = ec;
            js.iTotalDisplayRecords = projList.Count().ToString();
            js.iTotalRecords        = js.iTotalDisplayRecords;
            js.aaData = obj;

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult DataGrid()
        {
            int ec  = int.Parse(Request.QueryString["sEcho"]);
            int skp = int.Parse(Request.QueryString["iDisplayLength"]);
            int tke = int.Parse(Request.QueryString["iDisplayStart"]);

            IEnumerable <StandingData> projList = null;

            int id = (int)SessionHelper.Temp;

            if (id == 1)
            {
                projList = standingDataService.GetSource();
            }

            var obj = (from c in projList
                       select new object[] { c.Name, c.StringValue, c.IsActive?"Active":"Inactive"
                                             , new GridButtonModel[]
                                             {
                                                 new GridButtonModel {
                                                     U = Url.Action("Edit", new { id = c.Id }), T = "Edit", D = GridButtonDialog.dialig1.ToString(), H = "Edit", M = "class=\"btn btn-info btn-mini\""
                                                 },
                                             } }).Skip(tke).Take(skp).ToArray();

            JQueryDataTable js = new JQueryDataTable();

            js.sEcho = ec;
            js.iTotalDisplayRecords = projList.Count().ToString();
            js.iTotalRecords        = js.iTotalDisplayRecords;
            js.aaData = obj;

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
            // ''' <summary>
            // ''' Returns data to build a data grid
            // ''' </summary>
            // ''' <param name="params"></param>
            // ''' <returns></returns>
            // ''' <remarks></remarks>
            //Public Function GetData(ByVal params As Dictionary(Of String, String)) As JQueryDataTable
            //    Dim gridData As New JQueryDataTable
            //    Dim offset As Integer = params("start")
            //    Dim pageSize As Integer = params("length")
            //    Dim columnNames As String() = params("columnnames").Split(",")
            //    Dim columnIndex = CType(params("order[0].column"), Integer)
            //    Dim sortColumn As String = columnNames(columnIndex)
            //    Dim sortOrder As String = params("order[0].dir")
            //    Dim searchText As String = params("searchtext")
            //    Dim searchType As String = params("searchtype")
            //    Dim searchData As New DataSet
            //    Dim totalRecords As Integer
            //    Dim sortingOrder As Boolean
            //    sortingOrder = IIf(sortOrder.ToLower = "asc", False, True)
            //    Select Case searchType
            //        Case Is = "TEXTSEARCH"
            //            Dim dbTextSearch As New DBTextSearch(settings)
            //            searchData = dbTextSearch.TextSearch(searchText, offset, pageSize, sortColumn, IIf(sortOrder.ToLower = "asc", False, True))
            //        Case Is = "PAYMENTTYPESEARCH"
            //            Dim dbPaymentTypeSearch As New DBPaymentTypeSearch(settings)
            //            searchData = dbPaymentTypeSearch.PaymentTypeSearch(searchText, offset, pageSize, sortColumn, IIf(sortOrder.ToLower = "asc", False, True))
            //    End Select
            //    totalRecords = CType(searchData.Tables(0).Rows(0)(0), Integer)
            //    gridData.draw = params("draw")
            //    gridData.recordsTotal = totalRecords
            //    gridData.recordsFiltered = totalRecords
            //    gridData.data = ConvertDataTableToList(searchData.Tables(1))
            //    Return gridData
            //End Function
            /// <summary>
            /// Returns data to build a data grid
            /// </summary>
            /// <param name="params"></param>
            /// <param name="searchType"></param>
            /// <param name="offset"></param>
            /// <param name="pageSize"></param>
            /// <param name="sortColumn"></param>
            /// <param name="sortOrder"></param>
            /// <param name="searchText"></param>
            /// <returns></returns>
            /// <remarks></remarks>
            public JQueryDataTable GetData(Dictionary <string, string> @params, int draw, string searchType, int offset, int pageSize, string sortColumn, string sortOrder, string searchText)
            {
                JQueryDataTable gridData     = new JQueryDataTable();
                DataSet         searchData   = new DataSet();
                int             totalRecords = 0;
                bool            sortingOrder;

                sortingOrder = sortOrder.ToLower() == "asc" ? false : true;
                switch (searchType)
                {
                case "TEXTSEARCH":
                    TalentSystemDefaults.DESettings temp_settings = settings;
                    Database_Text_Search            dbTextSearch  = new Database_Text_Search(ref temp_settings);
                    settings   = temp_settings;
                    searchData = dbTextSearch.TextSearch(searchText, offset, pageSize, sortColumn, sortOrder.ToLower() == "asc" ? false : true);
                    break;

                case "PAYMENTTYPESEARCH":
                    TalentSystemDefaults.DESettings temp_settings2      = settings;
                    Database_PaymentType_Search     dbPaymentTypeSearch = new Database_PaymentType_Search(ref temp_settings2);
                    settings   = temp_settings2;
                    searchData = dbPaymentTypeSearch.PaymentTypeSearch(searchText, offset, pageSize, sortColumn, sortOrder.ToLower() == "asc" ? false : true);
                    break;
                }
                totalRecords             = System.Convert.ToInt32(searchData.Tables[0].Rows[0][0]);
                gridData.draw            = draw;
                gridData.recordsTotal    = totalRecords;
                gridData.recordsFiltered = totalRecords;
                gridData.data            = ConvertDataTableToList(searchData.Tables[1]);
                return(gridData);
            }
Пример #4
0
        public JsonResult DataGrid()
        {
            int ec  = int.Parse(Request.QueryString["sEcho"]);
            int skp = int.Parse(Request.QueryString["iDisplayLength"]);
            int tke = int.Parse(Request.QueryString["iDisplayStart"]);

            var projList = roleService.GetAll();

            var obj = (from c in projList
                       select new object[] { c.RoleName, c.RoleDefaultPage.Name, c.IsActive?"Active":"Inactive"
                                             , new GridButtonModel[]
                                             {
                                                 new GridButtonModel {
                                                     U = Url.Action("Edit", new { id = c.Id }), T = "Edit", D = GridButtonDialog.dialig1.ToString(), H = "Edit Role", M = "class=\"btn btn-info btn-mini\""
                                                 }
                                                 , new GridButtonModel {
                                                     U = Url.Action("Index", "RoleFeature", new { roleId = c.Id }), T = "Rights", M = "class=\"btn btn-info btn-mini\"", A = false
                                                 }
                                             } }).Skip(tke).Take(skp).ToArray();

            JQueryDataTable js = new JQueryDataTable();

            js.sEcho = ec;
            js.iTotalDisplayRecords = projList.Count().ToString();
            js.iTotalRecords        = js.iTotalDisplayRecords;
            js.aaData = obj;

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
            public JQueryDataTable GetSearchData(DTParameters dtParams)
            {
                JQueryDataTable     retVal = new JQueryDataTable();
                DatabaseSearchModel model  = default(DatabaseSearchModel);
                int    offset     = 0;
                int    pageSize   = 0;
                int    draw       = 0;
                string sortColumn = string.Empty;
                string searchText = string.Empty;
                string searchType = string.Empty;
                string sortOrder  = string.Empty;

                base.SetParamsAndSettings();
                string[] columnNames = dtParams.columnnames.Split(",".ToCharArray(), StringSplitOptions.None);
                var      columnIndex = System.Convert.ToInt32(dtParams.order[0].Column);

                offset     = dtParams.start;
                pageSize   = dtParams.length;
                sortColumn = columnNames[columnIndex];
                sortOrder  = dtParams.order[0].Dir.ToString();
                searchText = dtParams.searchtext;
                searchType = dtParams.searchtype;
                draw       = dtParams.draw;
                model      = new DatabaseSearchModel(settings);
                retVal     = model.GetData(@params, draw, searchType, offset, pageSize, sortColumn, sortOrder, searchText);
                return(retVal);
            }
        /// <summary>
        /// This methiod transforms the DataTableList data into a JQueryDataTable format.
        /// This is used by DataTables to ensure that the Ajax returns from server-side processing requests are drawn in sequence by DataTables (Ajax requests are asynchronous and thus can return out of sequence).
        /// This is used as part of the draw return parameter (see below).
        /// </summary>
        public JQueryDataTable <T> GetJQueryDataTable()
        {
            JQueryDataTable <T> result = new JQueryDataTable <T>();

            result.draw = Draw;

            //Initialize row count variables if not implicitly set
            if (DataTableList == null)
            {
                result.recordsTotal    = 0;
                result.recordsFiltered = 0;
                result.dataList        = new List <T>();
            }
            else
            {
                // Populate the totals
                if (RecordsTotal > 0)
                {
                    result.recordsTotal = RecordsTotal;
                }
                else
                {
                    result.recordsTotal = DataTableList.Count;
                }

                if (RecordsFiltered > 0)
                {
                    result.recordsFiltered = RecordsFiltered;
                }
                else
                {
                    result.recordsFiltered = DataTableList.Count;
                }

                // Populate the list
                result.dataList = DataTableList;
            }



            return(result);
        }
Пример #7
0
        public JsonResult DataGrid()
        {
            int    ec         = int.Parse(Request.QueryString["sEcho"]);
            int    skp        = int.Parse(Request.QueryString["iDisplayLength"]);
            int    tke        = int.Parse(Request.QueryString["iDisplayStart"]);
            string searchText = Request.QueryString["searchText"];

            var data = service.GetAll(searchText, userId);

            var obj = (from c in data
                       select new object[] { c.Pin, c.UserName, c.EmailAddress, c.Role.RoleName, c.IsActive?"Active":"Inactive"
                                             , new GridButtonModel[]
                                             {
                                                 new GridButtonModel {
                                                     U = Url.Action("Edit", new { id = c.Id }), T = "Edit", D = GridButtonDialog.dialig1.ToString(), H = "Edit User"
                                                 }
                                                 , new GridButtonModel {
                                                     U = Url.Action("Details", new { id = c.Id }), T = "Details", D = GridButtonDialog.dialig1.ToString(), H = "User Profile"
                                                 }
                                                 , new GridButtonModel {
                                                     U = Url.Action("ResetPass", new { id = c.Id }), T = "Password Reset", D = GridButtonDialog.dialig1.ToString(), H = "Reset Password", V = ("" + c.Password != "")
                                                 }
                                                 , new GridButtonModel {
                                                     U = Url.Action("Districts", new { id = c.Id }), T = "Districts", D = GridButtonDialog.dialig1.ToString(), H = "Assigned Districts"
                                                 }
                                             } }).Skip(tke).Take(skp).ToArray();

            JQueryDataTable js = new JQueryDataTable();

            js.sEcho = ec;
            js.iTotalDisplayRecords = data.Count().ToString();
            js.iTotalRecords        = js.iTotalDisplayRecords;
            js.aaData = obj;

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        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 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 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 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));
        }
Пример #12
0
        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));
        }