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

	Public Property Placement() As String
		Get
			If ViewState(Me.ID & "_Placement") Is Nothing Then
				Return String.Empty
			Else
				Return CType(ViewState(Me.ID & "_Placement"), String)
			End If
		End Get

		Set(ByVal value As String)
			ViewState(Me.ID & "_Placement") = value
		End Set
	End Property

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		If Not Page.IsPostBack Then
            'ltrContent.Text = String.Format("ControlID:{0};OwnerID:{1};OwnerType:{2}", "Promotion:" & Placement, 1, OwnerType.Other)	'ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)
            'ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)
            ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)

            'Dim contentRecordsCollection As New System.Collections.Generic.Dictionary(Of String, String)
            'contentRecordsCollection = HttpContext.Current.Application("CONTENT_RECORDS_COLLECTION")
            'Response.Write(contentRecordsCollection.ContainsKey("Promotion:" & Placement & ":" & 1 & ":" & OwnerType.Other.ToString) & "<BR>")
            'Response.Write(contentRecordsCollection("Promotion:" & Placement & ":" & 1 & ":" & OwnerType.Other.ToString) & "<BR>")

            'Response.Write("Promotion:" & Placement & ":" & "1" & ":" & OwnerType.Other & "<br>")




            ''#####################################################################
            ''THIS SECTION WAS CREATED AS A PROOF OF CONCEPT FOR RELEVANT CONTENT
            ''#####################################################################
            'Try
            '    Dim strContentIdentifier As String = "Promotion:" & Placement
            '    Dim displayGeneralContent As Boolean = True
            '    If Not (Request.Cookies("Knotice_Charter_Cookie") Is Nothing) Then
            '        Dim cookie As HttpCookie = Request.Cookies("Knotice_Charter_Cookie")

            '        If Not (cookie Is Nothing) Then
            '            If Not (cookie.Values("PlacementLocations") Is Nothing) Then
            '                Dim PlacementLocations() As String = cookie.Values("PlacementLocations").Split(",")

            '                For Each parm As String In PlacementLocations
            '                    If parm.Contains(":") Then
            '                        Dim y() As String = parm.Split(":")

            '                        '####################################################################################
            '                        'y(0) IS THE PAGE THIS RELEVANT CONTENT APPLIES TO.
            '                        'y(1) IS THE CATIGORIZATION OF THE CONTENT ON A PAGE.
            '                        'y(2) IS THE SPECIFIC CONTROL ON THE PAGE THAT THIS RELEVANT CONTENT APPLIES TO.
            '                        '####################################################################################

            '                        If UBound(y) > 1 Then
            '                            '#############################################################################
            '                            'CHECK TO SEE IF THE CURRENT PARM MATCHES THIS CONTENT ID PASSED TO THIS EVENT
            '                            '#############################################################################

            '                            If Placement.Trim().ToLower() = y(2).Trim().ToLower() Then
            '                                '##################################################################
            '                                'GET THE RELEVANT CONTENT RECORD BASED ON THIS VALUE FROM COOKIE
            '                                '##################################################################
            '                                strContentIdentifier = y(1).Trim().ToLower() & ":" & y(2).Trim().ToLower()

            '                                '################################
            '                                'GET THE RELEVANT CONTENT RECORD 
            '                                '################################
            '                                ltrContent.Text = ContentManager.Instance.GetContent(strContentIdentifier, 1, OwnerType.Other)
            '                                'ltrContent.Text = ContentManager.Instance.GetContent("ProductDetail:Telephone:Body", 1, OwnerType.Other)

            '                                Exit Sub
            '                            End If
            '                        Else
            '                            '###############################
            '                            'DISPLAY GENERAL CONTENT RECORD
            '                            '###############################
            '                            ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)
            '                            Exit Sub
            '                        End If
            '                    Else
            '                        '###############################
            '                        'DISPLAY GENERAL CONTENT RECORD
            '                        '###############################
            '                        ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)
            '                        Exit Sub
            '                    End If
            '                Next
            '            Else
            '                '###############################
            '                'DISPLAY GENERAL CONTENT RECORD
            '                '###############################
            '                ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)
            '                Exit Sub
            '            End If
            '        Else
            '            '###############################
            '            'DISPLAY GENERAL CONTENT RECORD
            '            '###############################
            '            ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)
            '            Exit Sub
            '        End If

            '    End If

            '    '#######################################################################################
            '    'SHOULD ONLY BE GENERAL CONTENT ONLY AT THIS POINT. RELEVANT CONTENT WOULD HAVE EXIT 
            '    'SUB ALREADY BASED ON THE VALUE IN THE COOKIE.
            '    '#######################################################################################
            '    ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)

            'Catch ex As Exception
            '    '##################################################################
            '    'IF THERE ARE ANY PROBLEMS JUST SHOW THE GENERAL CONTENT RECORD
            '    '##################################################################
            '    ltrContent.Text = ContentManager.Instance.GetContent("Promotion:" & Placement, 1, OwnerType.Other)
            'End Try








        End If
    End Sub
End Class
