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