Пример #1
0
 //[FUNCTION - addButton_Click]
 //Adds selected course to user's courses when button is clicked
 private void addButton_Click(object sender, EventArgs e)
 {
     if (courseAccepted == true)
     {
         selectedRow = addCoursesDataTable.Rows[selectedTableIndex];
         SingleCourse selectedCourseClass = allCourses[allCourses.IndexOf(allCourses.Find(s => (s.courseName == (string)selectedRow.Cells[1].Value) &&
                                                                                          (s.abrvCourseName == (string)selectedRow.Cells[0].Value)))];
         MainCourseForm.selectedCourses.Add(selectedCourseClass);
         addCourseStateLabel.ForeColor = Color.Green;
         addCourseStateLabel.Text      = "Added " + (string)selectedRow.Cells[1].Value + " to course list!";
         MainCourseForm.RefreshTable();
         courseAccepted = false;
     }
 }
Пример #2
0
 //[FUNCTION - AddSelectedCourse]
 //Adds the course that the user selected last
 private void AddSelectedCourse()
 {
     if (courseAccepted)
     {
         selectedRow = addCoursesDataTable.Rows[selectedTableIndex];
         SingleCourse selectedCourseClass = DeepCopySingleCourse(allCourses[allCourses.IndexOf(allCourses.Find(s => (s.getCourseName() == (string)selectedRow.Cells[1].Value) &&
                                                                                                               (s.getAbrvCourseName() == (string)selectedRow.Cells[0].Value)))]);
         MainCourseForm.selectedCourses.Add(selectedCourseClass);
         addCourseStateLabel.ForeColor = Color.Green;
         addCourseStateLabel.Text      = "Added " + (string)selectedRow.Cells[1].Value + " to course list!";
         MainCourseForm.RefreshTable();
         courseAccepted = false;
     }
     if (MainCourseForm.selectedCourses.Count() >= 10)
     {
         addCourseStateLabel.ForeColor = Color.Red;
         addCourseStateLabel.Text      = "Cannot have more that 10 courses!";
     }
 }