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
Imports System.Web
Imports System.Net

Partial Class Controls_OfferDetail
    Inherits System.Web.UI.UserControl

    Private _chatcategory As String

    Public Property Chatcategory() As String
        Get
            Return _chatcategory
        End Get
        Set(ByVal value As String)
            _chatcategory = value
        End Set
    End Property

	Public Property OfferID() As String
		Get
			If ViewState(Me.ID + "_OfferID") Is Nothing Then
				Return String.Empty
			Else
				Return CType(ViewState(Me.ID + "_OfferID"), String)
			End If
		End Get

		Set(ByVal value As String)
			ViewState(Me.ID + "_OfferID") = value
		End Set
	End Property

	Public Property OfferType() As ItemType
		Get
			If ViewState(Me.ID + "_OfferType") Is Nothing Then
				Return String.Empty
			Else
				Return CType(ViewState(Me.ID + "_OfferType"), String)
			End If
		End Get

		Set(ByVal value As ItemType)
			ViewState(Me.ID + "_OfferType") = value
		End Set
	End Property

	Public Property OfferName() As String
		Get
			Return ltrName.Text
		End Get

		Set(ByVal value As String)
			ltrName.Text = value
		End Set
	End Property

	Public Property OfferPrice() As String
		Get
			Return ltrPrice.Text
		End Get

		Set(ByVal value As String)
			ltrPrice.Text = value
		End Set
	End Property

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

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

  Public Property NationalPrice() As String
    Get
      Return ltrNationalPrice.Text
    End Get

    Set(ByVal value As String)
      ltrNationalPrice.Text = value
    End Set
  End Property

    '9/18/2007 Brad Miller - Added for G2B 4.1
    Public Property ContractDescription() As String
        Get
            Return ltrContractDescription.Text
        End Get

        Set(ByVal value As String)
            ltrContractDescription.Text = "<P><strong>Contract Description:</strong>" & value & "</P>"
        End Set
    End Property

    '9/18/2007 Brad Miller - Added for G2B 4.1
    Public Property ContractTermsAndConditions() As String
        Get
            Return ltrContractTermsAndConditions.Text
        End Get

        Set(ByVal value As String)
            ltrContractTermsAndConditions.Text = String.Format("<p><a href=""javascript:void(0)"" onClick=""javascript:window.open('../Visitors/ContractDetail.aspx?{0}={1}&{2}={3}','mywindow','width=500,height=500,scrollbars=yes,resizeable=yes')"">Contract Terms and Conditions</a></p>", QueryStringName.OfferID, Me.OfferID, QueryStringName.Section, "ContractTermsAndConditions")
        End Set
    End Property

    '9/18/2007 Brad Miller - Added for G2B 4.1
    Public Property Requirements() As String
        Get
            Return ltrRequirements.Text
        End Get

        Set(ByVal value As String)
            ltrRequirements.Text = String.Format("<p><a href=""javascript:void(0)"" onClick=""javascript:window.open('../Visitors/ContractDetail.aspx?{0}={1}&{2}={3}','mywindow','width=500,height=500,scrollbars=yes,resizeable=yes')"">Requirements</a></p>", QueryStringName.OfferID, Me.OfferID, QueryStringName.Section, "Requirements")
        End Set
    End Property

  Public Property Disclaimer() As String
    Get
      Return ltrDisclaimer.Text
    End Get

    Set(ByVal value As String)
      ltrDisclaimer.Text = "<P class=""disclaimer"">" & value & "</P>"
    End Set
  End Property

  Public Property OfferContent() As String
    Get
      Return ltrLongDesc.Text
    End Get

    Set(ByVal value As String)
      ltrLongDesc.Text = value
    End Set
  End Property

  Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
    Dim _ownerType As OwnerType

    aAddToCart.Visible = False
    aChat.Visible = False
    spanAlreadyIn.Visible = False

    If IsAvailable Then
      If Request.IsAuthenticated Then
        aChat.Visible = True
      Else
        aAddToCart.HRef = String.Format("javascript:addItem({0});", OfferID)
        aAddToCart.Visible = True
      End If
    Else
      spanAlreadyIn.Visible = True
    End If

    If Not Page.IsPostBack Then

      Select Case OfferType
        Case ItemType.Bundle
          _ownerType = OwnerType.Bundle
        Case ItemType.ServicePlan
          _ownerType = OwnerType.ServicePlan
        Case ItemType.Feature
          _ownerType = OwnerType.Feature
        Case Else
          _ownerType = OwnerType.Other
      End Select

      ' ''ltrShortDesc.Text = String.Format("ControlID:{0};OwnerID:{1};OwnerType:{2}", "OfferDetail:Head", OfferID, _ownerType)	'ContentManager.Instance.GetContent("OfferDetail:Head", OfferID, _ownerType)
      ''ltrShortDesc.Text = ContentManager.Instance.GetContent("OfferDetail:Head", OfferID, _ownerType)

      ''If ltrShortDesc.Text = String.Empty Then
      ''	ltrShortDesc.Text = String.Format("ControlID - OfferDetail:Head; OwnerID - {0}; OwnerTypeID: {1}", OfferID, _ownerType)
      ''End If

      'ltrLongDesc.Text = String.Format("ControlID:{0};OwnerID:{1};OwnerType:{2}", "OfferDetail:Body", OfferID, _ownerType)	'ContentManager.Instance.GetContent("OfferDetail:Body", OfferID, _ownerType)

      'ltrLongDesc.Text = ContentManager.Instance.GetContent("OfferDetail:Body", OfferID, _ownerType)

      If ltrLongDesc.Text = String.Empty Then
        ltrLongDesc.Text = String.Format("ControlID - OfferDetail:Body; OwnerID - {0}; OwnerTypeID: {1}", OfferID, _ownerType)
      End If
    End If
  End Sub

  Public Sub New()

  End Sub
End Class
