Exemple #1
0
        public override ProfileInfoCollection FindInactiveProfilesByUserName(
            ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate,
            int pageIndex, int pageSize, out int totalRecords)
        {
            CheckParameters(pageIndex, pageSize);

            SqlDatabase sqlDatabase = new SqlDatabase(_connectionString);
            DbCommand   dbCommand   = sqlDatabase.GetStoredProcCommand("adm.NlayerSP_ObtenerPerfilesInactivosPorUsuario");

            sqlDatabase.AddInParameter(dbCommand, "Login", DbType.String, usernameToMatch);
            sqlDatabase.AddInParameter(dbCommand, "UltimaActividad", DbType.Date, userInactiveSinceDate);
            sqlDatabase.AddInParameter(dbCommand, "Inicio", DbType.Int32, pageIndex);
            sqlDatabase.AddInParameter(dbCommand, "Cantidad", DbType.Int32, pageSize);

            ProfileInfoCollection profileInfoCollection = new ProfileInfoCollection();

            using (IDataReader dataReader = sqlDatabase.ExecuteReader(dbCommand))
            {
                totalRecords = dataReader.GetInt32(0);
                dataReader.NextResult();

                while (dataReader.Read())
                {
                    ProfileInfo profileInfo = GetProfileInfoFromReader(dataReader);
                    profileInfoCollection.Add(profileInfo);
                }
            }

            return(profileInfoCollection);
        }
Exemple #2
0
        /// <summary>
        /// Returns a user's profile
        /// Currently assumes a single user will match the token.
        /// </summary>
        /// <param name="authenticationOption"></param>
        /// <param name="usernameToMatch"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecords"></param>
        /// <returns></returns>
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            // TODO: Take paging into account
            // TODO: Take auth option into account
            totalRecords = 0;

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            GetAttributesRequest  request  = new GetAttributesRequest().WithDomainName(domain).WithItemName(usernameToMatch);
            GetAttributesResponse response = client.GetAttributes(request);

            if (response.GetAttributesResult.Attribute.Count > 0)
            {
                ProfileInfo      profile    = null;
                List <Attribute> attributes = response.GetAttributesResult.Attribute;
                MCItem           item       = new MCItem();
                item.Domain     = domain;
                item.ItemName   = usernameToMatch;
                item.Attributes = new Hashtable();
                foreach (Attribute attribute in attributes)
                {
                    item.Attributes.Add(attribute.Name, attribute.Value);
                }
                bool     Anon         = bool.Parse(item.Get("Anon").Replace("", "false"));
                DateTime LastActivity = DateTime.Parse(item.Get("LastActivity"));
                DateTime LastUpdated  = DateTime.Parse(item.Get("LastUpdated"));
                profile = new ProfileInfo(item.Id, Anon, LastActivity, LastUpdated, 0);
                profiles.Add(profile);
            }

            totalRecords = profiles.Count;
            return(profiles);
        }
Exemple #3
0
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption,
                                                                     string usernameToMatch,
                                                                     int pageIndex,
                                                                     int pageSize,
                                                                     out int totalRecords)
        {
            if (usernameToMatch == null)
            {
                throw new ArgumentNullException("usernameToMatch");
            }
            var pic  = new ProfileInfoCollection();
            var user = GetUserFromUserName(usernameToMatch);

            totalRecords = 0;
            if (user != null)
            {
                var username = GetUsername(user);
                pic.Add(new ProfileInfo(username,
                                        user.Properties.IsAnonymous,
                                        user.Properties.LastActivityDate,
                                        user.Properties.LastUpdatedDate,
                                        0));
                totalRecords = 1;
            }
            return(pic);
        }
