public override int GetNumberOfInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate) { ProfileType?profileType = null; if (authenticationOption == ProfileAuthenticationOption.Anonymous) { profileType = ProfileType.Anonymous; } else if (authenticationOption == ProfileAuthenticationOption.Authenticated) { profileType = ProfileType.Authenticated; } using (var transaction = new TransactionScope(mConfiguration)) { var profileStore = new ProfileUserDataStore(transaction); IList <ProfileUser> users = profileStore.FindByFields(ApplicationName, null, userInactiveSinceDate, profileType, PagingInfo.All); return(users.Count); } }
public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords) { ProfileType?profileType = null; if (authenticationOption == ProfileAuthenticationOption.Anonymous) { profileType = ProfileType.Anonymous; } else if (authenticationOption == ProfileAuthenticationOption.Authenticated) { profileType = ProfileType.Authenticated; } using (var transaction = new TransactionScope(mConfiguration)) { var profileStore = new ProfileUserDataStore(transaction); var paging = new PagingInfo(pageSize, pageIndex); IList <ProfileUser> users = profileStore.FindByFields(ApplicationName, null, null, profileType, paging); totalRecords = (int)paging.RowCount; return(ProfileUsersToProfileInfoCollection(users)); } }
public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate) { ProfileType?profileType = null; if (authenticationOption == ProfileAuthenticationOption.Anonymous) { profileType = ProfileType.Anonymous; } else if (authenticationOption == ProfileAuthenticationOption.Authenticated) { profileType = ProfileType.Authenticated; } int profilesDeleted = 0; using (var transaction = new TransactionScope(mConfiguration)) { var profileStore = new ProfileUserDataStore(transaction); IList <ProfileUser> users = profileStore.FindByFields(ApplicationName, null, userInactiveSinceDate, profileType, PagingInfo.All); profilesDeleted = users.Count; foreach (ProfileUser user in users) { profileStore.Delete(user.Id); } transaction.Commit(); } return(profilesDeleted); }
public override int DeleteProfiles(string[] usernames) { int profilesDeleted = 0; using (var transaction = new TransactionScope(mConfiguration)) { var profileStore = new ProfileUserDataStore(transaction); foreach (string userName in usernames) { IList <ProfileUser> users = profileStore.FindByFields(ApplicationName, userName, null, null, PagingInfo.All); profilesDeleted += users.Count; foreach (ProfileUser user in users) { profileStore.Delete(user.Id); } } transaction.Commit(); } return(profilesDeleted); }