/// <summary> /// 得到一个对象实体 /// </summary> public EDRS.Model.XT_QX_GNFL GetModel(string FLBM) { StringBuilder strSql = new StringBuilder(); strSql.Append("select FLBM,FLMC,FFLBM,FLXH,SFSC,DWBM,URLDZ from XT_QX_GNFL "); strSql.Append(ConfigHelper.GetConfigString("OrcDBLinq")); strSql.Append(" where FLBM=:FLBM "); OracleParameter[] parameters = { new OracleParameter(":FLBM", OracleType.VarChar, 50) }; parameters[0].Value = FLBM; EDRS.Model.XT_QX_GNFL model = new EDRS.Model.XT_QX_GNFL(); DataSet ds = null; try { ds = DbHelperOra.Query(strSql.ToString(), parameters); } catch (Exception ex) { EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public EDRS.Model.XT_QX_GNFL GetModel(string FLBM)", "EDRS.OracleDAL.XT_QX_GNFL", strSql.ToString(), parameters); } if (ds != null && ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EDRS.Model.XT_QX_GNFL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update XT_QX_GNFL set "); strSql.Append("FLMC=:FLMC,"); strSql.Append("FFLBM=:FFLBM,"); strSql.Append("FLXH=:FLXH,"); strSql.Append("SFSC=:SFSC,"); strSql.Append("DWBM=:DWBM,"); strSql.Append("URLDZ=:URLDZ"); strSql.Append(" where FLBM=:FLBM "); OracleParameter[] parameters = { new OracleParameter(":FLMC", OracleType.VarChar, 30), new OracleParameter(":FFLBM", OracleType.VarChar, 50), new OracleParameter(":FLXH", OracleType.Number, 4), new OracleParameter(":SFSC", OracleType.Char, 1), new OracleParameter(":DWBM", OracleType.VarChar, 50), new OracleParameter(":URLDZ", OracleType.NVarChar), new OracleParameter(":FLBM", OracleType.VarChar, 50) }; parameters[0].Value = model.FLMC; parameters[1].Value = model.FFLBM; parameters[2].Value = model.FLXH; parameters[3].Value = model.SFSC; parameters[4].Value = model.DWBM; parameters[5].Value = model.URLDZ; parameters[6].Value = model.FLBM; int rows = 0; try { rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); } catch (Exception ex) { EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public bool Update(EDRS.Model.XT_QX_GNFL model)", "EDRS.OracleDAL.XT_QX_GNFL", strSql.ToString(), parameters); } if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(EDRS.Model.XT_QX_GNFL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into XT_QX_GNFL("); strSql.Append("FLBM,FLMC,FFLBM,FLXH,SFSC,DWBM,URLDZ)"); strSql.Append(" values ("); strSql.Append(":FLBM,:FLMC,:FFLBM,:FLXH,:SFSC,:DWBM,:URLDZ)"); OracleParameter[] parameters = { new OracleParameter(":FLBM", OracleType.VarChar, 50), new OracleParameter(":FLMC", OracleType.VarChar, 30), new OracleParameter(":FFLBM", OracleType.VarChar, 50), new OracleParameter(":FLXH", OracleType.Number, 4), new OracleParameter(":SFSC", OracleType.Char, 1), new OracleParameter(":DWBM", OracleType.VarChar, 50), new OracleParameter(":URLDZ", OracleType.NVarChar) }; parameters[0].Value = model.FLBM; parameters[1].Value = model.FLMC; parameters[2].Value = model.FFLBM; parameters[3].Value = model.FLXH; parameters[4].Value = model.SFSC; parameters[5].Value = model.DWBM; parameters[6].Value = model.URLDZ; int rows = 0; try { rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); } catch (Exception ex) { EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public bool Add(EDRS.Model.XT_QX_GNFL model)", "EDRS.OracleDAL.XT_QX_GNFL", strSql.ToString(), parameters); } if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 添加配置数据 /// </summary> /// <returns></returns> private string AddData() { string msg = string.Empty; if (!ProvingFrom(ref msg)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "添加功能分类验证失败:" + msg, Request.Form.Get("txt_mc"), UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, msg, null)); } EDRS.BLL.XT_QX_GNFL bll = new EDRS.BLL.XT_QX_GNFL(this.Request); string number = UserInfo.DWBM + "000001";// Request.Form.Get("txt_dwbm").Trim() DataSet ds = bll.GetListByPage(" and dwbm=" + StringPlus.ReplaceSingle(UserInfo.DWBM.Trim()), "FLBM desc", 0, 1, null); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { number = (Decimal.Parse(ds.Tables[0].Rows[0]["FLBM"].ToString()) + 1).ToString(); } EDRS.Model.XT_QX_GNFL model = new EDRS.Model.XT_QX_GNFL(); model.FLBM = number; model.FLMC = Request.Form.Get("txt_mc").Trim(); model.DWBM = UserInfo.DWBM; // Request.Form.Get("txt_dwbm").Trim(); model.FLXH = Convert.ToDecimal(Request.Form.Get("txt_xh").Trim()); model.FFLBM = ""; model.SFSC = "N"; model.URLDZ = ""; if (bll.Add(model)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "添加功能分类成功", model.FLMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.win, "保存成功", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "添加功能分类失败", model.FLMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); }
/// <summary> /// 修改配置数据 /// </summary> /// <returns></returns> private string UpData() { string pzbm = Request.Form.Get("key_hidd").Trim(); if (string.IsNullOrEmpty(pzbm)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "修改功能分类的参数错误", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); } string msg = string.Empty; if (!ProvingFrom(ref msg)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "修改功能分类验证失败:" + msg, Request.Form.Get("txt_mc"), UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, msg, null)); } EDRS.BLL.XT_QX_GNFL bll = new EDRS.BLL.XT_QX_GNFL(this.Request); EDRS.Model.XT_QX_GNFL model = bll.GetModel(pzbm); if (model != null) { model.FLMC = Request.Form.Get("txt_mc").Trim(); model.DWBM = UserInfo.DWBM;// Request.Form.Get("txt_dwbm").Trim(); model.FLXH = Convert.ToDecimal(Request.Form.Get("txt_xh").Trim()); if (bll.Update(model)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "修改功能分类成功", model.FLMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.win, "保存成功", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "修改功能分类失败", model.FLMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "修改功能分类未找到信息", Request.Form.Get("txt_mc"), UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); }
/// <summary> /// 根据单位获取配置数据 /// </summary> /// <param name="DWBM"></param> /// <returns></returns> private string GetModel(string PZBM) { if (string.IsNullOrEmpty(PZBM)) { PZBM = Request["id"]; if (string.IsNullOrEmpty(PZBM)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "根据编号获取功能分类信息参数错误", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "参数错误", null)); } } EDRS.BLL.XT_QX_GNFL bll = new EDRS.BLL.XT_QX_GNFL(this.Request); EDRS.Model.XT_QX_GNFL model = bll.GetModel(PZBM); if (model != null) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "根据编号获取功能分类信息成功", model.FLMC, UserInfo, UserRole, this.Request); return(JsonHelper.JsonString(model)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.功能分类管理Web, "根据编号获取功能分类信息参数失败", Request["mc"], UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "获取数据失败", null)); }
/// <summary> /// 得到一个对象实体 /// </summary> public EDRS.Model.XT_QX_GNFL DataRowToModel(DataRow row) { EDRS.Model.XT_QX_GNFL model = new EDRS.Model.XT_QX_GNFL(); if (row != null) { if (row["FLBM"] != null) { model.FLBM = row["FLBM"].ToString(); } if (row["FLMC"] != null) { model.FLMC = row["FLMC"].ToString(); } if (row["FFLBM"] != null) { model.FFLBM = row["FFLBM"].ToString(); } if (row["FLXH"] != null && row["FLXH"].ToString() != "") { model.FLXH = decimal.Parse(row["FLXH"].ToString()); } if (row["SFSC"] != null) { model.SFSC = row["SFSC"].ToString(); } if (row["DWBM"] != null) { model.DWBM = row["DWBM"].ToString(); } if (row["URLDZ"] != null) { model.URLDZ = row["URLDZ"].ToString(); } } return(model); }