Exemple #4
0
        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption,
                                                             int pageIndex, int pageSize, out int totalRecords)
        {
            CheckParameters(pageIndex, pageSize);

            SqlDatabase sqlDatabase = new SqlDatabase(_connectionString);
            DbCommand   dbCommand   = sqlDatabase.GetStoredProcCommand("adm.NlayerSP_ObtenerPerfiles");

            sqlDatabase.AddInParameter(dbCommand, "Aplicacion", DbType.String, _applicationName);
            sqlDatabase.AddInParameter(dbCommand, "Inicio", DbType.Int32, pageIndex);
            sqlDatabase.AddInParameter(dbCommand, "Cantidad", DbType.Int32, pageSize);

            ProfileInfoCollection profileInfoCollection = new ProfileInfoCollection();

            using (IDataReader dataReader = sqlDatabase.ExecuteReader(dbCommand))
            {
                totalRecords = dataReader.GetInt32(0);
                dataReader.NextResult();

                while (dataReader.Read())
                {
                    ProfileInfo profileInfo = GetProfileInfoFromReader(dataReader);
                    profileInfoCollection.Add(profileInfo);
                }
            }

            return(profileInfoCollection);
        }
        /// <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);
        }
        /// <summary>
        /// Retrieves profile information for profiles in which the contact name matches the specified contact names.
        /// </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="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 profiles where the contact name matches the supplied <paramref name="usernameToMatch"/> parameter.
        /// </returns>
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            if (!this.initialized)
            {
                totalRecords = 0;
                return(new ProfileInfoCollection());
            }

            var result     = new ProfileInfoCollection();
            int pageNumber = pageIndex;

            do
            {
                int matchingUsersNumber;
                var users = this.userRepository.FindUsersByName(usernameToMatch, pageNumber, pageSize, out matchingUsersNumber);
                foreach (var user in users.Where(user => this.HasProfile(user.Name)))
                {
                    //Note: profile size should be counted.
                    result.Add(new ProfileInfo(user.Name, false, DateTime.Now, DateTime.Now, 0));
                }

                if (((pageNumber + 1) * pageSize) >= matchingUsersNumber)
                {
                    break;
                }

                pageNumber++;
            }while (result.Count < pageSize);

            totalRecords = result.Count;
            return(result);
        }
        /// <summary>
        /// Get a collection of profiles based upon a user name matching string and inactivity date.
        /// </summary>
        /// <param name="authenticationOption">Current authentication option setting.</param>
        /// <param name="userNameToMatch">Characters representing user name to match (L to R).</param>
        /// <param name="userInactiveSinceDate">Inactivity date for deletion.</param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecords">Total records found (output).</param>
        /// <returns>Collection of profiles.</returns>
        public override System.Web.Profile.ProfileInfoCollection FindInactiveProfilesByUserName(System.Web.Profile.ProfileAuthenticationOption authenticationOption, string userNameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            IObjectScope objScope = ORM.GetNewObjectScope();
            const string queryInactiveProfilesByUserName =
                @"SELECT * FROM EmployeeProfileExtent AS o WHERE o.Employee.Name LIKE $1 AND o.Employee.LastActivityDate <= $2";
            ProfileInfoCollection pic = new ProfileInfoCollection();
            IQuery query = objScope.GetOqlQuery(queryInactiveProfilesByUserName);

            using (IQueryResult result = query.Execute(userNameToMatch + '*', userInactiveSinceDate))
            {
                totalRecords = result.Count;
                int counter    = 0;
                int startIndex = pageSize * pageIndex;
                int endIndex   = startIndex + pageSize - 1;

                foreach (object res in result)
                {
                    if (counter >= startIndex)
                    {
                        EmployeeProfile ep = res as EmployeeProfile;
                        pic.Add(new ProfileInfo(ep.Employee.Name, false, ep.Employee.LastActivityDate, ep.LastUpdatedDate, 0));
                    }
                    if (counter >= endIndex)
                    {
                        break;
                    }
                    counter += 1;
                }
            }
            return(pic);
        }
        /// <summary>
        /// When overridden in a derived class, retrieves profile information for profiles in which the user name matches the specified user names.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Web.Profile.ProfileInfoCollection"/> containing user-profile information for profiles where the user name matches the supplied <paramref name="usernameToMatch"/> parameter.
        /// </returns>
        /// <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 user name to search for.
        ///                 </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>
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            if (pageIndex < 1 || pageSize < 1)
            {
                throw new ApplicationException(string.Format("{0} page index.", _ERR_INVALID_PARAMETER));
            }

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            int counter    = 0;
            int startIndex = pageSize * (pageIndex - 1);
            int endIndex   = startIndex + pageSize - 1;

            var foundProfile = new ProfileService().GetByUsernameApplicationName(usernameToMatch, this.ApplicationName);

            //totalRecords = profileList.Count;
            totalRecords = 0;
            if (foundProfile != null)
            {
                totalRecords = 1;
                profiles.Add(new ProfileInfo(foundProfile.Username, foundProfile.IsAnonymous.Value, foundProfile.LastActivityDate.Value, foundProfile.LastUpdatedDate.Value, 0));
            }

            return(profiles);
        }
        /// <summary>
        /// When overridden in a derived class, retrieves user profile data for all profiles in the data source.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Web.Profile.ProfileInfoCollection"/> containing user-profile information for all profiles in the data source.
        /// </returns>
        /// <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="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>
        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            if (pageIndex < 1 || pageSize < 1)
            {
                throw new ApplicationException(string.Format("{0} page index.", _ERR_INVALID_PARAMETER));
            }

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            int counter    = 0;
            int startIndex = pageSize * (pageIndex - 1);
            int endIndex   = startIndex + pageSize - 1;

            TList <Profile> profileList = new ProfileService().GetAll();

            totalRecords = profileList.Count;

            foreach (Profile profile in profileList)
            {
                if (counter >= startIndex)
                {
                    profiles.Add(new ProfileInfo(profile.Username, profile.IsAnonymous.Value, profile.LastActivityDate.Value, profile.LastUpdatedDate.Value, 0));
                }

                if (counter >= endIndex)
                {
                    break;
                }

                counter++;
            }

            return(profiles);
        }
