/// <summary> /// Retrieves profile information for profiles in which the last activity date occurred on or before the specified date and the user name matches the specified contact name. /// </summary> /// <param name="authenticationOption">One of the <see cref="T:System.Web.Profile.ProfileAuthenticationOption"/> values, specifying whether anonymous, authenticated, or both types of profiles are returned.</param> /// <param name="usernameToMatch">The contact name to search for.</param> /// <param name="userInactiveSinceDate">A <see cref="T:System.DateTime"/> that identifies which contact profiles are considered inactive. If the <see cref="P:System.Web.Profile.ProfileInfo.LastActivityDate"/> value of a contact profile occurs on or before this date and time, the profile is considered inactive.</param> /// <param name="pageIndex">The index of the page of results to return.</param> /// <param name="pageSize">The size of the page of results to return.</param> /// <param name="totalRecords">When this method returns, contains the total number of profiles.</param> /// <returns> /// A <see cref="T:System.Web.Profile.ProfileInfoCollection"/> containing contact profile information for inactive profiles where the contact name matches the supplied <paramref name="usernameToMatch"/> parameter. /// </returns> public override ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords) { if (!this.initialized) { totalRecords = 0; return(new ProfileInfoCollection()); } var result = new ProfileInfoCollection(); int pageNumber = pageIndex; do { int matchingProfilesCount; ProfileInfoCollection matchingProfiles = this.FindProfilesByUserName(authenticationOption, usernameToMatch, pageNumber, pageSize, out matchingProfilesCount); foreach (var profile in matchingProfiles.OfType <ProfileInfo>().Where(p => GetLastActiveDate(p.UserName) < userInactiveSinceDate)) { result.Add(profile); } if (((pageNumber + 1) * pageSize) >= matchingProfilesCount) { break; } pageNumber++; }while (result.Count < pageSize); totalRecords = result.Count; return(result); }