Пример #1
0
        private void PopulateCatTree()
        {
            ProductTree.Nodes.Clear();
            if (Convert.ToInt32(lkCommodityTypes.EditValue) == BLL.Type.Constants.Pharmacuticals)
            {
                Category    cat    = new Category();
                SubCategory subCat = new SubCategory();
                Product     prod   = new Product();
                cat.LoadAll();
                cat.Sort = "CategoryName";
                ProductTree.Nodes.Add("All0", "All");
                foreach (DataRowView dv in cat.DefaultView)
                {
                    TreeNode nodes = new TreeNode();
                    nodes.Name        = "cat" + dv["ID"].ToString();
                    nodes.Text        = dv["CategoryName"].ToString() + " (" + dv["CategoryCode"].ToString() + ")";
                    nodes.ToolTipText = "Double Click to List";
                    subCat.GetSubCategory(Convert.ToInt32(dv["ID"]));
                    subCat.Sort = "SubCategoryName";
                    foreach (DataRowView subDv in subCat.DefaultView)
                    {
                        TreeNode subNodes = new TreeNode();
                        subNodes.Name        = "sub" + subDv["ID"].ToString();
                        subNodes.Text        = subDv["SubCategoryName"].ToString() + " (" + subDv["SubCategoryCode"].ToString() + ")";
                        subNodes.ToolTipText = "Double Click to List";

                        nodes.Nodes.Add(subNodes);
                    }
                    ProductTree.Nodes[0].Nodes.Add(nodes);
                }
                ProductTree.Nodes[0].Expand();
            }
            else
            {
                SupplyCategory scat = new SupplyCategory();
                scat.LoadAll();
                scat.Sort = "Name";
                ProductTree.Nodes.Add("Als0", "All");
                foreach (DataRowView dv in scat.DefaultView)
                {
                    TreeNode nodes = new TreeNode();
                    nodes.Name        = "sup" + dv["ID"].ToString();
                    nodes.Text        = dv["Name"].ToString();
                    nodes.ToolTipText = "Double Click to List";
                    ProductTree.Nodes[0].Nodes.Add(nodes);
                }
                ProductTree.Nodes[0].Expand();
            }
        }
Пример #2
0
        private void PopulateCategory()
        {
            ProductTree.Nodes.Clear();
            Category    cat    = new Category();
            SubCategory subCat = new SubCategory();

            cat.LoadAll();
            cat.Sort = "CategoryName";
            ProductTree.Nodes.Add("All0", "All");
            foreach (DataRowView dv in cat.DefaultView)
            {
                TreeNode nodes = new TreeNode
                {
                    Name = "cat" + dv["ID"].ToString(),
                    Text =
                        dv["CategoryName"].ToString() + " (" + dv["CategoryCode"].ToString() + ")",
                    ToolTipText = "Double click to add"
                };
                subCat.GetSubCategory(Convert.ToInt32(dv["ID"]));
                subCat.Sort = "SubCategoryName";
                foreach (DataRowView subDv in subCat.DefaultView)
                {
                    if (!ExistInList(Convert.ToInt32(subDv["ID"])))
                    {
                        TreeNode subNodes = new TreeNode
                        {
                            Name = "sub" + subDv["ID"].ToString(),
                            Text =
                                subDv["SubCategoryName"].ToString() + " (" +
                                subDv["SubCategoryCode"].ToString() + ")",
                            ToolTipText = "Double click to add"
                        };

                        nodes.Nodes.Add(subNodes);
                    }
                }
                ProductTree.Nodes[0].Nodes.Add(nodes);
            }
            ProductTree.Nodes[0].Expand();
        }
Пример #3
0
        private void ManageItems_Load(object sender, EventArgs e)
        {
            Category    cat    = new Category();
            SubCategory subCat = new SubCategory();
            Product     prod   = new Product();

            cat.LoadAll();
            cat.Sort         = "CategoryName";
            lblCategory.Text = "Products By Category";
            ProductTree.Nodes.Add("All0", "All");
            foreach (DataRowView dv in cat.DefaultView)
            {
                TreeNode nodes = new TreeNode();
                nodes.Name        = "cat" + dv["ID"].ToString();
                nodes.Text        = dv["CategoryName"].ToString() + " (" + dv["CategoryCode"].ToString() + ")";
                nodes.ToolTipText = "Double Click to List";
                subCat.GetSubCategory(Convert.ToInt32(dv["ID"]));
                subCat.Sort = "SubCategoryName";
                foreach (DataRowView subDv in subCat.DefaultView)
                {
                    TreeNode subNodes = new TreeNode();
                    subNodes.Name        = "sub" + subDv["ID"].ToString();
                    subNodes.Text        = subDv["SubCategoryName"].ToString() + " (" + subDv["SubCategoryCode"].ToString() + ")";
                    subNodes.ToolTipText = "Double Click to List";

                    nodes.Nodes.Add(subNodes);
                }
                ProductTree.Nodes[0].Nodes.Add(nodes);
            }
            ProductTree.Nodes[0].Expand();

            Stores stor = new Stores();

            stor.GetActiveStores();
            cboStores.DataSource = stor.DefaultView;
        }