public void GetAllDics()
        {
            //用于序列化实体类的对象
            JavaScriptSerializer jss = new JavaScriptSerializer();

            //请求中携带的条件
            string order     = HttpContext.Request.Params["order"];
            string sort      = HttpContext.Request.Params["sort"];
            string searchKey = HttpContext.Request.Params["search"];
            int    offset    = Convert.ToInt32(HttpContext.Request.Params["offset"]); //0
            int    pageSize  = Convert.ToInt32(HttpContext.Request.Params["limit"]);

            int                 total = 0;
            SysDicManager       dm    = new SysDicManager();
            List <SysDicEntity> list  = dm.GetSearch(searchKey, sort, order, offset, pageSize, out total);
            //List<DicViewModel> listView = new List<DicViewModel>();
            //foreach (var item in list)
            //{
            //    listView.Add(new DicViewModel { iId = item.iId, iKey = item.iKey, iValue = item.iValue, iType = item.iType, iUpdatedOn = item.iUpdatedOn.ToString("yyyyMMdd HH:mm") });
            //}

            //给分页实体赋值
            PageModels <SysDicEntity> model = new PageModels <SysDicEntity>();

            model.total = total;
            if (total % pageSize == 0)
            {
                model.page = total / pageSize;
            }
            else
            {
                model.page = (total / pageSize) + 1;
            }

            model.rows = list;

            //将查询结果返回
            HttpContext.Response.Write(jss.Serialize(model));
        }
Beispiel #2
0
        public string GetAllDics(string order, string sort, string searchKey, int offset, int pageSize)
        {
            int                 total   = 0;
            SysDicManager       manager = new SysDicManager();
            List <SysDicEntity> list    = manager.GetSearch(searchKey, sort, order, offset, pageSize, out total);

            //给分页实体赋值
            PageModels <SysDicEntity> model = new PageModels <SysDicEntity>();

            model.total = total;
            if (total % pageSize == 0)
            {
                model.page = total / pageSize;
            }
            else
            {
                model.page = (total / pageSize) + 1;
            }

            model.rows = list;

            //将查询结果返回
            return(new JavaScriptSerializer().Serialize(model));
        }