示例#1
0
        private void GetData(HttpContext context, string btn)
        {
            if (btn != "show")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            try
            {
                int ProcessId = RequestHelper.GetInt("id", 0);
                BLL.System.sys_Process bll = new BLL.System.sys_Process();

                DataTable dt = bll.GetList(ProcessId).Tables[0];
                if (dt.Rows.Count == 0)
                {
                    context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,该条数据已被其他人删除!\"}");
                    return;
                }
                string rowsStr = Utils.ToJson(dt);

                DataTable detailDT   = bll.GetDetailList(ProcessId).Tables[0];
                string    detailInfo = Utils.ToJson(detailDT);

                StringBuilder jsonStr = new StringBuilder();
                jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":" + rowsStr + ",\"detailInfo\":" + detailInfo + "}");
                context.Response.Write(jsonStr);
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }
示例#2
0
        private void GetList(HttpContext context, string btn)
        {
            if (btn != "show")
            {
                context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}");
                return;
            }
            try
            {
                BLL.System.sys_Process bll = new BLL.System.sys_Process();


                DataTable     dt      = bll.GetList("").Tables[0];
                string        rowsStr = Utils.ToJson(dt);
                StringBuilder jsonStr = new StringBuilder();
                jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":");
                jsonStr.Append("{\"total\":" + dt.Rows.Count + ",\"rows\":");
                jsonStr.Append(rowsStr);
                jsonStr.Append("}}");
                context.Response.Write(jsonStr);
            }
            catch (Exception e)
            {
                context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}");
                return;
            }
        }