/// <summary> /// 绑定数据列表 /// </summary> /// <returns></returns> private string ListBind() { int pageNumber = int.Parse(Request["page"]); int pageSize = int.Parse(Request["rows"]); string where = string.Empty; object[] values = new object[2]; string key = Request["key"]; if (!string.IsNullOrEmpty(key)) { where += " and JSMC like :JSMC"; values[0] = "%" + key + "%"; } if (!string.IsNullOrEmpty(Request["dkey"])) { where += " and BMBM in (SELECT distinct ID FROM view_dw_bm START WITH trim(ID) = :ID CONNECT BY nocycle Parentid = PRIOR ID)"; values[1] = Request["dkey"].ToString(); } XT_QX_JSBM bll = new XT_QX_JSBM(this.Request); DataSet ds = bll.GetListByPageAlly(where, "", (pageSize * pageNumber) - pageSize + 1, (pageSize * pageNumber), values); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { int count = bll.GetRecordCount(where, values); return("{\"total\":" + count + ",\"rows\":" + JsonHelper.JsonString(ds.Tables[0]) + "}"); } return(ReturnString.JsonToString(Prompt.error, "未设置角色", null));; }
/// <summary> /// 修改 /// </summary> /// <param name="dwbm"></param> /// <returns></returns> private string UpData() { string JSBM = Request.Form.Get("key_hidd"); string BMBM = Request.Form.Get("key_hidd_dw"); string DWBM = Request.Form.Get("hidd_unitNumber"); if (string.IsNullOrEmpty(JSBM) || string.IsNullOrEmpty(BMBM) || string.IsNullOrEmpty(DWBM)) { return(ReturnString.JsonToString(Prompt.error, "参数错误", null)); } string msg = string.Empty; //if (!ProvingFrom(ref msg)) // return ReturnString.JsonToString(Prompt.error, msg, null); XT_QX_JSBM bll = new XT_QX_JSBM(this.Request); EDRS.Model.XT_QX_JSBM model = bll.GetModel(JSBM, BMBM, DWBM); if (model != null) { model.JSMC = Request.Form.Get("txt_name").Trim(); model.JSXH = Convert.ToDecimal(Request.Form.Get("txt_number").Trim()); if (bll.Update(model)) { return(ReturnString.JsonToString(Prompt.win, "保存成功", null)); } return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); } else { return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); } }
/// <summary> /// 删除 /// </summary> /// <returns></returns> private string DelData() { string ids = Request.Form["BMBM"]; XT_QX_JSBM bll = new XT_QX_JSBM(this.Request); //if (bll.Delete(ids)) // return ReturnString.JsonToString(Prompt.win, "删除数据成功", null); //return ReturnString.JsonToString(Prompt.error, "删除数据失败", null); return(""); }
/// <summary> /// 添加角色数据 /// </summary> /// <returns></returns> private string AddData() { string msg = string.Empty; if (!ProvingFrom(ref msg)) { return(ReturnString.JsonToString(Prompt.error, msg, null)); } string number = "001"; XT_ZZJG_BMBM bllBM = new XT_ZZJG_BMBM(this.Request); EDRS.Model.XT_ZZJG_BMBM modelBM = bllBM.GetModel("", Request.Form.Get("hidd_unitNumber").Trim()); if (modelBM == null) { return(ReturnString.JsonToString(Prompt.error, "选择部门不是有效部门,请重新选择", null)); } XT_QX_JSBM bll = new XT_QX_JSBM(this.Request); //获取角色数据编号中最大的一个编号 EDRS.Model.XT_QX_JSBM modelJS = bll.GetListOrderModel(" and DWBM='" + modelBM.DWBM + "' and BMBM='" + modelBM.BMBM + "' and rownum < 2", "JSBM desc", null); if (modelJS != null) { //将数据中最大编号加1表示自增防止编号重复 number = (int.Parse(modelJS.JSBM.ToString()) + 1).ToString(); int len = 3 - number.Length; //字符长度未到3在数字前面自动加0 for (int i = 0; i < len; i++) { number = number.Insert(0, "0"); } } EDRS.Model.XT_QX_JSBM model = new EDRS.Model.XT_QX_JSBM(); model.DWBM = modelBM.DWBM; model.BMBM = modelBM.BMBM; model.JSBM = number; model.JSMC = Request.Form.Get("txt_name").Trim(); model.JSXH = Convert.ToDecimal(Request.Form.Get("txt_number").Trim()); model.SPJSBM = ""; if (bll.Add(model)) { return(ReturnString.JsonToString(Prompt.win, "保存成功", null)); } return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); }
/// <summary> /// 根据编号获取数据 /// </summary> /// <returns></returns> private string GetModelOrParentList() { string JSBM = Request["id"]; string BMBM = Request["bmid"]; string DWBM = Request["dwid"]; if (string.IsNullOrEmpty(JSBM) || string.IsNullOrEmpty(BMBM) || string.IsNullOrEmpty(DWBM)) { return(ReturnString.JsonToString(Prompt.error, "参数错误", null)); } XT_QX_JSBM bll = new XT_QX_JSBM(this.Request); EDRS.Model.XT_QX_JSBM model = bll.GetModel(JSBM, DWBM, BMBM); if (model != null) { return(JsonHelper.JsonString(model)); } return(ReturnString.JsonToString(Prompt.error, "获取数据失败", null)); }