public string Execute(IList <string> inputParameters) { //Validations businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateIfAnyBugsExist(allTeams); //Operations var AllWorkItems = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Bug)) .ToList(); StringBuilder sb = new StringBuilder(); sb.AppendLine("----ALL BUGS IN APPLICAITION----"); long workItemCounter = 1; foreach (var item in AllWorkItems) { sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} "); workItemCounter++; } sb.AppendLine("---------------------------------"); var resultedAllItems = sb.ToString().Trim(); return(string.Format(resultedAllItems)); }
public string Execute(IList <string> inputParameters) { //Assign Values From List Of Parameters string statusToFilterBugFor = inputParameters[0]; //Validations var statusTypeForChecking = "Status"; inputValidator.IsNullOrEmpty(statusToFilterBugFor, statusTypeForChecking); businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateIfAnyBugsExist(allTeams); //Operations var isPriorityEnumConvertable = Enum.TryParse(statusToFilterBugFor, out BugStatus bugStatusToCheckFor); inputValidator.IsEnumConvertable(isPriorityEnumConvertable, "Status"); var filteredBugsByStatus = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Bug)) .Select(workItem => (Bug)workItem) .Where(bug => bug.BugStatus == bugStatusToCheckFor) .ToList(); StringBuilder sb = new StringBuilder(); long workItemCounter = 1; if (filteredBugsByStatus.Count == 0) { sb.AppendLine($"There are no Bugs with: {statusToFilterBugFor} Status in the app yet!"); } else { sb.AppendLine($"----ALL BUGS WITH {statusToFilterBugFor} STATUS IN APPLICAITION----"); foreach (var item in filteredBugsByStatus) { sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} "); workItemCounter++; } sb.AppendLine("---------------------------------"); } var resultedAllItems = sb.ToString().Trim(); return(string.Format(resultedAllItems)); }
public string Execute(IList <string> inputParameters) { //Assign Values From List Of Parameters string priorityToFilterStoryFor = inputParameters[0]; //Validations var priorityTypeForChecking = "Priority"; inputValidator.IsNullOrEmpty(priorityToFilterStoryFor, priorityTypeForChecking); businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateIfAnyStoriesExist(allTeams); //Operations var isStatusEnumConvertable = Enum.TryParse(priorityToFilterStoryFor, out Priority priorityToCheckFor); inputValidator.IsEnumConvertable(isStatusEnumConvertable, "Priority"); var filteredStoriesByPriority = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Story)) .Select(workItem => (Story)workItem) .Where(story => story.Priority == priorityToCheckFor) .ToList(); StringBuilder sb = new StringBuilder(); long workItemCounter = 1; if (filteredStoriesByPriority.Count == 0) { sb.AppendLine($"There are no Stories with: {priorityToFilterStoryFor} Status in the app yet!"); } else { sb.AppendLine($"----ALL STORIES WITH {priorityToFilterStoryFor} PRIORITY IN APPLICAITION----"); foreach (var item in filteredStoriesByPriority) { sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} "); workItemCounter++; } sb.AppendLine("---------------------------------"); } var resultedAllItems = sb.ToString().Trim(); return(string.Format(resultedAllItems)); }
public string Execute(IList <string> inputParameters) { //Assign Values From List Of Parameters string assigneeToFilterBugFor = inputParameters[0]; //Validations var assigneeTypeForChecking = "Assignee"; inputValidator.IsNullOrEmpty(assigneeToFilterBugFor, assigneeTypeForChecking); businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateIfAnyBugsExist(allTeams); //Operations var filteredBugsByAssignee = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Bug)) .Select(workItem => (Bug)workItem) .Where(bug => bug.Assignee.Name == assigneeToFilterBugFor) .ToList(); StringBuilder sb = new StringBuilder(); long workItemCounter = 1; if (filteredBugsByAssignee.Count == 0) { sb.AppendLine($"There are no Bugs with: {assigneeToFilterBugFor} Assignee in the app yet!"); } else { sb.AppendLine($"----ALL BUGS ASSIGNED TO MEMBER: {assigneeToFilterBugFor} IN APPLICAITION----"); foreach (var item in filteredBugsByAssignee) { sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} "); workItemCounter++; } sb.AppendLine("---------------------------------"); } var resultedAllItems = sb.ToString().Trim(); return(string.Format(resultedAllItems)); }
public string Execute(IList <string> inputParameters) { //Assign Values From List Of Parameters string teamToAddCommentToWorkItemFor = inputParameters[0]; string boardToAddCommentToWorkItemFor = inputParameters[1]; string itemTypeToAddWorkItemFor = inputParameters[2]; string workitemToAddCommentFor = inputParameters[3]; string authorOfComment = inputParameters[4]; string commentToAdd = inputParameters[5]; //Validations var itemTypeForChecking = "Item Title"; inputValidator.IsNullOrEmpty(workitemToAddCommentFor, itemTypeForChecking); var teamTypeForChecking = "Team Name"; inputValidator.IsNullOrEmpty(teamToAddCommentToWorkItemFor, teamTypeForChecking); var boardTypeForChecking = "Board Name"; inputValidator.IsNullOrEmpty(boardToAddCommentToWorkItemFor, boardTypeForChecking); var authorTypeForChecking = "Author"; inputValidator.IsNullOrEmpty(authorOfComment, authorTypeForChecking); businessLogicValidator.ValidateTeamExistance(allTeams, teamToAddCommentToWorkItemFor); businessLogicValidator.ValidateBoardExistanceInTeam(allTeams, boardToAddCommentToWorkItemFor, teamToAddCommentToWorkItemFor); businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateItemExistanceInBoard(allTeams, boardToAddCommentToWorkItemFor, teamToAddCommentToWorkItemFor, workitemToAddCommentFor); //Operations var workItemToAddCommentTo = allTeams.FindWorkItem(teamToAddCommentToWorkItemFor, itemTypeToAddWorkItemFor, boardToAddCommentToWorkItemFor, workitemToAddCommentFor); workItemOperations.AddComment(workItemToAddCommentTo, commentToAdd, authorOfComment); return(string.Format(AddedCommentFor, commentToAdd, authorOfComment, itemTypeToAddWorkItemFor, workitemToAddCommentFor)); }
public string Execute(IList <string> inputParameters) { //Assign Values From List Of Parameters string factorToSortBy = inputParameters[0]; //Validations var factorTypeForChecking = $"{factorToSortBy}"; inputValidator.IsNullOrEmpty(factorToSortBy, factorTypeForChecking); businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateIfAnyStoriesExist(allTeams); //Operations var filteredStories = new List <Story>(); if (factorToSortBy.ToLower() == "title") { filteredStories = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Story)) .Select(workItem => (Story)workItem) .OrderBy(storyToOrder => storyToOrder.Title) .ToList(); } else if (factorToSortBy.ToLower() == "priority") { filteredStories = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Story)) .Select(workItem => (Story)workItem) .OrderBy(storyToOrder => storyToOrder.Priority) .ToList(); } else if (factorToSortBy.ToLower() == "status") { filteredStories = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Story)) .Select(workItem => (Story)workItem) .OrderBy(storyToOrder => storyToOrder.StoryStatus) .ToList(); } else if (factorToSortBy.ToLower() == "size") { filteredStories = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Story)) .Select(workItem => (Story)workItem) .OrderBy(storyToOrder => storyToOrder.Size) .ToList(); } StringBuilder sb = new StringBuilder(); sb.AppendLine($"----ALL STORIES IN APPLICAITION SORTED BY {factorToSortBy}----"); long workItemCounter = 1; foreach (var item in filteredStories) { sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} "); workItemCounter++; } sb.AppendLine("---------------------------------"); var resultedAllItems = sb.ToString().Trim(); return(string.Format(resultedAllItems)); }