Esempio n. 1
0
        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
        }
Esempio n. 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));
        }
Esempio n. 3
0
        public IActionResult _ProductSearchPage(string PageName = null, ProductSRPFilters productSRPFilters = null)
        {
            ProductsSRPViewModel productsSRPViewModel = new ProductsSRPViewModel();

            productsSRPViewModel.PageName = PageName;;
            productLibrary.BindProdSearchFilterData(ref productsSRPViewModel, token);
            productsSRPViewModel.IsHotelDefSupplier = _configuration.GetValue <string>("IsHotelDefSupplier");

            if (productSRPFilters != null)
            {
                productsSRPViewModel.ProductSRPFilters.ProductTypeID    = productSRPFilters.ProductTypeID;
                productsSRPViewModel.ProductSRPFilters.ProductType      = productsSRPViewModel.ProductSRPFilters.ProductTypeList.Where(a => a.AttributeValue_Id == productSRPFilters.ProductTypeID).FirstOrDefault()?.Value;
                productsSRPViewModel.ProductSRPFilters.CityName         = productSRPFilters.CityName;
                productsSRPViewModel.ProductSRPFilters.LocationID       = productSRPFilters.LocationID;
                productsSRPViewModel.ProductSRPFilters.BudgetCategoryID = productSRPFilters.BudgetCategoryID;
                productsSRPViewModel.ProductSRPFilters.StarRating       = productSRPFilters.StarRating;
                productsSRPViewModel.ProductSRPFilters.Chain            = productSRPFilters.Chain;
            }
            return(View(productsSRPViewModel));
        }
Esempio n. 4
0
        /// <summary>
        /// Bind Master data for filters of product search
        /// </summary>
        /// <param name="productsSRPViewModel"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public bool BindProdSearchFilterData(ref ProductsSRPViewModel productsSRPViewModel, string token)
        {
            //ProductProviders productProviders = new ProductProviders(_configuration);
            //ProductSRPSearchRes objProposalRes = productProviders.GetProductSRPDetails(new ProductSRPSearchReq(), token).Result;

            MasterProviders objMasterProviders = new MasterProviders(_configuration);
            //Get Product Type list for filters dropdown
            ProdTypeGetRes objProdTypeGetRes = objMasterProviders.GetProdTypeByProdType(new ProdTypeGetReq(), token).Result;

            if (objProdTypeGetRes.ResponseStatus.Status == "Success" && objProdTypeGetRes.ProductTypeList.Count > 0)
            {
                productsSRPViewModel.ProductSRPFilters.ProductTypeList = objProdTypeGetRes.ProductTypeList.Select(a => new AttributeValues
                {
                    AttributeValue_Id = a.VoyagerProductType_Id,
                    Value             = a.Prodtype
                }).ToList();
            }

            //Get Product Budget Category list for filters dropdown
            ProdCatDefGetRes objProdCatDefGetRes = objMasterProviders.GetProdCatDef(token).Result;

            if (objProdCatDefGetRes.ResponseStatus.Status == "Success" && objProdCatDefGetRes.ProdCatDefProperties.Count > 0)
            {
                productsSRPViewModel.ProductSRPFilters.BudgetCategoryList = objProdCatDefGetRes.ProdCatDefProperties.Select(a => new AttributeValues
                {
                    AttributeValue_Id = a.VoyagerDefProductCategoryId,
                    Value             = a.Name
                }).ToList();
            }

            //Get Product Location list for filters dropdown
            ProductAttributeRes objProductAttributeRes = objMasterProviders.GetProdAttributeDetailsByNameOrVal(new ProductAttributeReq()
            {
                AttributeName = "Location"
            }, token).Result;

            if (objProductAttributeRes.ResponseStatus.Status == "Success" && objProductAttributeRes.ProductAttributeDetails.Count > 0)
            {
                productsSRPViewModel.ProductSRPFilters.LocationList = objProductAttributeRes.ProductAttributeDetails.Select(a => new AttributeValues
                {
                    AttributeValue_Id = a.AttributeId,
                    Value             = a.Value
                }).ToList();
            }

            //Populate Star Rating list for filters dropdown
            List <AttributeValues> starRating = new List <AttributeValues>
            {
                new AttributeValues {
                    Value = "1"
                },
                new AttributeValues {
                    Value = "2"
                },
                new AttributeValues {
                    Value = "3"
                },
                new AttributeValues {
                    Value = "4"
                },
                new AttributeValues {
                    Value = "5"
                }
            };

            productsSRPViewModel.ProductSRPFilters.StarRatingList = starRating;

            //Populate Product Status list for filters dropdown
            List <AttributeValues> statusList = new List <AttributeValues>
            {
                new AttributeValues {
                    Value = "Active"
                },
                new AttributeValues {
                    Value = "Inactive"
                }
            };

            productsSRPViewModel.ProductSRPFilters.StatusList = statusList;

            return(true);
        }