public questStatus Read(GroupId groupId, out GroupUserList groupUserList)
        {
            // Initialize
            questStatus status = null;

            groupUserList = null;


            // Get group
            Group group = null;

            status = _dbGroupsMgr.Read(groupId, out group);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Get group users
            using (FMSEntities dbContext = new FMSEntities())
            {
                List <Quest.Services.Dbio.FMS.GroupUsers> _groupUserList = null;
                status = read(dbContext, groupId, out _groupUserList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                groupUserList       = new GroupUserList();
                groupUserList.Group = group;
                foreach (Quest.Services.Dbio.FMS.GroupUsers _groupUser in _groupUserList)
                {
                    // Get user
                    UserId userId = new UserId(_groupUser.UserId);
                    User   user   = null;
                    status = _dbUsersMgr.Read(userId, out user);
                    if (!questStatusDef.IsSuccess(status))
                    {
                        return(status);
                    }
                    groupUserList.UserList.Add(user);
                }
            }
            return(new questStatus(Severity.Success));
        }
Exemple #2
0
        public questStatus Read(GroupId groupId, out GroupPrivilegeList groupPrivilegeList)
        {
            // Initialize
            questStatus status = null;

            groupPrivilegeList = null;


            // Get group
            Group group = null;

            status = _dbGroupsMgr.Read(groupId, out group);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Get group privileges
            using (FMSEntities dbContext = new FMSEntities())
            {
                List <Quest.Services.Dbio.FMS.GroupPrivileges> _groupPrivilegeList = null;
                status = read(dbContext, groupId, out _groupPrivilegeList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                groupPrivilegeList       = new GroupPrivilegeList();
                groupPrivilegeList.Group = group;
                foreach (Quest.Services.Dbio.FMS.GroupPrivileges _groupPrivilege in _groupPrivilegeList)
                {
                    // Get privilege
                    PrivilegeId privilegeId = new PrivilegeId(_groupPrivilege.PrivilegeId);
                    Privilege   privilege   = null;
                    status = _dbPrivilegesMgr.Read(privilegeId, out privilege);
                    if (!questStatusDef.IsSuccess(status))
                    {
                        return(status);
                    }
                    groupPrivilegeList.PrivilegeList.Add(privilege);
                }
            }
            return(new questStatus(Severity.Success));
        }