Exemplo n.º 1
0
        public IActionResult Accomodation()
        {
            ProductsPDPViewModel model = new ProductsPDPViewModel();

            model.Products.VoyagerProduct_Id = Request.Query["ProductId"].ToString();
            return(View(model));
        }
Exemplo n.º 2
0
        public IActionResult _Accomodation(string ProductId)
        {
            ProductsPDPViewModel model = new ProductsPDPViewModel();

            //model.MenuViewModel.QRFID = Request.Query["QRFId"].ToString();
            //model.MenuViewModel.MenuName = "Accomodation";
            model.ImageInitial = _configuration.GetValue <string>("SystemSettings:CountryImageInitial");

            #region Get Costing Officer Tour Info Header By QRFId
            //NewQuoteViewModel modelQuote = new NewQuoteViewModel { QRFID = "255" };
            //model.COHeaderViewModel = coCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token);
            //model.MenuViewModel.EnquiryPipeline = modelQuote.mdlMenuViewModel.EnquiryPipeline;
            #endregion

            #region Get Product Info from service
            //string ProductId = Request.Query["ProductId"].ToString();
            ProductPDPSearchRes ProductPDP = productProviders.GetProductPDPDetails(new List <string> {
                ProductId
            }, token).Result;
            if (ProductPDP.ProductDetails?.Count > 0)
            {
                model.Products = ProductPDP.ProductDetails.FirstOrDefault();
            }
            model.KeyFacilities = GetKeyFacilities();

            StaticMap._configuration = _configuration;
            //GeocoderLocation geocoder = null;
            string Landmark, mapURL = "https://maps.googleapis.com/maps/api/staticmap?zoom=10&size=640x416&maptype=roadmap&key=GoogleAPIKey";
            mapURL += "&markers=color:red|label:" + model.Products.ProductName.Substring(0, 1) + "|{0},{1}";
            mapURL  = string.Format(mapURL, model.Products.Lat, model.Products.Long);
            //model.Products.InAndAround.Add(new InAndAround
            //{
            //    LandmarkName = "British Museum",
            //    LandmarkType = "Attraction",
            //    Direction = "south",
            //    Distance = "10",
            //    DistanceUnit = "km",
            //});
            foreach (var item in model.Products.InAndAround)
            {
                Landmark = item.LandmarkName + "," + model.Products.CityName + "," + model.Products.CountryName;
                //geocoder = StaticMap.Locate(Landmark);
                //if (geocoder.Latitude != 0 && geocoder.Longitude != 0)
                //{
                mapURL += "&markers=color:blue|label:" + item.LandmarkName.Substring(0, 1) + "|" + Landmark;
                //mapURL = string.Format(mapURL, geocoder.Latitude, geocoder.Longitude);
                //}
            }
            if (StaticMap.RenderImage(mapURL, model.Products.VoyagerProduct_Id + "_PDP_hotelmap.png", out string output))
            {
                model.ProductMapUrl = output;
            }

            #endregion

            #region replacing image urls from resources to ImageResources
            if (model.Products != null)
            {
                foreach (var ProdResource in model.Products.ProductResources)
                {
                    if (ProdResource.ImageSRC != null)
                    {
                        ProdResource.ImageSRC = ProdResource.ImageSRC.Replace("resources/", "ImageResources/");
                    }
                }
            }
            #endregion
            return(View(model));
        }