Example #1
0
 public Outings(OutingType outing, int numOfPeople, string date, decimal perPerson, decimal totalCost)
 {
     Event       = outing;
     NumOfPeople = numOfPeople;
     Date        = date;
     PricePerson = perPerson;
     TotalCost   = totalCost;
 }
Example #2
0
 public OutingEvent(OutingType eventType, int numberPeople, DateTime outingDate, decimal outingCPP, decimal costPerEvent)
 {
     NumberPeople = numberPeople;
     OutingDate   = outingDate;
     OutingCPP    = outingCPP;
     CostPerEvent = costPerEvent;
     EventType    = eventType
 }
 public Outing(string outingName, int outingPeopleAttending, DateTime outingDateofEvent, decimal outingCostPerPerson, OutingType typeOfOuting)
 {
     OutingName            = outingName;
     OutingPeopleAttending = outingPeopleAttending;
     OutingDateOfEvent     = outingDateofEvent;
     OutingCostPerPerson   = outingCostPerPerson;
     TypeOfOuting          = typeOfOuting;
 }
Example #4
0
 public OutingInfo(OutingType outingType, int numberOfPeople, string date, decimal totalCostPerPerson, decimal totalCostByEvent)
 {
     OutingType         = outingType;
     NumberOfPeople     = numberOfPeople;
     Date               = date;
     TotalCostPerPerson = totalCostPerPerson;
     TotalCostByEvent   = totalCostByEvent;
 }
Example #5
0
 public Outing(OutingType type, int numOfPeople, DateTime dateOfOuting, decimal costPerPerson, decimal costPerOuting)
 {
     this.Type          = type;
     this.NumOfPeople   = numOfPeople;
     this.DateOfOuting  = dateOfOuting;
     this.CostPerPerson = costPerPerson;
     this.CostPerOuting = costPerOuting;
 }
        private void EnterNewOuting()
        {
            Console.WriteLine("Please follow the prompts to add a new claim to the list. \r\n" +
                              "1 = Beer Garden,\r\n" +
                              "2 = Bowling Event,\r\n" +
                              "3 = Golf Event \r\n" +
                              "4 = Amusement Park\r\n" +
                              "5 = Concert Event");

            Console.WriteLine("Please enter type of event as number.");
            int        newOutingType = Int32.Parse(Console.ReadLine());
            OutingType outingEnum    = OutingType.BeerGarden;

            switch (newOutingType)
            {
            case 1:
                string outingOne = "BeerGarden";
                outingEnum = (OutingType)Enum.Parse(typeof(OutingType), outingOne);
                break;

            case 2:
                string outingTwo = "BowlingEvent";
                outingEnum = (OutingType)Enum.Parse(typeof(OutingType), outingTwo);
                break;

            case 3:
                string outingThree = "GolfEvent";
                outingEnum = (OutingType)Enum.Parse(typeof(OutingType), outingThree);
                break;

            case 4:
                string outingFour = "AmusementPark";
                outingEnum = (OutingType)Enum.Parse(typeof(OutingType), outingFour);
                break;

            case 5:
                string outingFive = "ConcertEvent";
                outingEnum = (OutingType)Enum.Parse(typeof(OutingType), outingFive);
                break;
            }

            Console.WriteLine("Please enter date of event. Please enter MM/DD/YYYY");
            DateTime date = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Please enter admission or ticket price.");
            decimal admission = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Please enter total people in attendance of event.");
            int people = Int32.Parse(Console.ReadLine());

            Outing outing = new Outing(outingEnum, date, admission, people);

            eventList.AddEventToList(outing);
            Console.WriteLine("Event was recorded successfully.");
        }
 public Outings GetOutingByTypeDate(OutingType typeOfOuting, DateTime dateOfOuting)
 {
     foreach (Outings outings in _listOfOutings)
     {
         if (outings.TypeOfOuting == typeOfOuting && outings.DateOfEvent == dateOfOuting)
         {
             return(outings);
         }
     }
     return(null);
 }
 //Helper
 public Outings GetOutingByType(OutingType typeOfOuting)
 {
     foreach (Outings outings in _listOfOutings)
     {
         if (outings.TypeOfOuting == typeOfOuting)
         {
             return(outings);
         }
     }
     return(null);
 }
        public decimal CalculateCostByType(OutingType type)
        {
            decimal typeTotal = 0;

            foreach (Outing t in _outingsList)
            {
                if (type == t.Type)
                {
                    typeTotal += t.CostPerOuting;
                }
            }
            return(typeTotal);
        }
        public decimal AddCostofOneType(OutingType type)
        {
            decimal totalTypeCost = 0m;

            foreach (OutingInfo outing in _outings)
            {
                if (outing.OutingType == type)
                {
                    totalTypeCost += outing.TotalCostByEvent;
                }
            }
            return(totalTypeCost);
        }
        public decimal GetCostOfOutingsType(OutingType outingType)
        {
            decimal totalCost = 0m;

            foreach (Outing outing in _outingsList)
            {
                if (outing.TypeOfOuting == outingType)
                {
                    totalCost += outing.TotalCost;
                }
            }
            return(totalCost);
        }
