private void button1_Click(object sender, EventArgs e)
        {
            Conexao conexao = new Conexao();

            conexao.conectar();

            string query = "SELECT * FROM USUARIO WHERE PRONTUARIO=@PRONTUARIO AND SENHA=@SENHA";

            SqlCommand cmd = new SqlCommand(query, conexao.conexao);

            cmd.Parameters.AddWithValue("@PRONTUARIO", txtUsuario.Text);
            cmd.Parameters.AddWithValue("@SENHA", txtSenha.Text);

            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                Autenticacao.login(dr["prontuario"].ToString(), dr["senha"].ToString());
                //MessageBox.Show(Autenticacao.getUsuario());
                frmPrincipal fmp = new frmPrincipal();
                fmp.Show();
                //this.Close();
            }
            else
            {
                MessageBox.Show("ERRO: Usuário e/ou Senha não encontrado");
            }
            dr.Close();
            conexao.desconectar();
        }
예제 #2
0
        private void btnSair_Click(object sender, EventArgs e)
        {
            DialogResult iResposta;

            iResposta = MessageBox.Show("Deseja sair?", "Sair", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (iResposta.ToString() == "Yes")
            {
                frmPrincipal frmP = new frmPrincipal();
                frmP.Show();
            }
        }