Esempio n. 1
0
        public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
        {
            FileIO loader = new FileIO();
            switch (arguments.GetTypeOfChange())
            {
                case 0:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 0))
                        Console.WriteLine("Task {0} changed to {1}", arguments.GetParameter(1), arguments.GetParameter(3));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                case 1:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 1))
                        Console.WriteLine("Task {0} due date changed to {1}", arguments.GetParameter(1), arguments.GetParameter(3));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                case 2:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 0) && tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(5), 1))
                        Console.WriteLine("Task {0} changed to {1}, due date changed to {2}", arguments.GetParameter(1), arguments.GetParameter(3), arguments.GetParameter(5));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                case 3:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 1) && tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(5), 0))
                        Console.WriteLine("Task {0} changed to {1}, due date changed to {2}", arguments.GetParameter(1), arguments.GetParameter(5), arguments.GetParameter(3));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                default:
                    Console.WriteLine("Wrong arguments for change command");
                    break;
            }

            loader.SaveTasks(tasklist.GetTasks());
        }