private Boolean isValid() { Boolean isValidated = true; if (String.IsNullOrEmpty(TxtUsername.Text)) { isValidated = false; MessageBox.Show("Username can not be blank!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtUsername.Select(); } else if (String.IsNullOrEmpty(TxtPassword.Text)) { isValidated = false; MessageBox.Show("Password can not be blank!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtPassword.Select(); } return(isValidated); }
private void BtnLogin_Click(object sender, EventArgs e) { string name; string password = TxtPassword.Text; if (dba.GetEmployeAuth(TxtUserName.Text.Trim(), EncriptLib.SimpleCrypt(password))) { sessionMonitor.ExecuteLoginSession_SP(Properties.Settings.Default.UserID); Properties.Settings.Default.LastUser = TxtUserName.Text; Properties.Settings.Default.Save(); this.Hide(); name = TxtUserName.Text.ToLower(); WorkFlowMenagement main = new WorkFlowMenagement(); main.Show(); Properties.Settings.Default.Save(); } else { MessageBox.Show("Youe 'UserName' Or 'Password' is incorrect....!", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2); TxtPassword.Select(0, TxtPassword.TextLength); } }