private void BindData() { List <BestSellersReportLine> report = OrderManager.BestSellersReport(720, 4, 1); if (report.Count > 0) { dlCatalog.DataSource = report; dlCatalog.DataBind(); } else { this.Visible = false; } }
private void BindData() { if (SettingManager.GetSettingValueBoolean("Display.ShowBestsellersOnMainPage")) { int number = SettingManager.GetSettingValueInteger("Display.ShowBestsellersOnMainPageNumber"); var report = OrderManager.BestSellersReport(720, number, 1); if (report.Count > 0) { List <Product> productList = new List <Product>(); foreach (BestSellersReportLine line in report) { var productVariant = ProductManager.GetProductVariantById(line.ProductVariantId); if (productVariant != null) { var product = productVariant.Product; if (product != null) { bool contains = false; foreach (Product p in productList) { if (p.ProductId == product.ProductId) { contains = true; break; } } if (!contains) { productList.Add(product); } } } } dlCatalog.DataSource = productList; dlCatalog.DataBind(); } else { this.Visible = false; } } else { this.Visible = false; } }
protected void BindData() { Category category = CategoryManager.GetCategoryByID(CategoryID); //настройка видимости фильтра Category baseCategory = category; Category prevCat = category; while (baseCategory.ParentCategory != null) { prevCat = baseCategory; baseCategory = baseCategory.ParentCategory; } string categoryName = baseCategory.Name.ToLower(); AdjustFilters(prevCat, categoryName); AdjustColorsFilter(categoryName, category); // настройка лидеров продаж List <BestSellersReportLine> report = OrderManager.BestSellersReport(720, 10, 1); if (report.Count == 0) { ((TwoColumn)Page.Master).SalesLeader.Visible = false; } else { int index = report.Count > 9 ? 9 : report.Count - 1; ProductVariant productVariant = ProductManager.GetProductVariantByID(report[new Random().Next(index)].ProductVariantID); if (productVariant.Product.ProductPictures.Count > 0) { ((TwoColumn)Page.Master).imgSalesLeader.ImageUrl = PictureManager.GetPictureUrl(productVariant.Product.ProductPictures[0].Picture); } else { ((TwoColumn)Page.Master).imgSalesLeader.ImageUrl = PictureManager.GetPictureUrl(productVariant.Picture); } ((TwoColumn)Page.Master).hlSalesLeader.NavigateUrl = SEOHelper.GetProductURL(productVariant.Product); } // настройка уникального предложения if (category.FeaturedProducts.Count > 0) { Product product = category.FeaturedProducts[new Random().Next(category.FeaturedProducts.Count - 1)]; if (product.ProductPictures.Count > 0) { ((TwoColumn)Page.Master).imgUniqueProposal.ImageUrl = PictureManager.GetPictureUrl(product.ProductPictures[0].Picture); } else { ((TwoColumn)Page.Master).imgUniqueProposal.ImageUrl = PictureManager.GetPictureUrl(product.ProductVariants[0].Picture); } ((TwoColumn)Page.Master).hlUniqueProposal.NavigateUrl = SEOHelper.GetProductURL(product); } else { ((TwoColumn)Page.Master).Unique.Visible = false; } lDescription.Text = category.Description; SmallDescription.Text = category.SmallDescription; int totalRecords; Int32.TryParse(productsCount.SelectedItem.Text, out pageSize); if (pageSize == 0) { pageSize = Int32.MaxValue; } SortParameter sortParameter = GetSortParameter(); List <int> psoFilterOptions = new List <int>(); psoFilterOptions.AddRange(((TwoColumn)Page.Master).PSOFilterOption); psoFilterOptions.AddRange(this.designVariant.GetDesignVariantIds()); psoFilterOptions.AddRange(this.weddingBunchVariant.GetDesignVariantIds()); psoFilterOptions.AddRange(this.houseFlowersVariant.GetDesignVariantIds()); decimal?priceMin = CommonHelper.QueryStringInt("minCost", 0); if (priceMin == 0) { var twoColumn = (TwoColumn)Page.Master; if (twoColumn != null) { priceMin = twoColumn.MinPriceConverted; } } decimal?priceMax = CommonHelper.QueryStringInt("maxCost", 0); if (priceMax == 0) { var twoColumn = (TwoColumn)Page.Master; if (twoColumn != null) { priceMax = twoColumn.MaxPriceConverted; } } int minHeight = CommonHelper.QueryStringInt("minHeight", 0); int maxHeight = CommonHelper.QueryStringInt("maxHeight", int.MaxValue); int minWidth = CommonHelper.QueryStringInt("minWidth", 0); int maxWidth = CommonHelper.QueryStringInt("maxWidth", int.MaxValue); ProductCollection productCollection = ProductManager.GetAllProducts(CategoryID, 0, null, priceMin, priceMax, pageSize, CurrentPageIndex, psoFilterOptions, (int)sortParameter.SortBy, sortParameter.Ascending, minHeight, maxHeight, minWidth, maxWidth, out totalRecords); SetItemsToGrid(totalRecords, productCollection, categoryName); }
protected void BindData() { gvBestSellers.DataSource = OrderManager.BestSellersReport(720, 5, 1); gvBestSellers.DataBind(); }