Ejemplo n.º 1
0
        //Checked
        #region EnrolltheCourse()

        private void btnTaketheCourse_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Course course = new Course();
                course = (Course)dgAvaliableCourses.SelectedValue;
                //MessageBox.Show(course.CourseName.ToString());

                //passing the CourseID and StudentID to the StudentBLL to insert a row in the Enrollment table

                int result = bll.EnrollACourse(course.CourseID, ID);

                //MessageBox.Show(result.ToString());
                if (result == 1)
                {
                    MessageBox.Show("You have enrolled for " + course.CourseName.ToString() + " successfully");
                }
                else
                {
                    MessageBox.Show("You have already enrolled for " + course.CourseName.ToString() + ".");
                }
            }
            catch (CourseException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }