Exemplo n.º 1
0
 //finished
 private void RunRemoveTownPage()
 {
     Display.PrintRemoveTownPage();
     Services.CountryService countryService = new Services.CountryService();
     try
     {
         string countryName = Console.ReadLine();
         countryService.GetCountryByName(countryName);
         Console.WriteLine("Now enter name of town:");
         string townName = Console.ReadLine();
         Services.VoucherService voucherService = new Services.VoucherService();
         Services.HotelService   hotelService   = new Services.HotelService();
         Services.TownService    townService    = new Services.TownService();
         townService.GetTownByName(countryName, townName);
         voucherService.DeleteVoucherByTown(townName);
         hotelService.DeleteHotelByTown(townName);
         townService.DeleteTown(countryName, townName);
         Display.RemovedTownMessage(countryName, townName);
     }
     catch (Exception ex)
     {
         Display.PrintErrorScreen();
         Console.WriteLine(ex.Message);
         Console.WriteLine(Display.GoBackMessage());
     }
     Console.ReadKey(true);
 }
Exemplo n.º 2
0
        //finished
        private void RunListHotels()
        {
            Display.PrintListHotels();
            Services.CountryService countryService = new Services.CountryService();
            Services.TownService    townService    = new Services.TownService();
            Services.HotelService   hotelService   = new Services.HotelService();

            try
            {
                string countryName = Console.ReadLine();
                countryService.GetCountryByName(countryName);
                Display.PrintListHotelsMiddle();
                string townName = Console.ReadLine();
                townService.GetTownByName(countryName, townName);
                Display.PrintListHotelsBottom(countryName, townName);
                hotelService.ShowAllHotelsInTown(countryName, townName);
            }
            catch (Exception ex)
            {
                Display.PrintErrorScreen();
                Console.WriteLine(ex.Message);
                Console.WriteLine(Display.GoBackMessage());
            }
            Console.ReadKey(true);
        }
Exemplo n.º 3
0
        //finished
        private void RunListTouristsByHotel()
        {
            Display.PrintListTouristsByHotel();
            string country = Console.ReadLine();

            Services.CountryService countryService = new Services.CountryService();
            Services.TownService    townService    = new Services.TownService();
            Services.HotelService   hotelService   = new Services.HotelService();
            Services.VoucherService voucherService = new Services.VoucherService();
            try
            {
                countryService.GetCountryByName(country);
                Console.WriteLine("Enter name of town:");
                string town = Console.ReadLine();
                townService.GetTownByName(country, town);
                Console.WriteLine("Enter name of Hotel:");
                string hotel = Console.ReadLine();
                Display.ListTouristsByHotel(country, town, hotel);
            }
            catch (Exception ex)
            {
                Display.PrintErrorScreen();
                Console.WriteLine(ex.Message);
                Console.WriteLine(Display.GoBackMessage());
            }
            Console.ReadKey(true);
        }
Exemplo n.º 4
0
        //finished
        private void RunAddHotelPage()
        {
            Display.PrintAddHotelPage();
            Services.CountryService countryService = new Services.CountryService();
            Services.TownService    townService    = new Services.TownService();
            Services.HotelService   hotelService   = new Services.HotelService();

            try
            {
                string countryName = Console.ReadLine();
                countryService.GetCountryByName(countryName);
                Display.PrintAddHotelMiddle();
                string townName = Console.ReadLine();
                townService.GetTownByName(countryName, townName);
                Display.PrintAddHotelBottom();
                string hotelName = Console.ReadLine();
                Console.WriteLine("Enter number of stars for hotel:");
                int stars = int.Parse(Console.ReadLine());
                Console.WriteLine("Enter initial price per night:");
                decimal price = decimal.Parse(Console.ReadLine());
                hotelService.AddHotel(countryName, townName, hotelName, stars, price);
                Display.AddedHotelMessage(townName, hotelName);
            }
            catch (Exception ex)
            {
                Display.PrintErrorScreen();
                Console.WriteLine(ex.Message);
                Console.WriteLine(Display.GoBackMessage());
            }
            Console.ReadKey(true);
        }