Beispiel #1
0
        /// <summary>
        /// Load's room data by RoomId
        /// </summary>
        /// <param name="id">RoomId</param>
        public static List <RoomSql> GetData()
        {
            // Uses MySql Reader, since i had problems with NHibernate doing this.

            var room = new List <RoomSql>();

            MySqlDataReader reader = MySqlHelper.ExecuteReader(Application.ConnectionString, "SELECT * FROM rooms");

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    var instance = new RoomSql();
                    instance.id          = reader.GetInt32("id");
                    instance.ownerId     = reader.GetInt32("owner_id");
                    instance.caption     = reader.GetString("name");
                    instance.description = reader.GetString("description");
                    instance.model       = reader.GetString("model");
                    instance.state       = reader.GetString("state");
                    instance.category    = reader.GetInt32("category");
                    instance.password    = reader.GetString("password");
                    instance.wallpaper   = reader.GetString("wallpaper");
                    instance.wallsize    = reader.GetInt32("wallsize");
                    instance.floor       = reader.GetString("floor");
                    instance.floorsize   = reader.GetInt32("floorsize");
                    instance.score       = reader.GetInt32("score");
                    instance.tags.Add(reader.GetString("tags"));
                    instance.iconbg = reader.GetInt32("iconbg");
                    instance.iconfg = reader.GetInt32("iconfg");
                    instance.iconitems.Add(reader.GetString("iconitems"));
                    instance.usersMax = reader.GetInt32("users_max");
                    instance.usersNow = reader.GetInt32("users_now");

                    AllRooms.Add(instance);
                }
            }

            return(room);
        }
Beispiel #2
0
        /// <summary>
        /// Load's room data by RoomId
        /// </summary>
        /// <param name="id">RoomId</param>
        public static List<RoomSql> GetData()
        {
            // Uses MySql Reader, since i had problems with NHibernate doing this.

            var room = new List<RoomSql>();

            MySqlDataReader reader = MySqlHelper.ExecuteReader(Application.ConnectionString, "SELECT * FROM rooms");

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    var instance = new RoomSql();
                    instance.id = reader.GetInt32("id");
                    instance.ownerId = reader.GetInt32("owner_id");
                    instance.caption = reader.GetString("name");
                    instance.description = reader.GetString("description");
                    instance.model = reader.GetString("model");
                    instance.state = reader.GetString("state");
                    instance.category = reader.GetInt32("category");
                    instance.password = reader.GetString("password");
                    instance.wallpaper = reader.GetString("wallpaper");
                    instance.wallsize = reader.GetInt32("wallsize");
                    instance.floor = reader.GetString("floor");
                    instance.floorsize = reader.GetInt32("floorsize");
                    instance.score = reader.GetInt32("score");
                    instance.tags.Add(reader.GetString("tags"));
                    instance.iconbg = reader.GetInt32("iconbg");
                    instance.iconfg = reader.GetInt32("iconfg");
                    instance.iconitems.Add(reader.GetString("iconitems"));
                    instance.usersMax = reader.GetInt32("users_max");
                    instance.usersNow = reader.GetInt32("users_now");

                    AllRooms.Add(instance);
                }
            }

            return room;
        }