Esempio n. 1
0
        // that's output stuff
        public static Control showRooms()
        {
            List <SomerenModel.Rooms> rl = new List <SomerenModel.Rooms>();

            //SomerenDB.
            rl = SomerenDB.DB_getRooms();


            int      aantal = rl.Count();
            ListView c      = new ListView();

            c.Height = 1000;
            //       ListViewItem li = new ListViewItem();
            foreach (SomerenModel.Rooms room in rl)
            {
                c.Items.Add("RoomNumber: " + room.getRoomNumber().ToString());
                c.Items.Add("RoomCapacity: " + room.getRoomCapacity().ToString());
                c.Items.Add(room.getRoomType().ToString());
            }

            return(c);
        }
Esempio n. 2
0
        public static Control showRooms()
        {
            List <SomerenModel.Rooms> rooms = new List <SomerenModel.Rooms>();

            // linking the list to the DB connection in order to get data from it
            rooms = SomerenDB.DB_getRooms();

            // Making a list and editing its format
            //int aantal = rooms.Count();
            ListView roomsListView = new ListView();

            roomsListView.Height        = 370;
            roomsListView.Width         = 370;
            roomsListView.View          = View.Details;
            roomsListView.FullRowSelect = true;

            // adding colums to the list
            roomsListView.Columns.Add("Room Number", -2, HorizontalAlignment.Left);
            roomsListView.Columns.Add("Room Capacity", -2, HorizontalAlignment.Left);
            roomsListView.Columns.Add("Room Type", -2, HorizontalAlignment.Left);

            // storing data into the list
            foreach (SomerenModel.Rooms room in rooms)
            {
                ListViewItem entryListItem = roomsListView.Items.Add(room.getRoomNumber().ToString());
                entryListItem.SubItems.Add(room.getRoomCapacity().ToString());

                if (room.getRoomType() == true)
                {
                    entryListItem.SubItems.Add("Teachers Room");
                }
                else
                {
                    entryListItem.SubItems.Add("Students Room");
                }
            }

            return(roomsListView);
        }