protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //加载客户服务信息 BLL.HKSJ_Clients clients = new BLL.HKSJ_Clients(); // ClientsShow = clients.GetModelList(string.Empty); int pageIndex = Request["pageIndex"] == null ? 1 : Convert.ToInt32(Request["pageIndex"]); int pageSize = Request["pageSize"] == null ? 10 : Convert.ToInt32(Request["pageSize"]); int totalCount = clients.GetRecordCount(string.Empty); ClientsShow = clients.DataTableToList(clients.GetListByPage(string.Empty, "id", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex).Tables[0]); NavPager = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, totalCount); } }
public void ProcessRequest(HttpContext context) { //判断用户是否登录 //首先判断用户是否已经登陆 if (context.Session["user"] == null) { context.Response.Write("请您正常操作"); return; } context.Response.ContentType = "text/plain"; //page:2 //rows:10 //sort:ID //order:asc List <Model.HKSJ_Clients> list = new List <Model.HKSJ_Clients>(); BLL.HKSJ_Clients clientService = new BLL.HKSJ_Clients(); int pageIndex = context.Request["page"] == null ? 1 : int.Parse(context.Request["page"]); int pageSize = context.Request["rows"] == null ? 5 : int.Parse(context.Request["rows"]); DataSet ds = clientService.GetListByPage("", "id", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex); list = clientService.DataTableToList(ds.Tables[0]); int total = clientService.GetRecordCount(string.Empty); var data = new { total = total, rows = list }; JavaScriptSerializer TypicalClientJSon = new JavaScriptSerializer(); string json = TypicalClientJSon.Serialize(data); context.Response.Write(json); }