private void FormLogin_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { l.contact = TextBoxUser.Text.Trim(); l.password = TextBoxPass.Text.Trim(); int success = l_dal.loginCheck(l); if (success == 1) { MessageBox.Show("Login success(user)"); contact = TextBoxUser.Text; username = l.first_name; FormMainUser s = new FormMainUser(); s.Show(); this.Hide(); } if (success == 2) { MessageBox.Show("Login success(taxi)"); contact = TextBoxUser.Text; username = l_dal.login_user(l); FormMainTaxi s = new FormMainTaxi(); s.Show(); this.Hide(); } if (success == 0) { MessageBox.Show("Login failed"); } e.Handled = true; } }
private void ButtonLogin_Click_1(object sender, EventArgs e) { l.contact = TextBoxUser.Text.Trim(); l.password = TextBoxPass.Text.Trim(); int success = l_dal.loginCheck(l); if (success == 1) { MessageBox.Show("Login success(user)"); contact = TextBoxUser.Text; username = l.first_name; FormMainUser s = new FormMainUser(); s.Show(); this.Hide(); } if (success == 2) { MessageBox.Show("Login success(taxi)"); contact = TextBoxUser.Text; username = l_dal.login_user(l); FormMainTaxi s = new FormMainTaxi(); s.Show(); this.Hide(); } if (success == 0) { MessageBox.Show("Login failed"); } }