public void DeleteUser(PaxtonUser paxtonUser) { if (_trialRunOnly) { Logger.WriteLine("{0}\tTrial run - not deleting user.", paxtonUser); return; } _UpdatePaxtonUser(paxtonUser, false); }
private static void _UpdateExistingPaxtonUser(PaxtonUserRepository userRepository, MembershipDetails details, PaxtonUser paxtonUser) { if (paxtonUser.BecNumber == null) { Logger.WriteLine("No BEC number on Paxton DB - adding it."); paxtonUser.BecNumber = details.BecNumber; userRepository.UpdateUser(paxtonUser); } const int noAccess = 0; //Hopefully safe to hard code this - matches a value from a lookup table in the Paxton DB. if (details.MembershipStatus.ShouldHaveNoAccess()) { if (paxtonUser.AccessLevelId != noAccess) { Logger.WriteLine("User's membership status is {0} setting access level to 'No Access'", details.MembershipStatus); paxtonUser.AccessLevelId = noAccess; userRepository.UpdateUser(paxtonUser); } else { Logger.WriteLine("User's access level is already set to 'No Access'", details.MembershipStatus); } return; } Logger.WriteLine("Current users access level is {0}.", details.MembershipStatus); }
private void _UpdatePaxtonUser(PaxtonUser paxtonUser, bool active) { _net2Client.UpdateUserRecord( paxtonUser.UserId, paxtonUser.AccessLevelId, paxtonUser.DepartmentId, paxtonUser.AntiPassbackUser, paxtonUser.AlarmUser, paxtonUser.FirstName, paxtonUser.MiddleName, paxtonUser.Surname, paxtonUser.Telephone, paxtonUser.Extension, paxtonUser.PIN, paxtonUser.Picture, paxtonUser.ActivationDate, active, //if we're updating a use we want to make sure it's also active instead of just copying paxtonUser.Active, paxtonUser.Fax, paxtonUser.ExpiryDate, paxtonUser.CustomFields); }