Exemplo n.º 1
0
        void AddOuting()
        {
            Console.Clear();
            bool enterNewOuting  = false;
            bool chooseEventType = false;
            bool choosePeople    = false;
            bool chooseDate      = false;
            bool chooseCost      = false;
            bool chooseChanges   = false;
            bool makeChanges     = false;
            var  newOuting       = new Outing();

            while (enterNewOuting == false)
            {
                chooseChanges = false;
                while (chooseEventType == false)
                {
                    //Type of Event
                    chooseEventType = true;
                    Console.WriteLine("What type of event is this?\n" +
                                      "1) Golf\n" +
                                      "2) Bowling\n" +
                                      "3) Amusement Park\n" +
                                      "4) Concert");
                    string outingTypeChoice = Console.ReadLine();
                    switch (outingTypeChoice)
                    {
                    case "1":
                        newOuting.EventType = EventType.Golf;
                        break;

                    case "2":
                        newOuting.EventType = EventType.Bowling;
                        break;

                    case "3":
                        newOuting.EventType = EventType.AmusementPark;
                        break;

                    case "4":
                        newOuting.EventType = EventType.Concert;
                        break;

                    default:
                        Console.Clear();
                        Console.WriteLine("Please enter a valid number.\n" +
                                          "Press any key to continue...");
                        Console.ReadKey();
                        Console.Clear();
                        chooseEventType = false;
                        break;
                    }
                    Console.Clear();
                }
                while (choosePeople == false)
                {
                    //Amount of People
                    choosePeople = true;
                    Console.WriteLine("How many people attended this event?");

                    try
                    {
                        newOuting.Attended = int.Parse(Console.ReadLine());
                    }
                    catch (Exception)
                    {
                        Console.Clear();
                        Console.WriteLine("Please enter a valid number.\n" +
                                          "Press any key to continue...");
                        Console.ReadKey();
                        Console.Clear();
                        choosePeople = false;
                    }
                    Console.Clear();
                }
                while (chooseDate == false)
                {
                    //Date of Event
                    chooseDate = true;
                    Console.WriteLine("Please enter the date of the event (mm/dd/yyyy)");
                    try
                    {
                        newOuting.Date = DateTime.Parse(Console.ReadLine());
                        Console.Clear();
                    }
                    catch (Exception)
                    {
                        Console.Clear();
                        Console.WriteLine("Please enter a valid date. (mm/dd/yyyy)\n" +
                                          "Press any key to continue...");
                        Console.ReadKey();
                        Console.Clear();
                        chooseDate = false;
                    }
                }
                while (chooseCost == false)
                {
                    //Per person Cost
                    chooseCost = true;
                    Console.WriteLine("What was the per person cost?");

                    try
                    {
                        newOuting.PerPersonCost = int.Parse(Console.ReadLine());
                    }
                    catch (Exception)
                    {
                        Console.Clear();
                        Console.WriteLine("Please enter a valid number.\n" +
                                          "Press any key to continue...");
                        Console.ReadKey();
                        Console.Clear();
                        choosePeople = false;
                    }
                    Console.Clear();
                }
                while (chooseChanges == false)
                {
                    chooseChanges = true;

                    Console.WriteLine("Please review the information for the new outing\n");
                    newOuting.PrintProps();
                    Console.WriteLine("\nDo you want to make any changes to this outing?(y/n)");
                    string changesAnswer = Console.ReadLine().ToLower();

                    switch (changesAnswer)
                    {
                    case "y":
                        makeChanges = true;
                        break;

                    case "n":
                        enterNewOuting = true;
                        break;

                    default:
                        Console.Clear();
                        Console.WriteLine("Invalid selection. \nPress any key to continue...");
                        Console.ReadKey();
                        Console.Clear();
                        chooseChanges = false;
                        break;
                    }
                }
                Console.Clear();
                while (makeChanges == true)
                {
                    makeChanges = false;
                    Console.WriteLine($"What property would you like to change? Or select 5 to add the new outing.\n");
                    newOuting.PrintProps();
                    Console.WriteLine("5. Continue");
                    string propertyAnswer = Console.ReadLine().ToLower();
                    switch (propertyAnswer)
                    {
                    case "1":
                        chooseEventType = false;
                        Console.Clear();
                        break;

                    case "2":
                        choosePeople = false;
                        Console.Clear();
                        break;

                    case "3":
                        chooseDate = false;
                        Console.Clear();
                        break;

                    case "4":
                        chooseCost = false;
                        Console.Clear();
                        break;

                    case "5":
                        enterNewOuting = true;
                        Console.Clear();
                        break;

                    default:
                        Console.Clear();
                        Console.WriteLine("Invalid selection. \nPress any key to continue...");
                        Console.ReadKey();
                        Console.Clear();
                        makeChanges = true;
                        break;
                    }
                }
            }
            if (enterNewOuting == true)
            {
                _outings.AddOuting(newOuting);
                Console.Clear();
                Console.WriteLine($"You have successfully added the outing.");
                Console.WriteLine("Press any key to return to menu...");
                Console.ReadKey();
                Console.Clear();
            }
        }
