コード例 #1
0
        private void FillBranches()
        {
            objInv       = new InvoiceDB();
            objUtilityDB = new UtilityDB();
            DataSet ds = new DataSet();

            if (CommonData.LogUserId.ToUpper() == "ADMIN")
            {
                ds = objInv.AdminBranchCursor_Get("", "", "PARENT");
            }
            else
            {
                ds = objUtilityDB.UserBranchCursor_Get(CommonData.LogUserId, "", "", "PARENT");
            }
            ttvBranch.Nodes.Add("Branches", "Branches");
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ttvBranch.Nodes[0].Nodes.Add(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), ds.Tables[0].Rows[i]["COMPANY_NAME"].ToString());
                    DataSet dschild = new DataSet();
                    if (CommonData.LogUserId.ToUpper() == "ADMIN")
                    {
                        //if (sRep_Type == "SP_CHECKLIST")
                        //    dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "SP", "CHILD");
                        //else
                        dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "BR", "CHILD");
                    }
                    else
                    {
                        //if (sRep_Type == "SP_CHECKLIST")
                        //    dschild = objUtilityDB.UserBranchCursor_Get(CommonData.LogUserId, ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "SP", "CHILD");
                        //else
                        dschild = objUtilityDB.UserBranchCursor_Get(CommonData.LogUserId, ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "BR", "CHILD");
                    }
                    //tvBranches.Nodes[i].Nodes.Add("BRANCHES" + "(" + dschild.Tables[0].Rows.Count + ")");
                    if (dschild.Tables[0].Rows.Count > 0)
                    {
                        for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                        {
                            ttvBranch.Nodes[0].Nodes[i].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                        }
                    }
                }
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                this.ttvBranch.SelectedNode = ttvBranch.Nodes[0];
                this.ttvBranch.SelectedNode.Expand();
            }
        }
コード例 #2
0
        private void FillBranches()
        {
            try
            {
                objInv = new InvoiceDB();
                DataSet ds = new DataSet();
                ds = objInv.AdminBranchCursor_Get("", "", "PARENT");
                TreeNode tNode;
                //tNode = tvProducts.Nodes.Add("Products");
                //tvBranches.Nodes[0].Nodes.Add("Single Product");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        treeView1.Nodes.Add(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), ds.Tables[0].Rows[i]["COMPANY_NAME"].ToString());
                        DataSet dschild = new DataSet();

                        dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "HO", "CHILD");
                        if (dschild.Tables[0].Rows.Count > 0)
                        {
                            treeView1.Nodes[i].Nodes.Add("CORPORATE OFFICE" + " (" + dschild.Tables[0].Rows.Count + ")");
                            for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                            {
                                treeView1.Nodes[i].Nodes[treeView1.Nodes[i].Nodes.Count - 1].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                            }
                        }

                        dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "BR", "CHILD");
                        if (dschild.Tables[0].Rows.Count > 0)
                        {
                            treeView1.Nodes[i].Nodes.Add("BRANCHES" + " (" + dschild.Tables[0].Rows.Count + ")");
                            for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                            {
                                treeView1.Nodes[i].Nodes[treeView1.Nodes[i].Nodes.Count - 1].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                            }
                        }

                        dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "SP", "CHILD");
                        if (dschild.Tables[0].Rows.Count > 0)
                        {
                            treeView1.Nodes[i].Nodes.Add("STOCK POINTS" + " (" + dschild.Tables[0].Rows.Count + ")");
                            for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                            {
                                treeView1.Nodes[i].Nodes[treeView1.Nodes[i].Nodes.Count - 1].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                            }
                        }

                        dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "OL", "CHILD");
                        if (dschild.Tables[0].Rows.Count > 0)
                        {
                            treeView1.Nodes[i].Nodes.Add("OUTLETS" + " (" + dschild.Tables[0].Rows.Count + ")");
                            for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                            {
                                treeView1.Nodes[i].Nodes[treeView1.Nodes[i].Nodes.Count - 1].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                            }
                        }

                        dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "PU", "CHILD");
                        if (dschild.Tables[0].Rows.Count > 0)
                        {
                            treeView1.Nodes[i].Nodes.Add("PRODUCTION UNITS" + " (" + dschild.Tables[0].Rows.Count + ")");
                            for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                            {
                                treeView1.Nodes[i].Nodes[treeView1.Nodes[i].Nodes.Count - 1].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                            }
                        }

                        dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "TR", "CHILD");
                        if (dschild.Tables[0].Rows.Count > 0)
                        {
                            treeView1.Nodes[i].Nodes.Add("TRANSPORT UNITS" + " (" + dschild.Tables[0].Rows.Count + ")");
                            for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                            {
                                treeView1.Nodes[i].Nodes[treeView1.Nodes[i].Nodes.Count - 1].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            //this.tvBranches.SelectedNode = tNode.Nodes[1];
            //this.tvBranches.SelectedNode.Expand();
        }
コード例 #3
0
        private void FillBranches()
        {
            tvBranches.Nodes.Clear();

            objInv = new InvoiceDB();
            DataSet ds = new DataSet();

            ds = objInv.AdminBranchCursor_Get("", "", "PARENT");
            TreeNode tNode;

            //tNode = tvProducts.Nodes.Add("Products");
            //tvBranches.Nodes[0].Nodes.Add("Single Product");
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    tvBranches.Nodes.Add(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), ds.Tables[0].Rows[i]["COMPANY_NAME"].ToString());
                    DataSet dschild = new DataSet();
                    dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "BR", "CHILD");
                    tvBranches.Nodes[i].Nodes.Add("BRANCHES" + "(" + dschild.Tables[0].Rows.Count + ")");
                    if (dschild.Tables[0].Rows.Count > 0)
                    {
                        for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                        {
                            tvBranches.Nodes[i].Nodes[0].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                        }
                    }

                    dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "SP", "CHILD");
                    tvBranches.Nodes[i].Nodes.Add("STOCK POINTS" + "(" + dschild.Tables[0].Rows.Count + ")");
                    if (dschild.Tables[0].Rows.Count > 0)
                    {
                        for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                        {
                            tvBranches.Nodes[i].Nodes[1].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                        }
                    }

                    dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "PU", "CHILD");
                    tvBranches.Nodes[i].Nodes.Add("PRODUCTION UNITS" + "(" + dschild.Tables[0].Rows.Count + ")");
                    if (dschild.Tables[0].Rows.Count > 0)
                    {
                        for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                        {
                            tvBranches.Nodes[i].Nodes[2].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                        }
                    }

                    dschild = objInv.AdminBranchCursor_Get(ds.Tables[0].Rows[i]["COMPANY_CODE"].ToString(), "TR", "CHILD");
                    tvBranches.Nodes[i].Nodes.Add("TRANSPORT UNITS" + "(" + dschild.Tables[0].Rows.Count + ")");
                    if (dschild.Tables[0].Rows.Count > 0)
                    {
                        for (int j = 0; j < dschild.Tables[0].Rows.Count; j++)
                        {
                            tvBranches.Nodes[i].Nodes[3].Nodes.Add(dschild.Tables[0].Rows[j]["BRANCH_CODE"].ToString(), dschild.Tables[0].Rows[j]["BRANCH_NAME"].ToString());
                        }
                    }
                }
            }

            //this.tvBranches.SelectedNode = tNode.Nodes[1];
            //this.tvBranches.SelectedNode.Expand();
        }