Exemple #1
0
        private void FindPreviousEnumerateByCount(string domainID, int count)
        {
            string context;

            Member[] memberList;
            int      total;
            int      i;

            bool moreEntries =
                DomainProvider.FindFirstDomainMembers(
                    domainID,
                    0,
                    out context,
                    out memberList,
                    out total);

            if (total != MemberCount)
            {
                throw new ApplicationException("Total entries is incorrect.");
            }
            if (moreEntries == false)
            {
                throw new ApplicationException("No entries returned.");
            }
            if (memberList != null)
            {
                throw new ApplicationException("Member list returned.");
            }

            moreEntries =
                DomainProvider.FindSeekDomainMembers(
                    domainID,
                    ref context,
                    MemberCount,
                    0,
                    out memberList);

            if (moreEntries == true)
            {
                throw new ApplicationException("More entries returned.");
            }
            if (memberList != null)
            {
                throw new ApplicationException("Member list returned.");
            }

            for (i = 0; i < total;)
            {
                moreEntries =
                    DomainProvider.FindPreviousDomainMembers(
                        domainID,
                        ref context,
                        count,
                        out memberList);

                if (count > 0)
                {
                    if (memberList == null)
                    {
                        throw new ApplicationException("No member list returned.");
                    }
                    i += count;

                    if (i <= total)
                    {
                        if (moreEntries == false)
                        {
                            throw new ApplicationException("No more entries.");
                        }
                        if (memberList.Length != count)
                        {
                            throw new ApplicationException("Member list is incorrect.");
                        }
                    }
                    else
                    {
                        if (moreEntries == true)
                        {
                            throw new ApplicationException("More entries returned.");
                        }
                        if (memberList.Length != (total % count))
                        {
                            throw new ApplicationException("Member list is incorrect.");
                        }
                    }
                }
                else
                {
                    if (moreEntries == true)
                    {
                        throw new ApplicationException("More entries returned.");
                    }
                    if (memberList != null)
                    {
                        throw new ApplicationException("Member list returned.");
                    }
                    break;
                }
            }

            DomainProvider.FindCloseDomainMembers(domainID, context);
        }
Exemple #2
0
        private void FindPreviousEnumerateAll(string domainID)
        {
            string context;

            Member[] memberList;
            int      total;

            bool moreEntries =
                DomainProvider.FindFirstDomainMembers(
                    domainID,
                    0,
                    out context,
                    out memberList,
                    out total);

            if (total != MemberCount)
            {
                throw new ApplicationException("Total entries is incorrect.");
            }
            if (moreEntries == false)
            {
                throw new ApplicationException("No entries returned.");
            }
            if (memberList != null)
            {
                throw new ApplicationException("Member list returned.");
            }

            moreEntries =
                DomainProvider.FindSeekDomainMembers(
                    domainID,
                    ref context,
                    MemberCount,
                    0,
                    out memberList);

            if (moreEntries == true)
            {
                throw new ApplicationException("More entries returned.");
            }
            if (memberList != null)
            {
                throw new ApplicationException("Member list returned.");
            }

            moreEntries =
                DomainProvider.FindPreviousDomainMembers(
                    domainID,
                    ref context,
                    MemberCount + 1,
                    out memberList);

            if (moreEntries == true)
            {
                throw new ApplicationException("More entries returned.");
            }
            if (memberList == null)
            {
                throw new ApplicationException("No member list returned.");
            }
            if (memberList.Length != total)
            {
                throw new ApplicationException("Member list is incorrect.");
            }

            CheckMemberOrder(memberList);
            DomainProvider.FindCloseDomainMembers(domainID, context);
        }