Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int    allRecordCount = 0;
            string sortname       = context.Request.Params["sortname"];
            string sortorder      = context.Request.Params["sortorder"];
            int    page           = Convert.ToInt32(context.Request.Params["page"]) - 1; // 系统的索引从0开始,所以此处需要减1
            int    pagesize       = Convert.ToInt32(context.Request.Params["pagesize"]);
            string fromWhere      = context.Request.QueryString["fromwhere"];

            object sessionAppUser = context.Session[ConfigManager.GetSignInAppUserSessionName()];

            BLL = new ZlctBLL((AppUser)sessionAppUser);

            //排序
            string orderby = @" " + sortname + " " + sortorder + " ";
            //通过检索翻译 生成查询条件
            FilterTranslator ft = ContextExtension.GetGridData(context);
            //分页
            DataTable dt = new DataTable();

            switch (fromWhere)
            {
            case "Gzzs_List":
                dt = BLL.RetrieveGzzs_List(ft, pagesize, page, orderby, out allRecordCount).Result;
                break;

            case "Zshf_all_List":
                dt = BLL.RetrieveZshf_all_List(ft, pagesize, page, orderby, out allRecordCount).Result;
                break;

            case "DxjbSendRecords_List":
                dt = BLL.RetrieveDxjbSendRecords_List(ft, pagesize, page, orderby, out allRecordCount).Result;
                break;

            case "YzDxjb_List":
                dt = BLL.RetrieveYzDxjb_List(ft, pagesize, page, orderby, out allRecordCount).Result;
                break;
            }
            ft.Parms.Clear();
            string result = JSONHelper.DataTableToJson(dt);

            json = @"{""Rows"":[" + result + @"],""Total"":""" + allRecordCount + @"""}";
            context.Response.Write(json);
            context.Response.End();
        }