Beispiel #1
0
        public ProductArr Filter(string name, string quantity, CategoryProduct category_product)//add category
        {
            ProductArr        productArr        = new ProductArr();
            ProductDetailsArr productDetailsArr = new ProductDetailsArr();

            productDetailsArr.Fill();


            for (int i = 0; i < this.Count; i++)
            {
                Product product = (this[i] as Product);


                if (
                    product.ProductName.StartsWith(name) &&
                    (((product.QuantityStock > 0) && (quantity == "Yes")) ||
                     ((product.QuantityStock <= 0) && (quantity == "No")) ||
                     (quantity == "Is in stock?")) &&
                    (productDetailsArr.IsProductCategory(product, category_product) || category_product == null || category_product.ID == -1)
                    )
                {
                    productArr.Add(product);
                }
            }
            return(productArr);
        }
Beispiel #2
0
        public ProductDetailsArr Filter(Product product)
        {
            ProductDetailsArr productDetailsArr = new ProductDetailsArr();

            for (int i = 0; i < this.Count; i++)
            {
                ProductDetails productDetails = (this[i] as ProductDetails);

                if ((product == null) || (productDetails.Product.ID == product.ID))
                {
                    productDetailsArr.Add(productDetails);
                }
            }

            return(productDetailsArr);
        }