Example #1
0
 private void btnAdd_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (txtPerformanceName.Text == "")
         {
             throw new ApplicationException("Performance must have a name.");
         }
         if (dtpDate.SelectedDate <= DateTime.Now)
         {
             throw new ApplicationException("The performance date must be after today.");
         }
         if (performanceManager.AddPerformance(new Performance(999999, txtPerformanceName.Text, (DateTime)dtpDate.SelectedDate, txtDescription.Text)) == 1)
         {
             DialogResult = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }