public void Excluir(CategoriaClienteDTO dto) { bd = new AcessoBancoDados(); bd.Conectar(); string comando = "DELETE FROM CATEGORIA_CLIENTE " + "where id_categoria_cliente = '" + dto.IdCategoriaCliente + "'"; bd.ExecutarComandoSQL(comando); }
public void carregarSelecaoDeCategoria() { DataTable dt = bllCategoria.SelecionaTodasCategorias(); listaCategorias.Clear(); boxCategoria.Items.Clear(); foreach (DataRow row in dt.Rows) { string categoria = row["categoria_cliente"].ToString(); boxCategoria.Items.Add(categoria); CategoriaClienteDTO cat = new CategoriaClienteDTO(); cat.IdCategoriaCliente = Int32.Parse(row["id_categoria_cliente"].ToString()); listaCategorias.Add(cat); } }
public void Inserir(CategoriaClienteDTO dto) { try { bd = new AcessoBancoDados(); bd.Conectar(); string comando = "INSERT INTO CATEGORIA_CLIENTE(categoria_cliente) " + "values ('" + dto.CategoriaCliente + "')"; bd.ExecutarComandoSQL(comando); } catch (Exception ex) { MessageBox.Show("Erro ao tentar inserir: " + ex); } finally { bd = null; } }