Exemplo n.º 1
0
 private static void DeleteTaskListByName()//Delete tasklist  using name
 {
     Console.Write("Delete some taskList ?  (%Title%): "); string answer14 = Console.ReadLine();
     if (!answer14.Equals(""))
     {
         ToDoTaskList list = MainControl.FindList(answer14, currentUser);
         if (list != null) // If list exist
         {
             MainControl.Delete(list);
             Console.WriteLine("List with name \"" + answer14 + "\" has been succesfully deleted");
             currentUser = UserLab.Get().GetUser(currentUser.Id); // Refresh current user
             if (currentList != null)
             {
                 if (answer14 == currentList.Title) // If deleted list with current name has been deleted, refresh current list
                 {
                     currentList = null;
                 }
             }
         }
         else
         {
             Console.WriteLine("List with name: \"" + answer14 + "\" not found");
         }
     }
 }
Exemplo n.º 2
0
        private static void RenameCurrentList()//Modify tasklist
        {
            Console.Write("Current title: \"" + currentList.Title + "\"; Input new title: "); string answerTitle = Console.ReadLine();
            if (!answerTitle.Equals(""))
            {
                currentList.Title = answerTitle;

                currentUser = MainControl.Modify(currentList, currentUser);
                currentList = MainControl.FindList(answerTitle, currentUser); // Refresh.

                Console.WriteLine("You modified list with name \"" + currentList.Title + "\"; and id: " + currentList.Id);
            }
        }
Exemplo n.º 3
0
        private static void AddTaskInCurrentList()//Adding new task in current list
        {
            Console.Write("Add new task in current list ? (%TitleTask%): "); string answer12 = Console.ReadLine();
            if (!answer12.Equals(""))
            {
                Console.Write("Input new task: "); string answerNewTask = Console.ReadLine();
                currentUser = MainControl.Add(answer12, answerNewTask, currentList, currentUser);
                currentList = MainControl.FindList(currentList.Title, UserLab.Get().GetUser(currentUser.Id));

                ToDoTask task = MainControl.FindTask(answer12, currentList);
                Console.WriteLine("\nIn tasklist \"" + currentList.Title + "\" succesfully has been added new task \"" + task.Title + "\"");
            }
        }
Exemplo n.º 4
0
 private static int ChooseTaskListByName(int currentMenuLevel) //Choose some taskList by name
 {
     Console.Write("Choose some taskList? (%Title%): "); string answer13 = Console.ReadLine();
     if (!answer13.Equals(""))
     {
         currentList = MainControl.FindList(answer13, currentUser);
         if (currentList != null)
         {
             Console.WriteLine("Choosen list has name: \"" + currentList.Title + "\"; and id: " + currentList.Id);
             currentMenuLevel = 2;
         }
         else
         {
             Console.WriteLine("List with name: \"" + answer13 + "\" not found");
         }
     }
     return(currentMenuLevel);
 }
Exemplo n.º 5
0
 private static void DeleteTaskInCurrentListByName()//Delete task in current taskList using name
 {
     Console.Write("Delete task in current taskList ? (skip if don`t) (%Title%): "); string answer15 = Console.ReadLine();
     if (!answer15.Equals(""))
     {
         ToDoTask taskForDelete = MainControl.FindTask(answer15, currentList);
         if (taskForDelete != null)
         {
             MainControl.Delete(taskForDelete);
             Console.WriteLine("Task with name \"" + answer15 + "\" has been succesfully deleted");
             currentUser = UserLab.Get().GetUser(currentUser.Id); // Refresh current user
             currentList = MainControl.FindList(currentList.Title, UserLab.Get().GetUser(currentUser.Id));
             currentTask = MainControl.FindTask(answer15, currentList);
         }
         else
         {
             Console.WriteLine("Task with name: \"" + answer15 + "\" not found");
         }
     }
 }
Exemplo n.º 6
0
        private static void ModifyCurrentTask()//Modify current task
        {
            Console.Write("Current title: \"" + currentTask.Title + "\". Input new title: "); string answerTitle = Console.ReadLine();
            if (!answerTitle.Equals(""))
            {
                currentTask.Title = answerTitle;
            }
            Console.Write("Current task: \"" + currentTask.Text + "\". Input new task: "); string answerTask = Console.ReadLine();
            if (!answerTask.Equals(""))
            {
                currentTask.Text = answerTask;
            }
            Console.Write("Current status: \"" + (currentTask.IsCompleted ? "Completed" : "Not completed") + "\". Input new status (+/~): "); string answerCompleted = Console.ReadLine();
            if (!answerCompleted.Equals(""))
            {
                currentTask.IsCompleted = (answerCompleted.Equals("+") ? true : false);
            }

            currentUser = MainControl.Modify(currentTask, currentUser);
            currentList = MainControl.FindList(currentList.Title, currentUser);
            currentTask = MainControl.FindTask(currentTask.Title, currentList); // Refresh. Now not useful, but in future can be useful

            Console.WriteLine("You modified task with name \"" + currentTask.Title + "\"; and id: " + currentTask.Id);
        }