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; } }
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); } }
// 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); }