public VoterADInfo GetVoterInfo(string userName) { VoterADInfo result = null; if (ds != null && !String.IsNullOrEmpty(userName)) { ds.SearchScope = SearchScope.Subtree; ds.PageSize = 100; ds.CacheResults = false; ds.Filter = "(CN=" + userName + ")"; SearchResult user = ds.FindOne(); if (user != null) { var path = (string)user.Properties["distinguishedName"][0]; var ouPaths = GetOUPath(path, false); result = new VoterADInfo { UserName = userName, Path = String.Join(",", ouPaths), ADGroup = ouPaths.First(), ADGroupLevel = ouPaths.Count(), Email = (string)user.Properties["mail"][0] }; } } return(result); }
public void UpdateVoterADInfo(int surveyId, int voterId, VoterADInfo user) { ArrayList commandParameters = new ArrayList(); { commandParameters.Add(new SqlParameter("@SurveyId", surveyId).SqlValue); commandParameters.Add(new SqlParameter("@VoterId", voterId).SqlValue); commandParameters.Add(new SqlParameter("@AdGroup", user.ADGroup).SqlValue); commandParameters.Add(new SqlParameter("@AdGroupLevel", user.ADGroupLevel).SqlValue); commandParameters.Add(new SqlParameter("@AdPath", user.Path).SqlValue); } DbConnection.db.ExecuteNonQuery("vts_spVoterUpdateADInfo", commandParameters.ToArray()); }
public void UpdateVoterADInfo(int surveyId, int voterId, VoterADInfo user) { VoterFactory.Create().UpdateVoterADInfo(surveyId, voterId, user); }