/// <summary> /// 更新一条数据 /// </summary> public bool Update(FlagModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_Base_Flag set "); strSql.Append("flag_name=@flag_name"); strSql.Append(" where flag_id=@flag_id"); SqlParameter[] parameters = { new SqlParameter("@flag_id", SqlDbType.NVarChar, 50), new SqlParameter("@flag_name", SqlDbType.NVarChar, 100) }; parameters[0].Value = model.flag_id; parameters[1].Value = model.flag_name; int rows = adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(FlagModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_Base_Flag("); strSql.Append("flag_id,flag_name,if_use)"); strSql.Append(" values ("); strSql.Append("@flag_id,@flag_name,@if_use)"); SqlParameter[] parameters = { new SqlParameter("@flag_id", SqlDbType.NVarChar, 50), new SqlParameter("@flag_name", SqlDbType.NVarChar, 100), new SqlParameter("@if_use", SqlDbType.Int, 4) }; parameters[0].Value = model.flag_id; parameters[1].Value = model.flag_name; parameters[2].Value = model.if_use; int rows = adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public FlagModel DataRowToModel(DataRow row) { FlagModel model = new FlagModel(); if (row != null) { if (row["flag_id"] != null) { model.flag_id = row["flag_id"].ToString(); } if (row["flag_name"] != null) { model.flag_name = row["flag_name"].ToString(); } if (row["if_use"] != null && row["if_use"].ToString() != "") { model.if_use = int.Parse(row["if_use"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(FlagModel model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(FlagModel model) { return(dal.Add(model)); }