Example #1
0
        private void UIAddOuting()
        {
            Console.Clear();
            Console.WriteLine("NOTE: Inputs are spelling specific");
            Console.WriteLine("Enter Event Type\n1. Fishing\n2. Hunting\n3. Trapping\n4. Hiking");

            string eventStr  = Console.ReadLine();
            bool   eventBool = int.TryParse(eventStr, out int evnt);

            if (eventBool == false || evnt > 4 || evnt < 0)
            {
                Console.Clear();
                Console.WriteLine("INVALID RESPONSE");
                Console.ReadKey();
                UIAddOuting();
            }

            Event eventType = Event.Undefined;

            switch (evnt)
            {
            case 1:
                eventType = Event.Fishing;
                break;

            case 2:
                eventType = Event.Hunting;
                break;

            case 3:
                eventType = Event.Trapping;
                break;

            case 4:
                eventType = Event.Hiking;
                break;

            default:
                Console.WriteLine("Wrong!!!!");
                Console.ReadKey();
                UIAddOuting();
                break;
            }

            Console.Write("Enter Number of People that went to the Event: ");
            string numPeopleStr = Console.ReadLine();

            bool numBool = int.TryParse(numPeopleStr, out int numPeople);

            if (numBool == false)
            {
                Console.Clear();
                Console.WriteLine("INVALID RESPONSE");
                Console.ReadKey();
                UIAddOuting();
            }

            Console.Write("Enter Date of the Event (DD/MM/YY): ");
            string date = Console.ReadLine();

            DateTime eventDate = DateTime.Parse(date);

            Console.Write("Enter Cost Per Person: ");
            string costPerPersonStr = Console.ReadLine();

            bool costBool = double.TryParse(costPerPersonStr, out double costPerPerson);

            if (costBool == false)
            {
                Console.Clear();
                Console.WriteLine("INVALID RESPONSE");
                Console.ReadKey();
                UIAddOuting();
            }

            Console.Write("Enter Total Cost: ");
            string totalCostStr = Console.ReadLine();

            bool totalBool = double.TryParse(totalCostStr, out double totalCost);

            if (totalBool == false)
            {
                Console.Clear();
                Console.WriteLine("INVALID RESPONSE");
                Console.ReadKey();
                UIAddOuting();
            }

            Outing newOuting = new Outing(eventType, numPeople, eventDate, costPerPerson, totalCost);

            outingRepo.UpdateList(newOuting);

            Console.Clear();
            Console.WriteLine("Added To Events");
            Console.ReadKey();
            Console.Clear();
            Console.Write("Add Another Event? (Y/N) ");
            string input = Console.ReadLine();

            if (input == "Y" || input == "y")
            {
                UIAddOuting();
            }
            else
            {
                InitialPrompt();
            }
        }