Esempio n. 1
0
        public static People FromOrganizationAndGeography(Organization organization, Geography geography)
        {
            Geographies geoTree = geography.ThisAndBelow();

            // First, get list of people in the geography, then filter on memberships

            BasicPerson[] people = SwarmDb.GetDatabaseForReading().GetPeopleInGeographies(geoTree.Identities);

            // Filter on memberships

            return(People.LogicalOr(FilterByMembership(people, organization), FilterByApplicant(people, organization)));
        }
Esempio n. 2
0
        public static People FromOrganizationAndGeographyWithPattern(Organization organization, Geography geography,
                                                                     string pattern)
        {
            Geographies geoTree = geography.ThisAndBelow();

            pattern = pattern.Trim();
            if (pattern.Length == 0)
            {
                return(FromOrganizationAndGeography(organization, geography));
            }
            if (pattern.Length < 3)
            {
                // too short pattern! Return empty set.
                return(new People());
            }

            // First, get list of people in the geography, then filter on memberships

            BasicPerson[] candidates =
                SwarmDb.GetDatabaseForReading().GetPeopleInGeographiesWithPattern(geoTree.Identities, pattern);

            return(People.LogicalOr(FilterByMembership(candidates, organization), FilterByApplicant(candidates, organization)));
        }