Пример #1
0
        private void LoadProducts()
        {
            this.Cursor = Cursors.WaitCursor;
            this.tvProducts.Nodes.Clear();
            this.lbSelected.DataSource = null;

            string url = SVNManager.VERSIONS_URL;
            Dictionary <string, string> list = SVNManager.Instance.List(url);

            IEnumerable <string> sortedProducts = null;

            if (this.BetaData.Parent != null)
            {
                sortedProducts = from product in list.Keys
                                 where !product.Equals("Promob") &&
                                 !product.Equals("Catalog") &&
                                 !product.Equals(this.BetaData.Parent.Plugin.Name)
                                 select product;
            }
            else
            {
                sortedProducts = from product in list.Keys
                                 where !product.Equals("Promob") &&
                                 !product.Equals("Catalog")
                                 select product;
            }

            List <string> products = new List <string>();

            if (list.ContainsKey("Promob"))
            {
                products.Add("Promob");
            }

            if (list.ContainsKey("Catalog"))
            {
                products.Add("Catalog");
            }

            products.AddRange(sortedProducts);

            foreach (string name in products)
            {
                Product product = new Product(name);

                ProductTreeNode node = new ProductTreeNode(product);

                if (this.BetaData.DependencyProducts.Contains(product.Name))
                {
                    this.LoadProductVersions(node);
                }

                this.tvProducts.Nodes.Add(node);

                this.tvProducts.HideCheckBox(node);
            }

            this.Cursor = Cursors.Default;
        }
Пример #2
0
        private void btnRemove_Click(object sender, System.EventArgs e)
        {
            DependencyProduct         product               = this.lbSelected.SelectedItem as DependencyProduct;
            ProductTreeNode           productNode           = this.tvProducts.Nodes[product.Name] as ProductTreeNode;
            DependencyProductTreeNode dependencyProductNode = productNode.Nodes[product.ToString()] as DependencyProductTreeNode;

            this.tvProducts.SelectedNode  = dependencyProductNode;
            dependencyProductNode.Checked = false;
        }
Пример #3
0
        public List <ProductTreeNode> GetProductsTree()
        {
            List <ProductTreeNode> result = new List <ProductTreeNode>();

            var node = parameters.ContainsKey("node")
                ? parameters["node"]
                : String.Empty;

            if (node != "root")
            {
                List <IPackage> packages = (List <IPackage>)GetPackageList();
                foreach (IPackage package in packages)
                {
                    if (package.Id.ToString() == node)
                    {
                        foreach (IPackageProduct packageProduct in package.PackageProducts)
                        {
                            result.Add(new ProductTreeNode(packageProduct.Product.Id.ToString(),
                                                           packageProduct.Product.Name));
                        }
                    }
                }
                return(result);
            }

            if (parameters["packages"] == "True")
            {
                List <IPackage> packages = (List <IPackage>)GetPackageList();
                foreach (IPackage package in packages)
                {
                    ProductTreeNode parent = new ProductTreeNode(package.Id.ToString(), package.Name + " (" + package.PackageProducts.Count + ")");
                    parent.Children.Add(new ProductTreeNode("", package.PackageProducts.Count.ToString()));
                    result.Add(parent);
                }
                return(result);
            }

            //Else just products
            List <IProduct> products = (List <IProduct>)GetProductList();

            foreach (IProduct product in products)
            {
                result.Add(new ProductTreeNode(product.Id.ToString(), product.Name));
            }
            return(result);
        }
Пример #4
0
        private void LoadProductVersions(ProductTreeNode productNode)
        {
            List <Version> versions       = this.LoadVersions(productNode.Product.Name);
            List <Version> sortedVersions = this.SortVersions(versions);

            foreach (Version version in sortedVersions)
            {
                DependencyProduct         dependencyProduct = this.LoadDependencyProduct(productNode.Product.Name, version);
                DependencyProductTreeNode node = new DependencyProductTreeNode(dependencyProduct);

                node.Checked = this.BetaData.DependencyProducts.Contains(productNode.Product.Name, version.Name);

                productNode.Nodes.Add(node);
            }

            productNode.ExpandAll();

            this.UpdateSelectedVersions();
        }
