Example #1
0
        private NAAS_USRMGR.UserAccountType GetUserAccount(string userName)
        {
            NAAS_USRMGR.GetUserList getUserList = new NAAS_USRMGR.GetUserList();
            getUserList.adminName  = _usermgrRuntimeCredential.UserName;
            getUserList.credential = _usermgrRuntimeCredential.Password;
            getUserList.domain     = _usermgrRuntimeCredentialDomain;
            getUserList.rowId      = "0";
            getUserList.maxRows    = "-1";
            getUserList.userId     = userName;
            getUserList.status     = string.Empty;
            getUserList.affiliate  = string.Empty;

            NAAS_USRMGR.GetUserListResponse response = _usermgrClient.GetUserList(getUserList);
            if (CollectionUtils.IsNullOrEmpty(response.@return))
            {
                return(null);
            }
            foreach (NAAS_USRMGR.UserAccountType userAcct in response.@return)
            {
                if (string.Equals(userAcct.userId, userName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(userAcct);
                }
            }
            return(null);
        }
Example #2
0
        private int GetAllUserAccounts(NAAS_USRMGR.GetUserList getUserList, int startIndex, int count,
                                       OrderedSet <CachedUserAccountInfo> userAccounts)
        {
            getUserList.rowId   = startIndex.ToString();
            getUserList.maxRows = count.ToString();
            NAAS_USRMGR.GetUserListResponse response = null;
            bool processedError = false;

            try
            {
                response = _usermgrClient.GetUserList(getUserList);
            }
            catch (Exception e)
            {
                processedError = true;
                if (IsNaasXmlErrorMessage(e.Message))
                {
                    if (count == 1)
                    {
                        // This is the error, skip it
                        return(1);
                    }
                    else
                    {
                        return(GetAllUserAccountsXmlError(getUserList, startIndex, count, userAccounts));
                    }
                }
                else
                {
                    throw;
                }
            }

            if (!processedError)
            {
                if ([email protected] == 0)
                {
                    return(0);
                }
                foreach (NAAS_USRMGR.UserAccountType userAcct in response.@return)
                {
                    userAccounts.Add(new CachedUserAccountInfo(userAcct));
                }
                return([email protected]);
            }
            return(0);
        }