예제 #1
0
        private void FindNextEnumerateAll(string domainID)
        {
            string context;

            Member[] memberList;
            int      total;

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

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

            moreEntries =
                DomainProvider.FindNextDomainMembers(
                    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 not correct.");
            }

            CheckMemberOrder(memberList);
            DomainProvider.FindCloseDomainMembers(domainID, context);
        }
예제 #2
0
        private void FindNextEnumerateByCount(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 (moreEntries == false)
            {
                throw new ApplicationException("No more entries.");
            }
            if (memberList != null)
            {
                throw new ApplicationException("Member list returned.");
            }
            if (total != MemberCount)
            {
                throw new ApplicationException("Total entries is incorrect.");
            }

            for (i = 0; i < total;)
            {
                moreEntries =
                    DomainProvider.FindNextDomainMembers(
                        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 == false)
                    {
                        throw new ApplicationException("No more entries.");
                    }
                    if (memberList != null)
                    {
                        throw new ApplicationException("Member list returned.");
                    }
                    break;
                }
            }

            DomainProvider.FindCloseDomainMembers(domainID, context);
        }