protected void btnExcluir_Click(object sender, EventArgs e) { int id_Categoria = Convert.ToInt16(Request["Categoria"]); //#region Desativa Pessoa sem Local List <Produto> produtos = ProdutoOad.Get_Produtos(id_Categoria); bool possui = ((produtos.Count > 0)?true:false); if (!possui) { Categoria categoria = new Categoria(); categoria = CategoriaOad.Get_Categoria(id_Categoria); CategoriaOad.OperacaoCategoria(categoria, "E"); btnCancelar.Visible = false; btnExcluir.Visible = false; lblConfirmacao.Visible = false; lblSucesso.Visible = true; btnVoltar.Visible = true; } else { Response.Write("<script>alert('Categoria não pode ser excluída. A mesma possui vínculo com algum produto cadastrado.')</script>"); } //#endregion }
protected void btnSalvar_Click(object sender, EventArgs e) { Categoria categoria = new Categoria(); categoria.Nm_Categoria = txtCategoria.Text; CategoriaOad.OperacaoCategoria(categoria, "I"); Response.Redirect("~/Administrador/ListarCategoria.aspx"); }
protected void btnSalvar_Click(object sender, EventArgs e) { int id_Categoria = Convert.ToInt16(Request["Categoria"]); Categoria categoria = new Categoria(); categoria.Id_Categoria = id_Categoria; categoria.Nm_Categoria = txtCategoria.Text; CategoriaOad.OperacaoCategoria(categoria, "A"); Response.Redirect("~/Administrador/ListarCategoria.aspx"); }