Exemple #1
0
 //Remove calendar day
 private void ButtonRemove_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ClassCalendar calendar = GetCalendarForSelectedCalendarInComboboxFromDataBase();
         if (calendar.Status.StatusId != sql.SelectStatusId(EnumStatus.New))
         {
             throw new Exception("Calendar status must be new");
         }
         ClassCalendarDay day = GetCalendarDayForSelectedCalendarDayInDataGridFromDataBase(calendar.CalendarId);
         if (!(MessageBox.Show("Are you sure you want to delete this day?", "Continue?", MessageBoxButton.YesNo) == MessageBoxResult.Yes))
         {
             return;
         }
         sql.DeleteCalendarDay(day.CalendarDayId);
         ReloadData();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }