/// <summary> /// 得到一个对象实体 /// </summary> public EDRS.Model.XT_DZJZ_JZMB GetModel(string MBJZBH) { StringBuilder strSql = new StringBuilder(); strSql.Append("select MBJZBH,AJLB,SYCH from XT_DZJZ_JZMB "); strSql.Append(ConfigHelper.GetConfigString("OrcDBLinq")); strSql.Append(" where MBJZBH=:MBJZBH "); OracleParameter[] parameters = { new OracleParameter(":MBJZBH", OracleType.Char, 14) }; parameters[0].Value = MBJZBH; EDRS.Model.XT_DZJZ_JZMB model = new EDRS.Model.XT_DZJZ_JZMB(); 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_DZJZ_JZMB GetModel(string MBJZBH)", "EDRS.OracleDAL.XT_DZJZ_JZMB", strSql.ToString(), parameters); } if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public EDRS.Model.XT_DZJZ_JZMB DataRowToModel(DataRow row) { EDRS.Model.XT_DZJZ_JZMB model = new EDRS.Model.XT_DZJZ_JZMB(); if (row != null) { if (row["MBJZBH"] != null) { model.MBJZBH = row["MBJZBH"].ToString(); } if (row["AJLB"] != null) { model.AJLB = row["AJLB"].ToString(); } if (row["SYCH"] != null) { model.SYCH = row["SYCH"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EDRS.Model.XT_DZJZ_JZMB model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update XT_DZJZ_JZMB set "); strSql.Append("AJLB=:AJLB,"); strSql.Append("SYCH=:SYCH"); strSql.Append(" where MBJZBH=:MBJZBH "); OracleParameter[] parameters = { new OracleParameter(":AJLB", OracleType.VarChar, 50), new OracleParameter(":SYCH", OracleType.Char, 1), new OracleParameter(":MBJZBH", OracleType.Char, 14) }; parameters[0].Value = model.AJLB; parameters[1].Value = model.SYCH; parameters[2].Value = model.MBJZBH; 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_DZJZ_JZMB model)", "EDRS.OracleDAL.XT_DZJZ_JZMB", strSql.ToString(), parameters); } if (rows > 0) { return(true); } else { return(false); } }