/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.PATENTBILLINPUT_V2 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update PATENTBILLINPUT_V2 set "); strSql.Append("PID=:PID,"); strSql.Append("NOTENUMBER=:NOTENUMBER,"); strSql.Append("TYPE=:TYPE,"); strSql.Append("TEXT=:TEXT,"); strSql.Append("QUANTITY=:QUANTITY,"); strSql.Append("OFFICIALFEE=:OFFICIALFEE,"); strSql.Append("OTHERFEE=:OTHERFEE,"); strSql.Append("WAIVE=:WAIVE"); strSql.Append(" where PID=:PID "); OracleParameter[] parameters = { new OracleParameter(":PID", OracleType.VarChar, 30), new OracleParameter(":NOTENUMBER", OracleType.VarChar, 23), new OracleParameter(":TYPE", OracleType.VarChar, 30), new OracleParameter(":TEXT", OracleType.VarChar, 150), new OracleParameter(":QUANTITY", OracleType.Number, 10), new OracleParameter(":OFFICIALFEE", OracleType.Number, 4), new OracleParameter(":OTHERFEE", OracleType.Number, 4), new OracleParameter(":WAIVE", OracleType.VarChar, 6) }; parameters[0].Value = model.PID; parameters[1].Value = model.NOTENUMBER; parameters[2].Value = model.TYPE; parameters[3].Value = model.TEXT; parameters[4].Value = model.QUANTITY; parameters[5].Value = model.OFFICIALFEE; parameters[6].Value = model.OTHERFEE; parameters[7].Value = model.WAIVE; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.PATENTBILLINPUT_V2 DataRowToModel(DataRow row) { Model.PATENTBILLINPUT_V2 model = new Model.PATENTBILLINPUT_V2(); if (row != null) { if (row["PID"] != null) { model.PID = row["PID"].ToString(); } if (row["NOTENUMBER"] != null) { model.NOTENUMBER = row["NOTENUMBER"].ToString(); } if (row["TYPE"] != null) { model.TYPE = row["TYPE"].ToString(); } if (row["TEXT"] != null) { model.TEXT = row["TEXT"].ToString(); } if (row["QUANTITY"] != null && row["QUANTITY"].ToString() != "") { model.QUANTITY = decimal.Parse(row["QUANTITY"].ToString()); } if (row["OFFICIALFEE"] != null && row["OFFICIALFEE"].ToString() != "") { model.OFFICIALFEE = decimal.Parse(row["OFFICIALFEE"].ToString()); } if (row["OTHERFEE"] != null && row["OTHERFEE"].ToString() != "") { model.OTHERFEE = decimal.Parse(row["OTHERFEE"].ToString()); } if (row["WAIVE"] != null) { model.WAIVE = row["WAIVE"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.PATENTBILLINPUT_V2 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into PATENTBILLINPUT_V2("); strSql.Append("PID,NOTENUMBER,TYPE,TEXT,QUANTITY,OFFICIALFEE,OTHERFEE,WAIVE)"); strSql.Append(" values ("); strSql.Append(":PID,:NOTENUMBER,:TYPE,:TEXT,:QUANTITY,:OFFICIALFEE,:OTHERFEE,:WAIVE)"); OracleParameter[] parameters = { new OracleParameter(":PID", OracleType.VarChar, 30), new OracleParameter(":NOTENUMBER", OracleType.VarChar, 23), new OracleParameter(":TYPE", OracleType.VarChar, 30), new OracleParameter(":TEXT", OracleType.VarChar, 150), new OracleParameter(":QUANTITY", OracleType.Number, 10), new OracleParameter(":OFFICIALFEE", OracleType.Number, 4), new OracleParameter(":OTHERFEE", OracleType.Number, 4), new OracleParameter(":WAIVE", OracleType.VarChar, 6) }; parameters[0].Value = model.PID; parameters[1].Value = model.NOTENUMBER; parameters[2].Value = model.TYPE; parameters[3].Value = model.TEXT; parameters[4].Value = model.QUANTITY; parameters[5].Value = model.OFFICIALFEE; parameters[6].Value = model.OTHERFEE; parameters[7].Value = model.WAIVE; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.PATENTBILLINPUT_V2 GetModel(string PID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select PID,NOTENUMBER,TYPE,TEXT,QUANTITY,OFFICIALFEE,OTHERFEE,WAIVE from PATENTBILLINPUT_V2 "); strSql.Append(" where PID=:PID "); OracleParameter[] parameters = { new OracleParameter(":PID", OracleType.VarChar, 30) }; parameters[0].Value = PID; Model.PATENTBILLINPUT_V2 model = new Model.PATENTBILLINPUT_V2(); 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.PATENTBILLINPUT_V2 model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.PATENTBILLINPUT_V2 model) { return(dal.Add(model)); }