Esempio n. 1
0
        public static List <SomerenModel.Rooms> DB_getRooms()
        {
            SqlConnection             connection = openConnectionDB();
            List <SomerenModel.Rooms> rooms_list = new List <SomerenModel.Rooms>();


            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT room_number_id, RoomCapacity, RoomType  FROM Rooms");

            String sql = sb.ToString();

            SqlCommand    command = new SqlCommand(sql, connection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                SomerenModel.Rooms room = new SomerenModel.Rooms();
                room.setRoomNumber((int)reader["room_number_id"]);
                room.setRoomCapacity((int)reader["RoomCapacity"]);
                room.setRoomType((bool)reader["RoomType"]);
                rooms_list.Add(room);
            }
            reader.Close();
            connection.Close();

            return(rooms_list);
        }
Esempio n. 2
0
        public static List <SomerenModel.Rooms> DB_getRooms()
        {
            //SqlConnection connection = openConnectionDB();
            SqlConnection             connection = new SqlConnection(connString);
            List <SomerenModel.Rooms> rooms_list = new List <SomerenModel.Rooms>();

            connection.Open();


            //  SqlCommand command = new SqlCommand(sqlQuery, dbConnection);


            string        sql     = "SELECT RoomNumber, RoomCapacity, RoomType FROM dbo.Rooms";
            SqlCommand    command = new SqlCommand(sql, connection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                SomerenModel.Rooms room = new SomerenModel.Rooms();
                room.setRoomNumber((int)reader["RoomNumber"]);
                room.setRoomCapacity((int)reader["RoomCapacity"]);
                room.setRoomType((bool)reader["RoomType"]);
                rooms_list.Add(room);
            }
            reader.Close();
            connection.Close();

            return(rooms_list);
        }
Esempio n. 3
0
 public void addList(SomerenModel.Rooms s)
 {
     r.Add(s);
 }