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 + "\""); } }
private static int ChooseTaskInCurrentList(int currentMenuLevel) //Choose some task in current tasklist { Console.Write("Choose task in current list ? (skip if don`t)(%Title%): "); string answer14 = Console.ReadLine(); if (!answer14.Equals("")) { currentTask = MainControl.FindTask(answer14, currentList); if (currentTask != null) { Console.WriteLine("Choosen task has title: \"" + currentTask.Title + "\"; and id: " + currentTask.Id); currentMenuLevel = 3; } else { Console.WriteLine("Task with name: \"" + answer14 + "\" not found"); } } return(currentMenuLevel); }
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"); } } }
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); }