Пример #5
0
        void Bind()
        {
            var products =
                (from p in _data.Products
                 join f in _data.Features on p.ProductID equals f.ProductID into features
                 select new { p, features }).AsDynamic();
            var indexedAssignments = _data.Assignments;
            var index = indexedAssignments.Indexes.Add(a => new Tuple <int, int, int>(a.ProductID, a.FeatureID, a.EmployeeID));

            Index <Assignment> productIndex = indexedAssignments.Indexes.Add(a => a.ProductID);

            treeViewFeatures.BeginUpdate();
            treeViewFeatures.Nodes.Clear();
            int employeeID = comboAssignedTo.SelectedIndex;

            foreach (var product in products)
            {
                var productNode = new ProductTreeNode();
                productNode.ProductID = product.p.ProductID;
                productNode.Text      = product.p.ProductName;
                treeViewFeatures.Nodes.Add(productNode);
                bool productChecked = false;
                foreach (var feature in product.features)
                {
                    FeatureTreeNode featureNode = new FeatureTreeNode();
                    featureNode.FeatureID = feature.FeatureID;
                    featureNode.Text      = feature.FeatureName;
                    productNode.Nodes.Add(featureNode);

                    bool isChecked = index.ContainsKey(new Tuple <int, int, int>(product.p.ProductID, feature.FeatureID, employeeID));
                    if (isChecked)
                    {
                        featureNode.Checked = true;
                        productChecked      = true;
                    }
                }
                productNode.Checked = productChecked;
            }
            treeViewFeatures.ExpandAll();
            treeViewFeatures.EndUpdate();
            _dirty = false;
        }
    public List<ProductTreeNode> GetProductsTree()
    {
        List<ProductTreeNode> result = new List<ProductTreeNode>();

        if (!_State.Packages) {
            List<Product> products = (List<Product>)GetProductList();
            foreach (IProduct product in products)
                result.Add(new ProductTreeNode(product.Id.ToString(), product.Name));
        } else {
            List<Package> packages = (List<Package>)GetPackageList();
            foreach (IPackage package in packages) {
                ProductTreeNode parent = new ProductTreeNode(package.Id.ToString(), package.Name);
                foreach (IPackageProduct packageProduct in package.PackageProducts)
                    parent.Children.Add(new ProductTreeNode(packageProduct.Product.Id.ToString(), packageProduct.Product.Name));
                result.Add(parent);
            }
        }

        return result;
    }
        public List<ProductTreeNode> GetProductsTree()
        {
            List<ProductTreeNode> result = new List<ProductTreeNode>();

            var node = parameters.ContainsKey("node")
                ? parameters["node"]
                : String.Empty;

            if (node != "root")
            {
                List<IPackage> packages = (List<IPackage>)GetPackageList();
                foreach (IPackage package in packages)
                {
                    if (package.Id.ToString() == node)
                    {
                        foreach (IPackageProduct packageProduct in package.PackageProducts)
                            result.Add(new ProductTreeNode(packageProduct.Product.Id.ToString(),
                                                                    packageProduct.Product.Name));
                    }
                }
                return result;
            }

            if (parameters["packages"] == "True")
            {
                List<IPackage> packages = (List<IPackage>)GetPackageList();
                foreach (IPackage package in packages)
                {
                    ProductTreeNode parent = new ProductTreeNode(package.Id.ToString(), package.Name + " (" + package.PackageProducts.Count + ")");
                    parent.Children.Add(new ProductTreeNode("", package.PackageProducts.Count.ToString()));
                    result.Add(parent);
                }
                return result;
            }

            //Else just products
            List<IProduct> products = (List<IProduct>)GetProductList();
            foreach (IProduct product in products)
                result.Add(new ProductTreeNode(product.Id.ToString(), product.Name));
            return result;
        }