Exemple #10
0
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption,
                                                                     string usernameToMatch,
                                                                     int pageIndex, int pageSize, out int totalRecords)
        {
            var results = new ProfileInfoCollection();

            totalRecords = 0;

            try
            {
                using (var con = SQLiteUtils.GetConnection(_connectionString))
                {
                    con.Open();

                    using (var cmd = con.CreateCommand())
                    {
                        cmd.CommandText =
                            "SELECT u.UserName, u.IsAnonymous, u.LastActivityDate, p.LastUpdatedDate, DATALENGTH(p.PropertyNames) + DATALENGTH(p.PropertyValuesString) + DATALENGTH(p.PropertyValuesBinary) " +
                            "FROM [aspnet_Users] u, [aspnet_Profile] p " +
                            "WHERE u.UserId = p.UserId AND ApplicationId = @ApplicationId AND (@ProfileAuthOptions = 2 OR (@ProfileAuthOptions = 0 AND IsAnonymous = 1) OR (@ProfileAuthOptions = 1 AND IsAnonymous = 0)) AND (@UserNameToMatch IS NULL OR LoweredUserName LIKE LOWER(@UserNameToMatch)) " +
                            "ORDER BY u.UserName Asc " +
                            "LIMIT @PageSize OFFSET @PageStart";
                        cmd.Parameters.AddRange(new[]
                        {
                            cmd.CreateParameter("@ApplicationId", _applicationId),
                            cmd.CreateParameter("@ProfileAuthOptions", (int)authenticationOption),
                            cmd.CreateParameter("@UserNameToMatch", usernameToMatch),
                            cmd.CreateParameter("@PageSize", pageSize),
                            cmd.CreateParameter("@PageStart", pageIndex * pageSize)
                        });

                        using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
                        {
                            while (reader.Read())
                            {
                                var username         = reader.GetString(0);
                                var isAnonymous      = reader.GetBoolean(1);
                                var lastActivityDate = DateTime.SpecifyKind(reader.GetDateTime(2), DateTimeKind.Utc);
                                var lastUpdatedDate  = DateTime.SpecifyKind(reader.GetDateTime(3), DateTimeKind.Utc);
                                var size             = reader.GetInt32(4);

                                results.Add(new ProfileInfo(username, isAnonymous, lastActivityDate, lastUpdatedDate, size));
                            }
                        }
                    }
                }

                totalRecords = results.Count;
            }
            catch (SQLiteException ex)
            {
                if (!WriteExceptionsToEventLog)
                {
                    throw;
                }
                EventLogger.WriteToEventLog(ex, "FindProfilesByUserName");
            }

            return(results);
        }
Exemple #11
0
        /// <summary>
        ///     When overridden in a derived class, retrieves user-profile data from the data source for profiles in which the last
        ///     activity date occurred on or before the specified date.
        /// </summary>
        /// <returns>
        ///     A <see cref="T:System.Web.Profile.ProfileInfoCollection"></see> containing user-profile information about the
        ///     inactive profiles.
        /// </returns>
        /// <param name="authenticationOption">
        ///     One of the <see cref="T:System.Web.Profile.ProfileAuthenticationOption"></see> values, specifying whether
        ///     anonymous, authenticated, or both types of profiles are returned.
        /// </param>
        /// <param name="userInactiveSinceDate">
        ///     A <see cref="T:System.DateTime"></see> that identifies which user profiles are considered inactive. If the
        ///     <see
        ///         cref="P:System.Web.Profile.ProfileInfo.LastActivityDate">
        ///     </see>
        ///     of a user profile occurs on or before this date and time, the profile is considered inactive.
        /// </param>
        /// <param name="totalRecords">When this method returns, contains the total number of profiles.</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>
        public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption,
                                                                     DateTime userInactiveSinceDate, int pageIndex,
                                                                     int pageSize, out int totalRecords)
        {
            SessionWrapper sessionWrapper = SessionManager.GetSessionWrapper();

            try
            {
                var infos = new ProfileInfoCollection();
                IQueryable <ProfileValue> profiles =
                    from profile in
                    MemberShipFactory.Profiles.Take(pageSize).Skip(pageIndex * pageSize)
                    where profile.LastActivityDate < userInactiveSinceDate
                    select profile;
                totalRecords =
                    (from profile in
                     MemberShipFactory.Profiles.Take(pageSize).Skip(pageIndex * pageSize)
                     where profile.LastActivityDate < userInactiveSinceDate
                     select profile).Count();


                foreach (ProfileValue prof in profiles)
                {
                    User u = MemberShipFactory.CreateUserDao().GetByLoginId(prof.LoginId);
                    infos.Add(ToProfileInfo(prof));
                }
                return(infos);
            }
            finally
            {
                sessionWrapper.Close();
            }
        }
        private ProfileInfoCollection GetProfiles(
            ProfileAuthenticationOption authenticationOption,
            string usernameToMatch, DateTime userInactiveSinceDate,
            int pageIndex, int pageSize, out int totalRecords)
        {
            List <string> whereClauses = new List <string>();

            using (MySqlConnection c = new MySqlConnection(connectionString))
            {
                c.Open();

                MySqlCommand cmd = new MySqlCommand(
                    @"SELECT p.*, u.name, u.isAnonymous, u.lastActivityDate,
                LENGTH(p.stringdata) + LENGTH(p.binarydata) AS profilesize
                FROM my_aspnet_profiles p 
                JOIN my_aspnet_users u ON u.id = p.userId 
                WHERE u.applicationId = @appId", c);
                cmd.Parameters.AddWithValue("@appId", app.FetchId(c));

                if (usernameToMatch != null)
                {
                    cmd.CommandText += " AND u.name LIKE @userName";
                    cmd.Parameters.AddWithValue("@userName", usernameToMatch);
                }
                if (userInactiveSinceDate != DateTime.MinValue)
                {
                    cmd.CommandText += " AND u.lastActivityDate < @lastActivityDate";
                    cmd.Parameters.AddWithValue("@lastActivityDate", userInactiveSinceDate);
                }
                if (authenticationOption == ProfileAuthenticationOption.Anonymous)
                {
                    cmd.CommandText += " AND u.isAnonymous = 1";
                }
                else if (authenticationOption == ProfileAuthenticationOption.Authenticated)
                {
                    cmd.CommandText += " AND u.isAnonymous = 0";
                }

                cmd.CommandText += String.Format(" LIMIT {0},{1}", pageIndex * pageSize, pageSize);

                ProfileInfoCollection pic = new ProfileInfoCollection();
                using (MySqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        ProfileInfo pi = new ProfileInfo(
                            reader.GetString("name"),
                            reader.GetBoolean("isAnonymous"),
                            reader.GetDateTime("lastActivityDate"),
                            reader.GetDateTime("lastUpdatedDate"),
                            reader.GetInt32("profilesize"));
                        pic.Add(pi);
                    }
                }
                cmd.CommandText = "SELECT FOUND_ROWS()";
                totalRecords    = Convert.ToInt32(cmd.ExecuteScalar());
                return(pic);
            }
        }
Exemple #13
0
        /// <summary>
        /// Retrieves profile information for profiles in which the user name matches the specified user names.
        /// </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 user name to search for.</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 user-profile information for profiles where the user name matches the supplied <paramref name="usernameToMatch"/> parameter.
        /// </returns>
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            // Validate arguments
            if (pageIndex < 0)
            {
                throw new ArgumentOutOfRangeException("pageIndex");
            }
            if (pageSize < 1)
            {
                throw new ArgumentOutOfRangeException("pageSize");
            }
            if (authenticationOption == ProfileAuthenticationOption.Anonymous)
            {
                // Anonymous profiles not supported
                totalRecords = 0;
                return(new ProfileInfoCollection());
            }

            using (DataTable dt = new DataTable()) {
                // Prepare sql command
                using (SqlConnection db = this.OpenDatabase())
                    using (SqlCommand cmd = new SqlCommand("", db)) {
                        if (string.IsNullOrEmpty(usernameToMatch))
                        {
                            cmd.CommandText = this.ExpandCommand("SELECT $UserName AS UserName, $LastUpdate AS LastUpdate FROM $Profiles WHERE $UserName=@UserName ORDER BY $UserName");
                        }
                        else
                        {
                            cmd.CommandText = this.ExpandCommand("SELECT $UserName AS UserName, $LastUpdate AS LastUpdate FROM $Profiles WHERE $UserName=@UserName ORDER BY $UserName");
                            cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 100).Value = usernameToMatch;
                        }
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd)) da.Fill(dt);
                    }

                // Prepare paging
                ProfileInfoCollection pic = new ProfileInfoCollection();
                totalRecords = dt.Rows.Count;
                int minIndex = pageIndex * pageSize; if (minIndex > totalRecords - 1)
                {
                    return(pic);
                }
                int maxIndex = minIndex + pageSize - 1; if (maxIndex > totalRecords - 1)
                {
                    maxIndex = totalRecords - 1;
                }

                // Populate collection from data table
                for (int i = minIndex; i <= maxIndex; i++)
                {
                    pic.Add(new ProfileInfo(System.Convert.ToString(dt.Rows[i]["UserName"]),
                                            false,
                                            DateTime.Now,
                                            System.Convert.ToDateTime(dt.Rows[i]["LastUpdate"]),
                                            0));
                }
                return(pic);
            }
        }
Exemple #14
0
        // GetProfileInfo
        // Retrieves a count of profiles and creates a
        // ProfileInfoCollection from the profile data in the
        // database. Called by GetAllProfiles, GetAllInactiveProfiles,
        // FindProfilesByUserName, FindInactiveProfilesByUserName,
        // and GetNumberOfInactiveProfiles.
        // Specifying a pageIndex of 0 retrieves a count of the results only.
        private ProfileInfoCollection GetProfileInfo(
            ProfileAuthenticationOption authenticationOption,
            string usernameToMatch,
            DateTime?userInactiveSinceDate,
            int pageIndex,
            int pageSize,
            out int totalRecords)
        {
            totalRecords = 0;

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            // Count profiles only.
            if (pageSize == 0)
            {
                return(profiles);
            }

            int counter    = 0;
            int startIndex = pageSize * (pageIndex - 1);
            int endIndex   = startIndex + pageSize - 1;

            bool?isAnonymous = null;

            if (authenticationOption == ProfileAuthenticationOption.Anonymous)
            {
                isAnonymous = true;
            }
            else if (authenticationOption == ProfileAuthenticationOption.Authenticated)
            {
                isAnonymous = false;
            }

            foreach (CustomProfile profile in Accessor.GetProfile(
                         isAnonymous, usernameToMatch, userInactiveSinceDate, _applicationName, out totalRecords))
            {
                if (counter >= startIndex)
                {
                    ProfileInfo p = new ProfileInfo(
                        profile.UserName,
                        profile.IsAnonymous ?? true,
                        profile.LastActivityDate ?? DateTime.MinValue,
                        profile.LastUpdatedDate ?? DateTime.MinValue, 0);

                    profiles.Add(p);
                }

                if (counter >= endIndex)
                {
                    break;
                }

                counter++;
            }

            return(profiles);
        }
        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection pc = new ProfileInfoCollection();

            totalRecords = 0;

            switch (authenticationOption)
            {
            case ProfileAuthenticationOption.All:
            {
                PageQueryParams pageQueryParams = new PageQueryParams();
                pageQueryParams.PageIndex = pageIndex;
                pageQueryParams.PageSize  = pageSize;

                List <SystemUserWrapper> users = SystemUserWrapper.FindAllByPage(pageQueryParams);

                totalRecords = pageQueryParams.RecordCount;

                foreach (SystemUserWrapper user in users)
                {
                    pc.Add(new ProfileInfo(user.UserLoginID, false, user.LastActivityDate, user.LastLoginDate, 0));
                }

                return(pc);
            };

            case ProfileAuthenticationOption.Anonymous:
            {
                return(pc);
            };

            case ProfileAuthenticationOption.Authenticated:
            {
                List <SystemUserWrapper> users = SystemUserWrapper.FindAuthenticatedUserAll(((pageIndex - 1) * pageSize), pageSize, out totalRecords);
                foreach (SystemUserWrapper user in users)
                {
                    pc.Add(new ProfileInfo(user.UserLoginID, false, user.LastActivityDate, user.LastLoginDate, 0));
                }
                return(pc);
            };

            default: return(pc);
            }
        }
        /// <summary>
        /// *note method not supported on our custom profile provider, return empty profile
        /// </summary>
        private ProfileInfoCollection GetProfileInfo(ProfileAuthenticationOption authenticationOption, string usernameToMatch, object userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection profiles    = new ProfileInfoCollection();
            ProfileInfo           profileInfo = new ProfileInfo("", false, DateTime.MinValue, DateTime.MinValue, 0);

            profiles.Add(profileInfo);

            totalRecords = 0;
            return(profiles);
        }
        public virtual ProfileInfoCollection ProfileInfoCollectionFromCollection(global::SoftFluent.Samples.GED.Security.UserCollection users)
        {
            ProfileInfoCollection profiles = new ProfileInfoCollection();

            foreach (global::SoftFluent.Samples.GED.Security.User user in users)
            {
                profiles.Add(ProfileInfoFromUser(user));
            }
            return(profiles);
        }
Exemple #18
0
        public static ProfileInfoCollection ConvertToList(DataTable table)
        {
            ProfileInfoCollection list = new ProfileInfoCollection();

            foreach (DataRow row in table.Rows)
            {
                list.Add(ConvertToObject(row));
            }

            return(list);
        }
Exemple #19
0
        private static ProfileInfoCollection ToProfileInfoCollection(IEnumerable <User> users)
        {
            var profileCollection = new ProfileInfoCollection();

            foreach (var user in users)
            {
                profileCollection.Add(ToProfileInfo(user));
            }

            return(profileCollection);
        }
Exemple #20
0
        ////////////////////////////////////////////////////////
        // Private Methods                                    //
        //----------------------------------------------------//

        ////////////////////////////////////////////////////////
        // Get Profiles for Query                             //
        //----------------------------------------------------//
        private ProfileInfoCollection GetProfilesForQuery(string sqlQuery, SQLiteParameter[] args, int pageIndex, int pageSize, out int totalRecords)
        {
            if (pageIndex < 0)
            {
                throw new ArgumentException("Page index must be non-negative", "pageIndex");
            }
            if (pageSize < 1)
            {
                throw new ArgumentException("Page size must be positive", "pageSize");
            }

            long lBound = (long)pageIndex * pageSize;
            long uBound = lBound + pageSize - 1;

            if (uBound > System.Int32.MaxValue)
            {
                throw new ArgumentException("pageIndex*pageSize too large");
            }
            SQLiteConnection      holder   = new SQLiteConnection(_connectionString);
            ProfileInfoCollection profiles = new ProfileInfoCollection();
            SQLiteDataReader      reader   = null;

            holder.Open();
            SQLiteCommand cmd = new SQLiteCommand(sqlQuery, holder);
            int           len = args.Length;

            for (int iter = 0; iter < len; iter++)
            {
                reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
            }
            totalRecords = 0;
            while (reader.Read())
            {
                totalRecords++;
                if (totalRecords - 1 < lBound || totalRecords - 1 > uBound)
                {
                    continue;
                }

                string   username;
                DateTime dtLastActivity, dtLastUpdated;
                bool     isAnon;

                username       = reader.GetString(0);
                isAnon         = reader.GetBoolean(1);
                dtLastActivity = reader.GetDateTime(2);
                dtLastUpdated  = reader.GetDateTime(3);
                int size = reader.GetInt32(4);
                profiles.Add(new ProfileInfo(username, isAnon, dtLastActivity, dtLastUpdated, size));
            }
            holder.Close();
            return(profiles);
        }
Exemple #21
0
        /// <summary>
        /// Creates the profile info collection.
        /// </summary>
        /// <param name="profiles">The profiles.</param>
        /// <returns></returns>
        protected internal ProfileInfoCollection CreateProfileInfoCollection(IEnumerable <Profile> profiles)
        {
            ProfileInfoCollection collection = new ProfileInfoCollection();

            foreach (var p in profiles)
            {
                int size = p.Names.Length + p.ValuesString.Length + p.ValuesBinary.Length;
                collection.Add(new ProfileInfo(
                                   p.UserName, !p.Authenticated, p.LastUpdated, p.LastUpdated, size));
            }

            return(collection);
        }
        public static ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption profileAuthenticationOption, DateTime inactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection          infos    = new ProfileInfoCollection();
            List <SystemUserProfileEntity> profiles = businessProxy.GetAllInactiveProfiles(profileAuthenticationOption, inactiveSinceDate, pageIndex, pageSize, out totalRecords);

            foreach (SystemUserProfileEntity prof in profiles)
            {
                SystemUserEntity userEntity = userBusinessProxy.FindById(prof.UserID);

                infos.Add(new ProfileInfo(userEntity.UserLoginID, false, userEntity.LastActivityDate, prof.LastUpdatedDate, 2000));
            }
            return(infos);
        }
Exemple #23
0
        private static ProfileInfoCollection ExtractProfileInfoFromRows(List <dynamic> rows, out int totalRecords)
        {
            var profiles = new ProfileInfoCollection();

            totalRecords = 0;
            if (rows.Any())
            {
                totalRecords = GetTotalRecords(rows);
                rows.ForEach(row => profiles.Add(CreateProfileInfo(row)));
            }

            return(profiles);
        }
Exemple #24
0
        public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            var          connection = GetConnection();
            var          key        = string.Empty;
            var          min        = (double)userInactiveSinceDate.ToBinary();
            const double max        = double.MaxValue;

            switch (authenticationOption)
            {
            case ProfileAuthenticationOption.All:
                key = GetProfilesKey();
                break;

            case ProfileAuthenticationOption.Anonymous:
                key = GetProfilesKeyAnonymous();
                break;

            case ProfileAuthenticationOption.Authenticated:
                key = GetProfilesKeyAuthenticated();
                break;
            }

            var allUsersTask = connection.SortedSets.Range(_redisDb, key, min, max);
            var allUsers     = connection.Wait(allUsersTask);

            totalRecords = allUsers.Length;
            var start = pageIndex * pageSize;
            var users = allUsers.Skip(start).Take(pageSize);

            var collection = new ProfileInfoCollection();

            Parallel.ForEach(users, result =>
            {
                var profileResult   = new string(Encoding.UTF8.GetChars(result.Key));
                var parts           = profileResult.Split(':');
                var profileName     = parts[0];
                var isAuthenticated = Convert.ToBoolean(parts[1]);
                var profileTask     = connection.Hashes.GetAll(_redisDb, GetProfileKey(profileName, isAuthenticated));
                var profileDict     = connection.Wait(profileTask);
                if (profileDict.Count > 0)
                {
                    profileDict.Add("Username", Encoding.Unicode.GetBytes(profileName));
                    profileDict.Add("IsAuthenticated", BitConverter.GetBytes(isAuthenticated));
                    var user = CreateProfileInfoFromDictionary(profileDict);
                    collection.Add(user);
                }
            });

            return(collection);
        }
Exemple #25
0
        public ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption profileAuthenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection infos = new ProfileInfoCollection();

            SystemUserEntity user =
                this.DataObjectsContainerIocID.SystemUserDataObjectInstance.GetUserByLoginID(usernameToMatch);

            SystemUserProfileEntity prof = GetUserProfileByUserID(usernameToMatch);

            infos.Add(new ProfileInfo(user.UserLoginID, false, user.LastActivityDate, prof.LastUpdatedDate, prof.PropertyValuesBinary.Length + prof.PropertyValuesString.Length));
            totalRecords = 1;

            return(infos);
        }
Exemple #26
0
        /// <summary>
        /// *note method not supported on our custom profile provider, return empty profile
        /// </summary>
        ProfileInfoCollection GetProfileInfo(ProfileAuthenticationOption authenticationOption, string usernameToMatch, object userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            var profiles = new ProfileInfoCollection();

            profiles.Add(new ProfileInfo(
                             username: "",
                             isAnonymous: false,
                             lastActivityDate: DateTime.MinValue,
                             lastUpdatedDate: DateTime.MinValue,
                             size: 0));

            totalRecords = 0;

            return(profiles);
        }
        private ProfileInfoCollection GetProfiles(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime?userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            var query = GetQuery(authenticationOption, usernameToMatch, userInactiveSinceDate);

            totalRecords = (int)mongoCollection.Count(query);

            var profileInfoCollection = new ProfileInfoCollection();

            foreach (var bsonDocument in mongoCollection.FindAs <BsonDocument>(query).SetSkip(pageIndex * pageSize).SetLimit(pageSize))
            {
                profileInfoCollection.Add(ToProfileInfo(bsonDocument));
            }

            return(profileInfoCollection);
        }
        protected virtual ProfileInfoCollection GetProfileInfoCollection(IEnumerable <ISalesforceContact> contacts)
        {
            Assert.ArgumentNotNull(contacts, "contacts");

            var result = new ProfileInfoCollection();

            foreach (var contact in contacts)
            {
                this.Cache.Users.Add(contact);

                result.Add(new ProfileInfo(contact.Login, false, DateTime.Now, DateTime.Now, 0));
            }

            return(result);
        }
        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection profiles = new ProfileInfoCollection();
            UserList users = Bridge.GetUserContainer(false);

            if (users != null)
            {
                totalRecords = users.Children.Count;
                foreach (User u in users.GetChildren(new Collections.CountFilter(pageIndex * pageSize, pageSize)))
                {
                    profiles.Add(CreateProfile(u));
                }
            }
            totalRecords = 0;
            return(profiles);
        }
        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection profiles = new ProfileInfoCollection();
            User u = Bridge.GetUser(usernameToMatch);

            if (u != null)
            {
                totalRecords = 1;
                if (pageIndex == 0 && pageSize > 0)
                {
                    profiles.Add(CreateProfile(u));
                }
            }
            totalRecords = 0;
            return(profiles);
        }
 public override ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     ProfileInfoCollection profiles = new ProfileInfoCollection();
     FileInfo fi = this.GetProfileFile(usernameToMatch);
     if (fi != null && fi.Exists == true && fi.LastAccessTime < userInactiveSinceDate)
     {
         ProfileInfo profile = new ProfileInfo(usernameToMatch, false, fi.LastAccessTime, fi.LastWriteTime, GetProfileSize(fi));
         profiles.Add(profile);
     }
     totalRecords = profiles.Count;
     return profiles;
 }
    public ProfileInfoCollection FindProfilesByPropertyValue(SettingsProperty property, SearchOperator searchOperator, object value)
    {
        // instantiate an empty ProfileInfoCollection to use it for return
        ProfileInfoCollection pic = new ProfileInfoCollection();

        // try and open the connection and get the results
        try
        {
            // get the connection we're going to use
            using (SqlConnection conn = new SqlConnection(_connectionStringName))
            {

                // instantiate a SettingsPropertyValue from the property
                // to use it to serialize the value for comparison with the database
                SettingsPropertyValue spv = new SettingsPropertyValue(property);
                spv.PropertyValue = value;

                // set common parameters of the aspnet_Profile_FindProfiles stored procedure
                SqlCommand FindProfilesCommand = new SqlCommand("aspnet_Profile_FindProfiles", conn);
                FindProfilesCommand.CommandType = CommandType.StoredProcedure;
                FindProfilesCommand.CommandTimeout = _commandTimeout;
                FindProfilesCommand.Parameters.Add("@ApplicationName", System.Data.SqlDbType.NVarChar, 256).Value = base.ApplicationName;
                FindProfilesCommand.Parameters.Add("@PropertyName", System.Data.SqlDbType.NVarChar, 256).Value = property.Name;
                FindProfilesCommand.Parameters.Add("@OperatorType", System.Data.SqlDbType.Int).Value = (Int32)searchOperator;

                // if the serialized property value is of type string
                // carry on if the size is within allowed limits
                Boolean bTooBig = false;
                if (spv.SerializedValue is String)
                {
                    // if the serialized value is bigger than the PropertyValueString column's length
                    if (((String)spv.SerializedValue).Length > Int32.MaxValue)
                    {
                        bTooBig = true;
                    }
                    else
                    {
                        if (searchOperator == SearchOperator.Contains || searchOperator == SearchOperator.FreeText)
                        {
                            // if the searchOperator is a freetext operator then pass the value unaltered
                            FindProfilesCommand.Parameters.Add("@PropertyValueString",
                                System.Data.SqlDbType.NVarChar, Int32.MaxValue).Value = spv.PropertyValue;
                            FindProfilesCommand.Parameters.Add("@PropertyValueBinary",
                                System.Data.SqlDbType.VarBinary, Int32.MaxValue).Value = DBNull.Value;
                        }
                        else
                        {
                            // otherwise serialise the value before passing it
                            FindProfilesCommand.Parameters.Add("@PropertyValueString",
                                System.Data.SqlDbType.NVarChar, Int32.MaxValue).Value = spv.SerializedValue;
                            FindProfilesCommand.Parameters.Add("@PropertyValueBinary",
                                System.Data.SqlDbType.VarBinary, Int32.MaxValue).Value = DBNull.Value;
                        }

                        // set the parameter @PropertyType to indicate the property is a string
                        FindProfilesCommand.Parameters.Add("@PropertyType", System.Data.SqlDbType.Bit).Value = 0;
                    }
                }
                else
                {
                    if (((SqlBinary)spv.SerializedValue).Length > Int32.MaxValue)
                    {
                        bTooBig = true;
                    }
                    else
                    {
                        if (searchOperator == SearchOperator.Contains || searchOperator == SearchOperator.FreeText)
                        {
                            // if the searchOperator is a freetext operator then pass the value unaltered to the
                            // @PropertyValueString because we are passing a string anyway not a binary
                            FindProfilesCommand.Parameters.Add("@PropertyValueString",
                                System.Data.SqlDbType.NVarChar, Int32.MaxValue).Value = spv.PropertyValue;
                            FindProfilesCommand.Parameters.Add("@PropertyValueBinary",
                                System.Data.SqlDbType.VarBinary, Int32.MaxValue).Value = DBNull.Value;
                        }
                        else
                        {
                            // otherwise just serialise the value and pass it to the @PropertyBinaryValue
                            FindProfilesCommand.Parameters.Add("@PropertyValueString",
                                System.Data.SqlDbType.NVarChar, Int32.MaxValue).Value = DBNull.Value;
                            FindProfilesCommand.Parameters.Add("@PropertyValueBinary",
                                System.Data.SqlDbType.VarBinary, Int32.MaxValue).Value = spv.SerializedValue;
                        }

                        // set the parameter @PropertyType to indicate the property is a binary
                        FindProfilesCommand.Parameters.Add("@PropertyType", System.Data.SqlDbType.Bit).Value = 1;
                    }
                }

                if (bTooBig)
                {
                    // if the size is out of limits throw an exception
                    throw new ProviderException("Property value length is too big.");
                }

                // Open the database
                conn.Open();

                // Get a DataReader for the results we need
                using (SqlDataReader rdr = FindProfilesCommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (rdr.Read())
                    {
                        // create a ProfileInfo with the data you got back from the current record of the SqlDataReader
                        ProfileInfo pi = new ProfileInfo(rdr.GetString(rdr.GetOrdinal("UserName")),
                            rdr.GetBoolean(rdr.GetOrdinal("IsAnonymous")),
                            DateTime.SpecifyKind(rdr.GetDateTime(rdr.GetOrdinal("LastActivityDate")), DateTimeKind.Utc),
                            DateTime.SpecifyKind(rdr.GetDateTime(rdr.GetOrdinal("LastUpdatedDate")), DateTimeKind.Utc), 0);

                        // add the ProfileInfo you just created to the ProfileInfoCollection that we will return
                        pic.Add(pi);
                    }
                }
            }
        }
        catch (Exception e)
        {
            // if anything went wrong, throw an exception
            throw new ProviderException("An error occured while finding profiles with your search criteria!", e);
        }

        return pic;
    }
    //user made function for the next five functions to use
    private ProfileInfoCollection GetProfile(ProfileAuthenticationOption authenticationOption,
    string usernameToMatch, object userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
    {
        //MAS
        using (OrganizationService service = new OrganizationService(OurConnect()))
        {
            //Retrieve all profiles.

            ConditionExpression appCondition = new ConditionExpression();

            appCondition.AttributeName = consts.appname;
            appCondition.Operator = ConditionOperator.Equal;
            appCondition.Values.Add(_ApplicationName);

            FilterExpression filter = new FilterExpression();
            filter.Conditions.Add(appCondition);

            // If searching for a user name to match, add the command text and parameters.

            if (usernameToMatch != null)
            {
                ConditionExpression usernameCondition = new ConditionExpression();

                usernameCondition.AttributeName = consts.username;
                usernameCondition.Operator = ConditionOperator.Equal;
                usernameCondition.Values.Add(usernameToMatch);

                filter.Conditions.Add(usernameCondition);
            }

            // If searching for inactive profiles,
            // add the command text and parameters.

            if (userInactiveSinceDate != null)
            {
                ConditionExpression lastActivityCondition = new ConditionExpression();

                lastActivityCondition.AttributeName = consts.subject;
                lastActivityCondition.Operator = ConditionOperator.NotBetween;
                lastActivityCondition.Values.Add(userInactiveSinceDate);
                lastActivityCondition.Values.Add(DateTime.Now);

                filter.Conditions.Add(lastActivityCondition);
            }

            // If searching for a anonymous or authenticated profiles,
            // add the command text and parameters.
            ConditionExpression authenticationCondition = new ConditionExpression();

            switch (authenticationOption)
            {
              case ProfileAuthenticationOption.Anonymous:
                authenticationCondition.AttributeName = consts.isanonymous;
                authenticationCondition.Operator = ConditionOperator.Equal;
                authenticationCondition.Values.Add(true);
                break;
              case ProfileAuthenticationOption.Authenticated:
                authenticationCondition.AttributeName = consts.isanonymous;
                authenticationCondition.Operator = ConditionOperator.Equal;
                authenticationCondition.Values.Add(false);
                break;
              default:
                break;
            }

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            try
            {
                QueryExpression query = new QueryExpression(consts.userprofile);

                query.ColumnSet.AddColumn(consts.username);
                query.ColumnSet.AddColumn(consts.isanonymous);
                query.Criteria.AddFilter(filter);

                EntityCollection collection = service.RetrieveMultiple(query);

                totalRecords = collection.Entities.Count;

                if (totalRecords == 0) //No profiles
                    return null;
                else if (pageSize == 0)
                { //Count all profiles
                    for (int i = 0; i < totalRecords; i++)
                    {
                        ProfileInfo p = new ProfileInfo((string)collection.Entities[i][consts.username],
                                                        (bool)collection.Entities[i][consts.isanonymous],
                                                        lastActivity((string)collection.Entities[i][consts.username], String.Empty),
                                                        lastActivity((string)collection.Entities[i][consts.username], "Modified"),
                                                        0);
                        profiles.Add(p);
                    }
                    return profiles;
                }
                else
                { //All other functions
                    var start = pageSize * pageSize;
                    var end = (pageSize * pageSize) + (pageSize - (totalRecords % pageSize));
                    for (int i = start; i < end; i++)
                    {
                        ProfileInfo p = new ProfileInfo((string)collection.Entities[i][consts.username],
                                                        (bool)collection.Entities[i][consts.isanonymous],
                                                        lastActivity((string)collection.Entities[i][consts.username], String.Empty),
                                                        lastActivity((string)collection.Entities[i][consts.username], "Modified"),
                                                        0);
                        profiles.Add(p);
                    }
                    return profiles;
                }
            }

            catch (Exception e)
            {
                throw new Exception("Error in grabbing profiles.", e);//TODO: change exception type
            }
        }
    }
 public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
 {
     ProfileInfoCollection profiles = new ProfileInfoCollection();
     foreach (FileInfo fi in this.ProfileFiles)
     {
         if (fi != null && fi.Exists == true)
         {
             ProfileInfo profile = new ProfileInfo(this.GetUsernameFromFile(fi.Name), false, fi.LastAccessTime, fi.LastWriteTime, GetProfileSize(fi));
             profiles.Add(profile);
         }
     }
     totalRecords = profiles.Count;
     return profiles;
 }