Imports EBSServicesProvider
Imports CharterDotCom.CommonEntities.Library
Imports CharterDotCom.CommonEntities.Library.Enumerations
Imports CharterDotCom.CommonEntities.Library.EntityEBSServices


Partial Class TESTHARNESS_TestProviders_TestEAIServices
    Inherits System.Web.UI.Page

    Private _provider As IEBSServicesProvider


    Private Property Provider() As IEBSServicesProvider
        Get
            Return _provider
        End Get
        Set(ByVal value As IEBSServicesProvider)
            _provider = value
        End Set
    End Property


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then
            Dim lProvider As New EBSServicesProvider.ProviderManager
            Me.Provider = lProvider
        End If
    End Sub

    Protected Sub btnTestCustomerStatements_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTestCustomerStatements.Click
        Try
            '################################################################################################
            'MODIFICATION	ROD COPELAND	ISSUE ID 6661	CSG Multi-Statement - My Account Overview Page
            '################################################################################################
            Dim objRequest As New GetCustomerStatementsRequest
            Dim objResponse As New GetCustomerStatementsResponse
            Dim objCSGHeaderInfo As New CsgHeaderInfo()

            objCSGHeaderInfo.ConversationId = ""
            objCSGHeaderInfo.Region = ""
            objCSGHeaderInfo.RoutingArea = "8345781520037278".Substring(0, 6) & "00"

            objRequest.CsgHeaderInfo = objCSGHeaderInfo
            objRequest.AccountId = "8345781520037278"



            objResponse = Me.Provider.GetCustomerStatements(objRequest)



            If Not (objResponse Is Nothing) Then
                If Not objResponse.ExceptionMessage Is Nothing Then
                    '##########################
                    'ws exception has occured.
                    '##########################
                    Response.Write(objResponse.ExceptionMessage)
                Else
                    If Not (objResponse.AccountStatementAllInfo Is Nothing) Then
                        '###################################
                        'Serviceability looks to be good.
                        '###################################
                        Response.Write("Customer Statements Test is Good")
                    Else
                        Response.Write("CustomerStatements.AccountStatementAllInfo came back as Nothing")
                    End If
                End If
            Else
                Response.Write("objResponse came back as Nothing")
            End If

        Catch ex As Exception
            Response.Write("Customer Statements  Failed with the following error....    ")
            Response.Write(ex.Message)
        End Try
    End Sub

    Protected Sub btnTestServiceabilityByAddress_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTestServiceabilityByAddress.Click
        Try
            Dim objRequest As New GetServiceabilityRequest
            Dim objResponse As New GetServiceabilityResponse

            Dim lCriteria As New ServiceabilityCriteria
            Dim lAddress As New ServiceabilityCriteriaAddress
            lAddress.AddressLine1 = "1701 faith ct"
            lAddress.AddressLine2 = ""
            lAddress.CleansedAddress = True
            lAddress.ZipCode = "63026"

            lAddress.ZipCode4 = ""

            lCriteria.Item = lAddress
            lCriteria.ItemElementName = ItemChoiceType.Address

            objRequest.Criteria = lCriteria
            objRequest.SourceIPAddress = IIf(Request.ServerVariables("REMOTE_ADDR") Is Nothing, String.Empty, Request.ServerVariables("REMOTE_ADDR"))


            objResponse = Me.Provider.GetServiceability(objRequest)

            If Not (objResponse Is Nothing) Then
                If Not objResponse.ExceptionMessage Is Nothing Then
                    '##########################
                    'ws exception has occured.
                    '##########################
                    Response.Write(objResponse.ExceptionMessage)
                Else
                    If Not (objResponse.ServiceabilityResult Is Nothing) Then
                        '###################################
                        'Serviceability looks to be good.
                        '###################################
                        Response.Write("Serviceability Test is Good")
                    Else
                        Response.Write("ServiceabilityResult came back as Nothing")
                    End If
                End If
            Else
                Response.Write("objResponse came back as Nothing")
            End If

        Catch ex As Exception
            Response.Write("Serviceability  Failed with the following error....    ")
            Response.Write(ex.Message)
        End Try
    End Sub

    Protected Sub btnFindCSGAccountNumber_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFindCSGAccountNumber.Click
'###########################################################################
'PROJECT BIG SKY, JULY 2009     ROD COPELAND    ISSUE ID 6724
'###########################################################################
'CONVERT THE ICOMS ACCOUNT NUMBER AND PASS THE DATA INTO THE PROVISIONING 
'SYSTEM AS A CSG CUSTOMER THAT HAS BEEN CONVERTED FROM ICOMS.
'###########################################################################
        Try
            '#################################################################################
            'MODIFICATION	ROD COPELAND	ISSUE ID    	MAP ICOMS TO CSG ACCOUNT NUMBER - 
            'MY ACCOUNT REGISTRATION PROCESS.
            '#################################################################################
            Dim objRequest As New GetDataRequest
            Dim objResponse As New GetDataResponse

            objRequest.AccountNumberICOMS = "1001314449050250"



            objResponse = Me.Provider.FindCSGAccountNumber(objRequest)



            If Not (objResponse Is Nothing) Then
                If Not objResponse.ExceptionMessage Is Nothing Then
                    '##########################
                    'ws exception has occured.
                    '##########################
                    Response.Write(objResponse.ExceptionMessage)
                Else
                    '###############################
                    'SHOULD BE GOOD AT THIS POINT.
                    '###############################
                    Response.Write("GOOD AT THIS POINT")
                End If
            Else
                Response.Write("objResponse came back as Nothing")
            End If

        Catch ex As Exception
            Response.Write("Customer Statements  Failed with the following error....    ")
            Response.Write(ex.Message)
        End Try
    End Sub

    Protected Sub btnFindICOMSAccountNumberFromCSGAccountNumber_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFindICOMSAccountNumberFromCSGAccountNumber.Click
        '###########################################################################
        'PROJECT BIG SKY, JULY 2009     ROD COPELAND    ISSUE ID 7334
        '###########################################################################
        Try
            Dim objRequest As New GetDataRequest
            Dim objResponse As New GetDataResponseCSGToICOMSConversion

            objRequest.AccountNumberCSG = "8345781580193409"



            objResponse = Me.Provider.FindICOMSAccountNumberFromCSGAccountNumber(objRequest)



            If Not (objResponse Is Nothing) Then
                If Not objResponse.ExceptionMessage Is Nothing Then
                    '##########################
                    'ws exception has occured.
                    '##########################
                    Response.Write(objResponse.ExceptionMessage)
                Else
                    '###############################
                    'SHOULD BE GOOD AT THIS POINT.
                    '###############################
                    Response.Write("GOOD AT THIS POINT")
                End If
            Else
                Response.Write("objResponse came back as Nothing")
            End If

        Catch ex As Exception
            Response.Write("FindICOMSAccountNumberFromCSGAccountNumber  Failed with the following error....    ")
            Response.Write(ex.Message)
        End Try
    End Sub

    

    Protected Sub btnGetCSGCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetCSGCustomer.Click

        Try
            Dim objRequest As New GetCustomerRequest
            Dim objResponse As New GetCustomerResponse
            Dim objCSGHeaderInfo As New CsgHeaderInfo()

            objCSGHeaderInfo.ConversationId = ""
            objCSGHeaderInfo.Region = ""
            objCSGHeaderInfo.RoutingArea = "8345780100262751".Substring(0, 6) & "00" '"8345780660012034"
            objRequest.csgHeaderInfo = objCSGHeaderInfo
            objRequest.customerID = "1103033236341" '"1103034462383" '1108544255839" 

            objResponse = Me.Provider.GetCustomer(objRequest)

            If Not (objResponse Is Nothing) Then
                If Not objResponse.ExceptionMessage Is Nothing Then
                    '##########################
                    'ws exception has occured.
                    '##########################
                    Response.Write(objResponse.ExceptionMessage)
                Else
                    If Not (objResponse.SecurityCode Is Nothing) Then
                        '###################################
                        'Retrieving Customer Data succesful
                        '###################################
                        Response.Write("Customer Data retrieval is succesful")
                    Else
                        Response.Write("Customer Data retrieval failed")
                    End If
                End If
            Else
                Response.Write("objResponse came back as Nothing")
            End If

        Catch ex As Exception
            Response.Write("getCustomer  Failed with the following error....    ")
            Response.Write(ex.Message)
        End Try
    End Sub

    Protected Sub btnUpdateCSGCustomField_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdateCSGCustomField.Click
        Try
            'BE EXTRA CAREFUL TESTING this procedure as it can update Security Code
            Dim objRequest As New UpdateCustomFieldRequest
            Dim objResponse As New UpdateCustomFieldResponse
            Dim objCSGHeaderInfo As New CsgHeaderInfo()
            Dim objcustomField As New customFieldUpdate()

            objCSGHeaderInfo.ConversationId = ""
            objCSGHeaderInfo.Region = ""
            objCSGHeaderInfo.RoutingArea = "8345780100262751".Substring(0, 6) & "00"
            objRequest.CsgHeaderInfo = objCSGHeaderInfo
            objRequest.CustomerID = "1103033236341" '; "1103034462383" 'need to get a working customer ID

            objcustomField.Index = 4 ''need to check for right values. 
            objcustomField.Value = "1907"
            objRequest.CustomField = objcustomField

            objResponse = Me.Provider.UpdateCustomField(objRequest)

            If Not (objResponse Is Nothing) Then
                If Not objResponse.ExceptionMessage Is Nothing Then
                    '##########################
                    'ws exception has occured.
                    '##########################
                    Response.Write(objResponse.ExceptionMessage)
                Else
                    If Not (objResponse.Result Is Nothing) Then
                        '###################################
                        'Retrieving Customer Data succesful
                        '###################################
                        Response.Write("Update Security code is succesful")
                    Else
                        Response.Write("Update Security code failed")
                    End If
                End If
            Else
                Response.Write("objResponse came back as Nothing")
            End If

        Catch ex As Exception
            Response.Write("Update Custom Field  Failed with the following error....    ")
            Response.Write(ex.Message)
        End Try
    End Sub

    Protected Sub btnGetAccountsFromCSG_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetAccountsFromCSG.Click

        Try

            Dim objCSGHeaderInfo As New HeaderInfo
            objCSGHeaderInfo.ConversationId = ""
            objCSGHeaderInfo.Region = ""
            objCSGHeaderInfo.RoutingArea = "83457800"

            Dim objCriteria As New AccountCriteriaCSG
            objCriteria.ItemElementName = ItemChoiceTypeCSG.AccountNumber
            objCriteria.Item = "8345780590154948"

            Dim objRequest As New GetAccountsRequestCSG(objCSGHeaderInfo, objCriteria)
            Dim objResponse As GetAccountsResponseCSG = Me.Provider.GetAccountsFromCSG(objRequest)

            If Not (objResponse Is Nothing) Then
                If Not objResponse.ExceptionMessage Is Nothing Then
                    '##########################
                    'ws exception has occured.
                    '##########################
                    Response.Write(objResponse.ExceptionMessage)
                Else
                    If Not (objResponse.Result Is Nothing) Then
                        '###################################
                        'Retrieving Customer Data succesful
                        '###################################
                        Response.Write("GetAccountsFromCSG is succesful")
                    Else
                        Response.Write("GetAccountsFromCSG failed")
                    End If
                End If
            Else
                Response.Write("objResponse came back as Nothing")
            End If

        Catch ex As Exception
            Response.Write("GetAccountsFromCSG failed with the following error....    ")
            Response.Write(ex.Message)
        End Try

    End Sub

End Class
