/// <summary> /// 得到一个对象实体 /// </summary> public EDRS.Model.XT_QX_RYGNFP DataRowToModel(DataRow row) { EDRS.Model.XT_QX_RYGNFP model = new EDRS.Model.XT_QX_RYGNFP(); if (row != null) { if (row["DWBM"] != null) { model.DWBM = row["DWBM"].ToString(); } if (row["GH"] != null) { model.GH = row["GH"].ToString(); } if (row["GNBM"] != null) { model.GNBM = row["GNBM"].ToString(); } if (row["BMBM"] != null) { model.BMBM = row["BMBM"].ToString(); } //model.GNCS=row["GNCS"].ToString(); if (row["BZ"] != null) { model.BZ = row["BZ"].ToString(); } } return(model); }
/// <summary> /// 添加人员功能权限数据 /// </summary> /// <returns></returns> private string AddData() { string msg = string.Empty; string gnid = Request["gns"]; string ghs = Request["ghs"]; string[] arrghs = ghs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] arrgns = gnid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <EDRS.Model.XT_QX_RYGNFP> modelList = new List <EDRS.Model.XT_QX_RYGNFP>(); string where = string.Empty; string wghs = string.Empty; string wgnbms = string.Empty; for (int j = 0; j < arrgns.Length; j++) { for (int i = 0; i < arrghs.Length; i++) { EDRS.Model.XT_QX_RYGNFP model = new EDRS.Model.XT_QX_RYGNFP(); model.DWBM = UserInfo.DWBM; model.GH = arrghs[i]; model.GNBM = arrgns[j]; model.BMBM = "0 "; //model.GNCS = ""; model.BZ = ""; modelList.Add(model); if (j == 0) { wghs += "'" + arrghs[i] + "'"; if (i < arrghs.Length - 1) { wghs += ","; } } } wgnbms += "'" + arrgns[j] + "'"; if (j < arrgns.Length - 1) { wgnbms += ","; } } EDRS.BLL.XT_QX_RYGNFP bll = new EDRS.BLL.XT_QX_RYGNFP(this.Request); List <EDRS.Model.XT_QX_RYGNFP> modelList2 = bll.GetModelList(" and DWBM = '" + UserInfo.DWBM + "' and GH in (" + wghs + ") and GNBM in (" + wgnbms + ")"); List <EDRS.Model.XT_QX_RYGNFP> modelList3 = modelList.Except(modelList2, new XT_QX_RYGNFPListEquality()).ToList(); if (modelList3.Count == 0 || bll.AddList(modelList3)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能权限管理Web, "添加人员功能权限成功", "工号:" + ghs, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.win, "保存成功", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.功能权限管理Web, "添加人员功能权限失败", "工号:" + ghs, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EDRS.Model.XT_QX_RYGNFP model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update XT_QX_RYGNFP set "); strSql.Append("DWBM=:DWBM,"); strSql.Append("GH=:GH,"); strSql.Append("GNBM=:GNBM,"); strSql.Append("BMBM=:BMBM,"); strSql.Append("GNCS=:GNCS,"); strSql.Append("BZ=:BZ"); strSql.Append(" where DWBM=:DWBM and GH=:GH and GNBM=:GNBM "); OracleParameter[] parameters = { new OracleParameter(":DWBM", OracleType.VarChar, 50), new OracleParameter(":GH", OracleType.Char, 4), new OracleParameter(":GNBM", OracleType.VarChar, 50), new OracleParameter(":BMBM", OracleType.Char, 4), new OracleParameter(":GNCS", OracleType.Clob, 4000), new OracleParameter(":BZ", OracleType.VarChar, 900) }; parameters[0].Value = model.DWBM; parameters[1].Value = model.GH; parameters[2].Value = model.GNBM; parameters[3].Value = model.BMBM; parameters[4].Value = string.IsNullOrWhiteSpace(model.GNCS) ? " " : model.GNCS; parameters[5].Value = model.BZ; 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_RYGNFP model)", "EDRS.OracleDAL.XT_QX_RYGNFP", strSql.ToString(), parameters); } if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public EDRS.Model.XT_QX_RYGNFP GetModel(string DWBM, string GH, string GNBM) { StringBuilder strSql = new StringBuilder(); strSql.Append("select DWBM,GH,GNBM,BMBM,BZ from XT_QX_RYGNFP "); strSql.Append(ConfigHelper.GetConfigString("OrcDBLinq")); strSql.Append(" where DWBM=:DWBM and GH=:GH and GNBM=:GNBM "); OracleParameter[] parameters = { new OracleParameter(":DWBM", OracleType.VarChar, 50), new OracleParameter(":GH", OracleType.Char, 4), new OracleParameter(":GNBM", OracleType.VarChar, 50) }; parameters[0].Value = DWBM; parameters[1].Value = GH; parameters[2].Value = GNBM; EDRS.Model.XT_QX_RYGNFP model = new EDRS.Model.XT_QX_RYGNFP(); 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_RYGNFP GetModel(string DWBM,string GH,string GNBM)", "EDRS.OracleDAL.XT_QX_RYGNFP", strSql.ToString(), parameters); } if (ds != null && ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }