Exemplo n.º 1
0
        public static void ListTouristsByCountry(string countryName)
        {
            Console.Clear();
            Console.WriteLine(Header());
            Console.WriteLine(ListTouristsMenu());
            Console.WriteLine($"Tourists from {countryName}:" + Environment.NewLine);

            Services.TouristService touristService = new Services.TouristService();
            foreach (Tourist tourist in touristService.ShowAllTouristsByCountryTheyComeFrom(countryName))
            {
                Console.WriteLine(tourist.ToString());
            }

            Console.WriteLine(GoBackMessage());
        }
Exemplo n.º 2
0
        //finished
        private void RunListTouristsByCountry()
        {
            Display.PrintListTouristsByCountry();
            string country = Console.ReadLine();

            Services.TouristService touristService = new Services.TouristService();
            try
            {
                touristService.ShowAllTouristsByCountryTheyComeFrom(country);
                Display.ListTouristsByCountry(country);
            }
            catch (Exception ex)
            {
                Display.PrintErrorScreen();
                Console.WriteLine(ex.Message);
                Console.WriteLine(Display.GoBackMessage());
            }
            Console.ReadKey(true);
        }
Exemplo n.º 3
0
        //cursed - do not touch
        private void RunAddVoucher()
        {
            Display.PrintAddVoucherPage();
            Services.TouristService touristService = new Services.TouristService();
            Services.HotelService   hotelService   = new Services.HotelService();
            Services.VoucherService voucherService = new Services.VoucherService();
            try
            {
                Console.WriteLine("Enter tourist's ID:");
                int touristID = int.Parse(Console.ReadLine());
                Console.WriteLine("Enter name of country for hotel:");
                string countryName = Console.ReadLine();
                Console.WriteLine("Enter name of town for hotel:");
                string townName = Console.ReadLine();
                Console.WriteLine("Enter name of hotel:");
                string hotelName = Console.ReadLine();
                Console.WriteLine("Enter days of trip:");
                int daysOfTrip = int.Parse(Console.ReadLine());
                Console.WriteLine("Enter cancellation period (in days):");
                int cancellationPeriod = int.Parse(Console.ReadLine());
                Console.WriteLine("Enter start date (yyyy mm dd):");
                string[] date1     = Console.ReadLine().Split().ToArray();
                DateTime startDate = new DateTime(int.Parse(date1[0]), int.Parse(date1[1]), int.Parse(date1[2]));
                Console.WriteLine("Enter end date (yyyy mm dd):");
                string[] date2   = Console.ReadLine().Split().ToArray();
                DateTime endDate = new DateTime(int.Parse(date2[0]), int.Parse(date2[1]), int.Parse(date2[2]));

                voucherService.CreateVoucher(touristService.GetTouristById(touristID),
                                             voucherService.FindHotelByName(townName, hotelName, voucherService.FindTownByName(countryName, townName)),
                                             daysOfTrip,
                                             voucherService.CalculateTripPriceForVoucher(daysOfTrip, voucherService.FindHotelByName(townName, hotelName, voucherService.FindTownByName(countryName, townName)).PricePerNight),
                                             cancellationPeriod, startDate, endDate);
                Display.AddedVoucherMessage();
            }
            catch (Exception ex)
            {
                Display.PrintErrorScreen();
                Console.WriteLine(ex.Message);
                Console.WriteLine(Display.GoBackMessage());
            }
            Console.ReadKey(true);
        }
Exemplo n.º 4
0
 //finished
 private void RunAddTourist()
 {
     Display.PrintAddTouristPage();
     Services.TouristService touristService = new Services.TouristService();
     try
     {
         string firstName = Console.ReadLine();
         Console.WriteLine("Enter last name:");
         string lastName = Console.ReadLine();
         Console.WriteLine("Enter age:");
         int age = int.Parse(Console.ReadLine());
         Console.WriteLine("Enter home country:");
         string homeCountry = Console.ReadLine();
         touristService.RegisterTourist(firstName, lastName, age, homeCountry);
         Display.AddedTouristMessage(firstName, lastName);
     }
     catch (Exception ex)
     {
         Display.PrintErrorScreen();
         Console.WriteLine(ex.Message);
         Console.WriteLine(Display.GoBackMessage());
     }
     Console.ReadKey(true);
 }