private void TB_Name_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { TB_Password.Focus(); } }
private void TB_Username_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { TB_Password.Focus(); } }
private void Button_Login_Click(object sender, RoutedEventArgs e) { try { var verication = connection.Users.FirstOrDefault(S => S.Email == TB_Email.Text); if (verication == null) { MessageBox.Show("Your email is wrong!", "Warning", MessageBoxButton.OK); TB_Email.Focus(); return; } else if (verication.Password != TB_Password.Password) { MessageBox.Show("Your password is wrong!", "Warning", MessageBoxButton.OK); TB_Password.Focus(); return; } // MainWindow window_main = new MainWindow(); // Gunakan ini untuk database baru dan buat User terlebih dahulu MainWindow window_main = new MainWindow(verication.Email); // Gunakan parameter untuk bisa login window_main.Show(); this.Close(); } catch (Exception) { } }
private void ErrorMessage(OracleException Ex) { switch (Ex.Number) { case 1017: LB_Username.ForeColor = Color.Red; LB_MDP.ForeColor = Color.Red; TB_Password.Clear(); TB_Password.Focus(); LB_Error.Text = "*Erreur Usager/Mot de passe"; break; case 12170: MessageBox.Show("La base de données est indisponible,réessayer plus tard", "Erreur 12170", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case 12543: MessageBox.Show("Connexion impossible,Vérifiez votre connection internet", "Erreur 12543", MessageBoxButtons.OK, MessageBoxIcon.Error); break; default: MessageBox.Show(Ex.Message.ToString()); break; } }
private void CB_Users_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { TB_Password.Focus(); }