Example #12
0
        //Display Outings By Type
        public List <Outing> DisplayOutingByType(OutingType outingType)
        {
            List <Outing> listOfOutings = new List <Outing>();

            foreach (Outing outing in _outings)
            {
                if (outing.TypeOfOuting == outingType)
                {
                    listOfOutings.Add(outing);
                }
            }
            return(listOfOutings);
        }
        public double GetTotalCostByType(OutingType type)
        {
            double totalCost = 0.00;

            foreach (Outing outing in _outingDirectory)
            {
                if (outing.Type == type)
                {
                    totalCost += outing.TotalCost;
                }
            }
            return(totalCost);
        }
Example #14
0
        public double GetTotalByType(OutingType type)
        {
            double total = 0;

            foreach (var r in outings)
            {
                if (r.EventType == type)
                {
                    total += r.TotalCost;
                }
            }
            return(total);
        }
        public decimal CalculateTotalCostByType(OutingType type)
        {
            decimal typeTotal = 0m;

            foreach (Outings t in _outingsList)
            {
                if (type == t.Event)
                {
                    typeTotal += t.TotalCost;
                }
            }
            return(typeTotal);
        }
Example #16
0
        public double ViewTotalOutingCostByType(OutingType outingType)
        {
            double total = 0;

            foreach (Outing outing in _outingList)
            {
                if (outing.OutingEvent == outingType)
                {
                    total += outing.TotalCostOfEvent;
                }
            }
            return(total);
        }
Example #17
0
        public decimal GetOutingCostByType(OutingType outingType)
        {
            decimal cost = 0;

            foreach (OutingContent content in _listofOutingContent)
            {
                if (content.OutingType == outingType)
                {
                    cost = cost + content.TotalCostOfOutings;
                }
            }
            return(cost);
        }
Example #18
0
        //Helper method
        public Double GetOutingsByTypeTotal(OutingType getOutingType)
        {
            Double outingTypeTotal = 0;

            foreach (Outings outing in _outingsRepo)
            {
                if (outing.OutingType == getOutingType)
                {
                    outingTypeTotal += outing.CostOfEvent;
                }
            }
            return(outingTypeTotal);
        }
Example #19
0
        public decimal CostByType(OutingType type)
        {
            decimal totalCost = 0m;

            foreach (OutingEvent outing in _outingEvent)
            {
                if (type == outing.EventType)
                {
                    totalCost += outing.CostPerEvent;
                }
            }
            return(totalCost);
        }
Example #20
0
        public decimal OutingCostByType(OutingType subtype)
        {
            decimal costByType = 0;

            foreach (KOutings outing in _outingsList)
            {
                if (subtype == outing.TypeofOuting)
                {
                    costByType += outing.CostEvent;
                }
            }
            return(costByType);
        }
        public double CalculateOutingCostByType(OutingType outingType)
        {
            double outingTypeCost = 0;

            foreach (Outing outing in _outingsDirectory)
            {
                if (outing.TypeOfOuting == outingType)
                {
                    outingTypeCost += outing.OutingCost;
                }
            }


            return(outingTypeCost);
        }
