Exemplo n.º 1
0
        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 };
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public void UpdateLevel(UserLevelInfo level)
 {
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, System.Data.CommandType.Text,
         SQL_UPDATE_LEVEL, CreateParameters(level));
 }