Exemplo n.º 2
0
        public void CreateOuting()
        {
            BeginSubmenu("CREATE A NEW OUTING");
            Outing userOuting = new Outing();

            Console.WriteLine("Please enter the outing date (mm/dd/yyyy):");
            string dateInput = Console.ReadLine();

            string[] arrayOfDateInput = dateInput.Split('/');
            int      month            = int.Parse(arrayOfDateInput[0]);
            int      day  = int.Parse(arrayOfDateInput[1]);
            int      year = int.Parse(arrayOfDateInput[2]);

            userOuting.Date = new DateTime(year, month, day);
            Console.WriteLine(" ");
            Console.WriteLine("Choose the event type:\n" +
                              "1:  Golf\n" +
                              "2:  Bowling\n" +
                              "3: Amusement Park\n" +
                              "4: Concert\n");
            string eventTypeInput = Console.ReadLine();

            switch (eventTypeInput)
            {
            case "1":
                userOuting.EventType = EventType.Golf;
                break;

            case "2":
                userOuting.EventType = EventType.Bowling;
                break;

            case "3":
                userOuting.EventType = EventType.AmusementPark;
                break;

            case "4":
                userOuting.EventType = EventType.Concert;
                break;

            default:
                Console.WriteLine("Make a selection between 1 and 4.");
                Console.ReadKey();
                break;
            }
            Console.WriteLine(" ");
            Console.WriteLine("How many people attended the outing?");
            int attendanceInput = int.Parse(Console.ReadLine());

            userOuting.Attendance = attendanceInput;
            Console.WriteLine(" ");
            Console.WriteLine("What was the total cost of the outing? Do not include a dollar sign.");
            double totalCostInput = int.Parse(Console.ReadLine());

            userOuting.TotalCost = totalCostInput;

            _outingRepo.AddOuting(userOuting);
            Console.WriteLine(" ");
            Console.WriteLine("The new outing has been added to the directory!");
            EndSubmenu();
        }
 public void AddOuting(Outing outingToAdd)
 {
     outingToAdd.CostPerPerson = outingToAdd.CostOfEvent / outingToAdd.Attendees;
     _outings.Add(outingToAdd);
 }
 public void DisplayOuting(Outing outing)
 {
     Console.WriteLine(outing.ToConsoleString());
 }
Exemplo n.º 5
0
        public ActionResult RemoveOuting(int outingid)
        {
            Outing.DeleteOuting(outingid);

            return(RedirectToAction("OutingList"));
        }
        public void AddInitialOuting()
        {
            Outing testOuting = new Outing(50, new DateTime(2000, 10, 10), 500.00m, 0, EventType.AmusementPark);

            _outings.Add(testOuting);
        }
Exemplo n.º 7
0
 public void TestTotals()
 {
     Outing_Repository outingRepo = new Outing_Repository();
     Outing            newOuting  = new Outing(OutingType.Bowling, 2, new DateTime(12, 12, 12), 2.00d, 2000d);
     Outing            newOuting2 = new Outing(OutingType.Bowling, 2, new DateTime(12, 12, 12), 2.00d, 2000d);
 }
 public void Arrange()
 {
     _outingsRepo = new OutingsRepository();
     _outing      = new Outing("Golf", new DateTime(2019, 3, 17), 125);
     _outingsRepo.AddOutingToList(_outing);
 }
        private void AddOuting()
        {
            Outing newOuting = new Outing();
            bool   looper    = true;

            while (looper)
            {
                // Method for event team to add an outing event
                Console.Clear();
                KomodoLogo();
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("             Add New Outing Event");
                Console.ResetColor();

                DateTime date     = new DateTime();
                bool     dateLoop = false;
                while (!dateLoop)
                {
                    Console.WriteLine("Please Enter the Event Date (MMMM dd, YYYY):");
                    string dateString = Console.ReadLine();
                    dateLoop = DateTime.TryParse(dateString, out date);
                }
                newOuting.EventDate = date;
                Console.Clear();
                KomodoLogo();
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("             Add New Outing Event");
                Console.ResetColor();
                Console.WriteLine("Date: " + newOuting.EventDate.ToString("MMMM dd,yyyy"));
                Console.WriteLine("Event Type");
                Console.WriteLine("1> Golf");
                Console.WriteLine("2> Bowling");
                Console.WriteLine("3> Amusement Park");
                Console.WriteLine("4> Concert");
                Console.WriteLine("Please enter the number for the event type:");
                bool   eventSelect = true;
                string eventType   = "1";
                while (eventSelect)
                {
                    eventType = Console.ReadLine();
                    if (eventType == "1" || eventType == "2" || eventType == "3" || eventType == "4")
                    {
                        eventSelect = false;
                    }
                    else
                    {
                        Console.WriteLine("Please enter a valid selection 1, 2, 3, or 4");
                    }
                }
                newOuting.Type = (EventType)int.Parse(eventType);

                Console.Clear();
                KomodoLogo();
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("             Add New Outing Event");
                Console.ResetColor();
                Console.WriteLine("Date: " + newOuting.EventDate.ToString("MMMM dd,yyyy"));
                Console.WriteLine("Event Type: " + newOuting.Type);
                Console.WriteLine("Please enter the attendance number for this event:");
                string attendance = Console.ReadLine();
                newOuting.Attendance = Convert.ToInt32(attendance);
                Console.WriteLine("Enter cost for this event: ");
                string cost = Console.ReadLine();
                newOuting.CostOfEvent = Decimal.Parse(cost);


                Console.Clear();
                KomodoLogo();
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("             Add New Outing Event");
                Console.ResetColor();
                Console.WriteLine("Date: " + newOuting.EventDate.ToString("MMMM dd,yyyy"));
                Console.WriteLine("Event Type: " + newOuting.Type);
                Console.WriteLine("Event Attendance: " + newOuting.Attendance);
                Console.WriteLine("Event Cost: " + newOuting.CostOfEvent);
                Console.WriteLine();
                Console.WriteLine("Does all of this look correct? \nEnter Y to commit this event. \nEnter N to start over entering this event.");
                string correct = Console.ReadLine();
                if (correct.ToLower() == "y")
                {
                    looper = false;
                }
            }
            bool wasAdded = _repo.AddOuting(newOuting);

            if (wasAdded == true)
            {
                Console.WriteLine("Your Content was added to the database.");
                Console.WriteLine("Press any key to Continue.");
            }
            else
            {
                Console.WriteLine("Oops. Something went wrong. Your content was not added.  Please Try Again");
                Console.WriteLine("Press any key to continue.");
            }

            Console.ReadKey();
        }
