Exemplo n.º 1
0
        public CarArr GetCarArr()
        {
            CarArr carArr = new CarArr();

            Product product;

            for (int i = 0; i < this.Count; i++)
            {
                product = (this[i] as Product); //מוסיפים רק פריטים שלא קיימים כבר באוסף
                if (!carArr.IsContains(product.Model))
                {
                    carArr.Add(product.Model);
                }
            }

            return(carArr);
        }
Exemplo n.º 2
0
        public CarArr Filter(int id, Category category, Company company)
        {
            CarArr productArr = new CarArr();

            for (int i = 0; i < this.Count; i++)
            {
                Car product = (this[i] as Car);
                if
                (
                    (id <= 0 || product.Id == id) &&
                    ((category == null) || (product.Category.Id == category.Id)) &&
                    ((company == null) || (product.Company.Id == company.Id))
                )
                {
                    productArr.Add(product);
                    if (id > 0)
                    {
                        break;
                    }
                }
            }
            return(productArr);
        }