示例#1
0
        public static TreeList GetUserTree(string permissionId)
        {
            TreeList list = new TreeList();
            TList <GE.MyLearning.BL.UserInfo> users = null;
            VList <VwUserGroup> usergroups          = DataRepository.VwUserGroupProvider.GetAll();

            if ((permissionId != null) && (permissionId != ""))
            {
                users = GetUserListByPermissionID(permissionId);
            }
            else
            {
                users = DataRepository.UserInfoProvider.GetAll();
            }
            foreach (GE.MyLearning.BL.UserInfo user1 in users)
            {
                if (user1.UserStatus == 0)
                {
                    bool isGroupUser = false;
                    VList <VwUserGroup> usergroup = usergroups.FindAll(VwUserGroupColumn.UserId, user1.UserId);
                    foreach (VwUserGroup usergroup1 in usergroup)
                    {
                        if (usergroup1.GroupStatus == 0)
                        {
                            isGroupUser = true;
                            list.Add("Group_" + usergroup1.GroupId, usergroup1.GroupName, null);
                            list.Add(usergroup1.GroupId + "_" + user1.UserId, user1.UserCnName, "Group_" + usergroup1.GroupId);
                        }
                    }
                    if (!isGroupUser)
                    {
                        list.Add(user1.UserId, user1.UserCnName, null);
                    }
                }
            }
            foreach (TreeList.Node node1 in list.Nodes)
            {
                if (!((node1.ID.IndexOf('_') <= 0) || node1.ID.StartsWith("Group_")))
                {
                    node1.ID = node1.ID.Substring(node1.ID.IndexOf('_') + 1);
                }
            }
            return(list);
        }