Exemplo n.º 10
0
        public void AddOutingToList(OutingType outingType, int numberAttended, DateTime dateOfOuting, double costPerPerson, double totalCostOfEvent)
        {
            Outing newOuting = new Outing(outingType, numberAttended, dateOfOuting, costPerPerson, totalCostOfEvent);

            _outingRepo.AddToList(newOuting);
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            string     userInput;
            OutingRepo repo = new OutingRepo();

            do
            {
                Console.WriteLine("Please choose a menu item\n" +
                                  "1. Display a list of all outings\n" +
                                  "2. Add outing\n" +
                                  "3. Cost Statistics\n" +
                                  "4. Exit");
                userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    Console.Clear();
                    repo.DisplayAll();
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "2":
                    Console.Clear();
                    Console.WriteLine("Please enter the event type (Golf, Bowling, Amusement Park, Concert)");
                    string        eventSTR;
                    Outing.Events events = Outing.Events.Golf;
                    do
                    {
                        eventSTR = Console.ReadLine().ToLower().Replace(" ", "");
                        switch (eventSTR)
                        {
                        case "golf":
                            events = Outing.Events.Golf;
                            break;

                        case "bowling":
                            events = Outing.Events.Bowling;
                            break;

                        case "amusementpark":
                            events = Outing.Events.AmusementPark;
                            break;

                        case "concert":
                            events = Outing.Events.Concert;
                            break;

                        default:
                            Console.WriteLine("Please enter one of the options");
                            break;
                        }
                    } while (eventSTR != "golf" && eventSTR != "bowling" && eventSTR != "amusementpark" && eventSTR != "concert");
                    Console.Clear();
                    Console.WriteLine("Please enter the number of people that attended");
                    int  numberAttended;
                    bool isNumber;
                    do
                    {
                        if (int.TryParse(Console.ReadLine(), out numberAttended))
                        {
                            isNumber = true;
                        }
                        else
                        {
                            Console.WriteLine("Please enter a whole number");
                            isNumber = false;
                        }
                    } while (!isNumber);
                    Console.Clear();
                    Console.WriteLine("Please enter the date of the event (Format MM/DD/YY)");
                    DateTime date;
                    bool     isDate;
                    do
                    {
                        if (DateTime.TryParse(Console.ReadLine(), out date))
                        {
                            isDate = true;
                        }
                        else
                        {
                            Console.WriteLine("Please enter a date with the correct format");
                            isDate = false;
                        }
                    } while (!isDate);
                    Console.Clear();
                    Console.WriteLine("Please enter the cost per person for the event.");
                    decimal costPerPerson;
                    bool    isCost;
                    do
                    {
                        string costSTR = Console.ReadLine().Replace("$", "");
                        decimal.TryParse(costSTR, out costPerPerson);
                        if (decimal.Round(costPerPerson, 2) != costPerPerson || costSTR != Convert.ToString(costPerPerson))
                        {
                            Console.WriteLine("Please enter a valid number");
                            isCost = false;
                        }
                        else
                        {
                            isCost = true;
                        }
                    } while (!isCost);
                    Console.Clear();
                    Outing outing = new Outing(events, numberAttended, date, costPerPerson);
                    repo.AddOuting(outing);
                    Console.WriteLine("Outing added.\n" +
                                      "Press any key to continue...");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "3":
                    Console.Clear();
                    repo.CombinedCosts();
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "4":
                    break;

                default:
                    Console.WriteLine("Please choose a number between 1-4");
                    break;
                }
            } while (userInput != "4");
        }