private void btnRemover_Click(object sender, EventArgs e) { if (this.idSelecionado > 0) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Produto> ProdutosDAO = new ProdutoDAO(conn); Produto produto = new Produto(); produto.Id = this.idSelecionado; try { ProdutosDAO.Remover(produto); dataGridViewProdutos.DataSource = ProdutosDAO.ListarTudo(); dataGridViewProdutos.Refresh(); MessageBox.Show("Produto deletado!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.None); } catch { MessageBox.Show("Não foi possivel remover este produto", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.None); } } } else { MessageBox.Show("Selecione um produto!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.None); } }
private void BtnCadastraSupermercado_Click(object sender, EventArgs e) { if (btnCadastraSupermercado.Text.Equals("Finalizar Edição")) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Supermercado> SupermercadoDAO = new SupermercadoDAO(conn); Supermercado supermercado = new Supermercado(); supermercado.Nome = txtNomeSupermercado.Text; supermercado.Id = this.idSelecionado; SupermercadoDAO.Atualizar(supermercado); Dispose(); } } else { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Supermercado> SupermercadoDAO = new SupermercadoDAO(conn); Supermercado supermercado = new Supermercado(); supermercado.Nome = txtNomeSupermercado.Text; SupermercadoDAO.Inserir(supermercado); Dispose(); } } }
private void btnRemoverProduto_Click(object sender, EventArgs e) { if (this.idProdutoSelecionado > 0) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <ProdutosLista> ProdutosListasDAO = new ProdutosListasDAO(conn); ProdutosLista produto = new ProdutosLista(); produto.Id = this.idProdutoSelecionado; try { ProdutosListasDAO.Remover(produto); MessageBox.Show("Produto removido!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.None); this.atualizarDataGrid(this.idSelecionado); } catch { MessageBox.Show("Não foi possivel remover item na lista!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Selecione um produto!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.None); } }
private void btnRemover_Click(object sender, EventArgs e) { if (this.idSelecionado > 0) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Lista> ListasDAO = new ListasDAO(conn); Lista lista = new Lista(); lista.Id = IdSelecionado; try { ListasDAO.Remover(lista); dataGridViewListas.DataSource = ListasDAO.ListarTudo(); this.atualizarDataGrid(this.idSelecionado); MessageBox.Show("Lista deletada!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.None); } catch { MessageBox.Show("Falha ao deletar lista!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.None); } } } }
private void dataGridViewProdutos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { int index = e.RowIndex; DataGridViewRow selectedRow = dataGridViewProdutos.Rows[index]; int value = int.Parse(selectedRow.Cells[1].Value.ToString()); IdSelecionado = value; using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Produto> ProdutosDAO = new ProdutoDAO(conn); Produto p = new Produto(); p.Id = this.idSelecionado; Collection <Produto> colecao = ProdutosDAO.LocalizarPorCodigo(p); foreach (Produto prod in colecao) { if (prod.Id == this.idSelecionado) { CadastroNovoProduto form = new CadastroNovoProduto(prod, 1); form.StartPosition = FormStartPosition.CenterParent; form.ShowDialog(); break; } } } } }
private void btnEditarSupermercado_Click(object sender, EventArgs e) { if (this.idSelecionado > 0) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Supermercado> SupermercadosDAO = new SupermercadoDAO(conn); Supermercado s = new Supermercado(); s.Id = this.idSelecionado; Collection <Supermercado> colecao = SupermercadosDAO.ListarTudo(); foreach (Supermercado sup in colecao) { if (sup.Id == this.idSelecionado) { CadastroSupermercadoForm form = new CadastroSupermercadoForm(sup); form.StartPosition = FormStartPosition.CenterParent; form.ShowDialog(); dataGridViewSupermercados.DataSource = SupermercadosDAO.ListarTudo(); dataGridViewSupermercados.Refresh(); break; } } } } else { MessageBox.Show("Selecione um supermercado!", "Linguagem de programação II", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//funcao para atualizar datagrid listas private void atualizarDataGrid() { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Lista> ListasDAO = new ListasDAO(conn); Lista lista = new Lista(); dataGridViewListas.Refresh(); dataGridViewListas.DataSource = ListasDAO.ListarTudo(); } }
private void SupermercadosView_Load(object sender, EventArgs e) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Supermercado> SupermercadoDAO = new SupermercadoDAO(conn); Supermercado supermercado = new Supermercado(); dataGridViewSupermercados.Refresh(); dataGridViewSupermercados.DataSource = SupermercadoDAO.ListarTudo(); } }
public void loadDataGridProdutos() { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Produto> ProdutosDAO = new ProdutoDAO(conn); Produto produto = new Produto(); dataGridViewProdutos.Refresh(); dataGridViewProdutos.DataSource = ProdutosDAO.ListarTudo(); } }
private void txtFiltroProdutos_TextChanged(object sender, EventArgs e) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Produto> ProdutosDAO = new ProdutoDAO(conn); Produto produto = new Produto(); produto.NomeProduto = txtFiltroProdutos.Text; dataGridViewProdutos.DataSource = ProdutosDAO.LocalizarPorCodigo(produto); dataGridViewProdutos.Refresh(); } }
private void textBox1_TextChanged(object sender, EventArgs e) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Lista> ListasDAO = new ListasDAO(conn); Lista lista = new Lista(); lista.Nome = txtFiltro.Text; dataGridViewListas.DataSource = ListasDAO.LocalizarPorCodigo(lista); dataGridViewListas.Refresh(); } }
private void NovoProdutoListaForm_Load(object sender, EventArgs e) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Produto> ProdutosDAO = new ProdutoDAO(conn); Produto produto = new Produto(); cBoxProduto.DisplayMember = "nomeProduto"; cBoxProduto.ValueMember = "id"; cBoxProduto.DataSource = ProdutosDAO.ListarTudo(); } }
private void lblFiltroSupermercado_TextChanged(object sender, EventArgs e) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Supermercado> SupermercadosDAO = new SupermercadoDAO(conn); Supermercado supermercado = new Supermercado(); supermercado.Nome = txtFiltroSupermercado.Text; dataGridViewSupermercados.DataSource = SupermercadosDAO.LocalizarPorCodigo(supermercado); dataGridViewSupermercados.Refresh(); } }
public void Excluir(int ID) { using (Connection con = new Connection()) { con.Abrir(); IDAO <Beneficiario> TableIDAO = new BeneficiarioDAO(con); Beneficiario beneficiario = new Beneficiario(); beneficiario.BENEFICIARIO_ID = ID; TableIDAO.Remover(beneficiario); } }
public void Excluir(int ID) { using (Connection con = new Connection()) { con.Abrir(); IDAO <Metodo_Pag> TableIDAO = new Metodo_PagDAO(con); Metodo_Pag metodo_pag = new Metodo_Pag(); metodo_pag.METODO_PAG_ID = ID; TableIDAO.Remover(metodo_pag); } }
public void Excluir(int ID) { using (Connection con = new Connection()) { con.Abrir(); IDAO <Pagador> TableIDAO = new PagadorDAO(con); Pagador pagador = new Pagador(); pagador.PAGADOR_ID = ID; TableIDAO.Remover(pagador); } }
public void Excluir(int ID) { using (Connection con = new Connection()) { con.Abrir(); IDAO <Forma_Pag> TableIDAO = new Forma_PagDAO(con); Forma_Pag forma_Pag = new Forma_Pag(); forma_Pag.FORMA_PAG_ID = ID; TableIDAO.Remover(forma_Pag); } }
private void btnSalvar_Click(object sender, EventArgs e) { using (IConnection conn = new Connection()) { conn.Abrir(); IDAO <Lista> ListasDAO = new ListasDAO(conn); Lista lista = new Lista(); lista.Nome = txtNomeLista.Text.ToString().Trim(); ListasDAO.Inserir(lista); Dispose(); } }
public void Excluir(int ID) { using (Connection con = new Connection()) { con.Abrir(); IDAO <Tipo_Pag> TableIDAO = new Tipo_PagDAO(con); Tipo_Pag tipo_pag = new Tipo_Pag(); tipo_pag.TIPO_PAG_ID = ID; TableIDAO.Remover(tipo_pag); } }
public void Excluir(int ID) { using (Connection con = new Connection()) { con.Abrir(); IDAO <Pagamento> TableIDAO = new PagamentoDAO(con); Pagamento pagamento = new Pagamento(); pagamento.PAGAMENTO_ID = ID; TableIDAO.Remover(pagamento); } }
public Metodo_Pag LocalizarPrimeiro() { Metodo_Pag result = null; using (Connection con = new Connection()) { con.Abrir(); IDAO <Metodo_Pag> TableIDAO = new Metodo_PagDAO(con); result = TableIDAO.LocalizarPrimeiro(); } return(result); }
public Categoria LocalizarPorCodigo(params object[] keys) { Categoria = null; using (con = new Connection()) { con.Abrir(); TableIDAO = new CategoriaDAO(con); Categoria = TableIDAO.LocalizarPorCodigo(keys); } return(Categoria); }
public Categoria LocalizarPrimeiro() { Categoria = null; using (con = new Connection()) { con.Abrir(); TableIDAO = new CategoriaDAO(con); Categoria = TableIDAO.LocalizarPrimeiro(); } return(Categoria); }
public JsonResult GravarMateria(Materia materia) { string resposta = Util.Resultado.Ok.ToString(); using (IConnection Conexao = new Connection()) { Conexao.Abrir(); IDAO <Materia> materiaDAO = new MateriaDAO(Conexao); materiaDAO.inserir(materia); } return(Json(resposta)); }
public Collection <Metodo_Pag> ListarTudo() { Collection <Metodo_Pag> result = null; using (Connection con = new Connection()) { con.Abrir(); IDAO <Metodo_Pag> TableIDAO = new Metodo_PagDAO(con); result = TableIDAO.ListarTudo(); } return(result); }
public void Inserir(Metodo_Pag obj) { using (Connection con = new Connection()) { con.Abrir(); IDAO <Metodo_Pag> TableIDAO = new Metodo_PagDAO(con); Metodo_Pag metodo_pag = new Metodo_Pag(); metodo_pag.METODO_PAG_DESCRICAO = obj.METODO_PAG_DESCRICAO; TableIDAO.Inserir(metodo_pag); } }
public Collection <Beneficiario> ListarTudo() { Collection <Beneficiario> result = null; using (Connection con = new Connection()) { con.Abrir(); IDAO <Beneficiario> TableIDAO = new BeneficiarioDAO(con); result = TableIDAO.ListarTudo(); } return(result); }
public Beneficiario LocalizarPrimeiro() { Beneficiario result = null; using (Connection con = new Connection()) { con.Abrir(); IDAO <Beneficiario> TableIDAO = new BeneficiarioDAO(con); result = TableIDAO.LocalizarPrimeiro(); } return(result); }
public Pagamento LocalizarPorCodigo(int ID) { Pagamento result = null; using (Connection con = new Connection()) { con.Abrir(); IDAO <Pagamento> TableIDAO = new PagamentoDAO(con); result = TableIDAO.LocalizarPorCodigo(ID); } return(result); }
public Collection <Pagamento> ListarTudo() { Collection <Pagamento> result = null; using (Connection con = new Connection()) { con.Abrir(); IDAO <Pagamento> TableIDAO = new PagamentoDAO(con); result = TableIDAO.ListarTudo(); } return(result); }