Пример #1
0
        public IList <IUser> GetUsersByDomainLogin(string domainName, string userAlias, string firstName, string lastName)
        {
            ApplicationLogger.LogInfo("LDAPIntegration", string.Format(CultureInfo.CurrentCulture, "Searching local Logins tables for DomainName={0} AND UserAlias={1} AND FirstName={2} AND LastName={3}", domainName, userAlias, firstName, lastName));

            DataTable table = new DataTable();

            table.Locale = CultureInfo.CurrentCulture;

            using (OrganizationsLoginsTableAdapter adapter = new OrganizationsLoginsTableAdapter())
            {
                table = adapter.GetLoginByDomainName(
                    (string.IsNullOrEmpty(domainName) == false) ? domainName : null
                    , (string.IsNullOrEmpty(userAlias) == false) ? userAlias : null
                    , (string.IsNullOrEmpty(firstName) == false) ? firstName : null
                    , (string.IsNullOrEmpty(lastName) == false) ? lastName : null);
            }

            List <IUser> users = new List <IUser>();

            if (table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    users.Add(createNewUser(table.Rows[i]));
                }
                ApplicationLogger.LogInfo("LDAPIntegration", "result=Found!");
            }
            else
            {
                ApplicationLogger.LogInfo("LDAPIntegration", "result=not found.");
            }

            return(users);
        }
Пример #2
0
        public IList <IUser> GetUsersByEmail(string email)
        {
            ApplicationLogger.LogInfo("LDAPIntegration", string.Format(CultureInfo.CurrentCulture, "Searching local Logins table for email={0}", email));

            DataTable table = new DataTable();

            table.Locale = CultureInfo.CurrentCulture;

            using (OrganizationsLoginsTableAdapter adapter = new OrganizationsLoginsTableAdapter())
            {
                table = adapter.GetLoginByEmail(email);
            }

            List <IUser> users = new List <IUser>();

            if (table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    users.Add(createNewUser(table.Rows[i]));
                }
                ApplicationLogger.LogInfo("LDAPIntegration", "result=Found!");
            }
            else
            {
                ApplicationLogger.LogInfo("LDAPIntegration", "result=not found.");
            }

            return(users);
        }