private void btnconf_Click(object sender, EventArgs e) { try { ClassVenda v = new ClassVenda(); v.VALOR_TOTAL = double.Parse(txttotal.Text); v.DATA_PED = dtpPedido.Value.ToString("yyyyMMdd"); v.Novo_Venda(); DataTable dt = v.Pedido(); string ID_p = dt.Rows[0]["max(idpedido)"].ToString(); for (int i = 0; i < dtgVenda.Rows.Count - 1; i++) { ItensVenda item = new ItensVenda(); item.ID_PED = int.Parse(ID_p); item.ID_PROD = int.Parse(dtgVenda.Rows[i].Cells["idproduto"].Value.ToString()); item.PRECO = double.Parse(dtgVenda.Rows[i].Cells["preco_custo"].Value.ToString()); item.NovoItem(); } MessageBox.Show("Venda concluída !"); Venda vend = new Venda(); vend.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btninclui_Click(object sender, EventArgs e) { ClassVenda v = new ClassVenda(); v.DATA_PED = dtpPedido.Value.ToString("yyyyMMdd"); dtgPesq.DataSource = v.PesquisarData(); DataTable dt = v.PesquisarDataValor(); textBox1.Text = dt.Rows[0]["sum(val_pedido)"].ToString(); }