Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. private void btnentrar_Click(object sender, EventArgs e)
  2. {
  3. if ((txtLogin.Text == "") || (txtsenha.Text == ""))
  4. {
  5. MessageBox.Show("Digite Usuário e Senha!");
  6. txtLogin.Focus();
  7.  
  8. }
  9. else
  10. {
  11. clnlogin login = new clnlogin();
  12. OracleDataReader objDados;
  13. objDados = login.ListarLogin(txtLogin.Text);
  14. if (objDados.Read())
  15. {
  16. login.Usuario = objDados["usuario"].ToString();
  17. login.Senha = objDados["senha"].ToString();
  18. if (txtsenha.Text != login.Senha)
  19. {
  20. MessageBox.Show(" Senha Inválida", "ocorreu um Erro ao autenticar", MessageBoxButtons.OK, MessageBoxIcon.Error);
  21. txtsenha.Clear();
  22. txtsenha.Focus();
  23. }
  24.  
  25. else
  26. {
  27. frmPrincipal x = new frmPrincipal();
  28. this.Visible = false;
  29. MessageBox.Show("Bem Vindo ao Sistema" + "," + txtLogin.Text);
  30. x.Show();
  31. }
  32. }
  33. else
  34. {
  35. MessageBox.Show("Usuário Incorreto!");
  36. txtLogin.Clear();
  37. txtsenha.Clear();
  38. txtLogin.Focus();
  39. }
  40.  
  41. if ((txtsenha.Text == "123"))
  42. {
  43. MessageBox.Show("Cadastre sua Nova Senha!");
  44. txtsenha.Enabled = false;
  45. txtLogin.Enabled = false;
  46. lblnovasenha.Visible = true;
  47. txtnovasenha.Visible = true;
  48. btnsalvar.Visible = true;
  49. btnCancelar.Visible = false;
  50. btnentrar.Visible = false;
  51. txtnovasenha.Focus();
  52. }
  53. }
  54. }
  55.  
  56. private void btnentrar_Click(object sender, EventArgs e)
  57. {
  58. if ((txtLogin.Text == "") || (txtsenha.Text == ""))
  59. {
  60. MessageBox.Show("Digite Usuário e Senha!");
  61. txtLogin.Focus();
  62. return;
  63. }
  64.  
  65. if ((txtsenha.Text == "123"))
  66. {
  67. MessageBox.Show("Cadastre sua Nova Senha!");
  68. txtsenha.Enabled = false;
  69. txtLogin.Enabled = false;
  70. lblnovasenha.Visible = true;
  71. txtnovasenha.Visible = true;
  72. btnsalvar.Visible = true;
  73. btnCancelar.Visible = false;
  74. btnentrar.Visible = false;
  75. txtnovasenha.Focus();
  76. return;
  77. }
  78.  
  79. clnlogin login = new clnlogin();
  80. OracleDataReader objDados;
  81. objDados = login.ListarLogin(txtLogin.Text);
  82. if (!objDados.Read())
  83. {
  84. MessageBox.Show("Usuário Incorreto!");
  85. txtLogin.Clear();
  86. txtsenha.Clear();
  87. txtLogin.Focus();
  88. return;
  89. }
  90.  
  91. login.Usuario = objDados["usuario"].ToString();
  92. login.Senha = objDados["senha"].ToString();
  93. if (txtsenha.Text != login.Senha)
  94. {
  95. MessageBox.Show(" Senha Inválida", "ocorreu um Erro ao autenticar", MessageBoxButtons.OK, MessageBoxIcon.Error);
  96. txtsenha.Clear();
  97. txtsenha.Focus();
  98. return;
  99. }
  100.  
  101. frmPrincipal x = new frmPrincipal();
  102. this.Visible = false;
  103. MessageBox.Show("Bem Vindo ao Sistema" + "," + txtLogin.Text);
  104. x.Show();
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement