コード例 #1
0
    protected void CarregaCategoria(int id_Categoria)
    {
        Categoria categoria = new Categoria();

        categoria         = CategoriaOad.Get_Categoria(id_Categoria);
        txtCategoria.Text = categoria.Nm_Categoria;
    }
コード例 #2
0
    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
    }
コード例 #3
0
    protected void RetornarCategorias()
    {
        List <Categoria> list = new List <Categoria>();

        list = CategoriaOad.GetAll_Categorias();
        ddlCategoria.DataSource = list;
        ddlCategoria.DataBind();
    }
コード例 #4
0
    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");
    }
コード例 #5
0
    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");
    }
コード例 #6
0
    protected void listaCategoria()
    {
        List <Categoria> list = new List <Categoria>();

        list = CategoriaOad.GetAll_Categorias();
        if (list.Count == 0)
        {
            lblMensagem.Visible = true;
        }
        else
        {
            lblMensagem.Visible = false;
            gvwDados.DataSource = list;
            gvwDados.DataBind();
        }
    }
コード例 #7
0
 protected void gvwDados_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     gvwDados.PageIndex  = e.NewPageIndex;
     gvwDados.DataSource = CategoriaOad.GetAll_Categorias();
     gvwDados.DataBind();
 }
コード例 #8
0
 protected void carregaCategorias()
 {
     gvwDados.DataSource = CategoriaOad.GetAll_Categorias();
     gvwDados.DataBind();
 }