public override System.Web.Profile.ProfileInfoCollection FindProfilesByUserName(System.Web.Profile.ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            using (var Entities = Repository)
            {
                pageIndex = pageIndex < 1 ? 1 : pageIndex;
                Guid applicationInstance = Guid.Parse(ApplicationName);
                System.Web.Profile.ProfileInfoCollection profiles = new System.Web.Profile.ProfileInfoCollection();
                var members = Entities.
                    ApplicationInstance_v1_0
                    .Single(i => i.instanceUID == applicationInstance)
                    .Membership_v1_0.Where(m => m.Users_v1_0.email == usernameToMatch && m.Users_v1_0.isAnonymous == (authenticationOption == System.Web.Profile.ProfileAuthenticationOption.Anonymous || authenticationOption == System.Web.Profile.ProfileAuthenticationOption.All));

                totalRecords = members.Count();

                members.Skip((pageIndex - 1) * pageSize)
                    .ToList().ForEach(m =>
                    {
                        profiles.Add(new System.Web.Profile.ProfileInfo(m.Users_v1_0.email, m.Users_v1_0.isAnonymous, m.Users_v1_0.lastActivityDate.Value, m.Profile_v1_0.Max(p => p.LastUpdatedDate), m.Profile_v1_0.Count()));
                    });
                return profiles;
            }
        }
Beispiel #2
0
 public override System.Web.Profile.ProfileInfoCollection GetAllProfiles(System.Web.Profile.ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
 {
     System.Web.Profile.ProfileInfoCollection piCol = new System.Web.Profile.ProfileInfoCollection();
     using (DataSet ds = this.OpenXml())
     {
         DataTable dt = ds.Tables["Profile"];
         totalRecords = dt.Rows.Count;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             DataRow   dr         = dt.Rows[i];
             DataRow[] drProfData = ds.Tables["ProfileData"].Select(string.Format("ProfileId = '{0}'", dr["ProfileId"]));
             int       profSz     = 0;
             for (int j = 0; j < drProfData.Length; j++)
             {
                 profSz += drProfData[j]["PropertyValue"].ToString().Length;
             }
             System.Web.Profile.ProfileInfo pi = new System.Web.Profile.ProfileInfo((string)dr["UserName"], (bool)dr["IsAnonymous"], (DateTime)dr["LastActivityDate"], (DateTime)dr["LastUpdatedDate"], profSz);
             piCol.Add(pi);
         }
     }
     return(piCol);
 }
Beispiel #3
0
        public override System.Web.Profile.ProfileInfoCollection GetAllProfiles(System.Web.Profile.ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            using (var Entities = Repository)
            {
                pageIndex = pageIndex < 1 ? 1 : pageIndex;
                Guid applicationInstance = Guid.Parse(ApplicationName);
                System.Web.Profile.ProfileInfoCollection profiles = new System.Web.Profile.ProfileInfoCollection();
                var members = Entities.
                              ApplicationInstance_v1_0
                              .Single(i => i.instanceUID == applicationInstance)
                              .Membership_v1_0;

                totalRecords = members.Count();

                members.Skip((pageIndex - 1) * pageSize)
                .ToList().ForEach(m =>
                {
                    profiles.Add(new System.Web.Profile.ProfileInfo(m.Users_v1_0.email, m.Users_v1_0.isAnonymous, m.Users_v1_0.lastActivityDate.Value, m.Profile_v1_0.Max(p => p.LastUpdatedDate), m.Profile_v1_0.Count()));
                });
                return(profiles);
            }
        }
 /// <summary>
 /// Apaga os perfis informados.
 /// </summary>
 /// <param name="profiles"></param>
 /// <returns></returns>
 public override int DeleteProfiles(System.Web.Profile.ProfileInfoCollection profiles)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
 public override int DeleteProfiles(System.Web.Profile.ProfileInfoCollection profiles)
 {
     throw new Exception("The method or operation is not implemented.");
 }
        public override System.Web.Profile.ProfileInfoCollection GetAllProfiles(System.Web.Profile.ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            System.Web.Profile.ProfileInfoCollection retval = new System.Web.Profile.ProfileInfoCollection();
            try
            {
                IList<Profile> list = Profile.Search<Profile>(QrySearchProfiles.Query(authenticationOption, Application.ID, pageIndex, pageSize));
                totalRecords = (int)QrySearchProfiles.QueryCount(authenticationOption, Application.ID).UniqueResult<int>();

                foreach (Profile p in list)
                {
                    retval.Add(p.User.ToProfileInfo());
                }
            }
            catch (Exception ex)
            {
                throw new ProviderException("Unable to find inactive profiles", ex);
            }

            return retval;
        }
        public override System.Web.Profile.ProfileInfoCollection FindProfilesByUserName(System.Web.Profile.ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            if (string.IsNullOrEmpty(usernameToMatch))
                throw new ArgumentException("Username to match by cannot be empty", "usernameToMatch");

            System.Web.Profile.ProfileInfoCollection retval = new System.Web.Profile.ProfileInfoCollection();
            try
            {
                string matchOn = usernameToMatch.Replace("?", "_").Replace("*", "%");
                IList<Profile> list = Profile.Search<Profile>(QrySearchProfiles.Query(authenticationOption, matchOn, Application.ID, pageIndex, pageSize));
                totalRecords = (int)QrySearchProfiles.QueryCount(authenticationOption, matchOn, Application.ID).UniqueResult<int>();

                foreach (Profile p in list)
                {
                    retval.Add(p.User.ToProfileInfo());
                }
            }
            catch (Exception ex)
            {
                throw new ProviderException("Unable to find inactive profiles", ex);
            }

            return retval;
        }
 public override System.Web.Profile.ProfileInfoCollection GetAllProfiles(System.Web.Profile.ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
 {
     System.Web.Profile.ProfileInfoCollection piCol = new System.Web.Profile.ProfileInfoCollection();
     using (DataSet ds = this.OpenXml())
     {
         DataTable dt = ds.Tables["Profile"];
         totalRecords = dt.Rows.Count;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             DataRow dr = dt.Rows[i];
             DataRow[] drProfData = ds.Tables["ProfileData"].Select(string.Format("ProfileId = '{0}'", dr["ProfileId"]));
             int profSz = 0;
             for (int j = 0; j < drProfData.Length; j++)
                 profSz += drProfData[j]["PropertyValue"].ToString().Length;
             System.Web.Profile.ProfileInfo pi = new System.Web.Profile.ProfileInfo((string)dr["UserName"], (bool)dr["IsAnonymous"], (DateTime)dr["LastActivityDate"], (DateTime)dr["LastUpdatedDate"], profSz);
             piCol.Add(pi);
         }
     }
     return piCol;
 }