Beispiel #1
0
 public List <Product> FilterByTradeMark(string trademark)
 {
     TradeMark   = trademark;
     isTradeMark = true;
     AddItemsToTheTree(TradeMarkTree);
     Products.Clear();
     Products.AddRange(TradeMarkTree.Search(TradeMark).Products);
     return(Products);
 }
Beispiel #2
0
 public List <Product> FilterByName(string name)
 {
     Name        = name;
     isTradeMark = false;
     AddItemsToTheTree(NameTree);
     Products.Clear();
     Products.AddRange(NameTree.Search(Name).Products);
     return(Products);
 }
Beispiel #3
0
        public List <string> GetStringLabels(string type)
        {
            List <string> Labels = new List <string>();

            if (type == "Categories" && new CategoryDataAccess().GetList() != null)
            {
                foreach (var category in new CategoryDataAccess().GetList())
                {
                    Labels.Add(category.Name);
                }
                return(Labels);
            }
            foreach (var tree in Trees)
            {
                if (tree is StringBST)
                {
                    StringBST tempTree = (StringBST)tree;
                    if (tempTree.NumberOfNodes() == 0)
                    {
                        AddItemsToTheTree(tempTree);
                    }
                    if (String.Compare(tempTree.GetTreeType(), type, true) == 0)
                    {
                        if (type == "TradeMark")
                        {
                            tempTree.InOrder();
                            foreach (var product in tempTree.GetProducts())
                            {
                                if (!Labels.Exists(t => t.CompareTo(product.TradeMark) == 0))
                                {
                                    Labels.Add(product.TradeMark);
                                }
                            }
                            break;
                        }
                        if (type == "Name")
                        {
                            tempTree.InOrder();
                            foreach (var product in tempTree.GetProducts())
                            {
                                if (!Labels.Exists(t => t.CompareTo(product.Name) == 0))
                                {
                                    Labels.Add(product.Name);
                                }
                            }
                            break;
                        }
                    }
                    if (type == "Model" && tree == TradeMarkTree)
                    {
                        StringBST tempTradeMarkTree = (StringBST)tree;
                        if (tree.NumberOfNodes() == 0)
                        {
                            AddItemsToTheTree(tree);
                        }
                        tree.InOrder();
                        foreach (var product in tempTree.Search(TradeMark).Products)
                        {
                            if (!Labels.Exists(t => t.CompareTo(product.Model) == 0))
                            {
                                Labels.Add(product.Model);
                            }
                        }
                        break;
                    }
                }
            }
            return(Labels);
        }