Exemple #1
0
    private void LerDados()
    {
        List <Noticia> objDados = null;

        try
        {
            btnNovo.Enabled    = true;
            btnExcluir.Enabled = true;
            objDados           = DOModNoticia.Listar(new Noticia());

            if (objDados != null)
            {
                listPager.DataSource = objDados;
                listPager.DataBind();

                BindGrid();
            }

            if (objDados.Count <= 0)
            {
                btnExcluir.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            //Chama o método para gravar erro
            ((Modulos_Modulos)Master).ExibirAlerta(ex);
        }
    }
    private void CarregaCapaDireitoSuperior(DropDownList pDDL)
    {
        Noticia noticia = null;

        try
        {
            noticia             = new Noticia();
            pDDL.DataSource     = DOModNoticia.Listar(noticia).Where(x => x.Destaque == true).ToList();
            pDDL.DataTextField  = "Titulo";
            pDDL.DataValueField = "Id";
            pDDL.DataBind();
            pDDL.Items.Insert(0, new ListItem(Resources.Textos.Texto_Selecione, "0"));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void CarregaCapaDireitaCentral()
    {
        Noticia noticia = null;

        try
        {
            noticia              = new Noticia();
            ddlD2.DataSource     = DOModNoticia.Listar(noticia);
            ddlD2.DataTextField  = "Titulo";
            ddlD2.DataValueField = "Id";
            ddlD2.DataBind();
            ddlD2.Items.Insert(0, new ListItem(Resources.Textos.Texto_Selecione, "0"));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }