public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            var connection = GetConnection();
            var min = (double)userInactiveSinceDate.ToBinary();
            const double max = double.MaxValue;
            var key = string.Empty;
            switch (authenticationOption)
            {
                case ProfileAuthenticationOption.All:
                    key = GetProfilesKey();
                    break;
                case ProfileAuthenticationOption.Anonymous:
                    key = GetProfilesKeyAnonymous();
                    break;
                case ProfileAuthenticationOption.Authenticated:
                    key = GetProfilesKeyAuthenticated();
                    break;
            }

            var inactiveUsersTask = connection.SortedSets.Range(_redisDb, key, min, max);
            var inactiveUsers = connection.Wait(inactiveUsersTask);
            var count = 0;

            Parallel.ForEach(inactiveUsers, result =>
            {
                var profileResult = new string(Encoding.Unicode.GetChars(result.Key));
                var parts = profileResult.Split(':');
                var username = parts[0];
                var isAuthenticated = Convert.ToBoolean(parts[1]);
                if (DeleteProfile(username, isAuthenticated))
                    Interlocked.Increment(ref count);
            });

            return count;
        }
Example #2
0
        ////////////////////////////////////////////////////////
        // Delete Inactive Profiles                           //
        //----------------------------------------------------//
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            int appId = GetApplicationId(new SqliteConnection(_connectionString));
            string inClause = "SELECT PKID FROM users WHERE ApplicationId ='" + appId + "' AND LastActivityDate <= '" + userInactiveSinceDate.ToString("yyyy:MM:dd hh:mm:ss") + "' " + GetClauseForAuthenticationOptions(authenticationOption);
            string sqlQuery = "DELETE FROM aspnet_Profile WHERE PKID IN (" + inClause + ")";
            SqliteConnection conn = new SqliteConnection(_connectionString);
            int Result;
            try
            {
                conn.Open();
                SqliteCommand cmd = new SqliteCommand(sqlQuery, conn);
                Result = cmd.ExecuteNonQuery();
                return Result;
            }
            catch (Exception e)
            {
                if (WriteExceptionsToEventLog)
                {
                    WriteToEventLog(e, "Delete Inactive Profiles");

                    throw new ProviderException(exceptionMessage);
                }
                else
                {
                    throw e;
                }
            }
            finally
            {
                conn.Close();

            }
        }
        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;

            using (var transaction = new TransactionScope(_connName))
            {
                var profileStore = DSSEOProfile.Create(_connName);

                IList<SEOProfile> users = profileStore.FindByFields(ApplicationName, null, userInactiveSinceDate,
                                                                    profileType, PagingInfo.All);

                profilesDeleted = users.Count;

                foreach (var user in users)
                {
                    profileStore.Delete(user.Id);
                }

                transaction.Commit();
            }

            return profilesDeleted;
        }
        public override ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            totalRecords = 0;

            var users = Enumerable.Empty<User>();
            ReturnResult returnResult;

            switch (authenticationOption)
            {
                case ProfileAuthenticationOption.Anonymous:
                    returnResult =this.mongoGateway.GetInactiveAnonymSinceByUserName(this.ApplicationName, usernameToMatch,
                        userInactiveSinceDate, pageIndex, pageSize).Result;
                    users = returnResult.Users;
                    totalRecords =(int)returnResult.TotalRecords;
                    break;
                case ProfileAuthenticationOption.Authenticated:
                case ProfileAuthenticationOption.All:
                    returnResult = this.mongoGateway.GetInactiveSinceByUserName(this.ApplicationName, usernameToMatch, userInactiveSinceDate, pageIndex, pageSize).Result;
                    users = returnResult.Users;
                    totalRecords =(int)returnResult.TotalRecords;
                    break;
            }

            return ToProfileInfoCollection(users);
        }
Example #5
0
        public int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            try
            {
                OleDbConnection conn = null;
                OleDbCommand cmd = null;
                try
                {
                    conn = new OleDbConnection(SqlHelper.ConnString);
                    conn.Open();

                    cmd = new OleDbCommand(GenerateQuery(true, authenticationOption), conn);
                    cmd.CommandTimeout = CommandTimeout;
                    cmd.Parameters.Add(CreateInputParam("@InactiveSinceDate", OleDbType.VarChar, userInactiveSinceDate.ToUniversalTime()));

                    return cmd.ExecuteNonQuery();
                }
                finally
                {
                    if (cmd != null)
                    {
                        cmd.Dispose();
                    }
                    if (conn != null)
                    {
                        conn.Close();
                        conn = null;
                    }
                }
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        ///     When overridden in a derived class, deletes all user-profile data for profiles in which the last activity date
        ///     occurred before the specified date.
        /// </summary>
        /// <returns>
        ///     The number of profiles deleted from the data source.
        /// </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 deleted.
        /// </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>
        ///     value of a user profile occurs on or before this date and time, the profile is considered inactive.
        /// </param>
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption,
            DateTime userInactiveSinceDate)
        {
            SessionWrapper sessionWrapper = SessionManager.GetSessionWrapper();

            try
            {
                switch (authenticationOption)
                {
                    case ProfileAuthenticationOption.Anonymous:
                        return
                            MemberShipFactory.CreateProfileDao().DeleteAnonymous(
                                userInactiveSinceDate);
                    case ProfileAuthenticationOption.Authenticated:
                        return
                            MemberShipFactory.CreateProfileDao().DeleteAuthenticated(
                                userInactiveSinceDate);
                    default:
                        return MemberShipFactory.CreateProfileDao().Delete(userInactiveSinceDate);
                }
            }
            finally
            {
                sessionWrapper.Close();
            }
        }
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            OnDebug(this, name + ".DeleteInactiveProfiles()");

            int output = 0;

            try
            {
                IWcfProfileProvider remoteProvider = RemoteProvider();
                output = remoteProvider.DeleteInactiveProfiles(authenticationOption, userInactiveSinceDate);
                DisposeRemoteProvider(remoteProvider);
                OnLog(this, name + ": Deleted " + output.ToString() + " profiles inactive since " + userInactiveSinceDate.ToString("u") + ".");
            }
            catch (Exception ex)
            {
                if (!OnError(this, ex))
                {
                    throw;
                }

                output = 0;
            }

            return output;
        }
        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 (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ProfileUserDataStore 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 DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     try
     {
         AccessConnectionHolder holder = AccessConnectionHelper.GetConnection(_DatabaseFileName, true);
         try
         {
             string inClause = @"SELECT UserId FROM aspnet_Users " +
                 @"WHERE ApplicationId = @AppId AND LastActivityDate <= @LastActivityDate " + GetClauseForAuthenticationOptions(authenticationOption);
             string sqlQuery = @"DELETE FROM aspnet_Profile WHERE UserId IN (" + inClause + ")";
             OleDbCommand cmd = new OleDbCommand(sqlQuery, holder.Connection);
             cmd.Parameters.Add(new OleDbParameter("@AppId", GetApplicationId(holder)));
             cmd.Parameters.Add(CreateDateTimeOleDbParameter("@LastActivityDate", userInactiveSinceDate));
             return cmd.ExecuteNonQuery();
         }
         catch (Exception e)
         {
             throw AccessConnectionHelper.GetBetterException(e, holder);
         }
         finally
         {
             holder.Close();
         }
     }
     catch
     {
         throw;
     }
 }
        /// <summary>
        /// When overridden in a derived class, deletes all user-profile data for profiles in which the last activity date occurred before the specified date.
        /// </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 deleted.</param>
        /// <param name="userInactiveSinceDate">A <see cref="T:System.DateTime"/> that identifies which user profiles are considered inactive. If the <see cref="P:System.Web.Profile.ProfileInfo.LastActivityDate"/>  value of a user profile occurs on or before this date and time, the profile is considered inactive.</param>
        /// <returns>
        /// The number of profiles deleted from the data source.
        /// </returns>
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            SQLiteConnection cn = GetDBConnectionForProfile();
            try
            {
                using (SQLiteCommand cmd = cn.CreateCommand())
                {
                    cmd.CommandText = "DELETE FROM " + PROFILE_TB_NAME + " WHERE UserId IN (SELECT UserId FROM " + USER_TB_NAME
                    + " WHERE ApplicationId = $ApplicationId AND LastActivityDate <= $LastActivityDate"
                    + GetClauseForAuthenticationOptions(authenticationOption) + ")";

                    cmd.Parameters.AddWithValue("$ApplicationId", _applicationId);
                    cmd.Parameters.AddWithValue("$LastActivityDate", userInactiveSinceDate);

                    if (cn.State == ConnectionState.Closed)
                        cn.Open();

                    return cmd.ExecuteNonQuery();
                }
            }
            finally
            {
                if (!IsTransactionInProgress())
                    cn.Dispose();
            }
        }
        /// <summary>
        /// Deletes all user-profile data for profiles in which the last activity date occurred before the specified date.
        /// </summary>
        /// <param name="authenticationOption">One of the System.Web.Profile.ProfileAuthenticationOption values, specifying whether anonymous, authenticated, or both types of profiles are deleted.</param>
        /// <param name="userInactiveSinceDate">A System.DateTime that identifies which user profiles are considered inactive. If the System.Web.Profile.ProfileInfo.LastActivityDate value of a user profile occurs on or before this date and time, the profile is considered inactive.</param>
        /// <returns>The number of profiles deleted from the data source.</returns>
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            string[] userArray = new string[0];
            dal.GetInactiveProfiles((int)authenticationOption, userInactiveSinceDate, ApplicationName).CopyTo(userArray, 0);

            return DeleteProfiles(userArray);
        }
Example #12
0
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            var userIds = "";
            var anon = false;
            switch (authenticationOption) {
                case ProfileAuthenticationOption.Anonymous:
                    anon = true;
                    break;
                case ProfileAuthenticationOption.Authenticated:
                    anon = false;
                    break;
                default:
                    break;
            }
            try {
                var profs = profiles.GetInactiveProfiles(ApplicationName, userInactiveSinceDate, anon);

                if (profs != null) {
                    userIds = profs.Aggregate(userIds, (current, p) => current + (p.Id.ToString() + ","));
                }
            } catch (Exception ex) {
                if (WriteExceptionsToEventLog)
                    WriteToEventLog(ex, "DeleteInactiveProfiles");
                else
                    throw;
            }
            if (userIds.Length > 0)
                userIds = userIds.Substring(0, userIds.Length - 1);
            return DeleteProfilesbyId(userIds.Split(','));
        }
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            try {
                SqlConnectionHolder holder = null;
                try
                {
                    holder = SqlConnectionHelper.GetConnection(_sqlConnectionString, true);
                    CheckSchemaVersion( holder.Connection );

                    //MySqlCommand cmd = new MySqlCommand("dbo.aspnet_Profile_DeleteInactiveProfiles", holder.Connection);

                    //cmd.CommandTimeout = CommandTimeout;
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.Add(CreateInputParam("@ApplicationName", SqlDbType.NVarChar, ApplicationName));
                    //cmd.Parameters.Add(CreateInputParam("@ProfileAuthOptions", SqlDbType.Int, (int) authenticationOption));
                    //cmd.Parameters.Add(CreateInputParam("@InactiveSinceDate", SqlDbType.DateTime, userInactiveSinceDate.ToUniversalTime()));

                    object o = MySqlStoredProcedures.aspnet_Profile_DeleteInactiveProfiles(ApplicationName,
                            (int)authenticationOption, userInactiveSinceDate, holder);

                    if (o == null || !(o is int))
                        return 0;
                    return (int) o;
                }
                finally {
                    if( holder != null )
                    {
                        holder.Close();
                        holder = null;
                    }
                }
            } catch {
                throw;
            }
        }
 public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption,DateTime userInactiveSinceDate)
 {
     var isAnonymous = authenticationOption == ProfileAuthenticationOption.Anonymous;
     return UnitOfWork.Current.CreateRepository<Profile>().Delete(p =>
         p.ApplicationName == ApplicationName
         && p.LastActivityDate == userInactiveSinceDate
         && p.IsAnonymous == isAnonymous);
 }
Example #15
0
 public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     var users = dbContext.UserSet.Where(u => u.LastActivityTime < userInactiveSinceDate);
     foreach (var user in users)
     {
         dbContext.UserSet.Remove(user);
     }
     return dbContext.SaveChanges();
 }
        public void GivenConfirmedUsersWhenGetNumberOfInactiveProfilesThenNotSupportedException(ProfileAuthenticationOption option)
        {
            // arrange
            var testClass = new BetterProfileProvider();

            // act // assert
            Assert.Throws<NotSupportedException>(
                () => testClass.GetNumberOfInactiveProfiles(option, DateTime.MinValue));
        }
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            int totalRecords;
            ProfileInfoCollection profileInfoCollection = GetAllInactiveProfiles(authenticationOption,
                                                                                 userInactiveSinceDate,
                                                                                 0,
                                                                                 int.MaxValue,
                                                                                 out totalRecords);

            return DeleteProfiles(profileInfoCollection);
        }
        public void GivenConfirmedUsersWhenFindUsersbyUserNameThenThrowNotSupportedException(
            ProfileAuthenticationOption option)
        {
            // arrange
            var testClass = new BetterProfileProvider();

            // act // assert
            int totalRecords1;
            Assert.Throws<NotSupportedException>(
                () => testClass.FindProfilesByUserName(option, "value", 0, 10, out totalRecords1));
        }
 public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     int result = 0;
     List<Profile> profiles = (List<Profile>)NHibernateHelper.FindByNamedQuery("Profile.GetByLastUpdate", userInactiveSinceDate, NHibernateUtil.DateTime);
     result = profiles.Count;
     foreach (var prof in profiles)
     {
         NHibernateHelper.Delete(prof);
     }
     return result;
 }
 //private IProfileService _profileService;
 //#endregion Fields
 //#region Properties
 //public IApplicationService ApplicationService
 //{
 //    set { _applicationService = value; }
 //}
 //public IUserService UserService
 //{
 //    set { _userService = value; }
 //}
 //public IProfileService ProfileService
 //{
 //    set { _profileService = value; }
 //}
 //#endregion Properties
 //#region Initialization
 //public override void Initialize(string name, NameValueCollection config)
 //{
 //    // Initialize values from Web.config.
 //    if (null == config)
 //    {
 //        throw (new ArgumentNullException("config"));
 //    }
 //    if (string.IsNullOrEmpty(name))
 //    {
 //        name = "NHibernateProfileProvider";
 //    }
 //    if (string.IsNullOrEmpty(config["description"]))
 //    {
 //        config.Remove("description");
 //        config.Add("description", "NHibernate Profile Provider");
 //    }
 //    base.Initialize(name, config);
 //    application =
 //        _applicationService.CreateOrLoadApplication(
 //            ConfigurationUtil.GetConfigValue(config["applicationName"], HostingEnvironment.ApplicationVirtualPath));
 //}
 //#endregion Initialization
 //#region Operations
 public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     int result = 0;
     //List<Profile> profiles = (List<Profile>)_profileService.GetByLastUpdate(userInactiveSinceDate); //.FindByNamedQuery<Profile>("Profile.GetByLastUpdate", userInactiveSinceDate, NHibernateUtil.DateTime);
     //result = profiles.Count;
     //foreach (var prof in profiles)
     //{
     //    _profileService.DeleteProfile(prof);
     //}
     return result;
 }
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            var query = Query.And(Query.EQ("ApplicationName", this.ApplicationName), Query.LTE("LastActivityDate", userInactiveSinceDate));

            if (authenticationOption != ProfileAuthenticationOption.All)
            {
                query = Query.And(query, Query.EQ("IsAnonymous", authenticationOption == ProfileAuthenticationOption.Anonymous));
            }

            return (int)this.mongoCollection.Remove(query).DocumentsAffected;
        }
        public void GivenConfirmedUsersWhenGetAllInactiveProfilesThenNotSupportedException(ProfileAuthenticationOption option)
        {
            // arrange
            var testClass = new BetterProfileProvider();

            // act // assert
            int totalRecords;
            Assert.Throws<NotSupportedException>(
                () =>
                testClass.GetAllInactiveProfiles(
                    option, DateTime.MinValue, 0, 10, out totalRecords));
        }
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            if (authenticationOption == ProfileAuthenticationOption.Anonymous)
            {
                ExceptionReporter.ThrowArgument("PROFILE", "NOANONYMOUS");
            }

            // just clear the whole thing...
            ClearUserProfileCache();

            return DB.Current.__DeleteInactiveProfiles( this.ApplicationName, userInactiveSinceDate);
        }
 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)
 {
     if (pageIndex < 0)
         throw new ArgumentException("Page index must 0 or greater.");
     if (pageSize < 1)
         throw new ArgumentException("Page size must be greater than 0.");
     return GetProfileInfo(authenticationOption, usernameToMatch,null, pageIndex, pageSize, out totalRecords);
 }
Example #26
0
 public static int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     try
     {
         businessProxy.DeleteInactiveProfiles(authenticationOption, userInactiveSinceDate);
         return 1;
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return 0;
     }
 }
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption,
            DateTime userInactiveSinceDate)
        {
            SqlDatabase sqlDatabase = new SqlDatabase(_connectionString);
            DbCommand dbCommand = sqlDatabase.GetStoredProcCommand("adm.NlayerSP_EliminarPerfilesInactivos");

            sqlDatabase.AddInParameter(dbCommand, "Aplicacion", DbType.String, _applicationName);
            sqlDatabase.AddInParameter(dbCommand, "UltimaActividad", DbType.DateTime, userInactiveSinceDate);

            int deleteCount = (int) sqlDatabase.ExecuteScalar(dbCommand);

            return deleteCount;
        }
Example #28
0
 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 static ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     if (pageIndex < 0)
     {
         throw new ArgumentException(System.Web.SR.GetString("PageIndex_bad"), "pageIndex");
     }
     if (pageSize < 1)
     {
         throw new ArgumentException(System.Web.SR.GetString("PageSize_bad"), "pageSize");
     }
     SecUtility.CheckParameter(ref usernameToMatch, true, true, false, 0, "usernameToMatch");
     return Provider.FindInactiveProfilesByUserName(authenticationOption, usernameToMatch, userInactiveSinceDate, pageIndex, pageSize, out totalRecords);
 }
 public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     int count = 0;
     foreach (FileInfo fi in ProfileFiles)
     {
         if (fi.Exists == true && fi.LastAccessTime < userInactiveSinceDate)
         {
             fi.Delete();
             count++;
         }
     }
     return count;
 }
Example #31
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>
 /// <param name="authenticationOption">One of the System.Web.Profile.ProfileAuthenticationOption values, specifying
 /// whether anonymous, authenticated, or both types of profiles are returned.</param>
 /// <param name="userInactiveSinceDate">A System.DateTime that identifies which user profiles are considered inactive.
 /// If the System.Web.Profile.ProfileInfo.LastActivityDate of a user 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 System.Web.Profile.ProfileInfoCollection containing user-profile information
 /// about the inactive profiles.</returns>
 public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption,
                                                              DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     return(_profileProvider.GetAllInactiveProfiles(authenticationOption, userInactiveSinceDate, pageIndex, pageSize, out totalRecords));
 }
 public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     Engine.Logger.Warn("ContentProfileProvider.GetAllInactiveProfiles Not Implemented");
     totalRecords = 0;
     return(new ProfileInfoCollection());
 }
 public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     Engine.Logger.Warn("ContentProfileProvider.DeleteInactiveProfiles Not Implemented");
     return(0);
 }
Example #34
0
 public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
 {
     throw new NotImplementedException();
 }
Example #35
0
 public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
 {
     throw new NotImplementedException();
 }
 public static ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     return(default(ProfileInfoCollection));
 }
 public static ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch)
 {
     return(default(ProfileInfoCollection));
 }
Example #38
0
        public ProfileInfoCollection GetAllInactiveProfiles(string applicationName, ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            _Provider.ApplicationName = _ApplicationName;

            return(_Provider.GetAllInactiveProfiles(authenticationOption, userInactiveSinceDate, pageIndex, pageSize, out totalRecords));
        }
Example #39
0
        public ProfileInfoCollection GetAllProfiles(string applicationName, ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            _Provider.ApplicationName = _ApplicationName;

            return(_Provider.GetAllProfiles(authenticationOption, pageIndex, pageSize, out totalRecords));
        }
Example #40
0
        public int GetNumberOfInactiveProfiles(string applicationName, ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            _Provider.ApplicationName = _ApplicationName;

            return(_Provider.GetNumberOfInactiveProfiles(authenticationOption, userInactiveSinceDate));
        }
        /// <summary>
        /// System.Web.Profile.ProfileProvider methods.
        /// </summary>
        #region System.Web.Security.ProfileProvider methods

        /// <summary>
        /// ProfileProvider.DeleteInactiveProfiles
        /// </summary>
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            throw new NotImplementedException("DeleteInactiveProfiles: The method or operation is not implemented.");
        }
 public override ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     throw new NotImplementedException("FindInactiveProfilesByUserName: The method or operation is not implemented.");
 }
 public static ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate)
 {
     return(default(ProfileInfoCollection));
 }
Example #44
0
        public ProfileInfoCollection FindInactiveProfilesByUserName(string applicationName, ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            _Provider.ApplicationName = _ApplicationName;

            return(_Provider.FindInactiveProfilesByUserName(authenticationOption, usernameToMatch, userInactiveSinceDate, pageIndex, pageSize, out totalRecords));
        }
        public static ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            totalRecords = default(int);

            return(default(ProfileInfoCollection));
        }
 public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     SqlParameter[] args = new SqlParameter[1];
     args[0] = CreateInputParam("@InactiveSinceDate", SqlDbType.DateTime, userInactiveSinceDate.ToUniversalTime());
     return(GetProfilesForQuery(args, authenticationOption, pageIndex, pageSize, out totalRecords));
 }
        public static ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            totalRecords = default(int);

            return(default(ProfileInfoCollection));
        }
 public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
 {
     return(GetProfilesForQuery(new SqlParameter[0], authenticationOption, pageIndex, pageSize, out totalRecords));
 }
Example #49
0
 public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     throw new NotImplementedException();
 }
        private ProfileInfoCollection GetProfilesForQuery(SqlParameter[] args, ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            if (pageIndex < 0)
            {
                throw new ArgumentException(SecurityMessage.GetString(SecurityMessage.PageIndex_bad), "pageIndex");
            }
            if (pageSize < 1)
            {
                throw new ArgumentException(SecurityMessage.GetString(SecurityMessage.PageSize_bad), "pageSize");
            }

            long upperBound = (long)pageIndex * pageSize + pageSize - 1;

            if (upperBound > Int32.MaxValue)
            {
                throw new ArgumentException(SecurityMessage.GetString(SecurityMessage.PageIndex_PageSize_bad), "pageIndex and pageSize");
            }

            ParamsHelper parms = new ParamsHelper();

            parms.Add(CreateInputParam("@ApplicationName", SqlDbType.NVarChar, ApplicationName));
            parms.Add(CreateInputParam("@ProfileAuthOptions", SqlDbType.Int, (int)authenticationOption));
            parms.Add(CreateInputParam("@PageIndex", SqlDbType.Int, pageIndex));
            parms.Add(CreateInputParam("@PageSize", SqlDbType.Int, pageSize));
            foreach (SqlParameter arg in args)
            {
                parms.Add(arg);
            }

            ProfileInfoCollection profiles = new ProfileInfoCollection();

            totalRecords = 0;

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.SqlProviderConnString, CommandType.StoredProcedure, "dbo.Aspnet_Profile_GetProfiles", parms.ToArray()))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        string   username;
                        DateTime dtLastActivity, dtLastUpdated;
                        bool     isAnon;

                        username       = reader.GetString(0);
                        isAnon         = reader.GetBoolean(1);
                        dtLastActivity = DateTime.SpecifyKind(reader.GetDateTime(2), DateTimeKind.Local);
                        dtLastUpdated  = DateTime.SpecifyKind(reader.GetDateTime(3), DateTimeKind.Local);
                        int size = reader.GetInt32(4);
                        profiles.Add(new ProfileInfo(username, isAnon, dtLastActivity, dtLastUpdated, size));
                    }

                    totalRecords = profiles.Count;
                    if (reader.NextResult())
                    {
                        if (reader.Read())
                        {
                            totalRecords = reader.GetInt32(0);
                        }
                    }
                }
            }

            return(profiles);
        }
Example #51
0
 public override int GetNumberOfInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     throw new NotImplementedException();
 }
Example #52
0
 /// <summary>
 /// When overridden in a derived class, retrieves user profile data for all profiles
 /// in the data source.
 /// </summary>
 /// <param name="authenticationOption">One of the 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>
 /// <returns>A System.Web.Profile.ProfileInfoCollection containing user-profile information
 /// for all profiles in the data source.</returns>
 public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
 {
     return(_profileProvider.GetAllProfiles(authenticationOption, pageIndex, pageSize, out totalRecords));
 }
 public override ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
 {
     Engine.Logger.Warn("ContentProfileProvider.FindInactiveProfilesByUserName Not Implemented");
     totalRecords = 0;
     return(new ProfileInfoCollection());
 }
 public static int GetNumberOfProfiles(ProfileAuthenticationOption authenticationOption)
 {
     return(default(int));
 }
Example #55
0
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            StringBuilder insertQuery = GenerateTempInsertQueryForGetProfiles(authenticationOption);

            return(GetProfilesForQuery(null, pageIndex, pageSize, insertQuery, out totalRecords));
        }
 public static int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     return(default(int));
 }
 public static ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption)
 {
     return(default(ProfileInfoCollection));
 }
Example #58
0
 /// <summary>
 /// When overridden in a derived class, returns the number of profiles in which
 /// the last activity date occurred on or before the specified date.
 /// </summary>
 /// <param name="authenticationOption">One of the System.Web.Profile.ProfileAuthenticationOption values, specifying
 /// whether anonymous, authenticated, or both types of profiles are returned.</param>
 /// <param name="userInactiveSinceDate">A System.DateTime that identifies which user profiles are considered inactive.
 /// If the System.Web.Profile.ProfileInfo.LastActivityDate of a user profile
 /// occurs on or before this date and time, the profile is considered inactive.</param>
 /// <returns>The number of profiles in which the last activity date occurred on or before
 /// the specified date.</returns>
 public override int GetNumberOfInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
 {
     return(_profileProvider.GetNumberOfInactiveProfiles(authenticationOption, userInactiveSinceDate));
 }
 public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
 {
     throw new NotImplementedException("GetAllProfiles: The method or operation is not implemented.");
 }
        public static ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            totalRecords = default(int);

            return(default(ProfileInfoCollection));
        }