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);
        }
 public ActionResult Hotel(string Latitude, string Longitude)
 {
     List<Hotel> objHotelList = new List<Hotel>();
     Services.HotelService objHotelService = new Services.HotelService();
     objHotelList = objHotelService.GetHotelList(Latitude, Longitude);
     return Json(objHotelList, JsonRequestBehavior.AllowGet);
 }
Example #6
0
 public static void PrintListHotelsBottom(string countryName, string townName)
 {
     Console.Clear();
     Console.WriteLine(Header());
     Console.WriteLine(ListHotelsMenu());
     Console.WriteLine($"Hotels in {townName}:" + Environment.NewLine);
     Services.HotelService hotelService = new Services.HotelService();
     foreach (Data.Models.Hotel hotel in hotelService.ShowAllHotelsInTown(countryName, townName))
     {
         Console.WriteLine(hotel.ToString());
     }
     Console.WriteLine(GoBackMessage());
 }
Example #7
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);
        }
Example #8
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);
 }
Example #9
0
 public HotelServiceController()
 {
     _hotelservice = new Services.HotelService();
 }