/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.FCASE_INVENTORS model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update FCASE_INVENTORS set "); strSql.Append("PID=:PID,"); strSql.Append("OURNO=:OURNO,"); strSql.Append("ENT_ORDER=:ENT_ORDER,"); strSql.Append("NATIONALITY=:NATIONALITY,"); strSql.Append("COUNTRY=:COUNTRY,"); strSql.Append("PROVINCE=:PROVINCE,"); strSql.Append("ADDR=:ADDR,"); strSql.Append("ORIG_NAME=:ORIG_NAME,"); strSql.Append("TRAN_NAME=:TRAN_NAME"); strSql.Append(" where PID=:PID "); OracleParameter[] parameters = { new OracleParameter(":PID", OracleType.VarChar, 20), new OracleParameter(":OURNO", OracleType.VarChar, 30), new OracleParameter(":ENT_ORDER", OracleType.Number, 4), new OracleParameter(":NATIONALITY", OracleType.VarChar, 5), new OracleParameter(":COUNTRY", OracleType.VarChar, 5), new OracleParameter(":PROVINCE", OracleType.VarChar, 50), new OracleParameter(":ADDR", OracleType.VarChar, 200), new OracleParameter(":ORIG_NAME", OracleType.VarChar, 100), new OracleParameter(":TRAN_NAME", OracleType.VarChar, 100) }; parameters[0].Value = model.PID; parameters[1].Value = model.OURNO; parameters[2].Value = model.ENT_ORDER; parameters[3].Value = model.NATIONALITY; parameters[4].Value = model.COUNTRY; parameters[5].Value = model.PROVINCE; parameters[6].Value = model.ADDR; parameters[7].Value = model.ORIG_NAME; parameters[8].Value = model.TRAN_NAME; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.FCASE_INVENTORS DataRowToModel(DataRow row) { Model.FCASE_INVENTORS model = new Model.FCASE_INVENTORS(); if (row != null) { if (row["PID"] != null) { model.PID = row["PID"].ToString(); } if (row["OURNO"] != null) { model.OURNO = row["OURNO"].ToString(); } if (row["ENT_ORDER"] != null && row["ENT_ORDER"].ToString() != "") { model.ENT_ORDER = decimal.Parse(row["ENT_ORDER"].ToString()); } if (row["NATIONALITY"] != null) { model.NATIONALITY = row["NATIONALITY"].ToString(); } if (row["COUNTRY"] != null) { model.COUNTRY = row["COUNTRY"].ToString(); } if (row["PROVINCE"] != null) { model.PROVINCE = row["PROVINCE"].ToString(); } if (row["ADDR"] != null) { model.ADDR = row["ADDR"].ToString(); } if (row["ORIG_NAME"] != null) { model.ORIG_NAME = row["ORIG_NAME"].ToString(); } if (row["TRAN_NAME"] != null) { model.TRAN_NAME = row["TRAN_NAME"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.FCASE_INVENTORS model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into FCASE_INVENTORS("); strSql.Append("PID,OURNO,ENT_ORDER,NATIONALITY,COUNTRY,PROVINCE,ADDR,ORIG_NAME,TRAN_NAME)"); strSql.Append(" values ("); strSql.Append(":PID,:OURNO,:ENT_ORDER,:NATIONALITY,:COUNTRY,:PROVINCE,:ADDR,:ORIG_NAME,:TRAN_NAME)"); OracleParameter[] parameters = { new OracleParameter(":PID", OracleType.VarChar, 20), new OracleParameter(":OURNO", OracleType.VarChar, 30), new OracleParameter(":ENT_ORDER", OracleType.Number, 4), new OracleParameter(":NATIONALITY", OracleType.VarChar, 5), new OracleParameter(":COUNTRY", OracleType.VarChar, 5), new OracleParameter(":PROVINCE", OracleType.VarChar, 50), new OracleParameter(":ADDR", OracleType.VarChar, 200), new OracleParameter(":ORIG_NAME", OracleType.VarChar, 100), new OracleParameter(":TRAN_NAME", OracleType.VarChar, 100) }; parameters[0].Value = model.PID; parameters[1].Value = model.OURNO; parameters[2].Value = model.ENT_ORDER; parameters[3].Value = model.NATIONALITY; parameters[4].Value = model.COUNTRY; parameters[5].Value = model.PROVINCE; parameters[6].Value = model.ADDR; parameters[7].Value = model.ORIG_NAME; parameters[8].Value = model.TRAN_NAME; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.FCASE_INVENTORS GetModel(string PID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select PID,OURNO,ENT_ORDER,NATIONALITY,COUNTRY,PROVINCE,ADDR,ORIG_NAME,TRAN_NAME from FCASE_INVENTORS "); strSql.Append(" where PID=:PID "); OracleParameter[] parameters = { new OracleParameter(":PID", OracleType.VarChar, 20) }; parameters[0].Value = PID; Model.FCASE_INVENTORS model = new Model.FCASE_INVENTORS(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.FCASE_INVENTORS model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.FCASE_INVENTORS model) { return(dal.Add(model)); }