Beispiel #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string json   = "{}";
            string action = context.Request.Form["Action"];
            string sidstr = context.Request.Form["SID"];
            int    sid    = int.Parse(sidstr);

            if (action == "Show")
            {
                BLL.BBSSection bll = new BLL.BBSSection();
                DataSet        ds  = bll.GetList(sid, 20);               //调用业务逻辑层的方法
                ds.Tables[0].TableName = "Admin";                        //为数据表改名
                                                                         //返回列表
                json = WEB.DataConvertJson.DataTable2Json(ds.Tables[0]); //调用把datatable转为json的方法
            }
            context.Response.Write(json);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string json   = "";
            string action = context.Request.Form["Action"];

            if (action == "Show")//显示
            {
                if (context.Session["ID"] == null)
                {
                    json = "{}";//未登录
                }
                else
                {
                    BLL.BBSSection bll = new BLL.BBSSection();
                    DataSet        ds  = bll.GetList("");
                    ds.Tables[0].TableName = "SectionTable";
                    //返回列表
                    json = WEB.DataConvertJson.DataTable2Json(ds.Tables[0]);
                }
            }
            else if (action == "Del")                                     //删除操作
            {
                string         DelNumS = context.Request.Form["DelNumS"]; //获取批量删除的编号
                BLL.BBSSection bll     = new BLL.BBSSection();
                if (bll.DeleteList(DelNumS))
                {
                    json = "{'info':'删除成功'}";
                }
                else
                {
                    json = "{'info':'删除失败'}";
                }
            }
            context.Response.Write(json);
        }