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


C# MembershipUser类代码示例

本文整理汇总了C#中MembershipUser的典型用法代码示例。如果您正苦于以下问题:C# MembershipUser类的具体用法?C# MembershipUser怎么用?C# MembershipUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetByUser

 /// <summary>
 /// Return notifications for a specified user
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public IList<CategoryNotification> GetByUser(MembershipUser user)
 {
     var cacheKey = string.Concat(CacheKeys.CategoryNotification.StartsWith, "GetByUser-", user.Id);
     return _cacheService.CachePerRequest(cacheKey, () => _context.CategoryNotification
                                                                 .Where(x => x.User.Id == user.Id)
                                                                 .ToList());
 }
开发者ID:lenwen,项目名称:mvcforum,代码行数:12,代码来源:CategoryNotificationService.cs

示例2: SnitzMembershipUser

 public SnitzMembershipUser(MembershipUser mu, int posts,string country)
 {
     this.mu = mu;
     Posts = posts;
     Title = mu.Comment;
     Country = country;
 }
开发者ID:huwred,项目名称:SnitzDotNet,代码行数:7,代码来源:SnitzMembershipUser.cs

示例3: btnUpdate_Click

        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UserPresenter userPresenter = (UserPresenter)this.DataContext;
                MembershipUser membershipUser = new MembershipUser();
                DeepClone.CopyTo((MembershipUser)(userPresenter.View.dataGridUsers.SelectedItem), membershipUser);

                UserEditPresenter userEditPresenter = new UserEditPresenter(new UserEditView(), membershipUser);
                userEditPresenter.View.Label_AddOrEditUser.Content = "Edytowanie użytkownika";
                if (membershipUser.is_active) { userEditPresenter.View.ComboBox_active.SelectedValue = "TAK"; }
                else { userEditPresenter.View.ComboBox_active.SelectedValue = "NIE"; }
                if (userEditPresenter.View.ShowDialog() == true)
                {
                    membershipUser.creation_date = DateTime.Now;
                    userPresenter.SaveUser(membershipUser, true);
                    MembershipUser temp = (MembershipUser)userPresenter.View.dataGridUsers.SelectedItem;
                    ChangeCurrentRow(userPresenter, userEditPresenter, temp);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:pawelsorsa,项目名称:Fixed-Assets-System,代码行数:25,代码来源:UserView.xaml.cs

示例4: Delete

 public void Delete(MembershipUser user, PointsFor type, Guid referenceId)
 {
     var mp = _context.MembershipUserPoints.Include(x => x.User).Where(x => x.User.Id == user.Id && x.PointsFor == type && x.PointsForId == referenceId);
     var mpoints = new List<MembershipUserPoints>();
     mpoints.AddRange(mp);
     Delete(mpoints);
 }
开发者ID:lenwen,项目名称:mvcforum,代码行数:7,代码来源:MembershipUserPointsService.cs

示例5: sendMail

    private void sendMail(MembershipUser user)
    {
        MailMessage mailMessage = new MailMessage();
        mailMessage.From = new MailAddress("[email protected]");
        mailMessage.Subject = "Welcome To Tom's List";
        mailMessage.To.Add(new MailAddress(user.Email));

        Guid userId = (Guid)user.ProviderUserKey;
        string body = "";
        using (StreamReader reader = new StreamReader(Server.MapPath("~/Templates/NewAccountTemplate.html")))
        {
            body = reader.ReadToEnd();
        }

        body = body.Replace("<%UserName%>", user.UserName);

        string baseUrl = Request.Url.GetLeftPart(UriPartial.Authority) + (Request.ApplicationPath.Equals("/") ? "" : Request.ApplicationPath);
        string verifyUrl = "/Views/AccountVerify.aspx?ID=" + userId.ToString();

        body = body.Replace("<%VerifyUrl%>", baseUrl + verifyUrl);
        mailMessage.Body = body;
        mailMessage.IsBodyHtml = true;

        new SmtpClient().Send(mailMessage);
    }
开发者ID:bduong,项目名称:toms-list,代码行数:25,代码来源:Login.aspx.cs

示例6: MembershipUserIdentity

 public MembershipUserIdentity(MembershipUser user)
 {
     _user = user;
     if (Roles.Enabled)
     {
         _roles = Roles.GetRolesForUser(user.UserName);
     }
 }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:8,代码来源:MembershipUserIdentity.cs

示例7: AddNewPost

        /// <summary>
        /// Add a new post
        /// </summary>
        /// <param name="postContent"> </param>
        /// <param name="topic"> </param>
        /// <param name="user"></param>
        /// <param name="permissions"> </param>
        /// <returns>True if post added</returns>
        public Post AddNewPost(string postContent, Topic topic, MembershipUser user, out PermissionSet permissions)
        {
            // Get the permissions for the category that this topic is in
            permissions = _roleService.GetPermissions(topic.Category, UsersRole(user));

            // Check this users role has permission to create a post
            if (permissions[SiteConstants.Instance.PermissionDenyAccess].IsTicked || permissions[SiteConstants.Instance.PermissionReadOnly].IsTicked)
            {
                // Throw exception so Ajax caller picks it up
                throw new ApplicationException(_localizationService.GetResourceString("Errors.NoPermission"));
            }

            // Has permission so create the post
            var newPost = new Post
                               {
                                   PostContent = postContent,
                                   User = user,
                                   Topic = topic,
                                   IpAddress = StringUtils.GetUsersIpAddress(),
                                   DateCreated = DateTime.UtcNow,
                                   DateEdited = DateTime.UtcNow
                               };

            // Sort the search field out

            var category = topic.Category;
            if (category.ModeratePosts == true)
            {
                newPost.Pending = true;
            }

            var e = new PostMadeEventArgs { Post = newPost };
            EventManager.Instance.FireBeforePostMade(this, e);

            if (!e.Cancel)
            {
                // create the post
                Add(newPost);

                // Update the users points score and post count for posting
                _membershipUserPointsService.Add(new MembershipUserPoints
                                                     {
                                                         Points = _settingsService.GetSettings().PointsAddedPerPost,
                                                         User = user,
                                                         PointsFor = PointsFor.Post,
                                                         PointsForId = newPost.Id
                                                     });

                // add the last post to the topic
                topic.LastPost = newPost;

                EventManager.Instance.FireAfterPostMade(this, new PostMadeEventArgs { Post = newPost });

                return newPost;
            }

            return newPost;
        }
开发者ID:lenwen,项目名称:mvcforum,代码行数:66,代码来源:PostService.cs

示例8: GenerateMappedRecord

 public static Activity GenerateMappedRecord(MembershipUser user)
 {
     return new Activity
     {
         Data = KeyUserId + Equality + user.Id,
         Timestamp = user.CreateDate,
         Type = ActivityType.MemberJoined.ToString()
     };
 }
开发者ID:R3MUSDevPack,项目名称:Forums,代码行数:9,代码来源:MemberJoinedActivity.cs

示例9: GenerateMappedRecord

 public static Activity GenerateMappedRecord(MembershipUser user, DateTime modified)
 {
     return new Activity
     {
         Data = KeyUserId + Equality + user.Id,
         Timestamp = modified,
         Type = ActivityType.ProfileUpdated.ToString()
     };
 }
开发者ID:R3MUSDevPack,项目名称:Forums,代码行数:9,代码来源:ProfileUpdatedActivity.cs

示例10: GetUserStatus

 protected string GetUserStatus(MembershipUser user)
 {
     if (user.IsApproved == false)
         return "NOT APPROVED";
     else if (user.IsLockedOut)
         return "LOCKED";
     else
         return "Active";
 }
开发者ID:Learion,项目名称:BruceToolSet,代码行数:9,代码来源:UserList.aspx.cs

示例11: GenerateMappedRecord

 public static Activity GenerateMappedRecord(Badge badge, MembershipUser user, DateTime timestamp)
 {
     return new Activity
                {
                    // badge=badgeId,user=userId
                    Data = KeyBadgeId + Equality + badge.Id + Separator + KeyUserId + Equality + user.Id,
                    Timestamp = timestamp,
                    Type = ActivityType.BadgeAwarded.ToString()
                };
 }
开发者ID:R3MUSDevPack,项目名称:Forums,代码行数:10,代码来源:BadgeActivity.cs

示例12: GetByUserAndTag

 public IList<TagNotification> GetByUserAndTag(MembershipUser user, TopicTag tag, bool addTracking = false)
 {
     var notifications = _context.TagNotification
        .Where(x => x.User.Id == user.Id && x.Tag.Id == tag.Id);
     if (addTracking)
     {
         return notifications.ToList();
     }
     return notifications.AsNoTracking().ToList();
 }
开发者ID:lenwen,项目名称:mvcforum,代码行数:10,代码来源:TagNotificationService.cs

示例13: GetByUserAndCategory

 /// <summary>
 /// Return notifications for a specified user and category
 /// </summary>
 /// <param name="user"></param>
 /// <param name="category"></param>
 /// <param name="addTracking"></param>
 /// <returns></returns>
 public IList<CategoryNotification> GetByUserAndCategory(MembershipUser user, Category category, bool addTracking = false)
 {
     var cacheKey = string.Concat(CacheKeys.CategoryNotification.StartsWith, "GetByUserAndCategory-", user.Id, "-", category.Id, "-", addTracking);
     return _cacheService.CachePerRequest(cacheKey, () =>
     {
         var notifications = _context.CategoryNotification.Where(x => x.Category.Id == category.Id && x.User.Id == user.Id);
         if (addTracking)
         {
             return notifications.ToList();
         }
         return notifications.AsNoTracking().ToList();
     });
 }
开发者ID:lenwen,项目名称:mvcforum,代码行数:20,代码来源:CategoryNotificationService.cs

示例14: ResetPassword_OnClick

    public void ResetPassword_OnClick(object sender, EventArgs args)
    {
        string newPassword;
        u = Membership.GetUser(UsernameTextBox.Text, false);

        if (u == null)
        {
            Msg.Text = "Username " + Server.HtmlEncode(UsernameTextBox.Text) + " not found. Please check the value and re-enter.";
            return;
        }

        try
        {
            newPassword = u.ResetPassword(AnswerTextBox.Text);
        }
        catch (MembershipPasswordException e)
        {
            Msg.Text = "Invalid password answer. Please re-enter and try again.";
            return;
        }
        catch (Exception e)
        {
            Msg.Text = e.Message;
            return;
        }

        if (newPassword != null)
        {
            Msg.Text = "Password reset. Your new password is: " + Server.HtmlEncode(newPassword);
        }
        else
        {
            Msg.Text = "Password reset failed. Please re-enter your values and try again.";
        }
    }
开发者ID:haithemaraissia,项目名称:Done,代码行数:35,代码来源:ResetPassword.aspx.cs

示例15: FuddleUser

 public FuddleUser(string username)
 {
     SqlConnection conn = new SqlConnection(connString);
     this.user = Membership.GetUser(username);
     this.id = (Guid)user.ProviderUserKey;
     this.username = username;
 }
开发者ID:btevfik,项目名称:Fuddle,代码行数:7,代码来源:FuddleUser.cs


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