private void EnterButton_Click(object sender, EventArgs e) { if ((UserIdText.Text.Length != 6 || PasswordText.Text.Length != 8)) { MessageBox.Show("Account Number should be 6 character. Password should be 8 character, Please Try Again.", "Notice", MessageBoxButtons.OK); UserIdText.Clear(); PasswordText.Clear(); } else { if ((client = AccountHolders.FindClient(UserIdText.Text, "Account Number")) == null) { MessageBox.Show("Account Number or Password is Incorrect, Please Try Again.", "Notice", MessageBoxButtons.OK); PasswordText.Clear(); } else { if (client.Check(PasswordText.Text) && client.IsLocked()) { AccountScreen accountScreen = new AccountScreen(UserIdText.Text); this.Hide(); accountScreen.Show(); PasswordText.Clear(); } else { Logger(); MessageBox.Show("Account Number or Password is Incorrect, Please Try Again.", "Notice", MessageBoxButtons.OK); PasswordText.Clear(); } } } }
private void UserIdText_TextChanged(object sender, EventArgs e) { if (!(String.IsNullOrEmpty(UserIdText.Text))) { if (!(Char.IsDigit(UserIdText.Text[UserIdText.Text.Length - 1]))) { MessageBox.Show("Please Enter The Number!", "Notice", MessageBoxButtons.OK); string newUserId = ""; for (int i = 0; i < UserIdText.Text.Length - 1; ++i) { newUserId += UserIdText.Text[i]; } UserIdText.Text = newUserId; UserIdText.Select(UserIdText.Text.Length, 0); } } }
public void EnterUserId(string UserId) { UserIdText.Set(UserId); }