コード例 #1
0
 public ScheduledTimeSlot(Subject subject, Room room, TimeSlot timeSlot, HashSet<Group> groups)
 {
     this.subject = subject;
     this.room = room;
     this.timeSlot = timeSlot;
     this.groups = groups;
 }
コード例 #2
0
        public void initalizeExampleData()
        {
            if(organic_room_types == null)
            {
                organic_room_types = new HashSet<RoomType>();
                organic_room_types.Add(RoomType.Projector);
                organic_room_types.Add(RoomType.Komin);
            }

            if(available_timeslots == null)
            {
                var available_timeslot = new TimeSlot(DayOfWeek.Monday, 9, 22);
                available_timeslots = new List<TimeSlot>();
                available_timeslots.Add(available_timeslot);
            }

            if(rooms == null)
            {
                var room = new Room(organic_room_types, 150, available_timeslots, "ХФ210");
                rooms = new HashSet<Room>();
                rooms.Add(room);
            }

            if(requirements_list == null)
            {
                var requirements = new Requirements(10, available_timeslots, rooms);
                requirements_list = new List<Requirements>();
                requirements_list.Add(requirements);
                var organich_chemistry_teacher = new Teacher(requirements_list[0], "Prof. Hristo Hristov");
            }
            var organic_chemistry_teachers = new List<Teacher>();

            var s = new Subject(organic_room_types, organic_chemistry_teachers, "Organic Chemistry Lectures", 1);
        }
コード例 #3
0
        private void listBoxRooms_SelectedIndexChanged(object sender, EventArgs e)
        {
            var selectedRoom = listBoxRooms.SelectedItem as Room;

            if (selectedRoom == null)
            {
                if (previouslySelectedRoom != null)
                {
                    UpdateRoom(previouslySelectedRoom);
                    previouslySelectedRoom = null;
                }

                listBoxRoomMonday.ClearSelected();
                listBoxRoomTuesday.ClearSelected();
                listBoxRoomWednesday.ClearSelected();
                listBoxRoomThursday.ClearSelected();
                listBoxRoomFriday.ClearSelected();
                listBoxRoomSaturday.ClearSelected();

                ClearCheckedListRoomTypes();

                numericUpDownCapacity.Value = 0;

                roomName.Text = "";
                return;
            }

            previouslySelectedRoom = selectedRoom;

            UIHelpers.SetObjectTimeSlots(listBoxRoomMonday, selectedRoom.availability.Where(t => t.Day == DayOfWeek.Monday));
            UIHelpers.SetObjectTimeSlots(listBoxRoomTuesday, selectedRoom.availability.Where(t => t.Day == DayOfWeek.Tuesday));
            UIHelpers.SetObjectTimeSlots(listBoxRoomWednesday, selectedRoom.availability.Where(t => t.Day == DayOfWeek.Wednesday));
            UIHelpers.SetObjectTimeSlots(listBoxRoomThursday, selectedRoom.availability.Where(t => t.Day == DayOfWeek.Thursday));
            UIHelpers.SetObjectTimeSlots(listBoxRoomFriday, selectedRoom.availability.Where(t => t.Day == DayOfWeek.Friday));
            UIHelpers.SetObjectTimeSlots(listBoxRoomSaturday, selectedRoom.availability.Where(t => t.Day == DayOfWeek.Saturday));

            ClearCheckedListRoomTypes();
            foreach (var roomType in selectedRoom.types)
            {
                checkedListRoomTypes.SetItemChecked((int) roomType, true);
            }
            numericUpDownCapacity.Value = selectedRoom.capacity;
            roomName.Text = selectedRoom.nameOrNumber;
        }
コード例 #4
0
        private void UpdateRoom(Room room)
        {
            var roomAvailability = GetRoomAvailability();

            HashSet<RoomType> roomTypes = new HashSet<RoomType>();
            foreach (int selectedIndex in checkedListRoomTypes.CheckedIndices)
            {
                roomTypes.Add((RoomType)selectedIndex);
            }

            room.availability = roomAvailability;
            room.capacity = (uint) numericUpDownCapacity.Value;
            room.nameOrNumber = roomName.Text;
            room.types = roomTypes;

            RefreshRooms();
        }
コード例 #5
0
 public IEnumerable<ScheduledTimeSlot> GetRoomProgram(Room room)
 {
     return Schedule.Where(s => s.room == room);
 }