private void GetData(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { int billId = RequestHelper.GetInt("id", 0); BLL.System.sys_Process_BillSet bll = new BLL.System.sys_Process_BillSet(); DataTable dt = bll.GetList(billId).Tables[0]; if (dt.Rows.Count == 0) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,该条数据已被其他人删除!\"}"); return; } string rowsStr = Utils.ToJson(dt); DataTable pageDT = bll.GetList(billId).Tables[0]; StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":"); jsonStr.Append(rowsStr); jsonStr.Append(",\"pageInfo\":{\"total\":" + pageDT.Rows.Count + ",\"rows\":" + Utils.ToJson(pageDT) + "}"); jsonStr.Append("}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void GetBillTree(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{}"); return; } try { string treeJsonStr = "[{\"id\":0,\"text\":\"根模块\",\"children\":"; BLL.System.sys_Process_BillSet bll = new BLL.System.sys_Process_BillSet(); DataTable dt = bll.GetList("").Tables[0]; if (dt != null && dt.Rows.Count > 0) { treeJsonStr += DtToTreeJson(dt, "ID", "BillName", "SupId", "SortId", "0", "0"); } else { treeJsonStr += "\"\""; } treeJsonStr += "}]"; context.Response.Write(treeJsonStr); } catch { context.Response.Write("{}"); } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string id = RequestHelper.GetString("id"); string supId = RequestHelper.GetString("supId"); string billName = RequestHelper.GetString("billName"); string billSign = RequestHelper.GetString("billSign"); string tableName = RequestHelper.GetString("tableName"); string sortId = RequestHelper.GetString("sortId"); string flagHistory = RequestHelper.GetString("flagHistory"); string processId = RequestHelper.GetString("processId"); if (supId == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"上级模块编码不能为空!\"}"); return; } if (billName == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"模块名称不能为空!\"}"); return; } if (billSign != "" && Utils.StrToInt(processId, 0) == 0) { context.Response.Write("{\"status\":\"0\",\"msg\":\"必须选择审批流!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); BLL.System.sys_Process_BillSet bll = new BLL.System.sys_Process_BillSet(); Model.System.sys_Process_BillSet model = new Model.System.sys_Process_BillSet(); model.ID = Utils.StrToInt(id, 0); model.BillName = billName; model.BillSign = billSign; model.TableName = tableName; model.SortId = int.Parse(sortId); model.SupId = int.Parse(supId); model.ProcessId = Utils.StrToInt(processId, 0); model.FlagHistory = Utils.StrToBool(flagHistory, false); DataTable dt = bll.GetList(int.Parse(supId)).Tables[0]; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (id == "") { model.ID = bll.Add(model, out operaMessage); if (model.ID > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "新增模块配置:" + model.BillName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } else { if (bll.Update(model, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "修改模块配置:" + model.BillName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }