public override string Execute()
        {
            if (this.CommandParameters.Count != 3)
            {
                throw new ArgumentException("Parameters count is not valid!");
            }

            var currBoardItems   = Commons.currentBoard.WorkItems;
            var teamFeedbacks    = currBoardItems.Where(b => b.GetType().Name == "Feedback");
            var feedbackToModify = teamFeedbacks.FirstOrDefault(b => b.Title == this.CommandParameters[0]) as Feedback;

            if (this.CommandParameters[1] == "rating")
            {
                feedbackToModify.Rating = int.Parse(this.CommandParameters[2]);
            }
            else if (this.CommandParameters[1] == "status")
            {
                feedbackToModify.Status = ValidateEnums.ValidateStatusFeedback(this.CommandParameters[2]);
            }
            else
            {
                throw new ArgumentException("Invalid parameter to modify." + Environment.NewLine + "You can modify rating or status.");
            }

            feedbackToModify.History.Add($"{feedbackToModify.Title}'s {this.CommandParameters[1]} was modified to {this.CommandParameters[2]}");
            return($"{feedbackToModify.Title} feedback's {this.CommandParameters[1]} was modified to {this.CommandParameters[2]} in {Commons.currentBoard.Name} board!");
        }
Exemple #2
0
        public override string Execute()
        {
            var builder  = new StringBuilder();
            var allItems = this.WorkItemProvider.WorkItems;

            if (CommandParameters.Count == 0)
            {
                throw new ArgumentException("You must provide bug status to filter by.");
            }

            var feedbacks = allItems.Where(b => b.GetType().Name == "Feedback").Select(c => c as Feedback);


            if (feedbacks.Count() == 0)
            {
                throw new ArgumentException("No bugs available!");
            }

            var feedStts = ValidateEnums.ValidateStatusFeedback(this.CommandParameters[0]);

            {
                foreach (var feedback in feedbacks)
                {
                    if (feedback.Status == feedStts)
                    {
                        builder.AppendLine(feedback.ToString());
                    }
                }
            }

            return(builder.ToString().TrimEnd());
        }