private void btnfinalizar_Click(object sender, EventArgs e) { Venda venda = new Venda(int.Parse(txtbFuncionarioCod.Text), int.Parse(txtbClienteCod.Text), float.Parse(txtbValorCompra.Text.Replace("R$", "")), float.Parse(txtbValorPagamento.Text)); VendaRepository vendaRepository = new VendaRepository(); vendaRepository.cadastraVenda(venda); vendaRepository.obtemVendaID(venda); for (int i = 0; i < tabelaItensVenda.Rows.Count; i++) { ItensVenda itensVenda = new ItensVenda(venda.vendaID, int.Parse(tabelaItensVenda.Rows[i]["codBarras"].ToString()), int.Parse(tabelaItensVenda.Rows[i]["quantidadeItens"].ToString()), float.Parse(tabelaItensVenda.Rows[i]["precoUnitario"].ToString()), float.Parse(tabelaItensVenda.Rows[i]["precoTotal"].ToString())); ItensVendaRepository itensvendaRepository = new ItensVendaRepository(); itensvendaRepository.cadastraItensVenda(itensVenda); } }