예제 #1
0
        protected void btnUpdateUser_Click(object sender, EventArgs e)
        {
            MDBUser u = MDBUser.GetUser(txtUsername.Text);

            if (u.IsLockedOut && !chkbxLocked.Checked && chkbxResetPassword.Checked)
            {
                SetMessage("Password kan ikke nulstilles uden at låse brugeren op", true);
            }
            else
            {
                u.Firstname = txtFirstname.Text;
                u.Lastname  = txtLastname.Text;
                u.Type      = (MDBUser.UserType) int.Parse(ddlType.SelectedValue);
                u.Enabled   = chkbxEnabled.Checked;
                string newPassword = u.Save(chkbxLocked.Checked, chkbxResetPassword.Checked);

                if (chkbxResetPassword.Checked)
                {
                    SetMessage($"Bruger gemt og password nulstillet til: {newPassword}");
                }
                else
                {
                    SetMessage($"Bruger gemt");
                }

                chkbxResetPassword.Checked = false;

                if (chkbxLocked.Checked)
                {
                    chkbxLocked.Checked = false;
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMsg.Visible = false;

            if (!IsPostBack)
            {
                string username = Page.RouteData.Values["username"].ToString();
                if (!String.IsNullOrWhiteSpace(username))
                {
                    MDBUser u = MDBUser.GetUser(username);
                    FillInfo(u);

                    if (u == null)
                    {
                        SetMessage("Bruger findes ikke", true);
                    }
                }
                else
                {
                    FillInfo();
                }
            }
        }