private void btnVoltar_Click(object sender, EventArgs e)
        {
            frmTelaPrincipal frmTelaPrincipal = new frmTelaPrincipal();

            this.Hide();
            frmTelaPrincipal.Show();
        }
Example #2
0
        private void btnLogar_Click(object sender, EventArgs e)
        {
            if (txtUsuario.Text == "" || txtSenha.Text == "")
            {
                MessageBox.Show("Por favor preencher todos os campos!");
            }
            else if (txtUsuario.Text == "Usuário" && txtSenha.Text == "Senha")
            {
                MessageBox.Show("Por favor preencher todos os campos!");
            }
            else
            {
                usuario.Login = txtUsuario.Text;
                usuario.Senha = txtSenha.Text;
                DataTable dt = usuario.RealizarLogin();

                if (dt.Rows.Count != 0)
                {
                    if (dt.Rows[0]["ATLogin"].ToString() == usuario.Login && dt.Rows[0]["senha"].ToString() == usuario.Senha)
                    {
                        frmTelaPrincipal frmTelaPrincipal = new frmTelaPrincipal();
                        this.Hide();
                        frmTelaPrincipal.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Usuário ou senha incorretos!");
                }
            }
        }