private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            TimetableForm frmTT = new TimetableForm();

            frmTT.Show();
        }
Example #2
0
        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();
                }
            }
        }