private void SignIn_useEmailToLogin() { if (txtEmail.Text == "") { MessageBox.Show("Email field can not be empty."); return; } if (!FormatChecking.Password(txtPassword.Text)) { return; } if (!DataBaseControl.MatchingEmail_OfAllTable(txtEmail.Text)) { MessageBox.Show("Email does not exist"); return; } user = LoginByEmailAndPassword(txtEmail.Text, txtPassword.Text); if (user == User.Quit) { MessageBox.Show("Email or Password is wrong."); return; } userEmail = txtEmail.Text; Close(); }
private void SignUp() { if (txtUserAccountName.Text == "") { MessageBox.Show("User Account Name should not be empty."); return; } if (txtPassword.Text == "") { MessageBox.Show("User Account Name should not be empty."); return; } bool anyError = false; if (!FormatChecking.UserName(txtUserAccountName.Text)) { anyError = true; } if (!FormatChecking.Password(txtPassword.Text)) { anyError = true; } if (anyError) { CleanUpTextBox(); return; } if (DataBaseControl.MatchingAccountName_OfAllTable(txtUserAccountName.Text)) { MessageBox.Show("Sorry, the User Account Name has been used."); return; } if (txtEmail.Text != "" && PlayerDataBaseControl.MatchingEmail(txtEmail.Text)) { MessageBox.Show("Sorry, the Email has been used."); return; } PlayerDataBaseControl.Insert(txtUserAccountName.Text, txtPassword.Text, txtEmail.Text); userAccountName = txtUserAccountName.Text; userEmail = txtEmail.Text; PlayerDataBaseControl.playerAccountName = userAccountName; PlayerDataBaseControl.Load_PlayerID_By_PlayerAccountName(); user = User.Player; Close(); }
private void SignIn_useUserNameToLogin() { bool anyError = false; if (!FormatChecking.UserName(txtUserAccountName.Text)) { anyError = true; } if (!FormatChecking.Password(txtPassword.Text)) { anyError = true; } if (anyError) { return; } if (!DataBaseControl.MatchingAccountName_OfAllTable(txtUserAccountName.Text)) { MessageBox.Show("User Account Name does not exist."); return; } user = LoginByAccountNameAndPassword(txtUserAccountName.Text, txtPassword.Text); if (user == User.Quit) { MessageBox.Show("User Account Name or Password is wrong."); return; } userAccountName = txtUserAccountName.Text; userEmail = txtEmail.Text; Close(); }