コード例 #1
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         Course course = new Course();
         course.Name      = CName.Text.ToString();
         course.StartDate = StartDate.SelectedDate.GetValueOrDefault();
         course.EndDate   = EndDate.SelectedDate.GetValueOrDefault();
         CourseBL courseBL  = new CourseBL();
         bool     courseAdd = courseBL.AddNewCourse(course);
         if (courseAdd == true)
         {
             MessageBox.Show("Course Added Successfully...");
         }
         else
         {
             MessageBox.Show("Course not Added", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }