Example #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);
 }
Example #2
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);
        }
Example #3
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);
        }
Example #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);
        }
Example #5
0
 //finished
 private void RunAddCountryPage()
 {
     Display.PrintAddCountryPage();
     Services.CountryService countryService = new Services.CountryService();
     try
     {
         string countryName = Console.ReadLine();
         countryService.AddCountry(countryName);
         Display.AddedCountryMessage(countryName);
     }
     catch (Exception ex)
     {
         Display.PrintErrorScreen();
         Console.WriteLine(ex.Message);
         Console.WriteLine(Display.GoBackMessage());
     }
     Console.ReadKey(true);
 }
Example #6
0
        //finished
        private void RunListTowns()
        {
            Display.PrintListTowns();
            Services.CountryService countryService = new Services.CountryService();
            Services.TownService    townService    = new Services.TownService();

            try
            {
                string countryName = Console.ReadLine();
                countryService.GetCountryByName(countryName);
                Display.PrintListTownsBottom(countryName);
            }
            catch (Exception ex)
            {
                Display.PrintErrorScreen();
                Console.WriteLine(ex.Message);
                Console.WriteLine(Display.GoBackMessage());
            }
            Console.ReadKey(true);
        }
Example #7
0
 //finished
 private void RunRemoveCountryPage()
 {
     Display.PrintRemoveCountryPage();
     Services.CountryService countryService = new Services.CountryService();
     try
     {
         string countryName = Console.ReadLine();
         countryService.GetCountryByName(countryName);
         Services.VoucherService voucherService = new Services.VoucherService();
         voucherService.DeleteVoucherByCountry(countryName);
         Services.HotelService hotelService = new Services.HotelService();
         hotelService.DeleteHotelByCountry(countryName);
         Services.TownService townService = new Services.TownService();
         countryService.DeleteCountry(countryName);
         Display.RemovedCountryMessage(countryName);
     }
     catch (Exception ex)
     {
         Display.PrintErrorScreen();
         Console.WriteLine(ex.Message);
         Console.WriteLine(Display.GoBackMessage());
     }
     Console.ReadKey(true);
 }