Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
 public void UpdateVoterADInfo(int surveyId, int voterId, VoterADInfo user)
 {
     VoterFactory.Create().UpdateVoterADInfo(surveyId, voterId, user);
 }