Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnentrar_Click(object sender, EventArgs e)
- {
- if ((txtLogin.Text == "") || (txtsenha.Text == ""))
- {
- MessageBox.Show("Digite Usuário e Senha!");
- txtLogin.Focus();
- }
- else
- {
- clnlogin login = new clnlogin();
- OracleDataReader objDados;
- objDados = login.ListarLogin(txtLogin.Text);
- if (objDados.Read())
- {
- login.Usuario = objDados["usuario"].ToString();
- login.Senha = objDados["senha"].ToString();
- if (txtsenha.Text != login.Senha)
- {
- MessageBox.Show(" Senha Inválida", "ocorreu um Erro ao autenticar", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txtsenha.Clear();
- txtsenha.Focus();
- }
- else
- {
- frmPrincipal x = new frmPrincipal();
- this.Visible = false;
- MessageBox.Show("Bem Vindo ao Sistema" + "," + txtLogin.Text);
- x.Show();
- }
- }
- else
- {
- MessageBox.Show("Usuário Incorreto!");
- txtLogin.Clear();
- txtsenha.Clear();
- txtLogin.Focus();
- }
- if ((txtsenha.Text == "123"))
- {
- MessageBox.Show("Cadastre sua Nova Senha!");
- txtsenha.Enabled = false;
- txtLogin.Enabled = false;
- lblnovasenha.Visible = true;
- txtnovasenha.Visible = true;
- btnsalvar.Visible = true;
- btnCancelar.Visible = false;
- btnentrar.Visible = false;
- txtnovasenha.Focus();
- }
- }
- }
- private void btnentrar_Click(object sender, EventArgs e)
- {
- if ((txtLogin.Text == "") || (txtsenha.Text == ""))
- {
- MessageBox.Show("Digite Usuário e Senha!");
- txtLogin.Focus();
- return;
- }
- if ((txtsenha.Text == "123"))
- {
- MessageBox.Show("Cadastre sua Nova Senha!");
- txtsenha.Enabled = false;
- txtLogin.Enabled = false;
- lblnovasenha.Visible = true;
- txtnovasenha.Visible = true;
- btnsalvar.Visible = true;
- btnCancelar.Visible = false;
- btnentrar.Visible = false;
- txtnovasenha.Focus();
- return;
- }
- clnlogin login = new clnlogin();
- OracleDataReader objDados;
- objDados = login.ListarLogin(txtLogin.Text);
- if (!objDados.Read())
- {
- MessageBox.Show("Usuário Incorreto!");
- txtLogin.Clear();
- txtsenha.Clear();
- txtLogin.Focus();
- return;
- }
- login.Usuario = objDados["usuario"].ToString();
- login.Senha = objDados["senha"].ToString();
- if (txtsenha.Text != login.Senha)
- {
- MessageBox.Show(" Senha Inválida", "ocorreu um Erro ao autenticar", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txtsenha.Clear();
- txtsenha.Focus();
- return;
- }
- frmPrincipal x = new frmPrincipal();
- this.Visible = false;
- MessageBox.Show("Bem Vindo ao Sistema" + "," + txtLogin.Text);
- x.Show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement