コード例 #1
0
        protected void UpdateBtn_Click(object sender, EventArgs e)
        {
            var userManager = new UserManager(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);

            var oldUserInfo = userManager.GetUserInformationById(new Guid(UserId.Value));
            oldUserInfo.FirstName = Prenume.Text;
            oldUserInfo.LastName = Nume.Text;
            oldUserInfo.IsAsoc = Asociatie.Checked;
            oldUserInfo.UserCod = CodUser.SelectedValue;
            userManager.UpdateUser(oldUserInfo);
            
            var membership = Membership.Providers["PortalProvider"].GetUser(oldUserInfo.UserId,false);
            if (membership != null)
            {
                if (!Locked.Checked)
                    membership.UnlockUser();
                membership.Email = Email.Text;
                Membership.Providers["PortalProvider"].UpdateUser(membership);
            }

            Response.Redirect("~/EditareUseri.aspx");
        }
コード例 #2
0
    protected void UpdateUser(object sender, EventArgs e)
    {
        var userManager = new UserManager(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);

        var oldUserInfo = userManager.GetUserInformationById(new Guid(UserId.Value));
        oldUserInfo.FirstName = Prenume.Text;
        oldUserInfo.LastName = Nume.Text;
        oldUserInfo.UserCod = UserCodLbl.Text;
        userManager.UpdateUser(oldUserInfo);

        var membership = Membership.Providers["PortalProvider"].GetUser(oldUserInfo.UserId, false);
        if (membership != null)
        {
            membership.Email = Email.Text;
            Membership.Providers["PortalProvider"].UpdateUser(membership);
        }

        Response.Redirect(string.Format("~/DetailsFerme.aspx?ID={0}", IdFerma.Text));
    }