Пример #1
0
        /// <summary>
        /// Sets the current project, sprint, and story from a selected task
        /// </summary>
        /// <param name="task">The selected task</param>
        public void JumpToTask(TaskView task)
        {
            if (!_isLoggedIn)
            {
                throw new InvalidOperationException("User must be logged in");
            }
            else if (task == null) // Bad input value
            {
                throw new ArgumentNullException("Arguments to JumpToTask must not be null");
            }

            CurrStory = new StoryView(_dataModel.GetStoryByID(task.StoryID));
            CurrSprint = new SprintView(_dataModel.GetSprintByID(CurrStory.SprintID));
            CurrProject = new ProjectView(_dataModel.GetProjectByID(CurrSprint.ProjectID));
            CurrTask = task;
        }
Пример #2
0
        /// <summary>
        /// Updates the current project
        /// </summary>
        /// <param name="name">The name of the project</param>
        /// <param name="startDate">The start date of the project</param>
        /// <param name="endDate">The end date of the project</param>
        /// <param name="owner">The User who owns the new project</param>
        /// <param name="team">The team responsible for the new project</param>
        /// <returns>True if the changes succeed, false otherwise</returns>
        public bool ChangeCurrProject(string name, Nullable<DateTime> startDate, Nullable<DateTime> endDate, UserView owner, TeamView team)
        {
            if (!_isLoggedIn || CurrProject == null)
            {
                throw new InvalidOperationException("User must be logged in");
            }
            else if (name == null || !startDate.HasValue || owner == null || team == null)
            {
                throw new ArgumentNullException("Arguments to AddProject must not be null");
            }

            bool result = _dataModel.ChangeProject(CurrProject.ProjectID, name, startDate.Value, endDate, owner.UserID, team.TeamID);
            if (result)
            {
                updateProjectsForUser();
                CurrProject = new ProjectView(_dataModel.GetProjectByID(CurrProject.ProjectID));
            }

            return result;
        }