Пример #1
0
        public List <dto_User> Search(string Name)
        {
            List <dto_User> res = new List <dto_User>();

            using (PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, _settings.ADDomain))
            {
                UserPrincipal UserPrincipal = new UserPrincipal(principalContext);
                if (!string.IsNullOrEmpty(Name))
                {
                    UserPrincipal.SamAccountName = Name;
                }
                PrincipalSearcher search = new PrincipalSearcher(UserPrincipal);

                foreach (UserPrincipal result in search.FindAll())
                {
                    dto_User  user      = new dto_User();
                    dtoHelper dtoHelper = new dtoHelper();
                    dtoHelper.FillBase(user);
                    user.Name                = result.Name;
                    user.NameAr              = result.SamAccountName;
                    user.NameEn              = result.SamAccountName;
                    user.Email               = result.EmailAddress;
                    user.isActivated         = true;
                    user.ActivationStartDate = DateTime.Now;
                    user.IsDeleted           = false;
                    user.isAD                = true;
                    res.Add(user);
                    //if (result.SamAccountName.ToUpper().Contains("AABDELHAYD"))
                    //{
                    //}
                }
                return(res);
            }
        }
Пример #2
0
        public cls_Spooler(ILog log, IAppSettings appSettings)
        {
            _log            = log;
            _configurations = appSettings;
            _sleeptime      = appSettings.Spooler_SleepTime;

            _dto_Helper = new dtoHelper();
        }