Ejemplo n.º 1
0
 private void OKButton_Click(object sender, EventArgs e)
 {
     string[] value = CourseBox.Text.Split('\n');
     CoursePlanningController cpc = new CoursePlanningController();
     cpc.AddCourse(value);
     source.Refresh();
     this.Close();
 }
Ejemplo n.º 2
0
 public void AddCourse(string[] courseCodes)
 {
     // multithread network connection
     foreach (string str in courseCodes)
     {
         string newStr = Regex.Replace(str, @"[\n\r]", "");
         CoursePlanningController cpc = new CoursePlanningController();
         cpc.AddCourse(newStr);
     }
 }
Ejemplo n.º 3
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            CoursePlanningController cpc = new CoursePlanningController();
            if (CourseCode.Text.Length != 6 &&
                CourseCode.Text.Length != 5 ||
                Regex.IsMatch(CourseCode.Text, @"^[a-zA-Z]+$") )
            {
                MessageBox.Show("Please enter valid course code!");
                return;
            }
            int i;
            if (IndexNumber.Text.Length != 5 ||
                int.TryParse(IndexNumber.Text, out i) == false)
            {
                MessageBox.Show("Please enter valid index number!");
                return;
            }

            cpc.addIndex(CourseCode.Text, IndexNumber.Text);
            source.Refresh();
            this.Close();
        }
Ejemplo n.º 4
0
 private void Next_Click(object sender, EventArgs e)
 {
     Next.Enabled = false;
     Previous.Enabled = false;
     Save.Enabled = false;
     TimeTablePanel.Hide();
     TimeTablePanel.Controls.Clear();
     InitializeHeaderComponents();
     try
     {
         DisplayTimetableComponents(CoursePlanningController.IndexRefListCollection[++currentIndex]);
     }
     // if there is really no next one, generate it
     catch (ArgumentOutOfRangeException ex)
     {
         // oldCollectionPointer is used to determine whether new solution has been generated
         // therefore it will determine whether the end has been reached
         int oldCollectionPointer = CoursePlanningController.CollectionPointer;
         CoursePlanningController cpc = new CoursePlanningController();
         cpc.PlanCourseAndDisplayTimetable();
         currentIndex = CoursePlanningController.CollectionPointer;
         if (oldCollectionPointer == currentIndex)
             MessageBox.Show("There is no more combination.");
         DisplayTimetableComponents(CoursePlanningController.IndexRefListCollection[currentIndex]);
     }
     TimeTablePanel.Show();
     Next.Enabled = true;
     Previous.Enabled = true;
     Save.Enabled = true;
 }
Ejemplo n.º 5
0
        private void RemoveIndex_Click(object sender, EventArgs e)
        {
            CoursePlanningController cpc = new CoursePlanningController();
            if (Listbox_SelectedCourse.SelectedValue != null
                && Listbox_SelectedIndex.SelectedValue != null)
            {
                cpc.RemoveIndexFromCourse(((Course)Listbox_SelectedCourse.SelectedValue).CourseCode,
                    ((Index)(Listbox_SelectedIndex.SelectedValue)).IndexNumber);

                // refresh index list
                this.Refresh();
            }
        }
Ejemplo n.º 6
0
        private void RemoveCourse_Click(object sender, EventArgs e)
        {
            CoursePlanningController cpc = new CoursePlanningController();
            if (Listbox_SelectedCourse.SelectedValue != null)
            {
                cpc.RemoveCourse(((Course)Listbox_SelectedCourse.SelectedValue).CourseCode);

                // refresh the course list
                this.Refresh();
            }
        }
Ejemplo n.º 7
0
 private void PlanCourse_Click(object sender, EventArgs e)
 {
     CoursePlanningController cpc = new CoursePlanningController();
     TimeTablePage ttp = new TimeTablePage();
     if (cpc.CheckExamTime())
         if (cpc.PlanCourseAndDisplayTimetable())
         {
             ttp.InitializeTable();
             ttp.Show();
         }
 }