public void ShowCategory(int id, int rootID, int parentID) { if (ProductInfoCatalog != null) { Category_V02 category = CatalogHelper.FindCategory(ProductInfoCatalog, id, parentID, rootID); Category_V02 rootCategory = CatalogHelper.FindCategory(ProductInfoCatalog, rootID); if (category != null && rootCategory != null && CatalogProvider.IsDisplayable(rootCategory, Thread.CurrentThread.CurrentCulture.Name)) { CategoryName.Text = category.DisplayName; Overview.Text = category.Description; DivImage.Style["background"] = "url(" + category.ImagePath + ");background-repeat: no-repeat; background-position: center right"; SubCat.PopulateProducts(category, rootCategory); if (HLConfigManager.Configurations.DOConfiguration.AddScriptsForRecommendations) { // Send data to Adobe Target and Salesforce, only for main categories if (category.ID == rootCategory.ID) { AT_categoryName = string.Format("{0}_{1}", Locale, category.DisplayName); } } } else { if (!(id == 0 && rootID == 0 && parentID == 0)) { LoggerHelper.Warn(string.Format("No category found in ShowCategory for {0}-{2}-{3} {1}", id, this.Locale, rootID, parentID)); } } } }
private void navigateToProductDetailPage(string sku, string cmp) { Dictionary <string, SKU_V01> allSKUs = CatalogProvider.GetAllSKU(Locale, base.CurrentWarehouse); if (allSKUs != null) { SKU_V01 sku01; if (allSKUs.TryGetValue(sku, out sku01)) { if (sku01.Product != null) { Category_V02 category = findCategoryByProductID(ProductInfoCatalog.RootCategories, sku01.Product.ID); if (category != null) { if (cmp != null) { Response.Redirect( "~/ordering/ProductDetail.aspx?ProdInfoID=" + sku01.Product.ID + "&CategoryID=" + category.ID + "&CMP=" + cmp, false); } else { Response.Redirect( "~/ordering/ProductDetail.aspx?ProdInfoID=" + sku01.Product.ID + "&CategoryID=" + category.ID, false); } } } } } }
private Category_V02 findRootCategory(bool eventTicketMode, List <Category_V02> rootCategories) { Category_V02 current = null; foreach (Category_V02 category in rootCategories) { // Validate category display by rule if (CatalogProvider.IsDisplayable(category, Locale)) { if (Menu.ShouldTake(category, eventTicketMode, SessionInfo.ShowAllInventory, SessionInfo.IsHAPMode)) { current = category; break; } } } return(current); }
private List <InvoiceSKU> ValidSkus(List <InvoiceSKU> lstskus) { var ProductInfoCatalog = CatalogProvider.GetProductInfoCatalog(Thread.CurrentThread.CurrentCulture.Name); Dictionary <string, SKU_V01> allSKU; SKU_V01 sku_v01 = null; allSKU = ProductInfoCatalog.AllSKUs; InvoiceSKU validinvoicesku = null; List <InvoiceSKU> ValidInfoceSkus = new List <InvoiceSKU>(); foreach (var invoiceSku in lstskus) { allSKU.TryGetValue(invoiceSku.SKU, out sku_v01); if (sku_v01 != null) { validinvoicesku = new InvoiceSKU(); validinvoicesku.Quantity = invoiceSku.Quantity; validinvoicesku.SKU = invoiceSku.SKU; validinvoicesku.UnitVolumePoints = sku_v01.CatalogItem.VolumePoints; validinvoicesku.UnitTotalPrice = sku_v01.CatalogItem.ListPrice; validinvoicesku.TotalPrice = sku_v01.CatalogItem.ListPrice * invoiceSku.Quantity; validinvoicesku.TotalVolumePoints = sku_v01.CatalogItem.VolumePoints * invoiceSku.Quantity; validinvoicesku.ID = invoiceSku.ID; validinvoicesku.InvoiceID = invoiceSku.InvoiceID; validinvoicesku.Description = invoiceSku.Description; ValidInfoceSkus.Add(validinvoicesku); } } if (ValidInfoceSkus.Count > 0) { return(ValidInfoceSkus); } else { return(new List <InvoiceSKU>()); } }
protected void rgSearchProducts_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { if (!IsPostBack) { return; } if (string.IsNullOrEmpty(txtSearchTerm.Text)) { return; } var searchString = txtSearchTerm.Text; string locale = Locale.Replace("-", "_"); var skuList = new List <SKU_V01>(); try { if (HLConfigManager.Configurations.DOConfiguration.IsChina) { var indx = txtSearchTerm.Text.IndexOf(" "); if (indx > 0) { var skuid = txtSearchTerm.Text.Substring(0, indx); var prd = ProductsClone.FirstOrDefault(c => c.Contains(skuid)); if (!string.IsNullOrEmpty(prd)) { searchString = prd; } } } var searchResults = CatalogProvider.GetSKUsByList(locale, PLATFORM, searchString); if (searchResults == null) { throw new ApplicationException( string.Format( "No result received from CatalogProvider.GetSKUsByList. Locale: {0}, Platform: {1}, Search Term: {2}", locale, PLATFORM, txtSearchTerm.Text)); } foreach (var item in searchResults) { skuList.Add(ProductInfoCatalog.AllSKUs[item]); } } catch (Exception ex) { LoggerHelper.Exception("rgSearchProducts_NeedDataSource", ex); } if (skuList == null || skuList.Count() == 0) { string noResultsMessage = GetLocalResourceString("NoResults", "Sorry. No matches were found containing {0}. To conduct a new search, use the search field at the top of the page. For better results, try a different keyword or search item."); if (noResultsMessage.Contains("{0}")) { noResultsMessage = string.Format(noResultsMessage, txtSearchTerm.Text.Replace("'", "\\'")); } ScriptManager.RegisterStartupScript(this, GetType(), "alert1", "alert('" + noResultsMessage + "');", true); } rgSearchProducts.DataSource = skuList; }