private void LoadAdminUserDetail() { var id = Convert.ToInt32(Request.QueryString["id"]); var adminUser = _adminUserBll.GetAdminUserById(id); if (adminUser == null) { Response.Redirect("Default.aspx"); } txtUserName.Text = adminUser.UserName; txtPassword.Text = adminUser.Password; txtEmail.Text = adminUser.Email; txtFullName.Text = adminUser.UserName; chkbActive.Checked = adminUser.Active; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(BitcoinSession.AdminUser.ToString())) { var _adminUser = _adminUserBll.GetAdminUserById(BitcoinSession.AdminUser); if (_adminUser != null) { Response.Redirect("Default.aspx"); } } } }
protected void rptAdminUser_ItemCommand(object source, RepeaterCommandEventArgs e) { var adminUserId = e.Item.FindControl("hfAdminUserId") as HiddenField; if (e.CommandName == "Edit") { Response.Redirect("Edit.aspx?id=" + adminUserId.Value); } if (e.CommandName == "Delete") { var adminUser = _adminUserBll.GetAdminUserById(Convert.ToInt32(adminUserId.Value)); if (adminUser == null) { throw new ArgumentNullException("adminUser"); } _adminUserBll.DeleteAdminUser(adminUser); LoadAllAdminUsers(); } }
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); } } }