Ejemplo n.º 1
0
        public async Task <HotelAlternateServicesGetRes> GetAlternateServicesByBooking([FromBody] HotelAlternateServicesGetReq request)
        {
            var response = new HotelAlternateServicesGetRes();

            try
            {
                if (request != null)
                {
                    response = await _hotelsRepository.GetAlternateServicesByBooking(request);

                    if (response == null)
                    {
                        response.ResponseStatus.Status       = "Failure";
                        response.ResponseStatus.ErrorMessage = "An error.";
                    }
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "Product details can not be blank.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An error occurs " + ex.Message;
            }
            return(response);
        }
Ejemplo n.º 2
0
        public async Task <HotelAlternateServicesGetRes> GetAlternateServicesByBooking(HotelAlternateServicesGetReq productSearchReq, string ticket)
        {
            HotelAlternateServicesGetRes productHotelGetRes = new HotelAlternateServicesGetRes();

            productHotelGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceHotels:GetAlternateServicesByBooking"), productSearchReq, typeof(HotelAlternateServicesGetRes), ticket);

            return(productHotelGetRes);
        }
Ejemplo n.º 3
0
        public ActionResult GetSimilarHotels(string BookingNumber, string PositionId)
        {
            try
            {
                HotelAlternateServicesGetRes response = hotelsProviders.GetAlternateServicesByBooking(new HotelAlternateServicesGetReq()
                {
                    BookingNumber = BookingNumber, PositionId = PositionId
                }, token).Result;
                SimilarHotelsViewModel model = new SimilarHotelsViewModel()
                {
                    Caller = "bookings", BookingNumber = BookingNumber
                };

                if (response.AlternateServices.Count > 0)
                {
                    model.SelectedHotelList = response.AlternateServices.Where(a => a.IsBlackListed == null || a.IsBlackListed == false)
                                              .Select(b => new ProductList
                    {
                        Category         = b.Attributes != null ? b.Attributes.BdgPriceCategory : "",
                        Location         = b.Attributes != null ? b.Attributes.Location : "",
                        StarRating       = b.Attributes != null ? b.Attributes.StarRating : "",
                        VoyagerProductId = b.Product_Id,
                        Name             = b.Product_Name,
                        Supplier         = b.SupplierInfo?.Name,
                        SupplierId       = b.SupplierInfo?.Id,
                        LocationInfo     = new ProductLocation {
                            CityName = b.City, CountryName = b.Country
                        }
                    }).OrderBy(a => a.Name).ToList();

                    model.BlackListedHotelList = response.AlternateServices.Where(a => a.IsBlackListed == true)
                                                 .Select(b => new ProductList
                    {
                        Category         = b.Attributes.BdgPriceCategory,
                        Location         = b.Attributes.Location,
                        StarRating       = b.Attributes.StarRating,
                        VoyagerProductId = b.Product_Id,
                        Name             = b.Product_Name,
                        Supplier         = b.SupplierInfo?.Name,
                        SupplierId       = b.SupplierInfo?.Id,
                        LocationInfo     = new ProductLocation {
                            CityName = b.City, CountryName = b.Country
                        }
                    }).OrderBy(a => a.Name).ToList();

                    foreach (var hotel in model.SelectedHotelList)
                    {
                        hotel.VoyagerProductId = hotel.VoyagerProductId + "|" + hotel.SupplierId;
                        hotel.Name             = hotel.Name + " (";
                        if (!string.IsNullOrEmpty(hotel.LocationInfo.CityName))
                        {
                            hotel.Name = hotel.Name + hotel.LocationInfo.CityName;
                        }
                        if (!string.IsNullOrEmpty(hotel.StarRating))
                        {
                            hotel.Name = hotel.Name + ", " + hotel.StarRating;
                        }
                        if (!string.IsNullOrEmpty(hotel.Category))
                        {
                            hotel.Name = hotel.Name + "/" + hotel.Category;
                        }
                        if (!string.IsNullOrEmpty(hotel.Location))
                        {
                            hotel.Name = hotel.Name + "/" + hotel.Location;
                        }
                        if (!string.IsNullOrEmpty(hotel.Supplier))
                        {
                            hotel.Name = hotel.Name + "/" + hotel.Supplier;
                        }
                        hotel.Name = hotel.Name + ")";
                    }
                    foreach (var hotel in model.BlackListedHotelList)
                    {
                        hotel.VoyagerProductId = hotel.VoyagerProductId + "|" + hotel.SupplierId;
                        hotel.Name             = hotel.Name + " (";
                        if (!string.IsNullOrEmpty(hotel.LocationInfo.CityName))
                        {
                            hotel.Name = hotel.Name + hotel.LocationInfo.CityName;
                        }
                        if (!string.IsNullOrEmpty(hotel.StarRating))
                        {
                            hotel.Name = hotel.Name + ", " + hotel.StarRating;
                        }
                        if (!string.IsNullOrEmpty(hotel.Category))
                        {
                            hotel.Name = hotel.Name + "/" + hotel.Category;
                        }
                        if (!string.IsNullOrEmpty(hotel.Location))
                        {
                            hotel.Name = hotel.Name + "/" + hotel.Location;
                        }
                        if (!string.IsNullOrEmpty(hotel.Supplier))
                        {
                            hotel.Name = hotel.Name + "/" + hotel.Supplier;
                        }
                        hotel.Name = hotel.Name + ")";
                    }
                }
                return(PartialView("~/Views/Accomodation/_SimilarHotels.cshtml", model));
            }
            catch (Exception ex)
            {
                return(PartialView("~/Views/Accomodation/_SimilarHotels.cshtml"));
            }
        }