Exemple #1
0
        private void PopulateViewer(string NodeName, string ParentNodeName)
        {
            uxListView.Columns.Clear();
            uxListView.Items.Clear();

            switch (ParentNodeName)
            {
            case "rootPackages":
                uxListView.Columns.Add("Product Name", 150);
                uxListView.Columns.Add("Supplier Name", 150);
                List <Products_Suppliers> package_products = Products_SuppliersDB.GetProductsByPackageName(NodeName);
                foreach (Products_Suppliers item in package_products)
                {
                    uxListView.Items.Add(new ListViewItem(new string[] { item.productName, item.SupName }));
                }
                break;

            case "rootProducts":
                uxListView.Columns.Add("Product Name", 75);
                uxListView.Columns.Add("Supplier Name", 150);
                List <Products_Suppliers> product_suppliers = Products_SuppliersDB.GetSuppliersByProductName(NodeName);
                foreach (Products_Suppliers item in product_suppliers)
                {
                    uxListView.Items.Add(new ListViewItem(new string[] { item.productName, item.SupName }));
                }
                break;

            case "rootSuppliers":
                uxListView.Columns.Add("Supplier Name", 250);
                uxListView.Columns.Add("Product Name", 150);
                List <Products_Suppliers> supplier_products = Products_SuppliersDB.GetProductsBySupplierName(NodeName);
                foreach (Products_Suppliers item in supplier_products)
                {
                    uxListView.Items.Add(new ListViewItem(new string[] { item.SupName, item.productName }));
                }
                break;

            default:
                ;
                break;
            }
        }