protected void btnUpdate_Click(object sender, EventArgs e) { var adminUser = _adminUserBll.GetAdminUserById(Convert.ToInt32(Request.QueryString["id"])); if (adminUser == null) { throw new ArgumentNullException("adminUser"); } else { adminUser.Password = txtPassword.Text != adminUser.Password ? MD5Password.MD5Hash(txtPassword.Text) : adminUser.Password; adminUser.Email = txtEmail.Text; adminUser.FullName = txtFullName.Text; adminUser.Active = chkbActive.Checked; _adminUserBll.UpdateAdminUser(adminUser); DisplayMessage.ShowMessage("Updated 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); } } }