/// <summary> /// Adds a new bug to the system and reflects the addition /// in the table of bugs. /// </summary> /// <param name="bug">The bug view model to add to system.</param> private void AddBug(BugViewModel bug) { // Performs validation before bug is saved if (BugIsValidated()) { try { bug.CreatedBy = new UserViewModel(_Service.GetMyUser()); bug.Project = _ActiveProject.ToProjectModel(); // Convert bug view model to bug model service can accept Bug savedBug = _Service.AddBug(bug.ToBugModel()); _Notifier.AddNotification(new Notification { ImageUrl = Notification.ICON_ADD, Title = "Added Bug", Message = "The bug " + bug.Name + " has been added to the project" }); // Notify listeners that bug has been saved _Messenger.NotifyColleagues(Messages.AddPanelSavedBug, new BugViewModel(savedBug)); InitialiseBugViewModel(); // Close the add panel IsVisible = false; } catch (FaultException e) { MessageBox.Show(e.Message); } } }
/// <summary> /// Saves a bug which has been editied. /// </summary> /// <param name="bug">The object which has been edited.</param> private void SaveBug(BugViewModel bug) { if (BugIsValidated()) { try { Bug savedBug = _Service.SaveBug(bug.ToBugModel()); _Messenger.NotifyColleagues(Messages.SelectedBugSaved, new BugViewModel(savedBug)); EditedBug = new BugViewModel(savedBug); _Notifier.AddNotification(new Notification { ImageUrl = Notification.ICON_EDIT, Title = "Bug Saved", Message = "The bug " + savedBug.Name + " has been saved." }); IsVisible = false; } catch (FaultException e) { MessageBox.Show(e.Message); } } }
/// <summary> /// Adds a new bug to the system and reflects the addition /// in the table of bugs. /// </summary> /// <param name="bug">The bug view model to add to system.</param> private void AddBug(BugViewModel bug) { // Performs validation before bug is saved if (BugIsValidated()) { try { bug.CreatedBy = new UserViewModel(_Service.GetMyUser()); bug.Project = _ActiveProject.ToProjectModel(); // Convert bug view model to bug model service can accept Bug savedBug = _Service.AddBug(bug.ToBugModel()); _Notifier.AddNotification(new Notification { ImageUrl = Notification.ICON_ADD, Title = "Added Bug", Message = "The bug " + bug.Name + " has been added to the project" }); // Notify listeners that bug has been saved _Messenger.NotifyColleagues(Messages.AddPanelSavedBug, new BugViewModel(savedBug)); InitialiseBugViewModel(); // Close the add panel IsVisible = false; } catch (FaultException e) { MessageBox.Show(e.Message); } } }
/// <summary> /// Saves a bug which has been editied. /// </summary> /// <param name="bug">The object which has been edited.</param> private void SaveBug(BugViewModel bug) { if (BugIsValidated()) { try { Bug savedBug = _Service.SaveBug(bug.ToBugModel()); _Messenger.NotifyColleagues(Messages.SelectedBugSaved, new BugViewModel(savedBug)); EditedBug = new BugViewModel(savedBug); _Notifier.AddNotification(new Notification { ImageUrl = Notification.ICON_EDIT, Title = "Bug Saved", Message = "The bug " + savedBug.Name + " has been saved." }); IsVisible = false; } catch (FaultException e) { MessageBox.Show(e.Message); } } }