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_PromotionDetail
  Inherits System.Web.UI.UserControl

  Public Property Placement() As String
    Get
      Return ViewState("Me.ID" + "_Placement")
    End Get
    Set(ByVal value As String)
      ViewState("Me.ID" + "_Placement") = value
    End Set
  End Property

  Public ReadOnly Property Mode() As PromotionMode
    Get
      If Request.UrlReferrer.Host = Request.Url.Host Then
        Return PromotionMode.Internal
      Else
        Return PromotionMode.External
      End If
    End Get
  End Property

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim _contentText As String
    'Dim _detail As PromotionDetail

    'If LocationID > 0 Then
    '	lblPrice.Visible = True
    '	btnYes.Text = "Order Now"
    'Else
    '	lblPrice.Visible = False
    '	btnYes.Text = "Check Availability and Prices"
    'End If

    'If Mode = PromotionMode.External Then
    '	btnNo.Text = "No, Thanks"
    'Else
    '	btnNo.Text = "No, Thanks. Show Me More Offers."
    'End If

    '_content = New Content
    '_detail = _content.GetPromotionDetail(Placement, LocationID)
    Dim _promocode As String
    _promocode = Request.QueryString(QueryStringName.Placement)
    If _promocode IsNot Nothing Then
      _contentText = ContentManager.Instance.GetContent("CAMPAIGN", _promocode, OwnerType.Other)
      If _contentText <> String.Empty Then
        ltrText.Text = _contentText
      Else
        ltrText.Text = "We're sorry, but we are unable to validate your promotion code at this time.  You may proceed by viewing <a href='../Visitors/Localize.aspx?" & QueryStringName.TargetPage & "=" & Server.UrlEncode("../Order/AllOffers.aspx") & "' > all Charter offers</a> in your area."
      End If
    Else
      ltrText.Text = "We're sorry, but we are unable to validate your promotion code at this time.  You may proceed by viewing <a href='../Visitors/Localize.aspx?" & QueryStringName.TargetPage & "=" & Server.UrlEncode("../Order/AllOffers.aspx") & "' > all Charter offers</a> in your area."
    End If

    'If _detail.Price <> Decimal.MinValue Then
    '	lblPrice.Text = "$" & _detail.Price.ToString()
    'End If
  End Sub

  Protected Sub btnYes_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnYes.Click
    'Dim url As String

    'If LocationID > 0 Then
    '	url = String.Format("../Visitors/Offers.aspx?{0}={1}", QueryStringName.PromotionPlacement, Placement)
    '	Response.Redirect(url)
    'Else
    '	url = String.Format("../Visitors/Offers.aspx?{0}={1}", QueryStringName.PromotionPlacement, Placement)
    '	Response.Redirect(String.Format("../Visitors/Localize.aspx?{0}={1}", QueryStringName.TargetPage, Server.UrlEncode(url)))
    'End If
  End Sub

  Protected Sub btnNo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNo.Click
    Dim url As String

    If Mode = PromotionMode.External Then
      Response.Redirect("../Default.aspx")
    Else
      url = "Offers.aspx"
      Response.Redirect(String.Format("Localize.aspx?{0}={1}", QueryStringName.TargetPage, Server.UrlEncode(url)))
    End If
  End Sub
End Class