private void compraToolStripMenuItem1_Click(object sender, EventArgs e) { frmConsultaCompra f = new frmConsultaCompra(); f.ShowDialog(); f.Dispose(); }
private void btnLocalizar_Click(object sender, EventArgs e) { frmConsultaCompra f = new frmConsultaCompra(); f.ShowDialog(); f.Dispose(); try { if (f.codigo != 0) { DALConexao cx = new DALConexao(DadosDaConexao.stringDeConexao); CompraController comCom = new CompraController(cx); ModeloCompra modelo = comCom.CarregaModeloCompra(f.codigo); txtCodigo.Text = modelo.com_cod.ToString(); txtNotaFiscal.Text = modelo.com_nfiscal.ToString(); dateCompra.Value = modelo.com_data; txtCodigoFornecedor.Text = modelo.for_cod.ToString(); txtCodigoFornecedor_Leave(sender, e); txtTotal.Text = modelo.com_total.ToString(); cboNumeroDeParcelas.Text = modelo.com_nparcelas.ToString(); this.totalCompra = modelo.com_total;//armazena o valor total da compra cboTipoDePagamento.SelectedValue = modelo.tpa_cod; //itens da compra ItensCompraController itemCompra = new ItensCompraController(cx); DataTable tabela = itemCompra.Localizar(modelo.com_cod); for (int i = 0; i < tabela.Rows.Count; i++) { string icod = tabela.Rows[i]["pro_cod"].ToString(); string inome = tabela.Rows[i]["pro_nome"].ToString(); string iqtde = tabela.Rows[i]["itc_qtde"].ToString(); string ivalorUnitario = tabela.Rows[i]["itc_valor"].ToString(); Double TotalLocal = Convert.ToDouble(tabela.Rows[i]["itc_qtde"]) * Convert.ToDouble(tabela.Rows[i]["itc_valor"]); String[] it = new String[] { icod, inome, iqtde, ivalorUnitario, TotalLocal.ToString() }; this.dataProdutoItens.Rows.Add(it); } this.alteraBotoes(3); } else { this.limparTela(); this.alteraBotoes(1); } f.Dispose(); } catch //(Exception ex) { // throw new Exception(ex.Message); } }