/// <summary> /// 得到一个对象实体 /// </summary> public EDRS.Model.YX_DZJZ_JZRZJL GetModel(decimal XH) { StringBuilder strSql = new StringBuilder(); strSql.Append("select XH,DWBM,DWMC,BMBM,BMMC,CZRGH,CZR,CZSJ,CZIP,CZLX,RZNR,CZAJBMSAH,FQL from YX_DZJZ_JZRZJL "); strSql.Append(ConfigHelper.GetConfigString("OrcDBLinq")); strSql.Append(" where XH=:XH "); OracleParameter[] parameters = { new OracleParameter(":XH", OracleType.Number, 22) }; parameters[0].Value = XH; EDRS.Model.YX_DZJZ_JZRZJL model = new EDRS.Model.YX_DZJZ_JZRZJL(); 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.YX_DZJZ_JZRZJL GetModel(decimal XH)", "EDRS.OracleDAL.YX_DZJZ_JZRZJL", 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 EDRS.Model.YX_DZJZ_JZRZJL DataRowToModel(DataRow row) { EDRS.Model.YX_DZJZ_JZRZJL model = new EDRS.Model.YX_DZJZ_JZRZJL(); if (row != null) { if (row["XH"] != null && row["XH"].ToString() != "") { model.XH = decimal.Parse(row["XH"].ToString()); } if (row["DWBM"] != null) { model.DWBM = row["DWBM"].ToString(); } if (row["DWMC"] != null) { model.DWMC = row["DWMC"].ToString(); } if (row["BMBM"] != null) { model.BMBM = row["BMBM"].ToString(); } if (row["BMMC"] != null) { model.BMMC = row["BMMC"].ToString(); } if (row["CZRGH"] != null) { model.CZRGH = row["CZRGH"].ToString(); } if (row["CZR"] != null) { model.CZR = row["CZR"].ToString(); } if (row["CZSJ"] != null && row["CZSJ"].ToString() != "") { model.CZSJ = DateTime.Parse(row["CZSJ"].ToString()); } if (row["CZIP"] != null) { model.CZIP = row["CZIP"].ToString(); } if (row["CZLX"] != null) { model.CZLX = row["CZLX"].ToString(); } if (row["RZNR"] != null) { model.RZNR = row["RZNR"].ToString(); } if (row["CZAJBMSAH"] != null) { model.CZAJBMSAH = row["CZAJBMSAH"].ToString(); } if (row["FQL"] != null) { model.FQL = row["FQL"].ToString(); } } return(model); }
public void SetLog(string typeId, string dwbm, string dwmc, string gh, string mc, string bmbm, string bmmc, string msg, string billTag) { EDRS.Model.YX_DZJZ_JZRZJL entity = new EDRS.Model.YX_DZJZ_JZRZJL(); EDRS.BLL.YX_DZJZ_JZRZJL rzBll = new EDRS.BLL.YX_DZJZ_JZRZJL(HttpContext.Current.Request); entity.CZLX = typeId; entity.DWBM = dwbm; entity.DWMC = dwmc; entity.CZRGH = gh; entity.CZR = mc; entity.BMBM = bmbm; entity.BMMC = bmmc; entity.RZNR = msg; entity.CZAJBMSAH = billTag == null ? "" : billTag; rzBll.Add(entity); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(EDRS.Model.YX_DZJZ_JZRZJL model) { //删除日志 LogClearTable(); model.CZSJ = DateTime.Now; //代理IP model.CZIP = context.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (string.IsNullOrEmpty(model.CZIP)) { //真实IP model.CZIP = context.ServerVariables["REMOTE_ADDR"]; } StringBuilder strSql = new StringBuilder(); //获取序号 //try //{ // model.XH = NewTableID(); //} //catch (Exception ex) //{ // EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public bool Add(EDRS.Model.YX_DZJZ_JZRZJL model)|DbHelperOra.GetMaxID(\"XH\", \"YX_DZJZ_JZRZJL\")", "EDRS.OracleDAL.YX_DZJZ_JZRZJL", strSql.ToString()); // return false; //} string tableName = LogTable(); if (string.IsNullOrEmpty(tableName)) { tableName = "YX_DZJZ_JZRZJL"; } strSql.AppendFormat("insert into {0}(", tableName); strSql.Append("DWBM,DWMC,BMBM,BMMC,CZRGH,CZR,CZSJ,CZIP,CZLX,RZNR,CZAJBMSAH,FQL)"); strSql.Append(" values ("); strSql.Append(":DWBM,:DWMC,:BMBM,:BMMC,:CZRGH,:CZR,:CZSJ,:CZIP,:CZLX,:RZNR,:CZAJBMSAH,:FQL)"); OracleParameter[] parameters = { // new OracleParameter(":XH", OracleType.Number,4), new OracleParameter(":DWBM", OracleType.VarChar, 50), new OracleParameter(":DWMC", OracleType.VarChar, 300), new OracleParameter(":BMBM", OracleType.Char, 10), new OracleParameter(":BMMC", OracleType.VarChar, 300), new OracleParameter(":CZRGH", OracleType.Char, 4), new OracleParameter(":CZR", OracleType.VarChar, 60), new OracleParameter(":CZSJ", OracleType.DateTime), new OracleParameter(":CZIP", OracleType.VarChar, 20), new OracleParameter(":CZLX", OracleType.Char, 2), new OracleParameter(":RZNR", OracleType.VarChar, 300), new OracleParameter(":CZAJBMSAH", OracleType.VarChar, 100), new OracleParameter(":FQL", OracleType.Char, 4) }; //parameters[0].Value = model.XH; parameters[0].Value = (object)model.DWBM ?? DBNull.Value; parameters[1].Value = model.DWMC; parameters[2].Value = model.BMBM; parameters[3].Value = model.BMMC; parameters[4].Value = (object)model.CZRGH ?? DBNull.Value; parameters[5].Value = (object)model.CZR ?? DBNull.Value; parameters[6].Value = model.CZSJ; parameters[7].Value = model.CZIP; parameters[8].Value = model.CZLX; parameters[9].Value = model.RZNR; parameters[10].Value = model.CZAJBMSAH; parameters[11].Value = DateTime.Now.Year; 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.YX_DZJZ_JZRZJL model)", "EDRS.OracleDAL.YX_DZJZ_JZRZJL", strSql.ToString(), parameters); } if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(EDRS.Model.YX_DZJZ_JZRZJL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update YX_DZJZ_JZRZJL set "); strSql.Append("DWBM=:DWBM,"); strSql.Append("DWMC=:DWMC,"); strSql.Append("BMBM=:BMBM,"); strSql.Append("BMMC=:BMMC,"); strSql.Append("CZRGH=:CZRGH,"); strSql.Append("CZR=:CZR,"); strSql.Append("CZSJ=:CZSJ,"); strSql.Append("CZIP=:CZIP,"); strSql.Append("CZLX=:CZLX,"); strSql.Append("RZNR=:RZNR,"); strSql.Append("CZAJBMSAH=:CZAJBMSAH,"); strSql.Append("FQL=:FQL"); strSql.Append(" where XH=:XH "); OracleParameter[] parameters = { new OracleParameter(":DWBM", OracleType.VarChar, 50), new OracleParameter(":DWMC", OracleType.VarChar, 300), new OracleParameter(":BMBM", OracleType.Char, 10), new OracleParameter(":BMMC", OracleType.VarChar, 300), new OracleParameter(":CZRGH", OracleType.Char, 4), new OracleParameter(":CZR", OracleType.VarChar, 60), new OracleParameter(":CZSJ", OracleType.DateTime), new OracleParameter(":CZIP", OracleType.VarChar, 20), new OracleParameter(":CZLX", OracleType.Char, 2), new OracleParameter(":RZNR", OracleType.VarChar, 300), new OracleParameter(":CZAJBMSAH", OracleType.VarChar, 100), new OracleParameter(":FQL", OracleType.Char, 4), new OracleParameter(":XH", OracleType.Number, 4) }; parameters[0].Value = model.DWBM; parameters[1].Value = model.DWMC; parameters[2].Value = model.BMBM; parameters[3].Value = model.BMMC; parameters[4].Value = model.CZRGH; parameters[5].Value = model.CZR; parameters[6].Value = model.CZSJ; parameters[7].Value = model.CZIP; parameters[8].Value = model.CZLX; parameters[9].Value = model.RZNR; parameters[10].Value = model.CZAJBMSAH; parameters[11].Value = model.FQL; parameters[12].Value = model.XH; 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.YX_DZJZ_JZRZJL model)", "EDRS.OracleDAL.YX_DZJZ_JZRZJL", strSql.ToString(), parameters); } if (rows > 0) { return(true); } else { return(false); } }