Ejemplo n.º 1
0
        public static void Call(Director director)
        {
            var exit    = false;
            var command = 0;

            while (!exit)
            {
                PrintEmployeeMenu();
                try
                {
                    command = int.Parse(ReadLine());
                }
                catch
                {
                    WriteLine("Invalid command");
                }

                switch (command)
                {
                case 0:
                    exit = true;
                    break;

                case 1:
                    var result = TaskData.TasksById.Values.Aggregate("", (current, tasks) => current + tasks);
                    WriteLine(result);
                    break;

                case 2:
                    WriteLine("What is the name of the task?");
                    var name = ReadLine();
                    WriteLine("What is the description of the task?");
                    var description = ReadLine();
                    var id          = director.CreateTask(name, description);
                    WriteLine($"New task id: {id}");
                    break;

                case 3:
                    WriteLine("What is the id of the task?");
                    var taskId = ReadLine();
                    WriteLine("Write your comment:");
                    var comment = ReadLine();
                    director.CreateCommit(taskId, comment);
                    break;

                case 4:
                    WriteLine("What is the id of the task?");
                    taskId = ReadLine();
                    director.OpenTask(taskId);
                    break;

                case 5:
                    WriteLine("What is the id of the task?");
                    taskId = ReadLine();
                    director.ActiveTask(taskId);
                    break;

                case 6:
                    WriteLine("What is the id of the task?");
                    taskId = ReadLine();
                    director.ResolveTask(taskId);
                    break;

                case 7:
                    WriteLine("What is the name for the report?");
                    name = ReadLine();
                    director.CreateDayReport(name);
                    break;

                case 8:
                    WriteLine("What is the name for the report?");
                    name = ReadLine();
                    director.CreateSprintReport(name);
                    break;

                case 9:
                    director.UpdateSprintReport();
                    break;

                case 10:
                    WriteLine("What is the id of the task?");
                    taskId = ReadLine();
                    var resultSubordinate = SearchSubordinate(director);
                    director.UpdateTaskEmployee(taskId, resultSubordinate);
                    break;

                case 11:
                    resultSubordinate = SearchSubordinate(director);
                    director.AddNewSubordinate(resultSubordinate);
                    break;

                case 12:
                    foreach (var subordinate in director.Subordinates())
                    {
                        WriteLine(subordinate.ToString());
                    }
                    break;

                case 13:
                    director.CloseCurrentSprintReport();
                    break;

                default:
                    WriteLine("Wrong command!");
                    break;
                }
            }
        }