Exemple #1
0
 protected void FindPrograms_Click(object sender, EventArgs e)
 {
     if (ProgramList.SelectedIndex == 0)
     {
         errormsgs.Add("Select a program to obtain courses.");
         LoadMessageDisplay(errormsgs, "alert alert-info");
         ProgramList.DataSource = null;
         ProgramList.DataBind();
     }
     else
     {
         try
         {
             CoursesController sysmgr = new CoursesController();
             List <Courses>    info   = sysmgr.Courses_FindByProgram(int.Parse(ProgramList.SelectedValue));
             if (info.Count == 0)
             {
                 errormsgs.Add("No data found for the program");
                 LoadMessageDisplay(errormsgs, "alert alert-info");
             }
             else
             {
                 info.Sort((x, y) => x.CourseName.CompareTo(y.CourseName));
                 CoursesList.DataSource     = info;
                 CoursesList.DataTextField  = nameof(Courses.CourseName);
                 CoursesList.DataValueField = nameof(Courses.CourseID);
                 CoursesList.DataBind();
                 CoursesList.Items.Insert(0, "select...");
             }
         }
         catch (Exception ex)
         {
             errormsgs.Add(GetInnerException(ex).ToString());
             LoadMessageDisplay(errormsgs, "alert alert-danger");
         }
     }
 }
Exemple #2
0
 protected void ButtonSearch_Click(object sender, EventArgs e)
 {
     CoursesList.DataSource = _course.SearchCourses(int.Parse(listDepartment.SelectedValue), txtName.Text);
     CoursesList.DataBind();
 }
Exemple #3
0
 protected void LoadCoursesList()
 {
     CoursesList.DataSource = _course.GetCourses();
     CoursesList.DataBind();
 }