Imports System.Data
Imports System
Imports System.Data.SqlClient
Imports System.Data.Common
Imports Microsoft.Practices.EnterpriseLibrary.Data

Partial Class ContentComments
    Inherits System.Web.UI.Page
    Private _cmd As DbCommand
    Private _db As Database

    Private Property DB() As Database
        Get
            Return _db
        End Get
        Set(ByVal value As Database)
            _db = value
        End Set
    End Property
    Private Property CMD() As DbCommand
        Get
            Return _cmd
        End Get
        Set(ByVal value As DbCommand)
            _cmd = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'End Try
        Me.DB = DatabaseFactory.CreateDatabase("Charter.Website.WS.CommerceEngineConnectionString")


        Try
            Dim localID As Integer = Request.QueryString("id")

            Me.CMD = DB.GetStoredProcCommand("SUPPORT.GET_COMMENTS")

            If localID > 0 Then
                DB.AddInParameter(CMD, "@DOCUMENTID", DbType.Int32, localID)
            End If

            Dim retCode As Data.DataSet = DB.ExecuteDataSet(CMD)
            Dim dt As New DataTable
            Dim dr As DataRow

            If Not retCode Is Nothing _
                AndAlso Not retCode.Tables(0) Is Nothing _
                AndAlso retCode.Tables(0).Rows.Count > 0 Then
                dt = retCode.Tables(0)
                dr = dt.Rows(0)
                lblContentTitle.Text = dr("Title".ToString)
            Else
                lblContentTitle.Text = "No Comments Found..."
            End If
            dataGrid1.DataSource = retCode
            dataGrid1.DataBind()
        Catch ex As Exception
            Throw ex
        Finally

        End Try

    End Sub
End Class
