protected void btnSalvar_Click(object sender, EventArgs e) { TiposDeAutoresBL tipoauBL = new TiposDeAutoresBL(); TiposDeAutores tipos = new TiposDeAutores(); tipos.Id = utils.ComparaIntComZero(hfId.Value); tipos.Codigo = utils.ComparaIntComZero(lblCodigo.Text); tipos.Descricao = txtDescricao.Text; if (tipos.Id > 0) { if (tipoauBL.EditarBL(tipos)) { ExibirMensagem("Categoria atualizada com sucesso !"); txtDescricao.Focus(); } else ExibirMensagem("Não foi possível atualizar a categoria. Revise as informações."); } else { if (tipoauBL.InserirBL(tipos)) { ExibirMensagem("Categoria gravada com sucesso !"); LimparCampos(); txtDescricao.Focus(); } else ExibirMensagem("Não foi possível gravar a categoria. Revise as informações."); } }
protected void dtgBairros_RowDeleting(object sender, GridViewDeleteEventArgs e) { TiposDeAutoresBL tiposaBL = new TiposDeAutoresBL(); TiposDeAutores tiposAu = new TiposDeAutores(); tiposAu.Id = utils.ComparaIntComZero(dtgTiposAutores.DataKeys[e.RowIndex][0].ToString()); if (tiposaBL.ExcluirBL(tiposAu)) ExibirMensagem("Registro excluído com sucesso !"); else ExibirMensagem("Não foi possível excluir o registro, existem registros dependentes"); Pesquisar(null); }
private void CarregaTiposAutores() { TiposDeAutoresBL tipos = new TiposDeAutoresBL(); List<TiposDeAutores> listao = tipos.PesquisarBL(); ddlTiposAutores.Items.Clear(); ddlTiposAutores.Items.Add(new ListItem("Selecione", "")); foreach (TiposDeAutores tp in listao) { ddlTiposAutores.Items.Add(new ListItem(tp.Descricao, tp.Id.ToString())); } }
private void CarregarDados(int id_bai) { TiposDeAutoresBL tipoaBL = new TiposDeAutoresBL(); List<TiposDeAutores> tipos = tipoaBL.PesquisarBL(id_bai); foreach (TiposDeAutores ltBai in tipos) { hfId.Value = ltBai.Id.ToString(); lblCodigo.Text = ltBai.Codigo.ToString(); txtDescricao.Text = ltBai.Descricao; } }
private void Pesquisar(string valor) { DataTable tabela = new DataTable("tabela"); DataColumn coluna1 = new DataColumn("ID", Type.GetType("System.Int32")); DataColumn coluna2 = new DataColumn("CODIGO", Type.GetType("System.Int32")); DataColumn coluna3 = new DataColumn("DESCRICAO", Type.GetType("System.String")); tabela.Columns.Add(coluna1); tabela.Columns.Add(coluna2); tabela.Columns.Add(coluna3); TiposDeAutoresBL tautorBL = new TiposDeAutoresBL(); List<TiposDeAutores> tiposAutores; tiposAutores = tautorBL.PesquisarBuscaBL(valor); foreach (TiposDeAutores tipA in tiposAutores) { DataRow linha = tabela.NewRow(); linha["ID"] = tipA.Id; linha["CODIGO"] = tipA.Codigo; linha["DESCRICAO"] = tipA.Descricao; tabela.Rows.Add(linha); } dtbPesquisa = tabela; dtgTiposAutores.DataSource = tabela; dtgTiposAutores.DataBind(); }