private void cmdOK_Click(object sender, EventArgs e) { if (isValidInput()) { SecurityManager.ChangePassword(SecurityManager.EncodePassword(txtNewPassword.Text)); MessageBox.Show(Messages.Confirm.ProcessFinished); this.Close(); } }
private void cmdLogin_Click(object sender, EventArgs e) { this.Enabled = false; if (txtUserName.Text.Trim().Length > 0) { bool isAuthenticate = SecurityManager.IsAuthenticate(txtUserName.Text, SecurityManager.EncodePassword(txtPassword.Text), "ISAShowroomDb"); if (isAuthenticate) { SecurityManager.RecordLoginHistory(); this.DialogResult = DialogResult.OK; if (SecurityManager.IsLogin == true) { this.Visible = true; MessageBox.Show(SecurityManager.GetUserLogin(txtUserName.Text.Trim()), "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Enabled = true; return; } this.Visible = false; frmMain ifrmMain = new frmMain(); Program.MainForm = ifrmMain; ifrmMain.Show(); } else { if (SecurityManager.IsExist(txtUserName.Text)) { SecurityManager.RecordLoginAttempt(txtUserName.Text); } MessageBox.Show(Messages.Confirm.LoginFailed); } } this.Enabled = true; }