// InitialiseChannelItemCollection - Return a collection of ChannelItemEntities as read from // the RSS Feed. // public ArrayList InitialiseChannelItemCollection() { ArrayList list = null; CreateXPathNavigator(); if (nav != null) { XPathNodeIterator nodeItr = nav.Select("//channel/item"); while (nodeItr.MoveNext()) { // If an item has been found, initialise our ArrayList class type if necessary if (list == null) { list = new ArrayList(); } // Create our ChannelItemEntity instance and initialise it ChannelItemEntity item = new ChannelItemEntity(); item.title = nodeItr.Current.Evaluate("string(./title)").ToString(); item.link = nodeItr.Current.Evaluate("string(./link)").ToString(); item.description = nodeItr.Current.Evaluate("string(./description)").ToString(); item.author = nodeItr.Current.Evaluate("string(./author)").ToString(); item.category = nodeItr.Current.Evaluate("string(./category)").ToString(); item.publishedDate = nodeItr.Current.Evaluate("string(./pubDate)").ToString(); item.guid = nodeItr.Current.Evaluate("string(./guid)").ToString(); // Add it to our collection list.Add(item); } } return(list); }
/// <summary>Creates a new, empty ChannelItemEntity object.</summary> /// <returns>A new, empty ChannelItemEntity object.</returns> public override IEntity Create() { IEntity toReturn = new ChannelItemEntity(); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewChannelItem // __LLBLGENPRO_USER_CODE_REGION_END return(toReturn); }
// dgThread_Click = Event for when a users chooses to view the news item // public void dgThread_Click(object sender, System.EventArgs e) { // Get the current row (after the click event) and display the relevant items text int rowNumber = dgThreads.CurrentCell.RowNumber; ChannelItemEntity item = (ChannelItemEntity)currentChannel.channelItemEntityList[rowNumber]; txtContents.Text = item.Description; }
// WriteChannelItems - Write collection of 'ChannelItemEntity' to th database // public void WriteChannelItems(ArrayList list) { for (int idx = 0; idx < list.Count; idx++) { // Cast to its intended type ChannelItemEntity ci = (ChannelItemEntity)list[idx]; // Write to the database // READER: An Exercise for you to do } }