Imports CharterDotCom.CommonEntities.Library
Imports CharterDotCom.CommonEntities.Library.Common
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.WebSite.Library
Imports CharterDotCom.WebSite.Library.BLCommon

Partial Class Visitors_AffiliateContractDetail
    Inherits CharterCMSPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SetPageTitle("Affiliate Contract Detail")

        If Not Page.IsPostBack Then
            If Request.QueryString(QueryStringName.OfferID) IsNot Nothing Then
                Dim catalog As ICatalog
                Dim offerID As String
                Dim offer As ICartItem

                offerID = 0
                offer = Nothing

                If Not IsPostBack Then
                    If Not (Request.QueryString(QueryStringName.OfferID) Is Nothing) Then
                        offerID = Request.QueryString(QueryStringName.OfferID)
                    End If
                Else
                    If Not (Request.QueryString(QueryStringName.OfferID) Is Nothing) Then
                        offerID = Request.QueryString(QueryStringName.OfferID)
                    End If
                End If

                If offerID > 0 Then
                    catalog = AffliateCatalogManager.Instance.GetCatalog()

                    If catalog Is Nothing Then
                        Throw New MissingCatalogException()
                    End If

                    If catalog.Bundles.ContainsKey(offerID) Then
                        offer = catalog.Bundles(offerID)
                    ElseIf catalog.ServicePlans.ContainsKey(offerID) Then
                        offer = catalog.ServicePlans(offerID)
                    End If
                End If
                If Request.QueryString(QueryStringName.Section) IsNot Nothing Then
                    Select Case Request.QueryString(QueryStringName.Section).ToLower
                        Case "ContractTermsAndConditions".ToLower
                            ltrContent.Text = offer.ContractTermsAndConditions
                        Case "Requirements".ToLower
                            ltrContent.Text = offer.Requirements
                    End Select
                End If
            End If
        End If
    End Sub
End Class