Example #22
0
        private void AddEvent()
        {
            DateTime date;
            Outing   outing = new Outing();


            Console.WriteLine("What is the outing type? \n[1) Golf, 2) Bowling, 3) Theme Park, 4) Concert");
            int        userEnumSelection = int.Parse(Console.ReadLine());
            OutingType userOutingType    = (OutingType)userEnumSelection;

            outing.Type = userOutingType;
            Console.WriteLine("How many Attendees?");
            outing.Attendees = int.Parse(Console.ReadLine());
            Console.WriteLine("Date in mm/dd/yyyy format?");
            if (DateTime.TryParse(Console.ReadLine(), out date))
            {
                outing.Date = date;
            }
            else
            {
                Console.WriteLine("Format Error");
            }
            Console.WriteLine("Cost per person?");
            outing.CostPerPerson = decimal.Parse(Console.ReadLine());
            Console.WriteLine("Total cost of event?");
            outing.TotalCost = decimal.Parse(Console.ReadLine());
            switch (userEnumSelection)
            {
            case 1:
                _repo.AddToGolfList(outing);
                break;

            case 2:
                _repo.AddToBowlingList(outing);
                break;

            case 3:
                _repo.AddToThemeParkList(outing);
                break;

            case 4:
                _repo.AddToConcertList(outing);
                break;

            default:
                break;
            }
        }
        //Update
        public bool UpdateExistingOuting(OutingType typeOfOuting, DateTime dateOfOuting, Outings newOuting)
        {
            Outings oldOuting = GetOutingByTypeDate(typeOfOuting, dateOfOuting);

            if (oldOuting != null)
            {
                oldOuting.TypeOfOuting  = newOuting.TypeOfOuting;
                oldOuting.NumAttendees  = newOuting.NumAttendees;
                oldOuting.DateOfEvent   = newOuting.DateOfEvent;
                oldOuting.CostPerPerson = newOuting.CostPerPerson;
                oldOuting.CostEvent     = newOuting.CostEvent;

                return(true);
            }
            else
            {
                return(false);
            }
        }
        //Delete
        public bool RemoveOutingFromList(OutingType typeOfOuting, DateTime dateOfOuting)
        {
            Outings delOuting = GetOutingByTypeDate(typeOfOuting, dateOfOuting);

            if (delOuting == null)
            {
                return(false);
            }
            int initialCount = _listOfOutings.Count;

            _listOfOutings.Remove(delOuting);
            if (initialCount > _listOfOutings.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #25
0
        public void ObjectTest()
        {
            OutingContent contentOne = new OutingContent();

            contentOne.CostForEvent = 100m;
            decimal expected = 100m;

            Assert.AreEqual(expected, contentOne.CostForEvent);

            OutingContent content = new OutingContent(OutingType.Concert, 10, DateTime.Today, 10m);

            OutingType expectedType          = OutingType.Concert;
            int        expectedAttended      = 10;
            DateTime   expectedTime          = DateTime.Today;
            decimal    expectedCostPerPerson = 10m;
            decimal    expectedCostForEvent  = 100m;

            Assert.AreEqual(expectedType, content.Type);
            Assert.AreEqual(expectedAttended, content.PeopleAttended);
            Assert.AreEqual(expectedTime, content.Date);
            Assert.AreEqual(expectedCostPerPerson, content.CostPerPerson);
            Assert.AreEqual(expectedCostForEvent, content.CostForEvent);
        }
Example #26
0
        //Display Outings By Type w/ total $ for that type
        private void DisplayOutingsByType()
        {
            Console.Clear();

            Console.WriteLine("What type of outing do you want to view? (please enter a number)\n\n" +
                              "1. Golf\n" +
                              "2. Bowling\n" +
                              "3. Amusment Park\n" +
                              "4. Concert");

            string     typeAsString = Console.ReadLine();
            int        typeAsInt    = int.Parse(typeAsString);
            OutingType outingType   = (OutingType)typeAsInt;

            List <Outing> listOfOutings = _outingRepo.DisplayOutingByType(outingType);
            double        totalForType  = 0;

            foreach (Outing outing in listOfOutings)
            {
                if (outing.TypeOfOuting == outingType)
                {
                    Console.WriteLine($"Date: {outing.Date}\n" +
                                      $"Type Of Outing: {outing.TypeOfOuting}\n" +
                                      $"Number Of People: {outing.NumberOfPeople}\n" +
                                      $"Cost Per Person: ${outing.CostPerPerson}\n" +
                                      $"Total Cost of this Event: ${outing.TotalCostOfOuting}\n\n");
                }
                if (listOfOutings.Count < 1)
                {
                    Console.WriteLine("There are no outings of that type to display");
                }

                totalForType += outing.TotalCostOfOuting;
                Console.WriteLine($"The total for this type of outing is ${totalForType}");
            }
        }
        public void GetOutingInfo()
        {
            KOutings newOuting = new KOutings();

            Console.WriteLine("What is the outing type?\n\t" +
                              "1. Golf\n\t" +
                              "2. Bowling\n\t" +
                              "3. Amusement Park\n\t" +
                              "4. Concert\n\t" +
                              "5. Other");
            int        outingInt = int.Parse(Console.ReadLine());
            OutingType type      = _kOutingsRepo.GetTypefromInt(outingInt);

            newOuting.TypeofOuting = type;

            Console.WriteLine("Enter the number of attendees");
            decimal attendees = decimal.Parse(Console.ReadLine());

            newOuting.Attendees = attendees;

            Console.WriteLine("Enter the date of the outing");
            string date = Console.ReadLine();

            newOuting.Date = date;

            Console.WriteLine("Enter the cost per person");
            decimal costPerson = decimal.Parse(Console.ReadLine());

            newOuting.CostPerson = costPerson;

            decimal costEvent = costPerson * attendees;

            newOuting.CostEvent = costEvent;

            _kOutingsRepo.AddOutingToList(newOuting);
        }
Example #28
0
        public void RunMenu()
        {
            bool continueToRun = true;

            while (continueToRun)
            {
                Console.WriteLine("Company Outings Directory\n" +
                                  "\n" +
                                  "Please make a selection:\n" +
                                  "1. View all company outings\n" +
                                  "2. Add new company outing\n" +
                                  "3. View total outing cost by type of outing\n" +
                                  "4. View total cost of all outings\n" +
                                  "5. Exit");

                string menuSelection = Console.ReadLine();
                switch (menuSelection)
                {
                case "1":
                    ShowAllOutings();
                    Console.Clear();

                    break;

                case "2":
                    InputNewOuting();
                    break;

                case "3":
                    Console.WriteLine("Choose the outing type from below:\n" +
                                      "1. Golf\n" +
                                      "2. Bowling\n" +
                                      "3. Amusement Park\n" +
                                      "4. Concert");

                    string     outingTypeChoice = Console.ReadLine();
                    int        outingTypeID     = Convert.ToInt32(outingTypeChoice);
                    OutingType outingType       = (OutingType)outingTypeID;
                    if (_repo._outingsDirectory.Count != 0)
                    {
                        double outingTypeCost = _repo.CalculateOutingCostByType(outingType);
                        Console.Clear();
                        Console.WriteLine($"Total cost of {outingType} outings:\n" +
                                          $" ${outingTypeCost}");
                        Console.WriteLine("Press any key to return to the menu");
                        Console.ReadKey();
                    }
                    else
                    {
                        Console.WriteLine($"There are no {outingType} outings in the directory.\n" +
                                          $"Press any key to continue");
                        Console.ReadKey();
                        Console.Clear();
                    }


                    break;

                case "4":
                    Console.Clear();
                    double GrandTotalCost = _repo.CalculateGrandTotal();
                    Console.WriteLine($"Total cost of all outings:\n" +
                                      $"${GrandTotalCost}\n" +
                                      $"\n" +
                                      $"Press any key to return to the menu");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "5":
                    Console.Clear();
                    Console.WriteLine("Are you sure you want to exit?\n" +
                                      "Enter Y to quit. Otherwise, press Enter to go back to the selection menu.");
                    switch (Console.ReadLine())
                    {
                    case "y":
                        continueToRun = false;
                        Console.WriteLine("GoodBye!");

                        Thread.Sleep(2000);
                        break;
                    }

                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("Invalid selection, press any key to try again");
                    Console.ReadKey();
                    break;
                }
            }
        }
        public void KOutingsRepo_GetTypefromInt_ShouldReturnCorrectTYpe(int typeInput, OutingType expected)
        {
            var actual = _kOutingsRepo.GetTypefromInt(typeInput);

            Assert.AreEqual(expected, actual);
        }
Example #30
0
        public void InputNewOuting()
        {
            //Add outing date
            Console.Clear();
            Console.Write("Enter the outing month (MM): ");
            int month = int.Parse(Console.ReadLine());

            Console.Write("Enter the outing day (DD): ");
            int day = int.Parse(Console.ReadLine());

            Console.Write("Enter the outing year (YYYY): ");
            int year = int.Parse(Console.ReadLine());

            DateTime outingDate        = new DateTime(year, month, day);
            string   outingdateDisplay = outingDate.ToShortDateString();

            Console.Clear();
            Console.WriteLine($" Outing date set to: {outingdateDisplay}\n" +
                              $"Press any key to continue");
            Console.ReadKey();

            //Add outing type
            Console.WriteLine("Select the type of outing from below:\n" +
                              "1. Golf\n" +
                              "2. Bowling\n" +
                              "3. Amusement Park\n" +
                              "4. Concert");

            string outingTypeChoice = Console.ReadLine();

            int outingTypeID = Convert.ToInt32(outingTypeChoice);

            OutingType outingType = (OutingType)outingTypeID;

            Console.Clear();
            Console.WriteLine($"Outing type set to {outingType}\n" +
                              $"Press any key to continue");
            Console.ReadKey();

            Console.Clear();


            //Add outing attendees
            Console.WriteLine("What was the number of attendees?");

            int attendees = Convert.ToInt32(Console.ReadLine());

            Console.Clear();
            Console.WriteLine($"Thank you. Attendees set to {attendees}.\n" +
                              $"\n" +
                              $"Press any key to continue");
            Console.ReadKey();


            //Add outing cost per person
            Console.Clear();
            Console.WriteLine("What was the per-person cost of this outing?");
            double perPersonCost = Convert.ToDouble(Console.ReadLine());
            double outingCost    = _repo.SingleOutingTotalCost(perPersonCost, attendees);

            Console.Clear();
            Console.WriteLine($"Per-person cost: ${perPersonCost}\n" +
                              $"Total outing cost: ${outingCost}\n" +
                              $"Press any key to continue");



            Console.ReadKey();

            Outing outing = new Outing(outingType, attendees, outingDate, perPersonCost, outingCost);

            _repo.AddOutingToList(outing);

            Console.Clear();
            Console.WriteLine("Outing successfully added to directory");
        }