public IActionResult GetProductSRPDetail(string CompanyId)
        {
            ProductsSRPViewModel model = new ProductsSRPViewModel();

            #region Get Company info
            AgentGetReq request = new AgentGetReq()
            {
                CompanyId = CompanyId
            };
            AgentGetRes response = agentProviders.GetAgentDetailedInfo(request, token).Result;
            var         product  = response.AgentDetails.Products.Where(x => x.Supplier_Id == CompanyId).FirstOrDefault();
            #endregion

            if (product != null && !string.IsNullOrWhiteSpace(product.Product_Id))
            {
                #region Get ProductSRPDetails
                ProductProviders    productProviders = new ProductProviders(_configuration);
                ProductSRPSearchReq objProdReq       = new ProductSRPSearchReq()
                {
                    ProdId = product.Product_Id
                };
                ProductSRPSearchRes objProdRes = productProviders.GetProductSRPDetails(objProdReq, token).Result;
                var productSRPDetails          = objProdRes.ProductSearchDetails.Select(a => new ProductSRPDetails
                {
                    Address           = a.Address,
                    BdgPriceCategory  = a.BdgPriceCategory,
                    Chain             = a.Chain,
                    CityName          = a.CityName,
                    CountryName       = a.CountryName,
                    DefaultSupplier   = a.DefaultSupplier,
                    HotelImageURL     = a.HotelImageURL,
                    HotelType         = a.HotelType,
                    Location          = a.Location,
                    PostCode          = a.PostCode,
                    ProdDesc          = a.ProdDesc,
                    ProdName          = a.ProdName,
                    ProductCode       = a.ProductCode,
                    ProductType       = a.ProductType,
                    StarRating        = a.StarRating,
                    Street            = a.Street,
                    VoyagerProduct_Id = a.VoyagerProduct_Id,
                    ProductType_Id    = a.ProductType_Id
                }).ToList();

                model.ProductSRPDetails = productSRPDetails;

                var userRoles = HttpContext.Request.Cookies["UserRoles"] ?? string.Join(",", UserRoles);
                if (userRoles != null && userRoles.Contains("Administrator"))
                {
                    model.PageName = "PrdSupplierMapping";
                }
            }
            return(PartialView("~/Areas/Product/Views/ProductSRP/_ProductInfo.cshtml", model));

            #endregion
        }
Beispiel #2
0
        public IActionResult ProductSearchResultPage(ProductSRPFilters filters)
        {
            ProductsSRPViewModel productsSRPViewModel = new ProductsSRPViewModel();
            ProductProviders     productProviders     = new ProductProviders(_configuration);
            ProductSRPSearchReq  objQRFAgentRequest   = new ProductSRPSearchReq()
            {
                ProdType       = filters.ProductType,
                ProdName       = filters.ProdName,
                ProdCode       = filters.ProdCode,
                CityName       = filters.CityName,
                Location       = filters.Location == "Select" ? null : filters.Location,
                BudgetCategory = filters.BudgetCategory == "Select" ? null : filters.BudgetCategory,
                Chain          = filters.Chain,
                StarRating     = filters.StarRating,
                Status         = filters.Status
            };
            ProductSRPSearchRes objProposalRes = productProviders.GetProductSRPDetails(objQRFAgentRequest, token).Result;

            productsSRPViewModel.ProductSRPDetails = objProposalRes.ProductSearchDetails.Select(a => new ProductSRPDetails
            {
                Address           = a.Address,
                BdgPriceCategory  = a.BdgPriceCategory,
                Chain             = a.Chain,
                CityName          = a.CityName,
                CountryName       = a.CountryName,
                DefaultSupplier   = a.DefaultSupplier,
                DefaultSupplierId = a.DefaultSupplierId,
                HotelImageURL     = a.HotelImageURL != null ? a.HotelImageURL.Replace("resources/", "ImageResources/") : a.HotelImageURL,
                HotelType         = a.HotelType,
                Location          = a.Location,
                PostCode          = a.PostCode,
                ProdDesc          = a.ProdDesc,
                ProdName          = a.ProdName,
                ProductCode       = a.ProductCode,
                ProductType       = a.ProductType,
                StarRating        = a.StarRating,
                Street            = a.Street,
                VoyagerProduct_Id = a.VoyagerProduct_Id,
                ProductType_Id    = a.ProductType_Id
            }).ToList();

            var userRoles = HttpContext.Request.Cookies["UserRoles"] ?? string.Join(",", UserRoles);

            if (userRoles != null && userRoles.Contains("Administrator"))
            {
                productsSRPViewModel.PageName = "PrdSupplierMapping";
            }

            return(PartialView("_ProductInfo", productsSRPViewModel));
        }