/// <summary>Cria uma NewsList com base num DataSet</summary> /// <remarks> /// Este mtodo espera um dataset com as seguintes colunas, na /// ordem seguinte: /// id | Title | Content | Date /// /// O mtodo no liga aos nomes, vai aos ndices buscar o contedo /// </remarks> public NewsList NewsFromDataSet( DataSet ds ) { NewsList list = new NewsList(); foreach( DataRow row in ds.Tables[0].Rows ) { DateTime date = (DateTime) row[3]; string title = row[1].ToString(); string message = row[2].ToString(); string lang = row[3].ToString(); Entry entry = new Entry(date, message, title,lang); entry.Id = (int) row[0]; list.List.Add(entry); } return list; }
/// <summary>Mostra uma lista de notcias</summary> private void writeNews( HtmlTextWriter writer, NewsList list ) { foreach( Entry entry in list.List ) { writer.WriteLine("<div><span>{1}/{2}/{3}</span><br/>{0}</b></div>", entry.Title, entry.Issued.Day, entry.Issued.Month, entry.Issued.Year ); writer.WriteLine("<div>{0}</div>", entry.Content); writer.WriteLine("<hr noshade='noshade' size='1'/>"); } writer.WriteLine("<div align='center'><a href='{2}'>{1} <img src='{0}' /></a></div><br/>", OrionGlobals.getCommonImagePath("xml.gif"), CultureModule.getLanguage().getContent("news_feed"), OrionGlobals.resolveBase("rss.aspx") ); }