/// <summary> /// Updates the current user story /// </summary> /// <param name="priority">The priority number for this story</param> /// <param name="text">The text of this story</param> /// <param name="sprint">The sprint in which to place this story</param> /// <returns>True if the changes succeed, false otherwise</returns> public bool ChangeCurrStory(string priority, string text, SprintView sprint) { if (!_isLoggedIn || CurrStory == null) { throw new InvalidOperationException("User must be logged in"); } else if (priority == null || text == null || sprint == null) { throw new ArgumentNullException("Arguments to AddStory must not be null"); } int p; if (!int.TryParse(priority, out p)) { throw new ArgumentException("Priority must be a number"); } if (p <= 0) { throw new ArgumentOutOfRangeException("Priority must be positive"); } bool result = _dataModel.ChangeStory(CurrStory.StoryID, p, text, sprint.SprintID); if (result) { updateStoriesForSprint(); CurrStory = new StoryView(_dataModel.GetStoryByID(CurrStory.StoryID)); } return result; }
/// <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; }
/// <summary> /// Updates the current sprint /// </summary> /// <param name="name">The name of the sprint</param> /// <param name="startDate">The start date of the sprint</param> /// <param name="endDate">The end date of the sprint</param> /// <returns>True if the changes succeed, false otherwise</returns> public bool ChangeCurrSprint(string name, Nullable<DateTime> startDate, Nullable<DateTime> endDate) { if (!_isLoggedIn || CurrSprint == null) { throw new InvalidOperationException("User must be logged in"); } else if (!startDate.HasValue || name == null) { throw new ArgumentNullException("Arguments to AddSprint must not be null"); } bool result = _dataModel.ChangeSprint(CurrSprint.SprintID, name, startDate.Value, endDate); if (result) { CurrSprint = new SprintView(_dataModel.GetSprintByID(CurrSprint.SprintID)); updateSprintsForProject(); } return result; }