Пример #1
0
        public void CompletedInGroup(string name)
        {
            if (!groups.Contains(groups.First(x => x.Name == name)))
            {
                throw new GroupNotFoundException(OutputText.GroupNotFound);
            }

            Console.WriteLine("{0, 40}\n", $"Completed tasks in group {name}");
            OutputText.OutputHeader();

            foreach (var task in groups.First(x => x.Name == name).groupTasks)
            {
                var currentTask = tasks.First(x => x.Id == task);
                if (currentTask.IsCompleted && currentTask.NoSubtasks())
                {
                    currentTask.PrintTask();
                }
                else if (!currentTask.NoSubtasks())
                {
                    if (currentTask.IsCompleted)
                    {
                        currentTask.PrintTask(currentTask.Progress());
                    }
                    currentTask.PrintSubtasks(currentTask.subtasks
                                              .Select(x => x).Where(x => x.IsCompleted).ToList());
                }
            }
            Console.WriteLine();
        }
Пример #2
0
 public void Today()
 {
     Console.WriteLine("{0, 40}\n", "Today's deadline tasks");
     OutputText.OutputHeader();
     tasks.ForEach(x => { if (x.Deadline.Date == DateTime.Now.Date)
                          {
                              x.PrintTask();
                          }
                   });
     Console.WriteLine();
 }
Пример #3
0
 public void Completed()
 {
     OutputText.OutputHeader();
     foreach (var task in tasks)
     {
         if (task.IsCompleted && task.NoSubtasks())
         {
             task.PrintTask();
         }
         else if (!task.NoSubtasks())
         {
             if (task.IsCompleted)
             {
                 task.PrintTask(task.Progress());
             }
             task.PrintSubtasks(task.subtasks.Select(x => x).Where(x => x.IsCompleted).ToList());
         }
     }
     Console.WriteLine();
 }
Пример #4
0
        public void All()
        {
            OutputText.OutputHeader();

            groups.ForEach(x => { DisplayGroup(x); });

            foreach (var task in tasks.Select(x => x).Where(t => !HasGroup(t.Id)).OrderBy(t => t.IsCompleted))
            {
                if (task.NoSubtasks())
                {
                    task.PrintTask();
                }
                else
                {
                    task.PrintTask(task.Progress());
                    task.PrintSubtasks();
                }
            }
            Console.WriteLine();
        }