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()
        {
            if (this.CommandParameters.Count != 4)
            {
                throw new ArgumentException("Parameters count is not valid!");
            }
            var title = this.CommandParameters[0];
            var description = this.CommandParameters[1];
            var priority = ValidateEnums.ValidatePriority(CommandParameters[2]);
            var severity = ValidateEnums.ValidateSeverity(CommandParameters[3]);


            var currBoardItems = Commons.CurrBoardValid().WorkItems;

            var findBug = this.WorkItemProvider.Find(title);
            if (findBug != null)
            {
                throw new ArgumentException("Bug already exists!");

            }

            var newBug = this.Factory.CreateBug(title, description, priority, severity);

            Commons.AddToWIHistory(newBug);
            this.WorkItemProvider.Add(newBug);
            currBoardItems.Add(newBug);

            return $"{newBug.Title} bug added to {Commons.currentBoard.Name} board!" + Commons.CreateBugText();

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

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

            if (this.CommandParameters[1] == "priority")
            {
                bugToModify.Priority = ValidateEnums.ValidatePriority(this.CommandParameters[2]);
            }
            else if (this.CommandParameters[1] == "severity")
            {
                bugToModify.Severity = ValidateEnums.ValidateSeverity(this.CommandParameters[2]);
            }
            else if (this.CommandParameters[1] == "status")
            {
                bugToModify.Status = ValidateEnums.ValidateStatusBug(this.CommandParameters[2]);
            }
            else
            {
                throw new ArgumentException("Invalid parameter to modify." + Environment.NewLine + "You can modify priority, status or severity.");
            }


            bugToModify.History.Add($"{bugToModify.Title}'s {this.CommandParameters[1]} was modified to {this.CommandParameters[2]}");
            return($"{bugToModify.Title} bug's {this.CommandParameters[1]} was modified to {this.CommandParameters[2]} in {Commons.currentBoard.Name} board!");
        }
Exemple #4
0
        public override string Execute()
        {
            //overrite parameters with step by step user input

            if (this.CommandParameters.Count != 4)
            {
                throw new ArgumentException("Parameters count is not valid!");
            }
            var title       = this.CommandParameters[0];
            var description = this.CommandParameters[1];
            var priority    = ValidateEnums.ValidatePriority(CommandParameters[2]);
            var size        = ValidateEnums.ValidateStorySize(CommandParameters[3]);


            var currBoardItems = Commons.CurrBoardValid().WorkItems;

            var findStory = this.WorkItemProvider.Find(title);

            if (findStory != null)
            {
                throw new ArgumentException("Story already exists!");
            }

            var newStory = this.Factory.CreateStory(title, description, priority, size);


            Commons.AddToWIHistory(newStory);
            this.WorkItemProvider.Add(newStory);
            currBoardItems.Add(newStory);

            return($"{newStory.Title} story added to {Commons.currentBoard.Name} board!" + Commons.CreateStoryText());
        }
        public override string Execute()
        {
            var builder  = new StringBuilder();
            var allItems = this.WorkItemProvider.WorkItems;

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

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


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

            var storyVal = ValidateEnums.ValidateStatusStory(this.CommandParameters[0]);

            {
                foreach (var story in stories)
                {
                    if (story.Status == storyVal)
                    {
                        builder.AppendLine(story.ToString());
                    }
                }
            }

            return(builder.ToString().TrimEnd());
        }
        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 bugs = allItems.Where(b => b.GetType().Name == "Bug").Select(c => c as Bug);


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

            var bugStts = ValidateEnums.ValidateStatusBug(this.CommandParameters[0]);

            {
                foreach (var bug in bugs)
                {
                    if (bug.Status == bugStts)
                    {
                        builder.AppendLine(bug.ToString());
                    }
                }
            }

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