Exemplo n.º 1
0
        public void SyncUsers()
        {
            usersToAdd  = new List <Employee>();
            usersToEdit = new List <Employee>();

            using (EmployeeDataEntities db = new EmployeeDataEntities())
            {
                dbUsers = db.Employees.ToList();
            }

            var locations = new List <string> {
                "LDAP://Domain/OU=Users,OU=AU_TebOM01,OU=BIT,DC=corp1,DC=ad-is,DC=net",
            };

            empProvider.ClearDictionaries();

            locations.ForEach(l => sync(l));

            //add user values and update both dicts. remove from dbUsers
            empProvider.AddUsers(usersToAdd);

            //edit user values and update both dicts. remove from dbUsers
            empProvider.EditUsers(usersToEdit);

            //change status for users that are still remaining in dbUsers to "Not Available"
            empProvider.ChangeUserStatus(dbUsers, UserStatus.NotAvailable);
        }