Imports System.Xml Imports System.Text Imports System.IO Imports BVSoftware.BVC.Core Public Class Dealtime Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Protected WithEvents RSSFeed As System.Web.UI.WebControls.Literal 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load WriteRSS(CatalogServices.Products.ListAllProducts) End Sub Sub WriteRSS(ByVal source As DataTable) Dim sXML As String = "" Dim strWriter As New StringWriter Dim xw As XmlTextWriter = New XmlTextWriter(strWriter) xw.Formatting = Formatting.Indented xw.Indentation = 3 'xw.WriteStartDocument() ' start feed xw.WriteStartElement("BVCommerceDealtimeFeed") ' Start Channel xw.WriteStartElement("Products") Dim i As Integer For i = 0 To source.Rows.Count - 1 With source.Rows(i) xw.WriteStartElement("item") xw.WriteElementString("MPN", .Item("sku")) xw.WriteElementString("UPC", "") xw.WriteElementString("Manufacturer", "") xw.WriteElementString("ProductName", .Item("Name")) xw.WriteElementString("ProductDescription", .Item("description")) xw.WriteElementString("ProductPrice", String.Format("{0:c}", .Item("price"))) Select Case .Item("InventoryStatus") Case 0 xw.WriteElementString("StockAvailability", "N") xw.WriteElementString("StockDescription", "Out of Stock") Case 1 xw.WriteElementString("StockAvailability", "Y") xw.WriteElementString("StockDescription", "In Stock") Case 2 xw.WriteElementString("StockAvailability", "Y") xw.WriteElementString("StockDescription", "Call For Pricing") Case 3 xw.WriteElementString("StockAvailability", "N") xw.WriteElementString("StockDescription", "Backordered") Case Else xw.WriteElementString("StockAvailability", "Y") xw.WriteElementString("StockDescription", "In Stock") End Select xw.WriteElementString("ProductURL", Path.Combine(WebAppSettings.SiteStandardRoot, "productinfo.aspx?productid=") & .Item("id")) xw.WriteElementString("ProductImageURL", Path.Combine(WebAppSettings.SiteStandardRoot, ImageHelper.GetValidImage(.Item("SmallImageName")))) xw.WriteElementString("ShippingInformation", "") xw.WriteElementString("CategoryInformation", "") xw.WriteEndElement() End With Next ' Channel xw.WriteEndElement() ' End feed xw.WriteEndElement() 'xw.WriteEndDocument() xw.Flush() xw.Close() sXML = strWriter.ToString() xw = Nothing RSSFeed.Text = "" & System.Environment.NewLine() & sXML End Sub End Class