Beispiel #1
0
        private void btnRooms_Click(object sender, EventArgs e)
        {
            this.Hide();
            RoomForm frmRoom = new RoomForm();

            frmRoom.Show();
        }
        private void btnTimetable_Click(object sender, EventArgs e)
        {
            int TeacherCount = TableCount("Teacher");
            int RoomCount    = TableCount("Room");

            if (RoomCount <= 0)
            {
                MessageBox.Show("Error: No rooms assigned");
                GoToTableMenu();
            }
            else if (TeacherCount <= 0)
            {
                MessageBox.Show("Error: No teachers assigned");
                GoToTableMenu();
            }
            else
            {
                bool EnoughRooms = IsNumberOfRoomsEnough();
                if (IsNumberOfTeacherEnough() && EnoughRooms)
                {
                    // The algorithm to generate timetables is called
                    GenerateTimetables.Execute();

                    this.Hide();
                    TimetableForm frmTimetable = new TimetableForm();
                    frmTimetable.Show();
                }

                if (!EnoughRooms)
                {
                    this.Hide();
                    RoomForm frmRoom = new RoomForm();
                    frmRoom.Show();
                }
            }
        }