Imports CharterDotCom.CommonEntities.Library
Imports CharterDotCom.CommonEntities.Library.Enumerations
Imports CharterDotCom.CommonEntities.Library.EntityMemberServices
'Imports CharterDotCom.CommonEntities.Library.EntityEBSServices
Imports CharterDotCom.CommonEntities.Library.EntitySupport
Imports CharterDotCom.CommonEntities.Library.EntitySearch
Imports CharterDotCom.CommonEntities.Library.EntityWebConfig
'Imports CharterDotCom.CommonEntities.Library.EntityG2BServices
Imports CharterDotCom.CommonEntities.Library.Common
Imports CharterDotCom.WebSite.Library

Partial Class Controls_Product
    Inherits System.Web.UI.UserControl

    Public Property Item() As ProductItem
        Get
            If ViewState(Me.ID & "_Item") Is Nothing Then
                Return ProductItem.Unspecified
            Else
                Return CType(ViewState(Me.ID & "_Item"), ProductItem)
            End If
        End Get

        Set(ByVal value As ProductItem)
            ViewState(Me.ID & "_Item") = value
        End Set
    End Property

    Public Property ShowLearnMore() As Boolean
        Get
            If ViewState(Me.ID & "_ShowLearnMore") Is Nothing Then
                Return False
            Else
                Return CType(ViewState(Me.ID & "_ShowLearnMore"), Boolean)
            End If
        End Get

        Set(ByVal value As Boolean)
            ViewState(Me.ID & "_ShowLearnMore") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Dim _content As Content
        'Dim _product As Product
        Dim _url As String
        Dim _orderUrl As String
        Dim name As String

        If Not IsPostBack Then
            '	_content = New Content()
            '	_product = _content.GetProduct(Item)

            Select Case Item
                Case ProductItem.CableTV
                    _url = String.Format("../Visitors/Products.aspx?{0}={1}", QueryStringName.MenuItem, MenuItem.CableTV.GetHashCode())
                    _orderUrl = String.Format("../Visitors/Offers.aspx?{0}={1}", QueryStringName.ProductItem, ProductItem.CableTV.GetHashCode())
                    name = "&lid=" & Item.ToString & "_Order_Button&lpos=Left"
                Case ProductItem.Internet
                    _url = String.Format("../Visitors/Products.aspx?{0}={1}", QueryStringName.MenuItem, MenuItem.Internet.GetHashCode())
                    _orderUrl = String.Format("../Visitors/Offers.aspx?{0}={1}", QueryStringName.ProductItem, ProductItem.Internet.GetHashCode())
                    name = "&lid=" & Item.ToString & "_Order_Button&lpos=Middle"
                Case ProductItem.Telephone
                    _url = String.Format("../Visitors/Products.aspx?{0}={1}", QueryStringName.MenuItem, MenuItem.Telephone.GetHashCode())
                    _orderUrl = String.Format("../Visitors/Offers.aspx?{0}={1}", QueryStringName.ProductItem, ProductItem.Telephone.GetHashCode())
                    name = "&lid=" & Item.ToString & "_Order_Button&lpos=Right"
                Case Else
                    _url = String.Empty
                    _orderUrl = String.Empty
            End Select

            '	lnkImage.ImageUrl = _product.ImageUrl
            '	lnkImage.NavigateUrl = _url

            '	lnkName.Text = _product.Name
            '	lnkName.NavigateUrl = _url

            '	ltrDescription.Text = _product.Text

            '	lnkLearnMore.NavigateUrl = _url
            '	lnkLearnMore.Visible = ShowLearnMore

            'ltrContent.Text = String.Format("ControlID:{0};OwnerID:{1};OwnerType:{2}", "Product:" & Item.ToString(), 1, OwnerType.Other) 'ContentManager.Instance.GetContent("Product:" & Item.ToString(), 1, OwnerType.Other)


            '######################################################################################################
            'AT THIS POINT THIS CONTENT IS GLOBAL FOR ALL USERS, SO NO NEED TO DO A REMOTING CALL FOR THIS CONTENT
            '######################################################################################################
            'ltrContent.Text = ContentManager.Instance.GetContent("Product:" & Item.ToString(), 1, OwnerType.Other)
            ltrContent.Text = ContentManager.Instance.GetContent("Product:" & Item.ToString(), 1, OwnerType.Other)

            'lnkOrder.NavigateUrl = String.Format("../Visitors/Localize.aspx?{0}={1}", QueryStringName.TargetPage, Server.UrlEncode(_orderUrl))
            'lnkOrder.Attributes("name") = name
        End If
    End Sub
End Class