public void CreateSubject(string SubjectName, bool IsLecture) { Validate(); if (IsValid) { try { if (SubjectActions.SubjectAdd(SubjectName, IsLecture)) { MessageBox.Show("Subject added successfully!"); SendMessage("Subjects changed"); } else { MessageBox.Show("An unknown error has occoured"); } } catch (SubjectAlreadyExistsException ex) { ExceptionLogger.LogException(ex); MessageBox.Show("A subject with this name already exists!"); } catch (Exception e) { ExceptionLogger.LogException(e); MessageBox.Show(e.Message); } } }
public void delSubject(string Name) { try { if (SubjectActions.SubjectRemove(Name)) { MessageBox.Show("Subject has been deleted successfully!"); NotifyPropertyChanged("Subjects"); GetCoursesFromLoggedInUsers(); NotifyPropertyChanged("MondayCourses"); NotifyPropertyChanged("TuesdayCourses"); NotifyPropertyChanged("WednesdayCourses"); NotifyPropertyChanged("ThursdayCourses"); NotifyPropertyChanged("FridayCourses"); NotifyPropertyChanged("SaturdayCourses"); NotifyPropertyChanged("SundayCourses"); } else { MessageBox.Show("An unknown error has occured!"); } } catch (SubjectNotExistsException ex) { ExceptionLogger.LogException(ex); MessageBox.Show("This subject doesn't exists!"); } catch (Exception e) { ExceptionLogger.LogException(e); MessageBox.Show(e.Message); } }