public SqlParameter[] CreateParameters(UserLevelInfo uli) { SqlParameter param_levelid = new SqlParameter(PARAM_LEVELID,uli.LevelId); SqlParameter param_level = new SqlParameter(PARAM_LEVEL,uli.Level); return new SqlParameter[] {param_levelid,param_level }; }
public UserLevelInfo GetUserlevel(string levelid) { UserLevelInfo userlevel = null; SqlParameter param_levelid = new SqlParameter(PARAM_LEVELID,levelid); using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, System.Data.CommandType.Text, SQL_SELECT_LEVEL, param_levelid)) { while (rdr.Read()) { userlevel = new UserLevelInfo(rdr.GetString(0), rdr.GetValue(1).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(1)); } } return userlevel; }
public IList<UserLevelInfo> GetAllUserlevels() { IList<UserLevelInfo> userLevels = new List<UserLevelInfo>(); using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, System.Data.CommandType.Text, SQL_SELECT_LEVELS, null)) { while (rdr.Read()) { UserLevelInfo userlevel = new UserLevelInfo(rdr.GetString(0), rdr.GetValue(1).GetType().Equals(typeof(DBNull)) ? "" : rdr.GetString(1)); userLevels.Add(userlevel); } } return userLevels; }
public void UpdateLevel(UserLevelInfo level) { SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, System.Data.CommandType.Text, SQL_UPDATE_LEVEL, CreateParameters(level)); }