當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。