Пример #1
0
        private ArrayList GetSearchedProducts(int categoryID, string searchTerm, ArrayList products)
        {
            ProductController productController = new ProductController();

            foreach (ProductInfo product in productController.GetSearchedProducts(categoryID, searchTerm, false))
            {
                products.Add(product);
            }

            return products;
        }
Пример #2
0
        private void UpdateProductList(int categoryID)
        {
            grdProducts.DataSource = null;

            // Get current category
            //int categoryID = int.Parse(cmbCategory.SelectedValue);
            if (categoryID >= 0)
            {
                ProductController controller = new ProductController();
                //ArrayList productList = controller.GetCategoryProducts(categoryID, true);
                String searchTerm = this.tbProductFilter.Text;
                //ArrayList productList = controller.GetSearchedProducts(-1, searchTerm, true);
                bool archived = false;
                if (int.Parse(this.ddArchive.SelectedValue) == 1) archived = true;
                ArrayList productList = controller.GetSearchedProducts(-1, searchTerm, archived);

                if (productList.Count > 0)
                {
                    // Has page index been initialized?
                    if (_nav.PageIndex == Null.NullInteger)
                    {
                        _nav.PageIndex = 0;
                    }

                    // Update the grid
                    grdProducts.PageSize = 20;
                    grdProducts.AllowPaging = true;
                    grdProducts.DataSource = productList;
                    grdProducts.CurrentPageIndex = _nav.PageIndex;
                    grdProducts.DataBind();
                }
            }
        }