Partial Class Controls_Support
    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"), SupportMode)
            End If
        End Get

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

    Public Property Mode() As SupportMode
        Get
            If ViewState(Me.ID & "_Mode") Is Nothing Then
                Return SupportMode.Unspecified
            Else
                Return CType(ViewState(Me.ID & "_Mode"), SupportMode)
            End If
        End Get

        Set(ByVal value As SupportMode)
            ViewState(Me.ID & "_Mode") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            pnlSingleProduct.Visible = False
            pnlMultipleProduct.Visible = False

            Select Case Mode
                Case SupportMode.SingleProduct
                    Select Case Item
                        Case ProductItem.CableTV, ProductItem.DigitalCableTV, ProductItem.PayPerView, ProductItem.VideoOnDemand, ProductItem.HighDefinitionTV, ProductItem.DigitalVideoRecorder, ProductItem.BasicCableTV, ProductItem.InteractiveTV
                            ltrSingleProduct.Text = "Cable service"
                            lnkSingleProduct.Text = "Cable Help"
                            lnkSingleProduct.NavigateUrl = String.Format("../customers/support.aspx?{0}={1}", QueryStringName.ProductItem, ProductItem.CableTV.GetHashCode())
                        Case ProductItem.Internet
                            ltrSingleProduct.Text = "Internet service"
                            lnkSingleProduct.Text = "Internet Help"
                            lnkSingleProduct.NavigateUrl = String.Format("../customers/support.aspx?{0}={1}", QueryStringName.ProductItem, ProductItem.Internet.GetHashCode())
                        Case ProductItem.Telephone
                            ltrSingleProduct.Text = "Telephone service"
                            lnkSingleProduct.Text = "Telephone Help"
                            lnkSingleProduct.NavigateUrl = String.Format("../customers/support.aspx?{0}={1}", QueryStringName.ProductItem, ProductItem.Telephone.GetHashCode())
                        Case ProductItem.Unspecified
                            Throw New CharterUIException("The Support Item property is unspecified for the Support control.")
                    End Select

                    pnlSingleProduct.Visible = True
                Case SupportMode.MultipleProducts
                    pnlMultipleProduct.Visible = True
            End Select
        End If
    End Sub
End Class
