コード例 #1
0
        private void FiltrToDate(int numberTask)
        {
            Console.WriteLine("select a date");
            string filtr     = readingInfo();
            var    filtrTask = new WeeklyTask[numberTask];
            var    i         = 0;
            var    x         = 0;

            do
            {
                if (weeklyTasks[i] is RegularTask regularTask && ((IRegularTask)regularTask).GetDate() >= DateTime.Parse(filtr))
                {
                    filtrTask[x] = weeklyTasks[i];
                    x++;
                }
                i++;
            }while (i < numberTask);
            Console.WriteLine("tasks with the selected data:");
            ShowFiltr(x, filtrTask);
        }
コード例 #2
0
        private void FiltrToPriority(int numberTask)
        {
            Console.WriteLine("select priority");
            string filtr     = readingInfo();
            var    filtrTask = new WeeklyTask[numberTask];
            var    i         = 0;
            var    x         = 0;

            do
            {
                if (weeklyTasks[i] is PriorityTask priorityTask && ((IPriorityTask)priorityTask).GetPriority() == filtr)
                {
                    filtrTask[x] = weeklyTasks[i];
                    x++;
                }
                i++;
            }while (i < numberTask);

            Console.WriteLine("tasks with the selected priority:");
            ShowFiltr(x, filtrTask);
        }