当前位置: 首页>>代码示例>>C#>>正文


C# MembershipUserCollection.Add方法代码示例

本文整理汇总了C#中System.Web.Security.MembershipUserCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MembershipUserCollection.Add方法的具体用法?C# MembershipUserCollection.Add怎么用?C# MembershipUserCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Security.MembershipUserCollection的用法示例。


在下文中一共展示了MembershipUserCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_PreRender

        private void Page_PreRender()
        {
            MembershipUserCollection allUsers = Membership.GetAllUsers();
            MembershipUserCollection filteredUsers = new MembershipUserCollection();

            if (UserRoles.SelectedIndex > 0)
            {
                string[] usersInRole = Roles.GetUsersInRole(UserRoles.SelectedValue);
                foreach (MembershipUser user in allUsers)
                {
                    foreach (string userInRole in usersInRole)
                    {
                        if (userInRole == user.UserName)
                        {
                            filteredUsers.Add(user);
                            break; // Breaks out of the inner foreach loop to avoid unneeded checking.
                        }
                    }
                }
            }
            else
            {
                filteredUsers = allUsers;
            }
            Users.DataSource = filteredUsers;
            Users.DataBind();
        }
开发者ID:pijix,项目名称:CallCenter,代码行数:27,代码来源:UsersByRole.aspx.cs

示例2: GetMembershipUsers

 public virtual MembershipUserCollection GetMembershipUsers(string providerName)
 {
     MembershipUserCollection muc = new MembershipUserCollection();
     foreach (User u in Children)
     {
         muc.Add(u.GetMembershipUser(providerName));
     }
     return muc;
 }
开发者ID:spmason,项目名称:n2cms,代码行数:9,代码来源:UserList.cs

示例3: GetAllUsers

        public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
        {
            var col = new MembershipUserCollection();

            foreach (MembershipUser user in base.GetAllUsers(pageIndex, pageSize, out totalRecords)) {
                col.Add(GetUser(user.UserName, false));
            }

            return col;
        }
开发者ID:felipecsl,项目名称:dover,代码行数:10,代码来源:UACMembershipProvider.cs

