private void exibirPecas()
        {
            DataTable dt = PecaDAO.obterPecas();

            if (dt.Rows.Count != 0)
            {
                dgvPecas.DataSource = dt;
            }
        }
        private void BtnAdicionar_Click(object sender, EventArgs e)
        {
            OrcamentoDAO.vincularOrcamentoPeca(this.idOrcamento, this.idPeca);
            PecaDAO.debitaPeca(this.idPeca, (this.quantidadePeca - 1));

            Cadastro_Orcamento cadastro_orcamento = new Cadastro_Orcamento();

            cadastro_orcamento.idOrcamento = Convert.ToString(this.idOrcamento);
            cadastro_orcamento.definiOrcamento(this.orcamento);

            cadastro_orcamento.Show();
            this.Hide();
        }
 private void TxtPesquisaPeca_TextChanged(object sender, EventArgs e)
 {
     if (txtPesquisaPeca.Text != "")
     {
         DataTable dt = PecaDAO.filtrarPecas(txtPesquisaPeca.Text);
         if (dt.Rows.Count != 0)
         {
             dgvPecas.DataSource = dt;
         }
     }
     else
     {
         this.exibirPecas();
     }
 }
        private void BtnAlterar_Click(object sender, EventArgs e)
        {
            ModeloPeca novaPeca = new ModeloPeca();

            novaPeca._nomePeca       = txtNomeDaPeca.Text;
            novaPeca._quantidadePeca = Convert.ToInt32(txtQuantidade.Text);
            novaPeca._valorPeca      = Convert.ToDouble(txtValor.Text);
            novaPeca._idPeca         = this.idPeca;

            PecaDAO.alterarPeca(novaPeca);

            Pecas pecas = new Pecas();

            pecas.Show();
            this.Hide();
        }