Exemplo n.º 1
0
        public static List<Student> getMatchingStudents(string givenName, string surname)
        {
            List<Student> matches = new List<Student>();

            using (PrincipalContext pc = new PrincipalContext(
                ContextType.ApplicationDirectory, "ailds01v.home.ad1.sou.edu:1556",
                "CN=Users,CN=University", ContextOptions.Negotiate | ContextOptions.SecureSocketLayer))
            {
                SouPerson findPerson = new SouPerson(pc);
                findPerson.GivenName = givenName;
                findPerson.Surname = surname;

                PrincipalSearcher searcher = new PrincipalSearcher(findPerson);
                PrincipalSearchResult<Principal> results = searcher.FindAll();

                foreach (SouPerson person in results)
                {
                    if (person.souStudent == true)
                    {
                        Student s = new Student();
                        s.setKey1(person.souStudentKey1);
                        s.setKey2(person.souStudentKey2);
                        s.setUsername(person.Name);
                        matches.Add(s);
                    }
                }

                return matches;
            }
        }
Exemplo n.º 2
0
        public static List <Student> getMatchingStudents(string givenName, string surname)
        {
            List <Student> matches = new List <Student>();

            using (PrincipalContext pc = new PrincipalContext(
                       ContextType.ApplicationDirectory, "ailds01v.home.ad1.sou.edu:1556",
                       "CN=Users,CN=University", ContextOptions.Negotiate | ContextOptions.SecureSocketLayer))
            {
                SouPerson findPerson = new SouPerson(pc);
                findPerson.GivenName = givenName;
                findPerson.Surname   = surname;

                PrincipalSearcher searcher = new PrincipalSearcher(findPerson);
                PrincipalSearchResult <Principal> results = searcher.FindAll();

                foreach (SouPerson person in results)
                {
                    if (person.souStudent == true)
                    {
                        Student s = new Student();
                        s.setKey1(person.souStudentKey1);
                        s.setKey2(person.souStudentKey2);
                        s.setUsername(person.Name);
                        matches.Add(s);
                    }
                }

                return(matches);
            }
        }
Exemplo n.º 3
0
        // Implement the overloaded search method FindByIdentity
        public static new SouPerson FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue)
        {
            SouPerson result = (SouPerson)FindByIdentityWithType(context, typeof(SouPerson), identityType, identityValue);

            return(result);
        }