Пример #1
0
        public void ProcessInput()
        {
            //Display menu
            DisplayALL();
            Console.WriteLine();
            string AppAction = ConsoleUtils.DisplayMenu();

            while (AppAction != "Exit")
            {
                switch (AppAction)
                {
                case "List":
                    DisplayALL();
                    break;

                case "Add":
                    string[] newItemInfo = ConsoleUtils.ItemUserInput();
                    repo.AddItem(newItemInfo[0], newItemInfo[1]);    //DateTime.Parse(newItem[2])
                    DisplayALL();
                    break;

                case "Delete":
                    //ask usr for id
                    int itemID = ConsoleUtils.GetItemID();
                    //remove
                    repo.DeleteItem(itemID);
                    DisplayALL();
                    break;

                case "Update":
                    itemID = ConsoleUtils.GetItemID();
                    string[] updatedItemInfo = ConsoleUtils.ItemUserInput();
                    repo.UpdateItem(itemID, updatedItemInfo[0], updatedItemInfo[1]);    //, DateTime.Parse(updatedItem[2])
                    DisplayALL();
                    break;

                case "Pending":
                    ConsoleUtils.PrintAllItems(repo.GetPendingItems());
                    Console.WriteLine();
                    DisplayALL();
                    break;

                case "Done":
                    ConsoleUtils.PrintAllItems(repo.GetPendingItems());
                    Console.WriteLine();
                    DisplayALL();
                    break;

                case "Exit":
                    DisplayALL();
                    ConsoleUtils.QuitProgram();
                    break;

                default:
                    Console.WriteLine("You have entered an invalid option. Please try again.");
                    break;
                }
                AppAction = ConsoleUtils.DisplayMenu();
            }
        }
Пример #2
0
        public void ProcessInput()
        {
            //Display menu
            //DisplayALL();
            string action = ConsoleUtils.DisplayMenu();

            while (action != "Exit")
            {
                switch (action)
                {
                case "List":
                    DisplayALL();
                    break;

                case "Add":
                    string[] newItem = ConsoleUtils.ItemUserInput();
                    repo.AddItem(newItem[0], newItem[1]);
                    DisplayALL();
                    break;

                case "Delete":

                    int itemID = ConsoleUtils.GetItemID();

                    repo.DeleteItem(itemID);
                    DisplayALL();
                    break;

                case "Edit":
                    itemID = ConsoleUtils.GetItemID();
                    string[] updatedItem = ConsoleUtils.ItemUserInput();
                    repo.UpdateItem(itemID, updatedItem[0], updatedItem[1]);
                    DisplayALL();
                    break;

                case "Pending":
                    repo.GetPendingItems();
                    Console.WriteLine();
                    DisplayALL();
                    break;

                case "Done":
                    repo.GetDoneItems();
                    Console.WriteLine();
                    DisplayALL();
                    break;

                case "Exit":
                    DisplayALL();
                    Console.WriteLine("You have now quit the program");
                    break;

                default:
                    Console.WriteLine("You have entered an invalid option. Please try again.");
                    break;
                }
                action = ConsoleUtils.DisplayMenu();
            }
        }
Пример #3
0
        public void ProcessInput()
        {
            DisplayAll();
            string action = ConsoleUtils.DisplayMenu();

            while (action != "Completed")
            {
                switch (action)
                {
                case "List":
                    DisplayAll();
                    break;

                case "Add":
                    string[] newItem = ConsoleUtils.ItemUserInput();
                    repo.AddItem(newItem[0], newItem[1]);
                    DisplayAll();
                    break;

                case "Delete":
                    int itemID = ConsoleUtils.GetItemId();
                    repo.DeleteItem(itemID);
                    DisplayAll();
                    break;

                case "Update":
                    itemID = ConsoleUtils.GetItemId();
                    string[] updatedItem = ConsoleUtils.ItemUserInput();
                    repo.UpdateItem(itemID, updatedItem[0], updatedItem[1]);
                    DisplayAll();
                    break;

                case "Pending":
                    repo.GetPendingItems();
                    Console.WriteLine();
                    DisplayAll();
                    break;

                case "Completed":
                    repo.GetCompletedItems();
                    Console.WriteLine();
                    DisplayAll();
                    break;

                case "Exit":
                    DisplayAll();
                    Console.WriteLine("You have now quit the program.");
                    break;

                default:
                    Console.WriteLine("You have entered an invalid choice. Try again.");
                    break;
                }
                action = ConsoleUtils.DisplayMenu();
            }
            //action = ConsoleUtils.DisplayMenu();
        }
Пример #4
0
        public void Run()
        {
            string answer = ConsoleUtils.DisplayMenu(); //UI and Menu Display after string

            while (answer != "Q")
            {
                if (answer == "L")
                {
                    repo.GetToDoItems();
                    List <ToDoItems> list = repo.GetToDoItems();
                    ConsoleUtils.PrintToDoItems(list);
                }
                if (answer == "A")
                {
                    Console.WriteLine("Add a Description: ");
                    string Description = Console.ReadLine(); //strings for input
                    Console.WriteLine("Enter a Importance Status for item: (Low, Medium, High) ");
                    string Status = Console.ReadLine();
                    Console.WriteLine("Enter a Due Date: month/day/year ");
                    DateTime DueDate = Convert.ToDateTime(Console.ReadLine());
                    repo.AddItem(Description, Status, DueDate);
                }
                if (answer == "U")
                {
                    Console.WriteLine(" What is the ID of what needs to be updated: ");
                    int Id = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Update your Description of the item: ");
                    string Description = Console.ReadLine();
                    Console.WriteLine("Update Importance Status of the item: ");
                    string Status = Console.ReadLine();
                    Console.WriteLine("Update your due date of the item: ");
                    DateTime DueDate = Convert.ToDateTime(Console.ReadLine());
                    repo.UpdateItem(Id, Description, Status, DueDate);
                }
                if (answer == "R")
                {
                    Console.WriteLine("What is the ID of the item you want to Delete: ");
                    int Id = Convert.ToInt32(Console.ReadLine());
                    repo.DeleteItem(Id);
                }
                answer = ConsoleUtils.DisplayMenu();
            }
        }