private void saveAnnouncement()
 {
     if (txtTitle.Text.Trim() != "")
     {
         if (Announcement.deleteAnnouncement(selectedAnnouncement, false) == 0 && Announcement.addAnnouncementToDatabase(new Announcement(
                                                                                                                             Environment.UserName.Substring(0, 1).ToUpper() + Environment.UserName.Substring(1, Environment.UserName.Length - 1),
                                                                                                                             txtTitle.Text,
                                                                                                                             DateTime.Now.ToShortDateString(),
                                                                                                                             DateTime.Now.ToShortTimeString(),
                                                                                                                             datePicker.Text,
                                                                                                                             txtLocation.Text,
                                                                                                                             txtDescription.Text,
                                                                                                                             cmbSubject.Text), false) == 0)
         {
             MessageBox.Show("Announcement saved successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
             Close();
         }
         else
         {
             MessageBox.Show("Error adding announcement", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         MessageBox.Show("Announcement must have a title.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 public editAnnouncement(Announcement announcement)
 {
     selectedAnnouncement = announcement;
     InitializeComponent();
 }
Exemple #3
0
 public static int deleteAnnouncement(Announcement announcement, bool showMsgBoxes)
 {
     return(1);
 }