private void CarregarObjetosListagem() { try { CarregarTipoNoticia(); List <ModNoticia> objListModNoticia = new List <ModNoticia>(); objListModNoticia = DOModNoticia.ListarNoticiasModulos(IdConteudo, null); List <Noticia> lstNoticia = new List <Noticia>(); foreach (ModNoticia modNoticia in objListModNoticia) { lstNoticia.Add(DONoticia.Obter(new Noticia() { ID = modNoticia.IdNoticia })); } grvNoticias.DataSource = lstNoticia; grvNoticias.DataBind(); } catch (Exception ex) { throw ex; } }
private void ObterConteudo() { IdConteudo = Convert.ToInt32(this.Parent.ID.Replace("CTT_", string.Empty)); IdIdioma = 1; HttpCookie cookie = Request.Cookies["_culture"]; if (cookie != null) { IdIdioma = Convert.ToInt32(cookie.Value); } List <ModNoticia> lModNoticia = DOModNoticia.ListarNoticiasModulos(IdConteudo, null); List <Noticia> lNoticia = new List <Noticia>(); foreach (ModNoticia item in lModNoticia) { Noticia noticia = new Noticia(); noticia.ID = item.IdNoticia; noticia = DONoticia.Obter(noticia); lNoticia.Add(noticia); } List <int> lstAno = new List <int>(); foreach (var item in lNoticia) { if (!lstAno.Contains(item.DataNoticia.Year)) { lstAno.Add(item.DataNoticia.Year); } } ddlAno.DataSource = lstAno; ddlAno.DataBind(); Session.Add("sNoticias", lNoticia); pnlNoticiaHome.Visible = false; pnlNoticiaInterna.Visible = false; pnlNoticiaDestaque.Visible = false; if (lModNoticia.Count > 0) { if (lModNoticia[0].Home) { pnlNoticiaHome.Visible = true; CarregarDadosHome(lModNoticia); } else if (lModNoticia[0].Listagem) { pnlNoticiaInterna.Visible = true; BindNoticias(); } else if (lModNoticia[0].Destaque) { pnlNoticiaDestaque.Visible = true; CarregarDadosDestaque(lModNoticia); } divSemConteudo.Visible = false; divConteudo.Visible = true; } else { divSemConteudo.Visible = true; pnlNoticiaHome.Visible = false; pnlNoticiaInterna.Visible = false; pnlNoticiaDestaque.Visible = false; divConteudo.Visible = false; } }