Ejemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (_adminUserBll.CheckUserNameExists(txtUserName.Text))
     {
         DisplayMessage.ShowMessage("Username already registered, please choose a another username !", Page);
         return;
     }
     else if (_adminUserBll.CheckEmailExists(txtEmail.Text))
     {
         DisplayMessage.ShowMessage("Email already registered, please choose a another email !", Page);
         return;
     }
     else
     {
         AddNewAdminUser();
         ClearControls.ClearControl(this);
         DisplayMessage.ShowMessage("Inserted successfully !", Page);
     }
 }
    private void ChangePassword()
    {
        var id = BitcoinSession.AdminUser;

        if (id != 0)
        {
            var adminUser = _adminUserBll.GetAdminUserById(id);
            if (adminUser == null)
            {
                throw new ArgumentNullException("adminUser");
            }
            if (adminUser.Password != MD5Password.MD5Hash(txtCurrentPassword.Text))
            {
                DisplayMessage.ShowMessage("Your current password is not valid !", Page);
            }
            else
            {
                adminUser.Password = MD5Password.MD5Hash(txtNewPassword.Text);
                _adminUserBll.UpdateAdminUser(adminUser);
                ClearControls.ClearControl(this);
                DisplayMessage.ShowMessage("You have been changed password successfully !", Page);
            }
        }
    }