Exemplo n.º 1
0
    private void BindTree()
    {
        IList <Branch> branchLists = BranchManager.GetAllBranch();

        //循环添加机构
        foreach (Branch branch in branchLists)
        {
            TreeNode branchNode = new TreeNode(branch.BranchName, "", "~/images/menuclose.gif");

            IList <Depart> departLists = DepartInfoManager.GetDeparByBranchId(branch.BranchId);
            //循环添加部门
            foreach (Depart depart in departLists)
            {
                TreeNode     departNode = new TreeNode(depart.DepartName, "", "~/images/CloseTree.gif");
                IList <User> userLists  = UserManager.GetUseryDepartId(depart.DepartId);
                //循环添加用户
                foreach (User user in userLists)
                {
                    TreeNode userNode = new TreeNode(user.UserName, user.UserId, "~/images/person.gif");
                    departNode.ChildNodes.Add(userNode);
                }

                branchNode.ChildNodes.Add(departNode);
            }

            this.tvUser.Nodes.Add(branchNode);
        }
    }
Exemplo n.º 2
0
    public CascadingDropDownNameValue[] GetDeparts(string knownCategoryValues)
    {
        StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
        int branchId;

        if (!kv.ContainsKey("BranchId") || !Int32.TryParse(kv["BranchId"], out branchId))
        {
            return(null);
        }
        IList <Depart> departs = DepartInfoManager.GetDeparByBranchId(branchId);
        List <CascadingDropDownNameValue> departList = new List <CascadingDropDownNameValue>();

        foreach (Depart de in departs)
        {
            departList.Add(new CascadingDropDownNameValue(de.DepartName, de.DepartId.ToString()));
        }
        return(departList.ToArray());
    }