コード例 #1
0
        /// <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);
                }
            }
        }
コード例 #2
0
        /// <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);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Deletes the user selected bugs from the web service and bug table.
        /// </summary>
        private void DeleteSelectedBugs()
        {
            // For each selected bug, remove it from the service and view
            foreach (BugViewModel bug in SelectedBugs)
            {
                // Delete using web service
                _Service.DeleteBug(bug.ToBugModel());
                // Notify listeners of delete operation
                _Messenger.NotifyColleagues(Messages.SelectedBugDeleted, bug);

                _Notifier.AddNotification(new Notification {
                    ImageUrl = Notification.ICON_DELETE,
                    Title    = "Bug Deleted",
                    Message  = "The bug " + bug.Name + " has been deleted."
                });
            }
        }
コード例 #4
0
        protected override void SaveProject(ProjectViewModel project)
        {
            if (IsProjectValid)
            {
                ProjectViewModel savedProject = new ProjectViewModel(_Service.SaveProject(project.ToProjectModel()));

                _Notifier.AddNotification(new Notification
                {
                    ImageUrl = Notification.ICON_EDIT,
                    Title    = "Project Saved",
                    Message  = "The project " + savedProject.Name + " has been saved."
                });

                _Messenger.NotifyColleagues(Messages.SavedProject, savedProject);

                IsVisible = false;
            }
        }
コード例 #5
0
        private void DeleteProject(ProjectViewModel project)
        {
            try
            {
                _Service.DeleteProject(project.ToProjectModel());
                ManagedProjects.Remove(project);

                _Notifier.AddNotification(new Notification
                {
                    ImageUrl = Notification.ICON_DELETE,
                    Title    = "Project Deleted",
                    Message  = "The project " + project.Name + " has been deleted."
                });


                _Messenger.NotifyColleagues(Messages.DeletedProject, project);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
コード例 #6
0
        /// <summary>
        /// Attempts to register a new user and organisation with the service
        /// using form data.
        /// </summary>
        private void SaveCredentials()
        {
            IsSaveButtonEnabled = false;

            if (CanSave())
            {
                try
                {
                    User user = new User
                    {
                        Id        = _Service.GetMyUser().Id,
                        FirstName = this.FirstName,
                        Surname   = this.LastName,
                        Password  = this.Password,
                        Username  = this.Email,
                    };

                    // Execute registration operation concurrently
                    _Service.SaveUserCredentials(user);
                    _Notifier.AddNotification(new Notification {
                        ImageUrl = Notification.ICON_TICK, Title = "Saved!", Message = "Your account settings have been saved."
                    });
                    IsSaveButtonEnabled = false;
                }
                catch (FaultException e)
                {
                    IsSaveButtonEnabled = true;

                    MessageBox.Show(e.Message);
                }
            }
            else
            {
                IsSaveButtonEnabled = true;
            }
        }
コード例 #7
0
        private void RequestJoinProject()
        {
            if (InputIsValidated())
            {
                User myUser = _Service.GetMyUser();

                try
                {
                    _Service.RequestProjectAssignment(Code, myUser, SelectedRole);

                    _Notifier.AddNotification(new Notification {
                        ImageUrl = Notification.ICON_NOTIFICATION,
                        Title    = "Request Sent!",
                        Message  = "Your request to join this project has been sent."
                    });
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }

                Code = "";
            }
        }