示例4: GetHybridMembershipUserCollection

		private MembershipUserCollection GetHybridMembershipUserCollection(MembershipUserCollection membershipUserCollection) {
			if(membershipUserCollection == null) {
				return null;
			}
			var hybridMembershipUserCollection = new MembershipUserCollection();
			foreach(System.Web.Security.MembershipUser membershipUser in membershipUserCollection) {
				hybridMembershipUserCollection.Add(GetHybridMembershipUser(membershipUser));
			}
			return hybridMembershipUserCollection;
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:10,代码来源:HybridMembershipProvider.cs

示例5: CreateCollection

		public virtual MembershipUserCollection CreateCollection(IEnumerable<IEntry> entries) {
			var users = new MembershipUserCollection();
			foreach(var result in entries) {
				var user = Create(result);
				if(user != null) {
					users.Add(user);
				}
			}
			return users;
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:10,代码来源:LdapMembershipUserFactory.cs

示例6: GetAllUsers

        public MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
        {
            var collection = new MembershipUserCollection();
            foreach (User user in _userMgr.GetAllUsers())
            {
                collection.Add(new COATMemebershipUser(user));
            }

            totalRecords = collection.Count;
            return collection;
        }
开发者ID:MyRSG,项目名称:COAT,代码行数:11,代码来源:UserRepository.cs

示例7: ToMembershipUserCollection

        public static MembershipUserCollection ToMembershipUserCollection(this IEnumerable<User> users)
        {
            MembershipUserCollection membershipUsers = new MembershipUserCollection();

            foreach (User user in users)
            {
                membershipUsers.Add(user.ToMembershipUser());
            }

            return membershipUsers;
        }
开发者ID:ThomasSchmidt,项目名称:MixedStuff,代码行数:11,代码来源:MembershipExtensions.cs

示例8: Show

        public ActionResult Show()
        {
            MembershipUserCollection friendsList = new MembershipUserCollection();

            var friends = friendshipRepo.ListAllFriendships((Guid)currentUser.ProviderUserKey);
            foreach (var f in friends)
            {
                MembershipUser theFriend = Membership.GetUser(f.FriendId);
                friendsList.Add(theFriend);
            }
            return View(friendsList);
        }
开发者ID:feedme,项目名称:FeedMe,代码行数:12,代码来源:FriendsController.cs

示例9: GetOnlineUsers

        /// <summary>
        /// Return a MembershipUserCollection of currently online users
        /// </summary>
        /// <returns></returns>
        public static MembershipUserCollection GetOnlineUsers()
        {
            MembershipUserCollection members = System.Web.Security.Membership.GetAllUsers();
            MembershipUserCollection onlineMembers = new MembershipUserCollection();

            foreach (MembershipUser user in members)
            {
                if (user.IsOnline)
                    onlineMembers.Add(user);
            }

            return onlineMembers;
        }
开发者ID:runin2k1,项目名称:DrivingBarefoot,代码行数:17,代码来源:OnlineMembersWrapper.cs

示例10: GetAllUserWithSelectUser

        public static MembershipUserCollection GetAllUserWithSelectUser()
        {
            MembershipUserCollection misUsuariosConOtro = new MembershipUserCollection();
            MembershipUserCollection misUsuarios = Membership.GetAllUsers();

            if (misUsuarios == null) return null;

            MembershipUser miOtroUsuario = null;
            foreach (MembershipUser miUsuario in misUsuarios)
            {
                miOtroUsuario = new MembershipUser(
                    miUsuario.ProviderName,
                    "[Seleccione un usuario...]",
                    miUsuario.ProviderUserKey,
                    miUsuario.Email,
                    miUsuario.PasswordQuestion,
                    miUsuario.Comment,
                    miUsuario.IsApproved,
                    miUsuario.IsLockedOut,
                    miUsuario.CreationDate,
                    miUsuario.LastLoginDate,
                    miUsuario.LastActivityDate,
                    miUsuario.LastPasswordChangedDate,
                    miUsuario.LastLockoutDate);
                break;
            }

            misUsuariosConOtro.Add(miOtroUsuario);

            foreach (MembershipUser miUsuario in misUsuarios)
            {
                misUsuariosConOtro.Add(miUsuario);
            }

            return misUsuariosConOtro;
        }
开发者ID:carlosalbertoai,项目名称:AplicacionComercialWEB,代码行数:36,代码来源:Utilidades.cs

示例11: Page_PreRender

 private void Page_PreRender()
 {
     MembershipUserCollection allUsers = Membership.GetAllUsers();
     MembershipUserCollection filteredUsers = new MembershipUserCollection();
     bool isLockedOut = true;
     foreach (MembershipUser user in allUsers)
     {
         if (user.IsLockedOut == isLockedOut)
         {
             filteredUsers.Add(user);
         }
     }
     Users.DataSource = filteredUsers;
     Users.DataBind();
 }
开发者ID:pijix,项目名称:CallCenter,代码行数:15,代码来源:LockedUsers.aspx.cs

示例12: FindUsersByPredicate

        public static MembershipUserCollection FindUsersByPredicate(this Expression<Func<DataAccess.Login, bool>> predicate, int pageIndex, int pageSize, out int totalRecords)
        {
            MembershipUserCollection returnValue = new MembershipUserCollection();
            totalRecords = 0;

            using (var db = new DataAccess.CSSDataContext())
            {
                var logins = db.Logins.Where(predicate);

                totalRecords = logins.Count();

                foreach (var login in logins.Skip(pageIndex * pageSize).Take(pageSize))
                {
                    returnValue.Add(MembershipUserUtility.CreateMembershipUserFromLogin(login));
                }
            }

            return returnValue;
        }
开发者ID:LordBlacksun,项目名称:Allegiance-Community-Security-System,代码行数:19,代码来源:MembershipUserUtility.cs

示例13: GetAllMembershipUsers

 public static MembershipUserCollection GetAllMembershipUsers(string PROVIDERNAME, int pageIndex, int pageSize, out int totalRecords)
 {
     DbEntities entities = new DbEntities();
       MembershipUserCollection result = new MembershipUserCollection();
       try
       {
     IQueryable<appusers> listaTotalUsuarios = from users in entities.appusers
                                          select users;
     foreach (appusers u in listaTotalUsuarios)
     {
       result.Add(u.GetMembershipUser(PROVIDERNAME));
     }
       }
       catch (Exception e)
       {
     throw new Exception(string.Format("MSG:{0}\nINNER:{2}\nSTACK:{1}", e.Message, e.StackTrace, e.InnerException));
       }
       totalRecords = result.Count;
       return result;
 }
开发者ID:frpatino6,项目名称:Alertas,代码行数:20,代码来源:appUsers.cs

示例14: Page_PreRender

 private void Page_PreRender()
 {
     MembershipUserCollection allUsers = Membership.GetAllUsers();
     MembershipUserCollection filteredUsers = new MembershipUserCollection();
     bool isActive;
     if (active.SelectedValue == "Active")
     {
         isActive = true;
     }
     else
     {
         isActive = false;
     }
     foreach (MembershipUser user in allUsers)
     {
         if (user.IsApproved == isActive)
         {
             filteredUsers.Add(user);
         }
     }
     Users.DataSource = filteredUsers;
     Users.DataBind();
 }
开发者ID:pijix,项目名称:CallCenter,代码行数:23,代码来源:ActiveUsers.aspx.cs

示例15: FindUsersByName

        public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            var users = new MembershipUserCollection();
            var Db = GetDb();
            var q = from u in Db.Users select u;

            bool left = usernameToMatch.StartsWith("%");
            bool right = usernameToMatch.EndsWith("%");
            usernameToMatch = usernameToMatch.Trim('%');
            if (left && right)
                q = q.Where(u => u.Username.Contains(usernameToMatch));
            else if (left)
                q = q.Where(u => u.Username.EndsWith(usernameToMatch));
            else if (right)
                q = q.Where(u => u.Username.StartsWith(usernameToMatch));

            totalRecords = q.Count();
            q = q.OrderBy(u => u.Username).Skip(pageIndex * pageSize).Take(pageSize);
            foreach (var u in q)
                users.Add(GetMu(u));
            return users;
        }
开发者ID:rossspoon,项目名称:bvcms,代码行数:22,代码来源:CMSMembershipProvider.cs


注:本文中的System.Web.Security.MembershipUserCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。