Public MustInherit Class ContentItem
Private _ID As String
Public Title As String
Public Description As String
<XmlIgnore()> Public LiveDate As Date
<XmlIgnore()> Public EditControl As String
<XmlIgnore()> Public Type As String
<XmlIgnore()> _
Public Property ID() As String
Get
Return _ID
End Get
Set(ByVal Value As String)
_ID = Value
Dim drInfo As SqlDataReader = cmsDB.GetContentInfo(_ID)
With drInfo
If .Read Then
LiveDate = CDate(!online_date)
EditControl = CStr(!edit_control)
Type = CStr(!content_type)
End If
.Close()
End With
End Set
End Property
Shared Function Load(ByVal ContentID As String, ByVal ContentType As Type) As Object
Dim sContent As String = cmsDB.GetContent(ContentID)
If CBool(Len(sContent)) Then
Dim strMem As New StringReader(sContent)
Dim xml As New XmlSerializer(ContentType)
Return xml.Deserialize(strMem)
End If
End Function
Public Sub Save()
Dim strMem As New StringWriter()
Dim xml As New XmlSerializer(Me.GetType)
xml.Serialize(strMem, Me)
cmsDB.UpdateContent(_ID, strMem.ToString, LiveDate)
End Sub
End Class
Public Class HomePageItem
Inherits ContentItem
' Extend ContentItem class with properties
' specific to home page items
Public Author As String
Public URL As String
Public ImageURL As String
End Class