Esempio n. 1
0
        public static void Call(TeamLead teamLead)
        {
            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:
                    foreach (var task in TaskData.TasksById.Values)
                    {
                        WriteLine(task.ToString());
                    }
                    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          = teamLead.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();
                    teamLead.CreateCommit(taskId, comment);
                    break;

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

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

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

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

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

                case 9:
                    teamLead.UpdateSprintReport();
                    break;

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

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

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

                case 13:
                    teamLead.CloseCurrentSprintReport();
                    break;

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