public String ajax_MasterGridData(q_PowerUser sh)
        {
            ac = new a_PowerUser() { Connection = getSQLConnection(), logPlamInfo = plamInfo };
            var r = ac.SearchMaster(sh, LoginUserId);

            HandleResultAjaxFiles(r, Resources.Res.NoMessage);

            int page = (sh.page == null ? 1 : sh.page.CInt()); //int.Parse(getPage);

            int startRecord = PageCount.PageInfo(page, this.DefPageSize, r.Count);

            JQGridDataObject dataObject = new JQGridDataObject();
            List<RowElement> setRowElement = new List<RowElement>();

            foreach (var v in r.SearchData)
            {
                RowElement re = new RowElement();

                re.id = v.progid.ToString();
                re.cell = new String[8];
                re.cell[0] = v.progname;

                for (int i = 0; i < v.Powers.Count; i++)
                    re.cell[i + 1] = JsonConvert.SerializeObject(v.Powers[i], new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });

                setRowElement.Add(re);
            }

            dataObject.rows = setRowElement.ToArray();
            dataObject.total = PageCount.TotalPage;
            dataObject.page = PageCount.Page;
            dataObject.records = PageCount.RecordCount;
            return JsonConvert.SerializeObject(dataObject, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
        }
예제 #2
0
        public String ajax_MasterGridData(q_PowerUser sh)
        {
            ac = new a_PowerUser()
            {
                Connection = getSQLConnection(), logPlamInfo = plamInfo
            };
            var r = ac.SearchMaster(sh, LoginUserId);

            HandleResultAjaxFiles(r, Resources.Res.NoMessage);

            int page = (sh.page == null ? 1 : sh.page.CInt()); //int.Parse(getPage);

            int startRecord = PageCount.PageInfo(page, this.DefPageSize, r.Count);

            JQGridDataObject  dataObject    = new JQGridDataObject();
            List <RowElement> setRowElement = new List <RowElement>();

            foreach (var v in r.SearchData)
            {
                RowElement re = new RowElement();

                re.id      = v.progid.ToString();
                re.cell    = new String[8];
                re.cell[0] = v.progname;

                for (int i = 0; i < v.Powers.Count; i++)
                {
                    re.cell[i + 1] = JsonConvert.SerializeObject(v.Powers[i], new JsonSerializerSettings()
                    {
                        NullValueHandling = NullValueHandling.Ignore
                    });
                }

                setRowElement.Add(re);
            }

            dataObject.rows    = setRowElement.ToArray();
            dataObject.total   = PageCount.TotalPage;
            dataObject.page    = PageCount.Page;
            dataObject.records = PageCount.RecordCount;
            return(JsonConvert.SerializeObject(dataObject, new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            }));
        }