/// <summary> /// 更新一条数据 /// </summary> public bool Update(XHD.Model.dms_set_bonus_team model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update dms_set_bonus_team set "); strSql.Append("d_id=@d_id,"); strSql.Append("d_name=@d_name,"); strSql.Append("db_100=@db_100,"); strSql.Append("db_90=@db_90"); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@d_id", MySqlDbType.Int32, 11), new MySqlParameter("@d_name", MySqlDbType.VarChar, 50), new MySqlParameter("@db_100", MySqlDbType.Int32, 10), new MySqlParameter("@db_90", MySqlDbType.Int32, 10), new MySqlParameter("@id", MySqlDbType.Int32, 11) }; parameters[0].Value = model.d_id; parameters[1].Value = model.d_name; parameters[2].Value = model.db_100; parameters[3].Value = model.db_90; parameters[4].Value = model.id; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.dms_set_bonus_team DataRowToModel(DataRow row) { XHD.Model.dms_set_bonus_team model = new XHD.Model.dms_set_bonus_team(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["d_id"] != null && row["d_id"].ToString() != "") { model.d_id = int.Parse(row["d_id"].ToString()); } if (row["d_name"] != null) { model.d_name = row["d_name"].ToString(); } if (row["db_100"] != null && row["db_100"].ToString() != "") { model.db_100 = int.Parse(row["db_100"].ToString()); } if (row["db_90"] != null && row["db_90"].ToString() != "") { model.db_90 = int.Parse(row["db_90"].ToString()); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(XHD.Model.dms_set_bonus_team model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into dms_set_bonus_team("); strSql.Append("d_id,d_name,db_100,db_90)"); strSql.Append(" values ("); strSql.Append("@d_id,@d_name,@db_100,@db_90)"); MySqlParameter[] parameters = { new MySqlParameter("@d_id", MySqlDbType.Int32, 11), new MySqlParameter("@d_name", MySqlDbType.VarChar, 50), new MySqlParameter("@db_100", MySqlDbType.Int32, 10), new MySqlParameter("@db_90", MySqlDbType.Int32, 10) }; parameters[0].Value = model.d_id; parameters[1].Value = model.d_name; parameters[2].Value = model.db_100; parameters[3].Value = model.db_90; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XHD.Model.dms_set_bonus_team GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,d_id,d_name,db_100,db_90 from dms_set_bonus_team "); strSql.Append(" where id=@id"); MySqlParameter[] parameters = { new MySqlParameter("@id", MySqlDbType.Int32) }; parameters[0].Value = id; XHD.Model.dms_set_bonus_team model = new XHD.Model.dms_set_bonus_team(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }