Ejemplo n.º 1
0
        /// <summary>
        /// Get all inactive profiles.
        /// </summary>
        /// <param name="lastActivityDate">The last activity date to go back to.</param>
        /// <returns>The array of profiles that are inactive.</returns>
        private Nequeo.DataAccess.CloudInteraction.Data.Profile[] GetInactiveProfiles(DateTime lastActivityDate)
        {
            // Get the profiles.
            Nequeo.DataAccess.CloudInteraction.Data.Profile[] profiles =
                new Nequeo.DataAccess.CloudInteraction.Data.Extension.Profile().Select.
                SelectDataEntitiesPredicate(u =>
                                            (u.ApplicationName == ApplicationName) &&
                                            (u.LastActivityDate <= lastActivityDate)
                                            );

            // Return the prifiles.
            return(profiles);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete the profile
        /// </summary>
        /// <param name="username">The username.</param>
        /// <returns>True if complete; else false.</returns>
        private bool DeleteProfile(string username)
        {
            // Attempt to delete the user.
            bool ret = new Nequeo.DataAccess.CloudInteraction.Data.Extension.Profile().
                       Delete.DeleteItemPredicate(
                u =>
                (u.Username == username) &&
                (u.ApplicationName == ApplicationName)
                );

            // Return the result of the deletion.
            return(ret);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get the specific profile for the current application.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <returns>The profile; else null.</returns>
        private Nequeo.DataAccess.CloudInteraction.Data.Profile GetSpecificProfile(string username)
        {
            // Get the user data.
            Nequeo.DataAccess.CloudInteraction.Data.Extension.Profile profileExt = new Nequeo.DataAccess.CloudInteraction.Data.Extension.Profile();
            Nequeo.DataAccess.CloudInteraction.Data.Profile           profile    =
                profileExt.Select.SelectDataEntity(
                    u =>
                    (u.Username == username) &&
                    (u.ApplicationName == ApplicationName)
                    );

            // Return the profile.
            return(profile);
        }
Ejemplo n.º 4
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 System.Web.Profile.ProfileInfoCollection GetAllProfiles(System.Web.Profile.ProfileAuthenticationOption authenticationOption,
                                                                       int pageIndex, int pageSize, out int totalRecords)
        {
            ProfileInfoCollection profileInfoCol = new ProfileInfoCollection();

            Nequeo.DataAccess.CloudInteraction.Data.Extension.Profile profile = new Nequeo.DataAccess.CloudInteraction.Data.Extension.Profile();

            // Get all the profiles for the match.
            long profilesMatched = 0;
            int  skipNumber      = (pageIndex * pageSize);

            // Get the current set on data.
            IQueryable <Data.Profile> profileData = null;

            // Select the authentication option
            switch (authenticationOption)
            {
            case ProfileAuthenticationOption.Anonymous:
                profileData = profile.Select.QueryableProvider().
                              Where(u =>
                                    (u.ApplicationName == ApplicationName) && (u.IsAnonymous == true)).
                              OrderBy(u => u.Username).
                              Take(pageSize).
                              Skip(skipNumber);

                profilesMatched = profile.Select.GetRecordCount(u => (u.ApplicationName == ApplicationName) && (u.IsAnonymous == true));
                totalRecords    = Int32.Parse(profilesMatched.ToString());
                break;

            case ProfileAuthenticationOption.Authenticated:
                profileData = profile.Select.QueryableProvider().
                              Where(u =>
                                    (u.ApplicationName == ApplicationName) && (u.IsAnonymous == false)).
                              OrderBy(u => u.Username).
                              Take(pageSize).
                              Skip(skipNumber);

                profilesMatched = profile.Select.GetRecordCount(u => (u.ApplicationName == ApplicationName) && (u.IsAnonymous == false));
                totalRecords    = Int32.Parse(profilesMatched.ToString());
                break;

            default:
                // Get all the profiles for the match.
                profilesMatched = profile.Select.GetRecordCount(
                    u =>
                    (u.ApplicationName == ApplicationName));

                // Get the total number of uses.
                totalRecords = Int32.Parse(profilesMatched.ToString());

                // Get the current set on data.
                profileData = profile.Select.QueryableProvider().
                              Where(u =>
                                    (u.ApplicationName == ApplicationName)).
                              OrderBy(u => u.Username).
                              Take(pageSize).
                              Skip(skipNumber);
                break;
            }

            // For each profile found.
            if (profileData != null)
            {
                foreach (Data.Profile item in profileData)
                {
                    // Create the membership user.
                    System.Web.Profile.ProfileInfo profileUser =
                        new System.Web.Profile.ProfileInfo(
                            item.Username,
                            item.IsAnonymous.Value,
                            item.LastActivityDate.Value,
                            item.LastUpdatedDate.Value,
                            0);

                    // Add the profile to the collection.
                    profileInfoCol.Add(profileUser);
                }
            }

            // Return the collection of profile users.
            return(profileInfoCol);
        }