Exemple #1
0
        //Method to make a new list.
        internal static void NewListMaker()
        {
            bool         validator       = false;
            ShoppingData newShoppingData = new ShoppingData();

            do
            {
                Console.Clear();
                DisplayGreeting();

                //*************************************************
                //Get name of list and date.
                Console.Write("Enter new list name: ");
                newShoppingData.Name = Console.ReadLine().Trim();

                newShoppingData.Date  = DateTime.Now.ToString("MM/dd/yyyy");
                newShoppingData.Items = NewItemMaker();
                myShoppingLists.Add(newShoppingData);
                List <ShoppingData> newList = new List <ShoppingData>
                {
                    newShoppingData
                };

                SerializeNewList(myShoppingLists, GetFileName());

                //*****************************************
                Console.WriteLine("_____________________________________________________________");
                ShoppingData.PrintShoppingData(newList);
                if (key.Key == ConsoleKey.Enter)
                {
                    validator = true;
                }
            } while (!validator);
        }
Exemple #2
0
        //============================================
        //------------ Search Methods ----------------
        //Menu for searching through the lists.
        internal static void SavedSearch()
        {
            Console.Clear();

            int option = 0;

            while ((option = Prompt(SearchMenuOptions)) != SearchMenuOptions.Length)
            {
                switch (option)
                {
                case 1:
                    SearchResults(searchResultsList: myShoppingLists);
                    break;

                case 2:
                    ShoppingData.PrintShoppingData(myShoppingData: myShoppingLists);
                    break;
                }
            }
        }