Imports CharterDotCom.CommonEntities.Library
Imports CharterDotCom.CommonEntities.Library.EntityEBSServices
Imports System.Xml
Imports System.Net
Imports System.Web

Public Class ProviderManager
    Inherits IEBSServicesProvider

    Private _credentials As ICredentials
    Private wsCLU As WSCLU.CLUServicePort
    Private wsCSGCustomerAccount As WSCSG_CustomerAccount.AccountServicePort
    Private wsICOMSCustomerAccount As WSICOMS_CustomerAccount.AccountServicePort
    Private wsICOMSOrder As WSICOMS_Order.OrderServicePort
    Private wsCSGOrder As WSCSG_Order.OrderServicePort
    Private wsCSGPayment As WSCSG_Payment.PaymentServicePort
    Private wsICOMSPayment As WSICOMS_CustomerAccount.AccountServicePort
    Private wsServiceability As WSGetServiceability.ServiceabilityServicePort
    Private wsLocation As WS_Location.LocationServiceSchemaPort
    Private wsTelephony As WS_Telephony.LergServicePort
    Private wsCustomerOrderCriteria As WS_CustomerOrderCriteria.CustomerOrderServicePort
    Private wsELOA As WS_ELOA.EBSTPVServicePort

'###########################################################################
'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.
'###########################################################################
    Private wsDataService As WS_DataService.DataServicePort

    '###########################################################################
    'CSG My Account get/Update Security Code March25,2010    Sriman Kanuri
    '###########################################################################
    Private wsCustomer As WS_Customer.CustomerServicePort

    Private Property Credentials() As ICredentials
        Get
            Return _credentials
        End Get
        Set(ByVal value As ICredentials)
            _credentials = value
        End Set
    End Property
    Public Sub New()
    End Sub

    'Public Sub New(ByVal args As XmlNode)
    '  ''Dim netCredential As NetworkCredential
    '  ''Dim uri As Uri
    '  ''Try


    '  ''  If (Not args Is Nothing) AndAlso (Not args.ChildNodes(0) Is Nothing) AndAlso _
    '  ''          (args.ChildNodes(0).LocalName = Constant.CONFIG_PROVIDERDATA) Then
    '  ''    For Each providerData As XmlNode In args.ChildNodes(0).ChildNodes
    '  ''      Select Case providerData.LocalName.ToUpper

    '  ''        Case Constant.CONFIG_CLUWEBSERVICE
    '  ''          wsCLU = New WSCLU.CLUServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsCLU.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsCLU.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If
    '  ''        Case Constant.CONFIG_CSGACCOUNTWEBSERVICE
    '  ''          wsCSGCustomerAccount = New WSCSG_CustomerAccount.AccountServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsCSGCustomerAccount.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsCSGCustomerAccount.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If
    '  ''        Case Constant.CONFIG_ICOMSACCOUNTWEBSERVICE
    '  ''          wsICOMSCustomerAccount = New WSICOMS_CustomerAccount.AccountServicePort
    '  ''          wsICOMSPayment = New WSICOMS_CustomerAccount.AccountServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsICOMSCustomerAccount.Url = uri.AbsoluteUri
    '  ''            Me.wsICOMSPayment.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsICOMSCustomerAccount.Credentials = Me.Credentials
    '  ''              wsICOMSPayment.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If
    '  ''        Case Constant.CONFIG_ICOMSORDERWEBSERVICE
    '  ''          wsICOMSOrder = New WSICOMS_Order.OrderServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsICOMSOrder.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsICOMSOrder.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If
    '  ''        Case Constant.CONFIG_CSGORDERWEBSERVICE
    '  ''          wsCSGOrder = New WSCSG_Order.OrderServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsCSGOrder.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsCSGOrder.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If
    '  ''        Case Constant.CONFIG_CSGPAYMENTWEBSERVICE
    '  ''          wsCSGPayment = New WSCSG_Payment.PaymentServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsCSGPayment.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsCSGPayment.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If
    '  ''        Case Constant.CONFIG_SERVICEABILITYWEBSERVICE
    '  ''          wsServiceability = New WSGetServiceability.ServiceabilityServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsServiceability.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              wsServiceability.UseDefaultCredentials = False
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsServiceability.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If
    '  ''        Case Constant.CONFIG_TELEPHONYWEBSERVICE
    '  ''          wsTelephony = New WS_Telephony.LergServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsTelephony.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsTelephony.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If



    '  ''        Case Constant.CONFIG_CUSTOMERORDERCRITERIAWEBSERVICE
    '  ''          wsCustomerOrderCriteria = New WS_CustomerOrderCriteria.CustomerOrderServicePort
    '  ''          If (Not providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_USER) Is Nothing) AndAlso _
    '  ''              (Not providerData.Attributes(Constant.CONFIG_PASSWORD) Is Nothing) Then

    '  ''            uri = New Uri(providerData.Attributes("URL").Value)
    '  ''            Me.wsCustomerOrderCriteria.Url = uri.AbsoluteUri
    '  ''            If CBool(providerData.Attributes(Constant.CONFIG_AUTHENTICATIONREQUIRED).Value) Then
    '  ''              wsCustomerOrderCriteria.UseDefaultCredentials = False
    '  ''              netCredential = New NetworkCredential(providerData.Attributes(Constant.CONFIG_USER).Value, providerData.Attributes(Constant.CONFIG_PASSWORD).Value)
    '  ''              Me.Credentials = netCredential.GetCredential(uri, "Basic")
    '  ''              wsCustomerOrderCriteria.Credentials = Me.Credentials
    '  ''            End If
    '  ''          Else
    '  ''            Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''          End If




    '  ''        Case Else
    '  ''      End Select
    '  ''    Next
    '  ''  Else
    '  ''    Throw New Exception(Constant.EXCEPTION_CONFIGURATION)
    '  ''  End If
    '  ''Catch ex As Exception
    '  ''  Throw ex
    '  ''Finally


    '  ''End Try
    'End Sub

    Public Overrides Function GetLineupByID(ByVal obj As IProviderParameters) As IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetLineupByIDRequest
        Dim objRequest As New WSCLU.GetLineupByIDRequest
        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WSCLU.LineupResponse
        Dim objResponse As New GetLineupByIDResponse


        Try
            objTempRequest = CType(obj, GetLineupByIDRequest)


            objRequest.SystemInfo = New WSCLU.SystemInfo
            objRequest.SystemInfo.FTA = objTempRequest.SystemInfo.FTA
            objRequest.SystemInfo.ServiceLevelID = objTempRequest.SystemInfo.ServiceLevelID
            objRequest.SystemInfo.ServiceLevelName = objTempRequest.SystemInfo.ServiceLevelName
            objRequest.SystemInfo.SystemCode = objTempRequest.SystemInfo.SystemCode


            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            'Configure settings for CLU WebService
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsCLU = New WSCLU.CLUServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_URL))
            wsCLU.PreAuthenticate = True
            Me.wsCLU.Url = uri.AbsoluteUri
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsCLU.Credentials = Me.Credentials
            End If

            objTempResponse = Me.wsCLU.GetLineupByID(objRequest)


            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = EBSServicesProvider.WSCLU.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If

            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If Not (objTempResponse.SingleLineup Is Nothing) Then
                objResponse.SingleLineup = New SingleLineup
                objResponse.SingleLineup.LineupID = objTempResponse.SingleLineup.LineupID
                objResponse.SingleLineup.LineupName = objTempResponse.SingleLineup.LineupName

                If Not (objTempResponse.SingleLineup.LineupChannels Is Nothing) Then
                    ReDim objResponse.SingleLineup.LineupChannels(objTempResponse.SingleLineup.LineupChannels.GetUpperBound(0))
                    For i2 As Integer = 0 To objTempResponse.SingleLineup.LineupChannels.GetUpperBound(0)
                        objResponse.SingleLineup.LineupChannels(i2) = New SingleChannel
                        objResponse.SingleLineup.LineupChannels(i2).ChannelName = objTempResponse.SingleLineup.LineupChannels(i2).ChannelName
                        objResponse.SingleLineup.LineupChannels(i2).ChannelNumber = objTempResponse.SingleLineup.LineupChannels(i2).ChannelNumber
                        objResponse.SingleLineup.LineupChannels(i2).ServiceLevel = objTempResponse.SingleLineup.LineupChannels(i2).ServiceLevel
                    Next
                End If
            End If



            If Not (objTempResponse.Result Is Nothing) Then
                objResponse.Result = New Result
                objResponse.Result.DateTime = objTempResponse.Result.DateTime
                objResponse.Result.Description = objTempResponse.Result.Description

                If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                    objResponse.Result.ExceptionInfo = New ResultExceptionInfo
                    objResponse.Result.ExceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                    objResponse.Result.ExceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                    objResponse.Result.ExceptionInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                    objResponse.Result.ExceptionInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                End If

                objResponse.Result.ReferenceCode = objTempResponse.Result.ReferenceCode
                objResponse.Result.ReturnCode = objTempResponse.Result.ReturnCode
                objResponse.Result.Server = objTempResponse.Result.Server
                objResponse.Result.Source = objTempResponse.Result.Source

                If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                    For i2 As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                        objResponse.Result.StatusMessages(i2) = New CsgStatusMessage
                        objResponse.Result.StatusMessages(i2).Code = objTempResponse.Result.StatusMessages(i2).Code
                        objResponse.Result.StatusMessages(i2).Message = objTempResponse.Result.StatusMessages(i2).Message
                    Next
                End If

                objResponse.Result.Type = objTempResponse.Result.Type
            End If
            Return objResponse
        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function
    Public Overrides Function GetLineupBySystemFTA(ByVal obj As IProviderParameters) As IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetLineupBySystemFTARequest
        Dim objRequest As New WSCLU.GetLineupBySystemFTARequest

        '########################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '########################################
        Dim objTempResponse As New WSCLU.LineupResponse
        Dim objResponse As New GetLineupBySystemFTAResponse


        Try
            objTempRequest = CType(obj, GetLineupBySystemFTARequest)


            objRequest.SystemInfo = New WSCLU.SystemInfo
            objRequest.SystemInfo.FTA = objTempRequest.SystemInfo.FTA
            objRequest.SystemInfo.ServiceLevelID = objTempRequest.SystemInfo.ServiceLevelID
            objRequest.SystemInfo.ServiceLevelName = objTempRequest.SystemInfo.ServiceLevelName
            objRequest.SystemInfo.SystemCode = objTempRequest.SystemInfo.SystemCode


            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            'Configure settings for CLU WebService
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsCLU = New WSCLU.CLUServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_URL))
            Me.wsCLU.Url = uri.AbsoluteUri
            wsCLU.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsCLU.Credentials = Me.Credentials
            End If

            objTempResponse = Me.wsCLU.GetLineupBySystemFTA(objRequest)
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = EBSServicesProvider.WSCLU.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If

            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If Not (objTempResponse.SingleLineup Is Nothing) Then
                objResponse.SingleLineup = New SingleLineup
                objResponse.SingleLineup.LineupID = objTempResponse.SingleLineup.LineupID
                objResponse.SingleLineup.LineupName = objTempResponse.SingleLineup.LineupName

                If Not (objTempResponse.SingleLineup.LineupChannels Is Nothing) Then
                    ReDim objResponse.SingleLineup.LineupChannels(objTempResponse.SingleLineup.LineupChannels.GetUpperBound(0))
                    For i2 As Integer = 0 To objTempResponse.SingleLineup.LineupChannels.GetUpperBound(0)
                        objResponse.SingleLineup.LineupChannels(i2) = New SingleChannel
                        objResponse.SingleLineup.LineupChannels(i2).ChannelName = objTempResponse.SingleLineup.LineupChannels(i2).ChannelName
                        objResponse.SingleLineup.LineupChannels(i2).ChannelNumber = objTempResponse.SingleLineup.LineupChannels(i2).ChannelNumber
                        objResponse.SingleLineup.LineupChannels(i2).ServiceLevel = objTempResponse.SingleLineup.LineupChannels(i2).ServiceLevel
                    Next
                End If
            End If



            If Not (objTempResponse.Result Is Nothing) Then
                objResponse.Result = New Result
                objResponse.Result.DateTime = objTempResponse.Result.DateTime
                objResponse.Result.Description = objTempResponse.Result.Description

                If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                    objResponse.Result.ExceptionInfo = New ResultExceptionInfo
                    objResponse.Result.ExceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                    objResponse.Result.ExceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                    objResponse.Result.ExceptionInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                    objResponse.Result.ExceptionInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                End If

                objResponse.Result.ReferenceCode = objTempResponse.Result.ReferenceCode
                objResponse.Result.ReturnCode = objTempResponse.Result.ReturnCode
                objResponse.Result.Server = objTempResponse.Result.Server
                objResponse.Result.Source = objTempResponse.Result.Source

                If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                    For i2 As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                        objResponse.Result.StatusMessages(i2) = New CsgStatusMessage
                        objResponse.Result.StatusMessages(i2).Code = objTempResponse.Result.StatusMessages(i2).Code
                        objResponse.Result.StatusMessages(i2).Message = objTempResponse.Result.StatusMessages(i2).Message
                    Next
                End If

                objResponse.Result.Type = objTempResponse.Result.Type
            End If
            Return objResponse
        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function
    Public Overrides Function GetLineupByZipZip4(ByVal obj As IProviderParameters) As IProviderResults


        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetLineupByZipZip4Request
        Dim objRequest As New WSCLU.GetLineupByZipZip4Request

        '########################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '########################################
        Dim objTempResponse As New WSCLU.LineupResponse
        Dim objResponse As New GetLineupByZipZip4Response


        Try
            objTempRequest = CType(obj, GetLineupByZipZip4Request)


            objRequest.ZipInfo = New WSCLU.ZipInfo
            objRequest.ZipInfo.ServiceLevelID = objTempRequest.ZipInfo.ServiceLevelID
            objRequest.ZipInfo.ServiceLevelName = objTempRequest.ZipInfo.ServiceLevelName
            objRequest.ZipInfo.Zip = objTempRequest.ZipInfo.Zip
            objRequest.ZipInfo.Zip4 = objTempRequest.ZipInfo.Zip4



            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            'Configure settings for CLU WebService
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsCLU = New WSCLU.CLUServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_URL))
            Me.wsCLU.Url = uri.AbsoluteUri
            wsCLU.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CLUWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsCLU.Credentials = Me.Credentials
            End If

            objTempResponse = Me.wsCLU.GetLineupByZipZip4(objRequest)



            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = EBSServicesProvider.WSCLU.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If

            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If Not (objTempResponse.SingleLineup Is Nothing) Then
                objResponse.SingleLineup = New SingleLineup
                objResponse.SingleLineup.LineupID = objTempResponse.SingleLineup.LineupID
                objResponse.SingleLineup.LineupName = objTempResponse.SingleLineup.LineupName

                If Not (objTempResponse.SingleLineup.LineupChannels Is Nothing) Then
                    ReDim objResponse.SingleLineup.LineupChannels(objTempResponse.SingleLineup.LineupChannels.GetUpperBound(0))
                    For i2 As Integer = 0 To objTempResponse.SingleLineup.LineupChannels.GetUpperBound(0)
                        objResponse.SingleLineup.LineupChannels(i2) = New SingleChannel
                        objResponse.SingleLineup.LineupChannels(i2).ChannelName = objTempResponse.SingleLineup.LineupChannels(i2).ChannelName
                        objResponse.SingleLineup.LineupChannels(i2).ChannelNumber = objTempResponse.SingleLineup.LineupChannels(i2).ChannelNumber
                        objResponse.SingleLineup.LineupChannels(i2).ServiceLevel = objTempResponse.SingleLineup.LineupChannels(i2).ServiceLevel
                    Next
                End If
            End If



            If Not (objTempResponse.Result Is Nothing) Then
                objResponse.Result = New Result
                objResponse.Result.DateTime = objTempResponse.Result.DateTime
                objResponse.Result.Description = objTempResponse.Result.Description

                If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                    objResponse.Result.ExceptionInfo = New ResultExceptionInfo
                    objResponse.Result.ExceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                    objResponse.Result.ExceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                    objResponse.Result.ExceptionInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                    objResponse.Result.ExceptionInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                End If

                objResponse.Result.ReferenceCode = objTempResponse.Result.ReferenceCode
                objResponse.Result.ReturnCode = objTempResponse.Result.ReturnCode
                objResponse.Result.Server = objTempResponse.Result.Server
                objResponse.Result.Source = objTempResponse.Result.Source

                If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                    For i2 As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                        objResponse.Result.StatusMessages(i2) = New CsgStatusMessage
                        objResponse.Result.StatusMessages(i2).Code = objTempResponse.Result.StatusMessages(i2).Code
                        objResponse.Result.StatusMessages(i2).Message = objTempResponse.Result.StatusMessages(i2).Message
                    Next
                End If

                objResponse.Result.Type = objTempResponse.Result.Type
            End If






            Return objResponse

        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally
            wsCLU = Nothing
        End Try

    End Function


    Public Overrides Function GetAccountStatementsAllICOMS(ByVal obj As IProviderParameters) As IProviderResults
        Return Me.GetAccountsFromICOMS(obj)
    End Function


'################################################################################################
'MODIFICATION	ROD COPELAND	ISSUE ID 6661	CSG Multi-Statement - My Account Overview Page
'################################################################################################    
	Public Overrides Function GetCustomerStatements(ByVal obj As CharterDotCom.CommonEntities.Library.IProviderParameters) As CharterDotCom.CommonEntities.Library.IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetCustomerStatementsRequest
        Dim objRequest As WSCSG_CustomerAccount.GetCustomerStatementsRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As WSCSG_CustomerAccount.GetCustomerStatementsResponse
        Dim objResponse As New GetCustomerStatementsResponse



        Try
            objTempRequest = CType(obj, GetCustomerStatementsRequest)



            '#################################################
            'BUILD REQUEST OBJECT FOR THE WEB SERVICE REQUEST
            '#################################################
            If Not objTempRequest Is Nothing Then
                objRequest = New WSCSG_CustomerAccount.GetCustomerStatementsRequest

                If Not objTempRequest.CsgHeaderInfo Is Nothing Then
                    Dim objCSGHeaderInfo As New WSCSG_CustomerAccount.CsgHeaderInfo()
                    objCSGHeaderInfo.ConversationId = objTempRequest.CsgHeaderInfo.ConversationId
                    objCSGHeaderInfo.Region = objTempRequest.CsgHeaderInfo.Region
                    objCSGHeaderInfo.RoutingArea = objTempRequest.CsgHeaderInfo.RoutingArea

                    '###############################################################
                    'MODIFICATION   ROD COPELAND    MAR 11, 2010    ISSUE ID 8593
                    '###############################################################
                    'THE ONLY PURPOSE OF SETTING THIS VALUE AT THIS POINT IS TO ENSURE 
                    'THE EBPP VALUE IS REALTIME RATHER THAN EAI USING VANTAGE.  BEFORE 
                    'THIS CHANGE VANTAGE WAS BEING USED AND PEOPLE WERE MAKING CHANGES 
                    'THAT IMPACTED THE EBPP VALUE AND THE EAI WAS RESPONDING AS IF THE 
                    'CHANGES HAD NOT TAKEN EFFECT FOR ABOUT A DAY APPROX.
                    '################################################################
                    objCSGHeaderInfo.RealTime = True
                    '#################################################################

                    objRequest.CsgHeaderInfo = objCSGHeaderInfo
                End If
                objRequest.AccountId = objTempRequest.AccountId




                '#################################################
                'Configure settings for CSG Payment webservice
                '#################################################
                Dim context As HttpContext = HttpContext.Current
                Dim netCredential As NetworkCredential
                Dim uri As Uri
                wsCSGCustomerAccount = New WSCSG_CustomerAccount.AccountServicePort
                uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_URL))
                Me.wsCSGCustomerAccount.Url = uri.AbsoluteUri
                wsCSGCustomerAccount.PreAuthenticate = True
                If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                    netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_PASSWORD).ToString)
                    Me.Credentials = netCredential.GetCredential(uri, "Basic")
                    wsCSGCustomerAccount.Credentials = Me.Credentials
                End If





                '#############################
                'EXECUTE THE WS CALL TO EAI
                '#############################
                If Not objTempRequest Is Nothing Then
                    objTempResponse = Me.wsCSGCustomerAccount.GetCustomerStatements(objRequest)
                End If






                '#########################################################################################
                'translate back to a common object in the gateway, visible from Provider and the BL both.
                '#########################################################################################
                If (objTempResponse Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempResponse.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempResponse.Result.ReturnCode = WSCSG_CustomerAccount.ResultReturnCode.Success) Then
                    Throw New Exception(objTempResponse.Result.ExceptionInfo.Message.ToString())
                End If

                If Not objTempResponse Is Nothing Then
                    objResponse = New GetCustomerStatementsResponse


                    '###########################################################################################
                    'MODIFICATION   ROD COPELAND    3/12/2010   ISSUE ID: 8241
                    '###########################################################################################
                    objResponse.CustomerId = objTempResponse.CustomerId
                    '###########################################################################################


                    '############################
                    'TRANSLATE THE RESULT OBJECT
                    '############################
                    If Not objTempResponse.Result Is Nothing Then
                        If Not (objTempResponse.Result Is Nothing) Then
                            Dim lResult As New Result
                            lResult.DateTime = objTempResponse.Result.DateTime
                            lResult.Description = objTempResponse.Result.Description

                            If Not objTempResponse.Result.ExceptionInfo Is Nothing Then
                                Dim lExcepInfo As New ResultExceptionInfo
                                lExcepInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                                lExcepInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                                lExcepInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                                lExcepInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                                lResult.ExceptionInfo = lExcepInfo
                            End If

                            lResult.ReferenceCode = objTempResponse.Result.ReferenceCode

                            Select Case objTempResponse.Result.ReturnCode
                                Case WSCSG_CustomerAccount.ResultReturnCode.BusinessRuleNotMet
                                    lResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                                Case WSCSG_CustomerAccount.ResultReturnCode.DatabaseError
                                    lResult.ReturnCode = ResultReturnCode.DatabaseError
                                Case WSCSG_CustomerAccount.ResultReturnCode.Exception
                                    lResult.ReturnCode = ResultReturnCode.Exception
                                Case WSCSG_CustomerAccount.ResultReturnCode.InvalidXml
                                    lResult.ReturnCode = ResultReturnCode.InvalidXml
                                Case WSCSG_CustomerAccount.ResultReturnCode.NoDataFound
                                    lResult.ReturnCode = ResultReturnCode.NoDataFound
                                Case WSCSG_CustomerAccount.ResultReturnCode.Success
                                    lResult.ReturnCode = ResultReturnCode.Success
                            End Select

                            lResult.Server = objTempResponse.Result.Server
                            lResult.Source = objTempResponse.Result.Source

                            If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                                Dim objCsgStatusMessage() As CsgStatusMessage = New CsgStatusMessage() {}
                                ReDim objCsgStatusMessage(objTempResponse.Result.StatusMessages.GetUpperBound(0))
                                For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                                    objCsgStatusMessage(i) = New CsgStatusMessage
                                    objCsgStatusMessage(i).Code = objTempResponse.Result.StatusMessages(i).Code
                                    objCsgStatusMessage(i).Message = objTempResponse.Result.StatusMessages(i).Message
                                Next
                                lResult.StatusMessages = objCsgStatusMessage
                            End If

                            Select Case objTempResponse.Result.Type
                                Case WSCSG_CustomerAccount.ResultType.Error
                                    lResult.Type = ResultType.Error
                                Case WSCSG_CustomerAccount.ResultType.Informational
                                    lResult.Type = ResultType.Informational
                            End Select

                            objResponse.Result = lResult
                        End If
                    End If


                    objResponse.AccountStatementAllInfo = New AccountStatementAllInfo(objTempResponse.AccountStatementAllInfo.GetUpperBound(0)) {}


                    '#######################################
                    'TRANSLATE ACCOUNT STATEMENT OBJECT
                    '#######################################
                    If Not (objTempResponse.AccountStatementAllInfo Is Nothing) Then
                        For ii As Integer = 0 To objTempResponse.AccountStatementAllInfo.GetUpperBound(0)
                            objResponse.AccountStatementAllInfo(ii) = New AccountStatementAllInfo()
                            objResponse.AccountStatementAllInfo(ii).AccountId = objTempResponse.AccountStatementAllInfo(ii).AccountId()
                            objResponse.AccountStatementAllInfo(ii).BusinessUnit = objTempResponse.AccountStatementAllInfo(ii).BusinessUnit
                            objResponse.AccountStatementAllInfo(ii).EBPP = objTempResponse.AccountStatementAllInfo(ii).EBPP

                            '##########################################################################
                            'MODIFICATION   ROD COPELAND    JUN 30, 2009    BIGSKY PROJECT
                            '##########################################################################
                            'THE STATEMENT OBJECT IS NOW A COLLECTION COMING BACK FROM EAI'S WEBSERVICE 
                            'CALL AND WILL NOW BE LOOPED THRU AS AN ARRAY.  THE STATEMENT ARRAY WILL 
                            'DISPLAY MULTI-STATEMENTS ON THE MYACCOUNT OVERVIEW PAGES.
                            '##########################################################################
                            If Not (objTempResponse.AccountStatementAllInfo(ii).Statement Is Nothing) Then
                                Dim lStatement() As Statement = New Statement(objTempResponse.AccountStatementAllInfo(ii).Statement.GetUpperBound(0)) {}

                                For si As Integer = 0 To objTempResponse.AccountStatementAllInfo(ii).Statement.GetUpperBound(0)
                                    lStatement(si) = New Statement()

                                    If Not (objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail Is Nothing) Then
                                        lStatement(si).BillingDetail = New BillingDetail(objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail.GetUpperBound(0)) {}
                                        For i As Integer = 0 To objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail.GetUpperBound(0)
                                            lStatement(si).BillingDetail(i) = New BillingDetail()
                                            lStatement(si).BillingDetail(i).Amount = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Amount
                                            lStatement(si).BillingDetail(i).BillingCode = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).BillingCode
                                            lStatement(si).BillingDetail(i).BillingCodeDescription = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).BillingCodeDescription
                                            lStatement(si).BillingDetail(i).BillingDiscount = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).BillingDiscount
                                            lStatement(si).BillingDetail(i).BillingDiscountDescription = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).BillingDiscountDescription
                                            lStatement(si).BillingDetail(i).Description = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Description

                                            If Not (objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate Is Nothing) Then
                                                lStatement(si).BillingDetail(i).Prorate = New Prorate()
                                                lStatement(si).BillingDetail(i).Prorate.DailyNewRate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.DailyNewRate
                                                lStatement(si).BillingDetail(i).Prorate.DailyOldRate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.DailyOldRate
                                                lStatement(si).BillingDetail(i).Prorate.NewCharge = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.NewCharge
                                                lStatement(si).BillingDetail(i).Prorate.NewRate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.NewRate
                                                lStatement(si).BillingDetail(i).Prorate.NewRateBeginDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.NewRateBeginDate
                                                lStatement(si).BillingDetail(i).Prorate.NewRateDays = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.NewRateDays
                                                lStatement(si).BillingDetail(i).Prorate.OldCharge = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.OldCharge
                                                lStatement(si).BillingDetail(i).Prorate.OldRate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.OldRate
                                                lStatement(si).BillingDetail(i).Prorate.OldRateDays = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.OldRateDays
                                                lStatement(si).BillingDetail(i).Prorate.OldRateEndDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Prorate.OldRateEndDate
                                            End If

                                            lStatement(si).BillingDetail(i).Reference = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Reference

                                            lStatement(si).BillingDetail(i).ServiceCode = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).ServiceCode
                                            lStatement(si).BillingDetail(i).ServiceCodeDescription = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).ServiceCodeDescription
                                            lStatement(si).BillingDetail(i).TransactionCode = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).TransactionCode
                                            lStatement(si).BillingDetail(i).TransactionDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).TransactionDate

                                            If Not (objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Usage Is Nothing) Then
                                                lStatement(si).BillingDetail(i).Usage = New Usage()
                                                lStatement(si).BillingDetail(i).Usage.BeginDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Usage.BeginDate
                                                lStatement(si).BillingDetail(i).Usage.BeginTime = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Usage.BeginTime
                                                lStatement(si).BillingDetail(i).Usage.Destination = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Usage.Destination
                                                lStatement(si).BillingDetail(i).Usage.Duration = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Usage.Duration
                                                lStatement(si).BillingDetail(i).Usage.Origination = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetail(i).Usage.Origination
                                            End If
                                        Next
                                    End If

                                    lStatement(si).BillingDetailCount = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingDetailCount

                                    lStatement(si).BillingFromDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingFromDate
                                    lStatement(si).BillingThruDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).BillingThruDate
                                    lStatement(si).CurrentStatementDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).CurrentStatementDate
                                    lStatement(si).OneTimeCharge = objTempResponse.AccountStatementAllInfo(ii).Statement(si).OneTimeCharge
                                    lStatement(si).OtherCredit = objTempResponse.AccountStatementAllInfo(ii).Statement(si).OtherCredit
                                    lStatement(si).Payment = objTempResponse.AccountStatementAllInfo(ii).Statement(si).Payment

                                    '#######################################################################################################
                                    'MODIFICATION   ROD COPELAND    ISSUE ID:8153   FEB 02, 2010
                                    'PER TIM W - EAI: CSG WILL RETURN A DATE OR A DESCRIPTION BUT NOT BOTH AND IN SOME RARE CASES, NOTHING.
                                    'VALIDATION OF THIS IS IN THE UI/CONTROLS/QUICKPAY.ASCX.VB
                                    '#######################################################################################################
                                    lStatement(si).PaymentDueDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).PaymentDueDate
                                    lStatement(si).DueDateDescription = objTempResponse.AccountStatementAllInfo(ii).Statement(si).DueDateDescription

                                    lStatement(si).PreviousBalance = objTempResponse.AccountStatementAllInfo(ii).Statement(si).PreviousBalance
                                    lStatement(si).PreviousStatementDate = objTempResponse.AccountStatementAllInfo(ii).Statement(si).PreviousStatementDate
                                    lStatement(si).RecurringCharge = objTempResponse.AccountStatementAllInfo(ii).Statement(si).RecurringCharge
                                    lStatement(si).StatementBalance = objTempResponse.AccountStatementAllInfo(ii).Statement(si).StatementBalance
                                    lStatement(si).CalculatedBalance = objTempResponse.AccountStatementAllInfo(ii).Statement(si).CalculatedBalance
                                    lStatement(si).CalculatedBalanceStatus = objTempResponse.AccountStatementAllInfo(ii).Statement(si).CalculatedBalanceStatus

                                    lStatement(si).StatementId = objTempResponse.AccountStatementAllInfo(ii).Statement(si).StatementId

                                    Select Case objTempResponse.AccountStatementAllInfo(ii).Statement(si).StatementType
                                        Case WSCSG_CustomerAccount.StatementType.Item1
                                            lStatement(si).StatementType = StatementType.Item1
                                        Case WSCSG_CustomerAccount.StatementType.Item2
                                            lStatement(si).StatementType = StatementType.Item2
                                        Case WSCSG_CustomerAccount.StatementType.Item3
                                            lStatement(si).StatementType = StatementType.Item3
                                        Case WSCSG_CustomerAccount.StatementType.Item4
                                            lStatement(si).StatementType = StatementType.Item4
                                        Case WSCSG_CustomerAccount.StatementType.Item5
                                            lStatement(si).StatementType = StatementType.Item5
                                        Case WSCSG_CustomerAccount.StatementType.Item6
                                            lStatement(si).StatementType = StatementType.Item6
                                        Case WSCSG_CustomerAccount.StatementType.Item7
                                            lStatement(si).StatementType = StatementType.Item7
                                    End Select

                                    lStatement(si).TotalFees = objTempResponse.AccountStatementAllInfo(ii).Statement(si).TotalFees
                                Next 'END STATEMENT LOOP



                                objResponse.AccountStatementAllInfo(ii).Statements = lStatement



                            End If
                        Next
                    End If
                End If


                '############################
                Return objResponse
                '############################


            Else
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If

        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try

    End Function


    Public Overrides Function GetAccountsFromCSG(ByVal obj As IProviderParameters) As IProviderResults
        Dim lGetAccountsRequest As GetAccountsRequestCSG = CType(obj, GetAccountsRequestCSG)
        Dim objGetAccountsRequest As WSCSG_CustomerAccount.GetAccountsRequest
        Dim objCsgHeaderInfo As WSCSG_CustomerAccount.CsgHeaderInfo
        Dim objCriteria As WSCSG_CustomerAccount.AccountCriteria
        Dim objAccountCriteriaCustomerAddress As WSCSG_CustomerAccount.AccountCriteriaCustomerAddress
        Dim objAccountCriteriaName As WSCSG_CustomerAccount.AccountCriteriaName
        Dim objTempGetAccountsResponse As WSCSG_CustomerAccount.GetAccountsResponse
        Dim objGetAccountsResponse As GetAccountsResponseCSG
        Dim lResult As New Result
        Dim objCsgStatusMessage() As CsgStatusMessage = New CsgStatusMessage() {}
        Dim objAccount() As AccountCSG = Nothing


        Dim objbillingInfo As BillingInfo
        Dim objpaymentHistory() As PaymentHistory
        Dim objlinesOfBusiness() As LineOfBusiness
        Dim objbillToAddress As AccountAddress
        Try
            lGetAccountsRequest = CType(obj, GetAccountsRequestCSG)
            If Not lGetAccountsRequest Is Nothing Then
                objGetAccountsRequest = New WSCSG_CustomerAccount.GetAccountsRequest

                If Not lGetAccountsRequest.HeaderInfo Is Nothing Then
                    objCsgHeaderInfo = New WSCSG_CustomerAccount.CsgHeaderInfo()
                    With lGetAccountsRequest.HeaderInfo
                        objCsgHeaderInfo.Region = .Region
                        objCsgHeaderInfo.RoutingArea = .RoutingArea
                        objCsgHeaderInfo.ConversationId = .ConversationId
                    End With
                    objGetAccountsRequest.CsgHeaderInfo = objCsgHeaderInfo
                End If


                If Not lGetAccountsRequest.Criteria Is Nothing Then
                    objCriteria = New WSCSG_CustomerAccount.AccountCriteria()

                    If Not lGetAccountsRequest.Criteria.Item Is Nothing Then
                        If TypeOf (lGetAccountsRequest.Criteria.Item) Is String Then
                            objCriteria.Item = lGetAccountsRequest.Criteria.Item
                        ElseIf TypeOf (lGetAccountsRequest.Criteria.Item) Is AccountCriteriaCustomerAddress Then
                            objAccountCriteriaCustomerAddress = New WSCSG_CustomerAccount.AccountCriteriaCustomerAddress()
                            With CType(lGetAccountsRequest.Criteria.Item, AccountCriteriaCustomerAddress)
                                objAccountCriteriaCustomerAddress.AddressLine1 = .AddressLine1
                                objAccountCriteriaCustomerAddress.AddressLine2 = .AddressLine2
                                objAccountCriteriaCustomerAddress.City = .City
                                objAccountCriteriaCustomerAddress.State = .State
                                objAccountCriteriaCustomerAddress.ZipCode = .ZipCode
                            End With
                            objCriteria.Item = objAccountCriteriaCustomerAddress
                        ElseIf TypeOf (lGetAccountsRequest.Criteria.Item) Is AccountCriteriaName Then
                            objAccountCriteriaName = New WSCSG_CustomerAccount.AccountCriteriaName()
                            With CType(lGetAccountsRequest.Criteria.Item, AccountCriteriaName)
                                objAccountCriteriaName.FirstName = .FirstName
                                objAccountCriteriaName.LastName = .LastName
                            End With
                            objCriteria.Item = objAccountCriteriaName
                        Else
                            Throw New Exception("Not a valid criteria. Valid types are String, AccountCriteriaCustomerAddress, AccountCriteriaName")
                        End If
                    End If
                    'objCriteria.ItemElementName = CType(lGetAccountsRequest.Criteria.ItemElementName, WSCSG_CustomerAccount.ItemChoiceType)
                    Select Case lGetAccountsRequest.Criteria.ItemElementName
                        Case ItemChoiceTypeCSG.AccountNumber
                            objCriteria.ItemElementName = WSCSG_CustomerAccount.ItemChoiceType.AccountNumber
                        Case ItemChoiceTypeCSG.CustomerAddress
                            objCriteria.ItemElementName = WSCSG_CustomerAccount.ItemChoiceType.CustomerAddress
                        Case ItemChoiceTypeCSG.CustomerNumber
                            objCriteria.ItemElementName = WSCSG_CustomerAccount.ItemChoiceType.CustomerNumber
                        Case ItemChoiceTypeCSG.MacAddress
                            objCriteria.ItemElementName = WSCSG_CustomerAccount.ItemChoiceType.MacAddress
                        Case ItemChoiceTypeCSG.Name
                            objCriteria.ItemElementName = WSCSG_CustomerAccount.ItemChoiceType.Name
                        Case ItemChoiceTypeCSG.TelephoneNumber
                            objCriteria.ItemElementName = WSCSG_CustomerAccount.ItemChoiceType.TelephoneNumber
                    End Select




                    objGetAccountsRequest.Criteria = objCriteria
                End If




                '########################
                'MAKE WEBSERVICE CALL
                '########################
                'Configure settings for CSG Account WebService
                Dim context As HttpContext = HttpContext.Current
                Dim netCredential As NetworkCredential
                Dim uri As Uri
                wsCSGCustomerAccount = New WSCSG_CustomerAccount.AccountServicePort
                uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_URL))
                Me.wsCSGCustomerAccount.Url = uri.AbsoluteUri
                wsCSGCustomerAccount.PreAuthenticate = True
                If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                    netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_PASSWORD).ToString)
                    Me.Credentials = netCredential.GetCredential(uri, "Basic")
                    wsCSGCustomerAccount.Credentials = Me.Credentials
                End If

                objTempGetAccountsResponse = Me.wsCSGCustomerAccount.GetAccounts(objGetAccountsRequest)




                If (objTempGetAccountsResponse Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempGetAccountsResponse.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempGetAccountsResponse.Result.ReturnCode = WSCSG_CustomerAccount.ResultReturnCode.Success) Then
                    Throw New Exception(objTempGetAccountsResponse.Result.ReturnCode.ToString())
                End If
                If Not objTempGetAccountsResponse Is Nothing Then
                    If Not (objTempGetAccountsResponse.Result Is Nothing) Then
                        lResult = New Result
                        lResult.DateTime = objTempGetAccountsResponse.Result.DateTime
                        lResult.Description = objTempGetAccountsResponse.Result.Description

                        If Not objTempGetAccountsResponse.Result.ExceptionInfo Is Nothing Then
                            Dim lExcepInfo As New ResultExceptionInfo
                            lExcepInfo.Code = objTempGetAccountsResponse.Result.ExceptionInfo.Code
                            lExcepInfo.Message = objTempGetAccountsResponse.Result.ExceptionInfo.Message
                            lExcepInfo.StackTrace = objTempGetAccountsResponse.Result.ExceptionInfo.StackTrace
                            lExcepInfo.Type = objTempGetAccountsResponse.Result.ExceptionInfo.Type
                            lResult.ExceptionInfo = lExcepInfo
                        End If
                        lResult.ReferenceCode = objTempGetAccountsResponse.Result.ReferenceCode

                        Select Case objTempGetAccountsResponse.Result.ReturnCode
                            Case WSCSG_CustomerAccount.ResultReturnCode.BusinessRuleNotMet
                                lResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                            Case WSCSG_CustomerAccount.ResultReturnCode.DatabaseError
                                lResult.ReturnCode = ResultReturnCode.DatabaseError
                            Case WSCSG_CustomerAccount.ResultReturnCode.Exception
                                lResult.ReturnCode = ResultReturnCode.Exception
                            Case WSCSG_CustomerAccount.ResultReturnCode.InvalidXml
                                lResult.ReturnCode = ResultReturnCode.InvalidXml
                            Case WSCSG_CustomerAccount.ResultReturnCode.NoDataFound
                                lResult.ReturnCode = ResultReturnCode.NoDataFound
                            Case WSCSG_CustomerAccount.ResultReturnCode.Success
                                lResult.ReturnCode = ResultReturnCode.Success
                        End Select

                        lResult.Server = objTempGetAccountsResponse.Result.Server
                        lResult.Source = objTempGetAccountsResponse.Result.Source


                        If Not (objTempGetAccountsResponse.Result.StatusMessages Is Nothing) Then
                            ReDim objCsgStatusMessage(objTempGetAccountsResponse.Result.StatusMessages.GetUpperBound(0))
                            For i As Integer = 0 To objTempGetAccountsResponse.Result.StatusMessages.GetUpperBound(0)
                                objCsgStatusMessage(i) = New CsgStatusMessage
                                objCsgStatusMessage(i).Code = objTempGetAccountsResponse.Result.StatusMessages(i).Code
                                objCsgStatusMessage(i).Message = objTempGetAccountsResponse.Result.StatusMessages(i).Message
                            Next
                            lResult.StatusMessages = objCsgStatusMessage
                        End If

                        Select Case objTempGetAccountsResponse.Result.Type
                            Case WSCSG_CustomerAccount.ResultType.Error
                                lResult.Type = ResultType.Error
                            Case WSCSG_CustomerAccount.ResultType.Informational
                                lResult.Type = ResultType.Informational
                        End Select
                    End If ' end objResponse.result test

                End If 'end objResponse test

                If Not objTempGetAccountsResponse.Accounts Is Nothing Then
                    objAccount = New AccountCSG(objTempGetAccountsResponse.Accounts.GetUpperBound(0)) {}
                    For i As Integer = 0 To objTempGetAccountsResponse.Accounts.GetUpperBound(0)
                        objAccount(i) = New AccountCSG()
                        With objTempGetAccountsResponse.Accounts(i)
                            objAccount(i).AccountId = .AccountId
                            objAccount(i).CustomerId = .CustomerId
                            objAccount(i).Salutation = .Salutation
                            objAccount(i).FirstName = .FirstName
                            objAccount(i).LastName = .LastName
                            objAccount(i).PrimaryPhone = .PrimaryPhone
                            objAccount(i).SecondaryPhone = .SecondaryPhone
                            objAccount(i).AddressLine1 = .AddressLine1
                            objAccount(i).AddressLine2 = .AddressLine2
                            objAccount(i).City = .City
                            objAccount(i).State = .State
                            objAccount(i).ZipCode = .ZipCode
                            objAccount(i).ConnectDate = .ConnectDate
                            objAccount(i).DisconnectDate = .DisconnectDate
                            objAccount(i).CurrentAccountBalance = .CurrentAccountBalance
                            objAccount(i).DaysDelinquent = .DaysDelinquent
                            objAccount(i).DelinquencyAmount = .DelinquencyAmount
                            objAccount(i).LastPaymentAmount = .LastPaymentAmount
                            objAccount(i).AuditCreationDate = .AuditCreationDate
                            objAccount(i).LocationId = .LocationId

                            Select Case .ConnectStatus
                                Case WSCSG_CustomerAccount.ConnectStatus.ChargedOff
                                    objAccount(i).ConnectStatus = ConnectStatus.ChargedOff
                                Case WSCSG_CustomerAccount.ConnectStatus.NonPayAccount
                                    objAccount(i).ConnectStatus = ConnectStatus.NonPayAccount
                                Case WSCSG_CustomerAccount.ConnectStatus.Normal
                                    objAccount(i).ConnectStatus = ConnectStatus.Normal
                                Case WSCSG_CustomerAccount.ConnectStatus.NotAvailable
                                    objAccount(i).ConnectStatus = ConnectStatus.NotAvailable
                                Case WSCSG_CustomerAccount.ConnectStatus.VoluntaryDisconnect
                                    objAccount(i).ConnectStatus = ConnectStatus.VoluntaryDisconnect
                            End Select
                            'objAccount(i).ConnectStatus = CType(.ConnectStatus, ConnectStatus)

                            'objAccount(i).MonetaryStatus = CType(.MonetaryStatus, MonetaryStatus)
                            Select Case .MonetaryStatus
                                Case WSCSG_CustomerAccount.MonetaryStatus.CreditOnAccount
                                    objAccount(i).MonetaryStatus = MonetaryStatus.CreditOnAccount
                                Case WSCSG_CustomerAccount.MonetaryStatus.Delinquent
                                    objAccount(i).MonetaryStatus = MonetaryStatus.Delinquent
                                Case WSCSG_CustomerAccount.MonetaryStatus.Normal
                                    objAccount(i).MonetaryStatus = MonetaryStatus.Normal
                                Case WSCSG_CustomerAccount.MonetaryStatus.NotAvailable
                                    objAccount(i).MonetaryStatus = MonetaryStatus.NotAvailable
                                Case WSCSG_CustomerAccount.MonetaryStatus.OverLimitAndDelinquent
                                    objAccount(i).MonetaryStatus = MonetaryStatus.OverLimitAndDelinquent
                                Case WSCSG_CustomerAccount.MonetaryStatus.OverPayPerViewLimit
                                    objAccount(i).MonetaryStatus = MonetaryStatus.OverPayPerViewLimit
                            End Select

                            'objAccount(i).DelinquencyStatus = CType(.DelinquencyStatus, DelinquencyStatus)
                            Select Case .DelinquencyStatus
                                Case WSCSG_CustomerAccount.DelinquencyStatus.ChargedOff
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.ChargedOff
                                Case WSCSG_CustomerAccount.DelinquencyStatus.DowngradeService
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.DowngradeService
                                Case WSCSG_CustomerAccount.DelinquencyStatus.NonPayDisconnect
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.NonPayDisconnect
                                Case WSCSG_CustomerAccount.DelinquencyStatus.Normal
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.Normal
                                Case WSCSG_CustomerAccount.DelinquencyStatus.NotAvailable
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.NotAvailable
                                Case WSCSG_CustomerAccount.DelinquencyStatus.OpenNonPayEquipmentDisabled
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.OpenNonPayEquipmentDisabled
                                Case WSCSG_CustomerAccount.DelinquencyStatus.OpenNonPayWithEquipment
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.OpenNonPayWithEquipment
                                Case WSCSG_CustomerAccount.DelinquencyStatus.OpenVoluntaryDisconnect
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.OpenVoluntaryDisconnect
                                Case WSCSG_CustomerAccount.DelinquencyStatus.PayPerViewRestricted
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.PayPerViewRestricted
                                Case WSCSG_CustomerAccount.DelinquencyStatus.PendingChangeOfService
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.PendingChangeOfService
                                Case WSCSG_CustomerAccount.DelinquencyStatus.PendingNonPay
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.PendingNonPay
                                Case WSCSG_CustomerAccount.DelinquencyStatus.VoluntaryDisconnect
                                    objAccount(i).DelinquencyStatus = DelinquencyStatus.VoluntaryDisconnect
                            End Select

                        End With


                        If Not objTempGetAccountsResponse.Accounts(i).BillingInfo Is Nothing Then
                            objbillingInfo = New BillingInfo()
                            With objTempGetAccountsResponse.Accounts(i).BillingInfo
                                objbillingInfo.CycleDay = .CycleDay
                                objbillingInfo.FromDate = .FromDate
                                objbillingInfo.ThruDate = .ThruDate
                                objbillingInfo.Frequency = .Frequency
                                objbillingInfo.TaxGroup = .TaxGroup
                                objbillingInfo.StatementHold = .StatementHold
                                objbillingInfo.EBPP = .EBPP
                                objbillingInfo.Electronic = .Electronic
                                objbillingInfo.ElectronicOutsourced = .ElectronicOutsourced
                                objbillingInfo.Hardcopy = .Hardcopy
                                objbillingInfo.CustomerDiscount = .CustomerDiscount
                                objbillingInfo.CustomerDiscountBeginDate = .CustomerDiscountBeginDate
                                objbillingInfo.CustomerDiscountEndDate = .CustomerDiscountEndDate
                            End With
                            objAccount(i).BillingInfo = objbillingInfo
                        End If

                        If Not objTempGetAccountsResponse.Accounts(i).PaymentHistory Is Nothing Then
                            objpaymentHistory = New PaymentHistory(objTempGetAccountsResponse.Accounts(i).PaymentHistory.GetUpperBound(0)) {}
                            For j As Integer = 0 To objTempGetAccountsResponse.Accounts(i).PaymentHistory.GetUpperBound(0)
                                With objTempGetAccountsResponse.Accounts(i).PaymentHistory(j)
                                    objpaymentHistory(j).Month = .Month
                                    objpaymentHistory(j).Year = .Year
                                    objpaymentHistory(j).Delinquent = .Delinquent
                                End With
                            Next
                            objAccount(i).PaymentHistory = objpaymentHistory
                        End If

                        If objTempGetAccountsResponse.Accounts(i).Transfer IsNot Nothing Then
                            objAccount(i).Transfer = New Transfer()
                            objAccount(i).Transfer.AccountID = objTempGetAccountsResponse.Accounts(i).Transfer.AccountID
                            objAccount(i).Transfer.Identifier = objTempGetAccountsResponse.Accounts(i).Transfer.Identifier
                            objAccount(i).Transfer.Status = objTempGetAccountsResponse.Accounts(i).Transfer.Status
                        End If

                        If Not objTempGetAccountsResponse.Accounts(i).LinesOfBusiness Is Nothing Then
                            objlinesOfBusiness = New LineOfBusiness(objTempGetAccountsResponse.Accounts(i).LinesOfBusiness.GetUpperBound(0)) {}
                            For j As Integer = 0 To objTempGetAccountsResponse.Accounts(i).LinesOfBusiness.GetUpperBound(0)
                                objlinesOfBusiness(j) = New LineOfBusiness()
                                With objTempGetAccountsResponse.Accounts(i).LinesOfBusiness(j)

                                    'objlinesOfBusiness(j).Status = CType(.Status, LineOfBusinessStatus)
                                    Select Case .Status
                                        Case WSCSG_CustomerAccount.LineOfBusinessStatus.Active
                                            objlinesOfBusiness(j).Status = LineOfBusinessStatus.Active
                                        Case WSCSG_CustomerAccount.LineOfBusinessStatus.Disconnect
                                            objlinesOfBusiness(j).Status = LineOfBusinessStatus.Disconnect
                                        Case WSCSG_CustomerAccount.LineOfBusinessStatus.NeverConnected
                                            objlinesOfBusiness(j).Status = LineOfBusinessStatus.NeverConnected
                                    End Select


                                    'objlinesOfBusiness(j).Type = CType(.Type, LineOfBusinessTypeCSG)
                                    Select Case .Type
                                        Case WSCSG_CustomerAccount.LineOfBusinessType.Data
                                            objlinesOfBusiness(j).Type = LineOfBusinessTypeCSG.Data
                                        Case WSCSG_CustomerAccount.LineOfBusinessType.Telephony
                                            objlinesOfBusiness(j).Type = LineOfBusinessTypeCSG.Telephony
                                        Case WSCSG_CustomerAccount.LineOfBusinessType.Video
                                            objlinesOfBusiness(j).Type = LineOfBusinessTypeCSG.Video
                                        Case WSCSG_CustomerAccount.LineOfBusinessType.VideoData
                                            'currently not showing avail.
                                    End Select
                                End With
                            Next
                            objAccount(i).LinesOfBusiness = objlinesOfBusiness
                        End If

                        If Not objTempGetAccountsResponse.Accounts(i).BillToAddress Is Nothing Then
                            objbillToAddress = New AccountAddress()
                            With objTempGetAccountsResponse.Accounts(i).BillToAddress
                                objbillToAddress.AddressLine1 = .AddressLine1
                                objbillToAddress.AddressLine2 = .AddressLine2
                                objbillToAddress.City = .City
                                objbillToAddress.State = .State
                                objbillToAddress.ZipCode = .ZipCode
                            End With
                            objAccount(i).BillToAddress = objbillToAddress
                        End If
                    Next
                End If

                objGetAccountsResponse = New GetAccountsResponseCSG(lResult, objAccount)
            Else
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If
            Return objGetAccountsResponse
        Catch ex As Exception
            objGetAccountsResponse = Nothing
            If objGetAccountsResponse Is Nothing Then
                objGetAccountsResponse = New GetAccountsResponseCSG(Nothing, Nothing)
            End If

            objGetAccountsResponse.Exception = True
            objGetAccountsResponse.ExceptionMessage = ex.Message
            objGetAccountsResponse.ExceptionStackTrace = ex.StackTrace
            Return objGetAccountsResponse
        Finally

        End Try


    End Function
    Public Overrides Function GetAccountsFromICOMS(ByVal obj As IProviderParameters) As IProviderResults
        Dim lGetAccountStatementsAllRequest As GetAccountStatementsAllRequestICOMS = CType(obj, GetAccountStatementsAllRequestICOMS)
        Dim objGetAccountStatementsAllRequest As WSICOMS_CustomerAccount.GetAccountStatementsAllRequest
        Dim objIcomsHeaderInfo As WSICOMS_CustomerAccount.IcomsHeaderInfo
        Dim objTempGetAccountsResponse As WSICOMS_CustomerAccount.GetAccountStatementsAllResponse
        Dim objGetAccountStatementsAllResponse As New GetAccountStatementsAllResponseICOMS
        Dim lResult As Result
        Dim objCsgStatusMessage() As CsgStatusMessage = New CsgStatusMessage() {}
        Dim objAccountStatementAllInfo As AccountStatementAllResult
        Dim objStatement() As StatementAll
        Dim objMOP As MOP
        Dim objCredit As DebitCredit
        Dim objDebit As DebitCredit
        Try
            If Not lGetAccountStatementsAllRequest Is Nothing Then
                objGetAccountStatementsAllRequest = New WSICOMS_CustomerAccount.GetAccountStatementsAllRequest

                If Not lGetAccountStatementsAllRequest.IcomsHeaderInfo Is Nothing Then
                    objIcomsHeaderInfo = New WSICOMS_CustomerAccount.IcomsHeaderInfo()

                    'objIcomsHeaderInfo.SiteId = CType(lGetAccountStatementsAllRequest.IcomsHeaderInfo.SiteId, WSICOMS_CustomerAccount.SiteId)
                    Select Case lGetAccountStatementsAllRequest.IcomsHeaderInfo.SiteId
                        Case SiteId.Site100
                            objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site100
                        Case SiteId.Site200
                            objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site200
                        Case SiteId.Site300
                            objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site300
                        Case SiteId.Site400
                            objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site400
                        Case SiteId.Site500
                            objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site500
                        Case SiteId.Site600
                            objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site600
                    End Select

                    objGetAccountStatementsAllRequest.IcomsHeaderInfo = objIcomsHeaderInfo
                End If
                objGetAccountStatementsAllRequest.AccountId = lGetAccountStatementsAllRequest.AccountNumber

                'Configure settings for ICOMS Payment webservice
                Dim context As HttpContext = HttpContext.Current
                Dim netCredential As NetworkCredential
                Dim uri As Uri
                wsICOMSCustomerAccount = New WSICOMS_CustomerAccount.AccountServicePort
                uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_URL))
                Me.wsICOMSCustomerAccount.Url = uri.AbsoluteUri
                wsICOMSCustomerAccount.PreAuthenticate = True
                If CBool(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                    netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_PASSWORD).ToString)
                    Me.Credentials = netCredential.GetCredential(uri, "Basic")
                    wsICOMSCustomerAccount.Credentials = Me.Credentials
                End If

                objTempGetAccountsResponse = Me.wsICOMSCustomerAccount.GetAccountStatementsAll(objGetAccountStatementsAllRequest)

                If (objTempGetAccountsResponse Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempGetAccountsResponse.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempGetAccountsResponse.Result.ReturnCode = WSICOMS_CustomerAccount.ResultReturnCode.Success) Then
                    Throw New Exception(objTempGetAccountsResponse.Result.ReturnCode.ToString())
                End If

                If Not objTempGetAccountsResponse Is Nothing Then
                    objGetAccountStatementsAllResponse = New GetAccountStatementsAllResponseICOMS
                    If Not objTempGetAccountsResponse.Result Is Nothing Then
                        If Not (objTempGetAccountsResponse.Result Is Nothing) Then
                            lResult = New Result
                            lResult.DateTime = objTempGetAccountsResponse.Result.DateTime
                            lResult.Description = objTempGetAccountsResponse.Result.Description

                            If Not objTempGetAccountsResponse.Result.ExceptionInfo Is Nothing Then
                                Dim lExcepInfo As New ResultExceptionInfo
                                lExcepInfo.Code = objTempGetAccountsResponse.Result.ExceptionInfo.Code
                                lExcepInfo.Message = objTempGetAccountsResponse.Result.ExceptionInfo.Message
                                lExcepInfo.StackTrace = objTempGetAccountsResponse.Result.ExceptionInfo.StackTrace
                                lExcepInfo.Type = objTempGetAccountsResponse.Result.ExceptionInfo.Type
                                lResult.ExceptionInfo = lExcepInfo
                            End If

                            lResult.ReferenceCode = objTempGetAccountsResponse.Result.ReferenceCode

                            'lResult.ReturnCode =  CType(objTempGetAccountsResponse.Result.ReturnCode, ResultReturnCode)
                            Select Case objTempGetAccountsResponse.Result.ReturnCode
                                Case WSICOMS_CustomerAccount.ResultReturnCode.BusinessRuleNotMet
                                    lResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                                Case WSICOMS_CustomerAccount.ResultReturnCode.DatabaseError
                                    lResult.ReturnCode = ResultReturnCode.DatabaseError
                                Case WSICOMS_CustomerAccount.ResultReturnCode.Exception
                                    lResult.ReturnCode = ResultReturnCode.Exception
                                Case WSICOMS_CustomerAccount.ResultReturnCode.InvalidXml
                                    lResult.ReturnCode = ResultReturnCode.InvalidXml
                                Case WSICOMS_CustomerAccount.ResultReturnCode.NoDataFound
                                    lResult.ReturnCode = ResultReturnCode.NoDataFound
                                Case WSICOMS_CustomerAccount.ResultReturnCode.Success
                                    lResult.ReturnCode = ResultReturnCode.Success
                            End Select

                            lResult.Server = objTempGetAccountsResponse.Result.Server
                            lResult.Source = objTempGetAccountsResponse.Result.Source


                            If Not (objTempGetAccountsResponse.Result.StatusMessages Is Nothing) Then
                                ReDim objCsgStatusMessage(objTempGetAccountsResponse.Result.StatusMessages.GetUpperBound(0))
                                For i As Integer = 0 To objTempGetAccountsResponse.Result.StatusMessages.GetUpperBound(0)
                                    objCsgStatusMessage(i) = New CsgStatusMessage
                                    objCsgStatusMessage(i).Code = objTempGetAccountsResponse.Result.StatusMessages(i).Code
                                    objCsgStatusMessage(i).Message = objTempGetAccountsResponse.Result.StatusMessages(i).Message
                                Next
                                lResult.StatusMessages = objCsgStatusMessage
                            End If
                            'lResult.Type = CType(objTempGetAccountsResponse.Result.Type, ResultType)
                            Select Case objTempGetAccountsResponse.Result.Type
                                Case WSICOMS_CustomerAccount.ResultType.Error
                                    lResult.Type = ResultType.Error
                                Case WSICOMS_CustomerAccount.ResultType.Informational
                                    lResult.Type = ResultType.Informational
                            End Select

                            objGetAccountStatementsAllResponse.Result = lResult
                        End If ' end objResponse.result test
                    End If

                    If Not objTempGetAccountsResponse.AccountStatementAllInfo Is Nothing Then
                        objAccountStatementAllInfo = New AccountStatementAllResult
                        'objAccountStatementAllInfo.SiteId = CType(objTempGetAccountsResponse.AccountStatementAllInfo.SiteId, SiteId1)
                        Select Case objTempGetAccountsResponse.AccountStatementAllInfo.SiteId
                            Case WSICOMS_CustomerAccount.SiteId.Site100
                                objAccountStatementAllInfo.SiteId = SiteId1.Site100
                            Case WSICOMS_CustomerAccount.SiteId.Site200
                                objAccountStatementAllInfo.SiteId = SiteId1.Site200
                            Case WSICOMS_CustomerAccount.SiteId.Site300
                                objAccountStatementAllInfo.SiteId = SiteId1.Site300
                            Case WSICOMS_CustomerAccount.SiteId.Site400
                                objAccountStatementAllInfo.SiteId = SiteId1.Site400
                            Case WSICOMS_CustomerAccount.SiteId.Site500
                                objAccountStatementAllInfo.SiteId = SiteId1.Site500
                            Case WSICOMS_CustomerAccount.SiteId.Site600
                                objAccountStatementAllInfo.SiteId = SiteId1.Site600
                        End Select


                        objAccountStatementAllInfo.AccountNumber = objTempGetAccountsResponse.AccountStatementAllInfo.AccountId
                        If Not objTempGetAccountsResponse.AccountStatementAllInfo.Statement Is Nothing Then
                            objStatement = New StatementAll(objTempGetAccountsResponse.AccountStatementAllInfo.Statement.GetUpperBound(0)) {}

                            For i As Integer = 0 To objTempGetAccountsResponse.AccountStatementAllInfo.Statement.GetUpperBound(0)
                                objStatement(i) = New StatementAll()
                                With objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i)
                                    objStatement(i).StatementDescription = .StatementDescription
                                    objStatement(i).LastStatementDate = .LastStatementDate
                                    objStatement(i).BalanceLastStatement = .BalanceLastStatement

                                    '###############################################################
                                    'MODIFICATION   ROD COPELAND    ISSUE 3979  JULY 28, 2008
                                    '###############################################################
                                    'OBJECT MODEL NEEDED STATEMENT DUE DATE FOR UI, ADDED OTHER 
                                    'NEW VALUES LISTED BELOW WHILE WE'RE IN HERE.
                                    '###############################################################
                                    objStatement(i).LastPayAmount = .LastPayAmount
                                    objStatement(i).LastPayDate = .LastPayDate
                                    objStatement(i).LastPayMOP = .LastPayMOP
                                    objStatement(i).LastTransType = .LastTransType
                                    objStatement(i).StatementDueDate = .StatementDueDate
                                    objStatement(i).TotalStatementAmount = .TotalStatementAmount
                                    '###############################################################

                                End With

                                'objStatement(i).StatementCode = CType(objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).StatementCode, StatementCode)
                                Select Case objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).StatementCode
                                    Case WSICOMS_CustomerAccount.StatementCode.All
                                        objStatement(i).StatementCode = StatementCode.All
                                    Case WSICOMS_CustomerAccount.StatementCode.Data
                                        objStatement(i).StatementCode = StatementCode.Data
                                    Case WSICOMS_CustomerAccount.StatementCode.Misc1
                                        objStatement(i).StatementCode = StatementCode.Misc1
                                    Case WSICOMS_CustomerAccount.StatementCode.Misc2
                                        objStatement(i).StatementCode = StatementCode.Misc2
                                    Case WSICOMS_CustomerAccount.StatementCode.Telephony
                                        objStatement(i).StatementCode = StatementCode.Telephony
                                    Case WSICOMS_CustomerAccount.StatementCode.Video_Data
                                        objStatement(i).StatementCode = StatementCode.Video_Data
                                End Select

                                If Not objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).MOP Is Nothing Then
                                    objMOP = New MOP()
                                    With objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).MOP
                                        objMOP.Code = .Code
                                        objMOP.Description = .Description
                                        objMOP.BillingDay = .BillingDay
                                        objMOP.BillFormatCode = .BillFormatCode
                                        objMOP.ProduceStatement = .ProduceStatement
                                        objMOP.ServiceClass = .ServiceClass
                                        objMOP.LanguageCode = .LanguageCode
                                        objMOP.ProcessControlNumber = .ProcessControlNumber
                                        objMOP.TransactionType = .TransactionType
                                        objMOP.NumberTransactions = .NumberTransactions

                                        'objMOP.BillHandlingCode = CType(.BillHandlingCode, BillHandlingCode)
                                        Select Case .BillHandlingCode
                                            Case WSICOMS_CustomerAccount.BillHandlingCode.CheckFree
                                                objMOP.BillHandlingCode = BillHandlingCode.CheckFree
                                            Case WSICOMS_CustomerAccount.BillHandlingCode.Default
                                                objMOP.BillHandlingCode = BillHandlingCode.Default
                                            Case WSICOMS_CustomerAccount.BillHandlingCode.ePayWithNoPaperBill
                                                objMOP.BillHandlingCode = BillHandlingCode.ePayWithNoPaperBill
                                            Case WSICOMS_CustomerAccount.BillHandlingCode.ePayWithPaperBill
                                                objMOP.BillHandlingCode = BillHandlingCode.ePayWithPaperBill
                                        End Select


                                        'objMOP.StatementStatus = CType(.StatementStatus, StatementStatus)

                                        Select Case .StatementStatus
                                            Case WSICOMS_CustomerAccount.StatementStatus.Active
                                                objMOP.StatementStatus = StatementStatus.Active
                                            Case WSICOMS_CustomerAccount.StatementStatus.Disconnect
                                                objMOP.StatementStatus = StatementStatus.Disconnect
                                            Case WSICOMS_CustomerAccount.StatementStatus.NonPayDisconnect
                                                objMOP.StatementStatus = StatementStatus.NonPayDisconnect
                                            Case WSICOMS_CustomerAccount.StatementStatus.NoServices
                                                objMOP.StatementStatus = StatementStatus.NoServices
                                            Case WSICOMS_CustomerAccount.StatementStatus.PendingChange
                                                objMOP.StatementStatus = StatementStatus.PendingChange
                                            Case WSICOMS_CustomerAccount.StatementStatus.PendingDisconnect
                                                objMOP.StatementStatus = StatementStatus.PendingDisconnect
                                            Case WSICOMS_CustomerAccount.StatementStatus.PendingInstall
                                                objMOP.StatementStatus = StatementStatus.PendingInstall
                                            Case WSICOMS_CustomerAccount.StatementStatus.PendingReconnect
                                                objMOP.StatementStatus = StatementStatus.PendingReconnect
                                            Case WSICOMS_CustomerAccount.StatementStatus.TemporaryDisconnect
                                                objMOP.StatementStatus = StatementStatus.TemporaryDisconnect
                                        End Select


                                    End With
                                    objStatement(i).MOP = objMOP
                                End If
                                If Not objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).Credit Is Nothing Then
                                    objCredit = New DebitCredit()
                                    With objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).Credit
                                        objCredit.TransMasterAmount = .TransMasterAmount
                                        objCredit.TaxAmount = .TaxAmount
                                        objCredit.TransferTaxAmount = .TransferTaxAmount
                                    End With
                                    objStatement(i).Credit = objCredit
                                End If
                                If Not objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).Debit Is Nothing Then
                                    objDebit = New DebitCredit()
                                    With objTempGetAccountsResponse.AccountStatementAllInfo.Statement(i).Debit
                                        objDebit.TransMasterAmount = .TransMasterAmount
                                        objDebit.TaxAmount = .TaxAmount
                                        objDebit.TransferTaxAmount = .TransferTaxAmount
                                    End With
                                    objStatement(i).Debit = objDebit
                                End If


                            Next
                            objAccountStatementAllInfo.Statement = objStatement
                        End If
                        objGetAccountStatementsAllResponse.AccountStatementAllInfo = objAccountStatementAllInfo
                    End If
                    Return objGetAccountStatementsAllResponse
                Else
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
            Else
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If

        Catch ex As Exception
            objGetAccountStatementsAllResponse.Exception = True
            objGetAccountStatementsAllResponse.ExceptionMessage = ex.Message
            objGetAccountStatementsAllResponse.ExceptionStackTrace = ex.StackTrace
            Return objGetAccountStatementsAllResponse
        Finally

        End Try
    End Function









    Public Overrides Function GetAccountDetailsFromICOMS(ByVal obj As IProviderParameters) As IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetAccountDetailsRequest
        Dim objRequest As New WSICOMS_CustomerAccount.GetAccountDetailsRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WSICOMS_CustomerAccount.GetAccountDetailsResponse
        Dim objResponse As New GetAccountDetailsResponse


        Try
            objTempRequest = CType(obj, GetAccountDetailsRequest)



            If Not objTempRequest Is Nothing Then
                If Not objTempRequest.IcomsHeaderInfo Is Nothing Then
                    objRequest.IcomsHeaderInfo = New WSICOMS_CustomerAccount.IcomsHeaderInfo()

                    Select Case objTempRequest.IcomsHeaderInfo.SiteId
                        Case SiteId.Site100
                            objRequest.IcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site100
                        Case SiteId.Site200
                            objRequest.IcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site200
                        Case SiteId.Site300
                            objRequest.IcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site300
                        Case SiteId.Site400
                            objRequest.IcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site400
                        Case SiteId.Site500
                            objRequest.IcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site500
                        Case SiteId.Site600
                            objRequest.IcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site600
                    End Select
                End If


                If Not (objTempRequest.Criteria Is Nothing) Then
                    Select Case objTempRequest.Criteria.ItemElementName
                        Case ItemChoiceType.AccountNumber
                            If Not (objTempRequest.Criteria.Item Is Nothing) Then
                                objRequest.AccountId = objTempRequest.Criteria.Item.ToString()
                            End If
                        Case ItemChoiceTypeICOMS.Name
                            '############################################
                            'NO ACTION DEFINED FOR NAME AS A CRITIERIA
                            '############################################
                        Case ItemChoiceTypeICOMS.TelephoneNumber
                            '############################################
                            'NO ACTION DEFINED FOR PHONE NUMBER AS A CRITIERIA
                            '############################################
                    End Select
                End If


            End If








            '##########################################
            'Configure settings for  WebService
            '##########################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsICOMSCustomerAccount = New WSICOMS_CustomerAccount.AccountServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_URL))
            Me.wsICOMSCustomerAccount.Url = uri.AbsoluteUri
            wsICOMSCustomerAccount.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsICOMSCustomerAccount.Credentials = Me.Credentials
            End If








            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            objTempResponse = Me.wsICOMSCustomerAccount.GetAccountDetails(objRequest)





            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WSICOMS_CustomerAccount.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If




            If Not (objTempResponse.AccountInfo Is Nothing) Then
                objResponse.AccountInfo = New AccountDetailsResult()

                If Not (objTempResponse.AccountInfo.Account Is Nothing) Then
                    objResponse.AccountInfo.Account = New AccountInfo

                    If Not (objTempResponse.AccountInfo.Account.AccountDetails Is Nothing) Then
                        '#########################################
                        'LOOP THRU THE ACCOUNT DETAILS COLLECTION
                        '#########################################
                        objResponse.AccountInfo.Account.AccountDetails = New AccountDetailsLineOfBusiness() {}
                        ReDim objResponse.AccountInfo.Account.AccountDetails(objTempResponse.AccountInfo.Account.AccountDetails.GetUpperBound(0))
                        For ii As Integer = 0 To objTempResponse.AccountInfo.Account.AccountDetails.GetUpperBound(0)

                            '####################################
                            'LOOP THRU THE EQUIPMENT COLLECTION
                            '####################################
                            objResponse.AccountInfo.Account.AccountDetails(ii).Equipment = New EquipmentDetail() {}
                            ReDim objResponse.AccountInfo.Account.AccountDetails(ii).Equipment(objTempResponse.AccountInfo.Account.AccountDetails(ii).Equipment.GetUpperBound(0))
                            For iii As Integer = 0 To objTempResponse.AccountInfo.Account.AccountDetails(ii).Equipment.GetUpperBound(0)
                                objResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).ComponentCode = objTempResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).ComponentCode
                                objResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).MACAddress = objTempResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).MACAddress
                                objResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).Model = objTempResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).Model
                                objResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).SerialNumber = objTempResponse.AccountInfo.Account.AccountDetails(ii).Equipment(iii).SerialNumber
                            Next

                            '####################################
                            'LOOP THRU THE OUTLET COLLECTION
                            '####################################
                            objResponse.AccountInfo.Account.AccountDetails(ii).Outlets = New LineOfBusinessOutletEquipment() {}
                            ReDim objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets.GetUpperBound(0))
                            For iii As Integer = 0 To objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets.GetUpperBound(0)
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Address = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Address
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).DateInstalled = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).DateInstalled
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).ItemNumber = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).ItemNumber
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).LECFreeze = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).LECFreeze
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).LPIC = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).LPIC
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).LPICFreeze = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).LPICFreeze
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).OccurrenceType = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).OccurrenceType
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).OutletNumber = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).OutletNumber
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Ownership = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Ownership
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).PIC = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).PIC
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).PICFreeze = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).PICFreeze
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).PortNumber = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).PortNumber
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).SerialNumber = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).SerialNumber
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).ServiceOccurrence = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).ServiceOccurrence


                                '####################################
                                'LOOP THRU THE SERVICES COLLECTION
                                '####################################
                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services = New OutletService() {}
                                ReDim objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services(objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services.GetUpperBound(0))
                                For iv As Integer = 0 To objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services.GetUpperBound(0)
                                    objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services(iv).Code = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services(iv).Code
                                    objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services(iv).Rate = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services(iv).Rate
                                    objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services(iv).Status = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).Services(iv).Status
                                Next


                                objResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).TelephoneNumber = objTempResponse.AccountInfo.Account.AccountDetails(ii).Outlets(iii).TelephoneNumber
                            Next

                        Next
                    End If



                    objResponse.AccountInfo.Account.AccountId = objTempResponse.AccountInfo.Account.AccountId
                    objResponse.AccountInfo.Account.AddressLine1 = objTempResponse.AccountInfo.Account.AddressLine1
                    objResponse.AccountInfo.Account.AddressLine2 = objTempResponse.AccountInfo.Account.AddressLine2
                    objResponse.AccountInfo.Account.AddressLine3 = objTempResponse.AccountInfo.Account.AddressLine3
                    objResponse.AccountInfo.Account.AddressLine4 = objTempResponse.AccountInfo.Account.AddressLine4
                    objResponse.AccountInfo.Account.City = objTempResponse.AccountInfo.Account.City
                    objResponse.AccountInfo.Account.Company = objTempResponse.AccountInfo.Account.Company
                    objResponse.AccountInfo.Account.Division = objTempResponse.AccountInfo.Account.Division
                    objResponse.AccountInfo.Account.FirstName = objTempResponse.AccountInfo.Account.FirstName
                    objResponse.AccountInfo.Account.Franchise = objTempResponse.AccountInfo.Account.Franchise
                    objResponse.AccountInfo.Account.LastName = objTempResponse.AccountInfo.Account.LastName
                    objResponse.AccountInfo.Account.MiddleInitial = objTempResponse.AccountInfo.Account.MiddleInitial
                    objResponse.AccountInfo.Account.PrimaryPhone = objTempResponse.AccountInfo.Account.PrimaryPhone
                    objResponse.AccountInfo.Account.State = objTempResponse.AccountInfo.Account.State
                    objResponse.AccountInfo.Account.ZipCode = objTempResponse.AccountInfo.Account.ZipCode


                    Select Case objTempResponse.AccountInfo.Source
                        Case DataSource.Database
                            objResponse.AccountInfo.Source = DataSource.Database
                        Case DataSource.RemoteSystem
                            objResponse.AccountInfo.Source = DataSource.RemoteSystem
                    End Select

                End If

                If Not (objTempResponse.Result Is Nothing) Then
                    Dim objexceptionInfo As ResultExceptionInfo
                    Dim objstatusMessages() As IcomsStatusMessage = New IcomsStatusMessage() {}

                    objResponse.Result = New Result
                    objResponse.Result.ReferenceCode = objTempResponse.Result.ReferenceCode
                    objResponse.Result.Description = objTempResponse.Result.Description
                    objResponse.Result.DateTime = objTempResponse.Result.DateTime
                    objResponse.Result.Source = objTempResponse.Result.Source
                    objResponse.Result.Server = objTempResponse.Result.Server
                    objResponse.Result.ReturnCode = objTempResponse.Result.ReturnCode
                    If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                        objexceptionInfo = New ResultExceptionInfo
                        objexceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                        objexceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                        objResponse.Result.ExceptionInfo = objexceptionInfo
                    End If
                    If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                        ReDim objstatusMessages(objTempResponse.Result.StatusMessages.GetUpperBound(0))
                        For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                            objstatusMessages(i) = New IcomsStatusMessage()
                            objstatusMessages(i).Code = objTempResponse.Result.StatusMessages(i).Code
                            objstatusMessages(i).Message = objTempResponse.Result.StatusMessages(i).Message
                        Next
                        objResponse.Result.StatusMessagesIcoms = objstatusMessages
                    End If
                    objResponse.Result.Type = objTempResponse.Result.Type

                End If
            End If



            Return objResponse


        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse

        Finally

        End Try
    End Function














    Public Overrides Function GetCPNIVerificationFromCSG(ByVal obj As IProviderParameters) As IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetCPNIVerificationRequestCSG
        Dim objRequest As New WSCSG_CustomerAccount.GetCPNIVerificationRequest

        '########################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '########################################
        Dim objTempResponse As New WSCSG_CustomerAccount.GetCPNIVerificationResponse
        Dim objResponse As New GetCPNIVerificationResponseCSG


        Try
            objTempRequest = CType(obj, GetCPNIVerificationRequestCSG)



            '#################################################
            'BUILD REQUEST OBJECT FOR THE WEB SERVICE REQUEST
            '#################################################
            If Not objTempRequest Is Nothing Then
                objRequest.AccountNumber = objTempRequest.AccountNumber

                If Not objTempRequest.CsgHeaderInfo Is Nothing Then
                    Dim objCsgHeaderInfo As New WSCSG_CustomerAccount.CsgHeaderInfo()
                    objCsgHeaderInfo.RoutingArea = objTempRequest.CsgHeaderInfo.RoutingArea
                    objRequest.CsgHeaderInfo = objCsgHeaderInfo
                End If

                objRequest.PIN = objTempRequest.PIN
            End If




            '#################################
            'Configure settings for WebService
            '#################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsCSGCustomerAccount = New WSCSG_CustomerAccount.AccountServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_URL))
            Me.wsCSGCustomerAccount.Url = uri.AbsoluteUri
            wsCSGCustomerAccount.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CSGACCOUNTWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsCSGCustomerAccount.Credentials = Me.Credentials
            End If





            '########################################
            'DO THE CALL TO THE WEB SERVICE
            '########################################
            objTempResponse = Me.wsCSGCustomerAccount.GetCPNIVerification(objRequest)






            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WSCSG_CustomerAccount.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If

            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################

            objResponse.Verified = objTempResponse.Verified




            If Not (objTempResponse.Result Is Nothing) Then
                objResponse.Result = New Result
                objResponse.Result.DateTime = objTempResponse.Result.DateTime
                objResponse.Result.Description = objTempResponse.Result.Description

                If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                    objResponse.Result.ExceptionInfo = New ResultExceptionInfo
                    objResponse.Result.ExceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                    objResponse.Result.ExceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                    objResponse.Result.ExceptionInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                    objResponse.Result.ExceptionInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                End If

                objResponse.Result.ReferenceCode = objTempResponse.Result.ReferenceCode
                objResponse.Result.ReturnCode = objTempResponse.Result.ReturnCode
                objResponse.Result.Server = objTempResponse.Result.Server
                objResponse.Result.Source = objTempResponse.Result.Source

                If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                    For i2 As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                        objResponse.Result.StatusMessages(i2) = New CsgStatusMessage
                        objResponse.Result.StatusMessages(i2).Code = objTempResponse.Result.StatusMessages(i2).Code
                        objResponse.Result.StatusMessages(i2).Message = objTempResponse.Result.StatusMessages(i2).Message
                    Next
                End If
                objResponse.Result.Type = objTempResponse.Result.Type
            End If


            Return objResponse



        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function
    Public Overrides Function GetCPNIVerificationFromICOMS(ByVal obj As IProviderParameters) As IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetCPNIVerificationRequestICOMS
        Dim objRequest As New WSICOMS_CustomerAccount.GetCPNIVerificationRequest

        '########################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '########################################
        Dim objTempResponse As New WSICOMS_CustomerAccount.GetCPNIVerificationResponse
        Dim objResponse As New GetCPNIVerificationResponseICOMS

        Try
            objTempRequest = CType(obj, GetCPNIVerificationRequestICOMS)

            '#################################################
            'BUILD REQUEST OBJECT FOR THE WEB SERVICE REQUEST
            '#################################################
            If Not objTempRequest Is Nothing Then
                objRequest.AccountId = objTempRequest.AccountNumber

                If Not objTempRequest.IcomsHeaderInfo Is Nothing Then
                    Dim objIcomsHeaderInfo As New WSICOMS_CustomerAccount.IcomsHeaderInfo()
                    If objTempRequest.IcomsHeaderInfo.SiteId Is Nothing Then
                        objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.NotSpecified
                    Else
                        Select Case objTempRequest.IcomsHeaderInfo.SiteId.Trim()
                            Case "100"
                                objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site100
                            Case "200"
                                objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site200
                            Case "300"
                                objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site300
                            Case "400"
                                objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site400
                            Case "500"
                                objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site500
                            Case "600"
                                objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site600
                            Case Else
                                objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.NotSpecified
                        End Select
                    End If
                    objRequest.IcomsHeaderInfo = objIcomsHeaderInfo
                End If

                objRequest.PIN = objTempRequest.PIN
            End If

            '#################################
            'Configure settings for WebService
            '#################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsICOMSCustomerAccount = New WSICOMS_CustomerAccount.AccountServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_URL))
            Me.wsICOMSCustomerAccount.Url = uri.AbsoluteUri
            wsICOMSCustomerAccount.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_USER).ToString, _
                                                      context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsICOMSCustomerAccount.Credentials = Me.Credentials
            End If

            '########################################
            'DO THE CALL TO THE WEB SERVICE
            '########################################
            objTempResponse = Me.wsICOMSCustomerAccount.GetCPNIVerification(objRequest)






            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WSICOMS_CustomerAccount.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If

            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################

            objResponse.Verified = objTempResponse.Verified




            If Not (objTempResponse.Result Is Nothing) Then
                objResponse.Result = New Result
                objResponse.Result.DateTime = objTempResponse.Result.DateTime
                objResponse.Result.Description = objTempResponse.Result.Description

                If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                    objResponse.Result.ExceptionInfo = New ResultExceptionInfo
                    objResponse.Result.ExceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                    objResponse.Result.ExceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                    objResponse.Result.ExceptionInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                    objResponse.Result.ExceptionInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                End If

                objResponse.Result.ReferenceCode = objTempResponse.Result.ReferenceCode
                objResponse.Result.ReturnCode = objTempResponse.Result.ReturnCode
                objResponse.Result.Server = objTempResponse.Result.Server
                objResponse.Result.Source = objTempResponse.Result.Source

                If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                    For i2 As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                        objResponse.Result.StatusMessagesIcoms(i2) = New IcomsStatusMessage
                        objResponse.Result.StatusMessagesIcoms(i2).Code = objTempResponse.Result.StatusMessages(i2).Code
                        objResponse.Result.StatusMessagesIcoms(i2).Message = objTempResponse.Result.StatusMessages(i2).Message
                    Next
                End If
                objResponse.Result.Type = objTempResponse.Result.Type
            End If


            Return objResponse



        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function







    Public Overrides Function GetOrderCSG(ByVal obj As IProviderParameters) As IProviderResults
        Dim lGetOrdersRequestCSG As GetOrdersRequestCSG
        Dim objGetOrdersRequestCSG As WSCSG_Order.GetOrdersRequest
        Dim objTempGetOrdersResponse As WSCSG_Order.GetOrdersResponse
        Dim objGetOrdersResponseCSG As New GetOrdersResponseCSG
        Try
            lGetOrdersRequestCSG = CType(obj, GetOrdersRequestCSG)
            If Not lGetOrdersRequestCSG Is Nothing Then
                objGetOrdersRequestCSG = New WSCSG_Order.GetOrdersRequest
                If Not lGetOrdersRequestCSG.CsgHeaderInfo Is Nothing Then
                    objGetOrdersRequestCSG.CsgHeaderInfo = BuildCsgHeaderInfo(lGetOrdersRequestCSG.CsgHeaderInfo)
                End If


                'objGetOrdersRequestCSG.OrderClass = CType(lGetOrdersRequestCSG.OrderClass, WSCSG_Order.GetOrdersOrderClass)
                Select Case lGetOrdersRequestCSG.OrderClass
                    Case GetOrdersOrderClass.NotSpecified
                        objGetOrdersRequestCSG.OrderClass = WSCSG_Order.GetOrdersOrderClass.NotSpecified
                    Case GetOrdersOrderClass.ServiceRequest
                        objGetOrdersRequestCSG.OrderClass = WSCSG_Order.GetOrdersOrderClass.ServiceRequest
                    Case GetOrdersOrderClass.SpecialRequest
                        objGetOrdersRequestCSG.OrderClass = WSCSG_Order.GetOrdersOrderClass.SpecialRequest
                    Case GetOrdersOrderClass.TroubleCall
                        objGetOrdersRequestCSG.OrderClass = WSCSG_Order.GetOrdersOrderClass.TroubleCall
                End Select

                'objGetOrdersRequestCSG.OrderStatus = CType(lGetOrdersRequestCSG.OrderStatus, WSCSG_Order.GetOrdersOrderStatus)
                Select Case lGetOrdersRequestCSG.OrderStatus
                    Case GetOrdersOrderStatus.Cancelled
                        objGetOrdersRequestCSG.OrderStatus = WSCSG_Order.GetOrdersOrderStatus.Cancelled
                    Case GetOrdersOrderStatus.Completed
                        objGetOrdersRequestCSG.OrderStatus = WSCSG_Order.GetOrdersOrderStatus.Completed
                    Case GetOrdersOrderStatus.NotSpecified
                        objGetOrdersRequestCSG.OrderStatus = WSCSG_Order.GetOrdersOrderStatus.NotSpecified
                    Case GetOrdersOrderStatus.Open
                        objGetOrdersRequestCSG.OrderStatus = WSCSG_Order.GetOrdersOrderStatus.Open
                End Select


                objGetOrdersRequestCSG.CustomerId = lGetOrdersRequestCSG.CustomerId
                objGetOrdersRequestCSG.LocationId = lGetOrdersRequestCSG.LocationId




                '####################
                'MAKE WEBSERVICE CALL
                '####################
                objTempGetOrdersResponse = Me.wsCSGOrder.GetOrders(objGetOrdersRequestCSG)




                If (objTempGetOrdersResponse Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempGetOrdersResponse.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempGetOrdersResponse.Result.ReturnCode = WSCSG_Order.ResultReturnCode.Success) Then
                    Throw New Exception(objTempGetOrdersResponse.Result.ReturnCode.ToString())
                End If
                If Not objTempGetOrdersResponse Is Nothing Then
                    objGetOrdersResponseCSG = New GetOrdersResponseCSG
                    If Not objTempGetOrdersResponse.Result Is Nothing Then
                        objGetOrdersResponseCSG.Result = BuildResult(objTempGetOrdersResponse.Result)
                    End If
                    If Not objTempGetOrdersResponse.GetOrdersResult Is Nothing Then
                        objGetOrdersResponseCSG.GetOrdersResult = BuildOrderInfo(objTempGetOrdersResponse.GetOrdersResult)
                    End If
                    Return objGetOrdersResponseCSG
                Else
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
            Else
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If
        Catch ex As Exception
            objGetOrdersResponseCSG.Exception = True
            objGetOrdersResponseCSG.ExceptionMessage = ex.Message
            objGetOrdersResponseCSG.ExceptionStackTrace = ex.StackTrace
            Return objGetOrdersResponseCSG
        Finally

        End Try
    End Function
    Public Overrides Function GetOrderICOMS(ByVal obj As IProviderParameters) As IProviderResults
        Dim lGetOrdersRequestICOMS As GetOrdersRequestICOMS
        Dim objGetOrdersRequestICOMS As WSICOMS_Order.GetOrdersRequest
        Dim objTempGetOrdersResponse As WSICOMS_Order.GetOrdersResponse
        Dim objGetOrdersResponseICOMS As New GetOrdersResponseICOMS
        Try
            lGetOrdersRequestICOMS = CType(obj, GetOrdersRequestICOMS)
            If Not lGetOrdersRequestICOMS Is Nothing Then
                objGetOrdersRequestICOMS = New WSICOMS_Order.GetOrdersRequest
                objGetOrdersRequestICOMS.IcomsHeaderInfo = BuildIcomsHeaderInfo(lGetOrdersRequestICOMS.IcomsHeaderInfo)
                objGetOrdersRequestICOMS.AccountId = lGetOrdersRequestICOMS.AccountId
                objGetOrdersRequestICOMS.OrderCheckInStatus = lGetOrdersRequestICOMS.OrderCheckInStatus
                objGetOrdersRequestICOMS.WorkOrderNumber = lGetOrdersRequestICOMS.WorkOrderNumber



                '####################
                'MAKE WEBSERVICE CALL
                '####################
                objTempGetOrdersResponse = wsICOMSOrder.GetOrders(objGetOrdersRequestICOMS)



                If (objTempGetOrdersResponse Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempGetOrdersResponse.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempGetOrdersResponse.Result.ReturnCode = WSICOMS_Order.ResultReturnCode.Success) Then
                    Throw New Exception(objTempGetOrdersResponse.Result.ReturnCode.ToString())
                End If
                If Not objTempGetOrdersResponse Is Nothing Then
                    objGetOrdersResponseICOMS = New GetOrdersResponseICOMS
                    If Not objTempGetOrdersResponse.Result Is Nothing Then
                        objGetOrdersResponseICOMS.Result = BuildResult(objTempGetOrdersResponse.Result)
                    End If
                    If Not objTempGetOrdersResponse.GetOrdersResult Is Nothing Then
                        objGetOrdersResponseICOMS.GetOrdersResult = BuildGetOrdersResult(objTempGetOrdersResponse.GetOrdersResult)
                    End If


                    Return objGetOrdersResponseICOMS
                Else
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
            Else
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If
        Catch ex As Exception
            objGetOrdersResponseICOMS.Exception = True
            objGetOrdersResponseICOMS.ExceptionMessage = ex.Message
            objGetOrdersResponseICOMS.ExceptionStackTrace = ex.StackTrace
            Return objGetOrdersResponseICOMS
        Finally

        End Try


    End Function
    Public Overrides Function AddCardPaymentCSG(ByVal obj As IProviderParameters) As IProviderResults
        Dim lAddCardPaymentRequestCSG As AddCardPaymentRequestCSG
        Dim objAddCardPaymentResponseCSG As New AddCardPaymentResponseCSG
        Dim objAddCardPaymentRequest As WSCSG_Payment.AddCardPaymentRequest
        Dim objTempAddCardPaymentResponseCSG As WSCSG_Payment.AddCardPaymentResponse
        Try
            lAddCardPaymentRequestCSG = CType(obj, AddCardPaymentRequestCSG)
            If Not lAddCardPaymentRequestCSG Is Nothing Then
                objAddCardPaymentRequest = New WSCSG_Payment.AddCardPaymentRequest
                If Not lAddCardPaymentRequestCSG.CsgHeaderInfo Is Nothing Then
                    objAddCardPaymentRequest.CsgHeaderInfo = BuildCsgHeaderInfoPayment(lAddCardPaymentRequestCSG.CsgHeaderInfo)
                End If
                If Not lAddCardPaymentRequestCSG.Payment Is Nothing Then
                    objAddCardPaymentRequest.Payment = BuildCardPaymentRequest(lAddCardPaymentRequestCSG.Payment)
                End If

                'Configure settings for CSG Account WebService
                Dim context As HttpContext = HttpContext.Current
                Dim netCredential As NetworkCredential
                Dim uri As Uri
                wsCSGPayment = New WSCSG_Payment.PaymentServicePort
                uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_URL))
                Me.wsCSGPayment.Url = uri.AbsoluteUri
                wsCSGPayment.PreAuthenticate = True
                If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                    netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_PASSWORD).ToString)
                    Me.Credentials = netCredential.GetCredential(uri, "Basic")
                    wsCSGPayment.Credentials = Me.Credentials
                End If

                objTempAddCardPaymentResponseCSG = Me.wsCSGPayment.AddCardPayment(objAddCardPaymentRequest)


                If (objTempAddCardPaymentResponseCSG Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempAddCardPaymentResponseCSG.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempAddCardPaymentResponseCSG.Result.ReturnCode = WSCSG_Payment.ResultReturnCode.Success) Then
                    'Throw New Exception(objTempAddCardPaymentResponseCSG.Result.ReturnCode.ToString())
                    '#################################################################################
                    'MODIFICATION 6/5/2007 BY ROD COPELAND
                    '#################################################################################
                    'ALTHOUGH THIS WAS NOT THE PREFERRED FIX FOR ERROR MESSAGES. RATHER THAN RETURNING 
                    'THE MOST MEANINGFUL MESSAGE OF "EXCEPTION" BACK TO EXPLAIN WHAT HAPPEN ON THE APP 
                    'SERVER, LETS AT LEAST SEND SOMETHING A BIT MORE MEANING FULL BACK SO PEOPLE CAN 
                    'HAVE AN INDICATION WHAT THE HECK HAPPEN.  THE PREFERRED FIX WOULD BE TO INTEGRATE 
                    'THE ERROR CODE MAPPING SOLUTION INTO THE EBS SERVICE PROVIDER.  BECAUSE THE PM 
                    'AND BUSINES SPONSOR DONT GET THE TECH RATIONALE AS TO WHY THIS IS BONUS FOR EBS 
                    'PROVIDER, THEY WONT ALLOCATE TIME TO DO THE CHANGES.
                    '#################################################################################
                    Throw New Exception(objTempAddCardPaymentResponseCSG.Result.ExceptionInfo.Message)
                End If
                If Not objTempAddCardPaymentResponseCSG Is Nothing Then
                    objAddCardPaymentResponseCSG = New AddCardPaymentResponseCSG
                    If Not objTempAddCardPaymentResponseCSG.Result Is Nothing Then
                        objAddCardPaymentResponseCSG.Result = BuildResult(objTempAddCardPaymentResponseCSG.Result)
                    End If
                    If Not objTempAddCardPaymentResponseCSG.Payment Is Nothing Then
                        objAddCardPaymentResponseCSG.Payment = BuildCardPaymentResponse(objTempAddCardPaymentResponseCSG.Payment)
                    End If
                    Return CType(objAddCardPaymentResponseCSG, IProviderResults)
                Else ' else of (If Not objTempAddCardPaymentResponseCSG Is Nothing)
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If ' end of (If Not objTempAddCardPaymentResponseCSG Is Nothing)
            Else ' else of (If Not lAddCardPaymentRequestCSG Is Nothing)
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If ' end of (If Not lAddCardPaymentRequestCSG Is Nothing)

        Catch ex As Exception
            objAddCardPaymentResponseCSG.Exception = True
            objAddCardPaymentResponseCSG.ExceptionMessage = ex.Message
            objAddCardPaymentResponseCSG.ExceptionStackTrace = ex.StackTrace
            Return objAddCardPaymentResponseCSG
        Finally

        End Try
    End Function
    Public Overrides Function AddCardPaymentICOMS(ByVal obj As IProviderParameters) As IProviderResults
        Dim lAddCardPaymentRequestICOMS As AddCardPaymentRequestICOMS
        Dim objAddCardPaymentResponseICOMS As New AddCardPaymentResponseICOMS
        Dim objAddCardPaymentRequest As WSICOMS_CustomerAccount.AddCardPaymentRequest
        Dim objTempAddCardPaymentResponseICOMS As WSICOMS_CustomerAccount.AddCardPaymentResponse
        Try
            lAddCardPaymentRequestICOMS = CType(obj, AddCardPaymentRequestICOMS)
            If Not lAddCardPaymentRequestICOMS Is Nothing Then
                objAddCardPaymentRequest = New WSICOMS_CustomerAccount.AddCardPaymentRequest
                If Not lAddCardPaymentRequestICOMS.IcomsHeaderInfo Is Nothing Then
                    objAddCardPaymentRequest.IcomsHeaderInfo = BuildIcomsHeaderInfoAccount(lAddCardPaymentRequestICOMS.IcomsHeaderInfo)
                End If
                If Not lAddCardPaymentRequestICOMS.CardPayment Is Nothing Then
                    objAddCardPaymentRequest.CardPayment = BuildCardPayment(lAddCardPaymentRequestICOMS.CardPayment)
                End If

                'Configure settings for ICOMS Account webservice
                Dim context As HttpContext = HttpContext.Current
                Dim netCredential As NetworkCredential
                Dim uri As Uri
                wsICOMSPayment = New WSICOMS_CustomerAccount.AccountServicePort
                uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_URL))
                Me.wsICOMSPayment.Url = uri.AbsoluteUri
                wsICOMSPayment.PreAuthenticate = True
                If CBool(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                    netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_USER).ToString, _
                                                          context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_PASSWORD).ToString)
                    Me.Credentials = netCredential.GetCredential(uri, "Basic")
                    wsICOMSPayment.Credentials = Me.Credentials
                End If

                objTempAddCardPaymentResponseICOMS = Me.wsICOMSPayment.AddCardPayment(objAddCardPaymentRequest)

                If (objTempAddCardPaymentResponseICOMS Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempAddCardPaymentResponseICOMS.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempAddCardPaymentResponseICOMS.Result.ReturnCode = WSICOMS_CustomerAccount.ResultReturnCode.Success) Then
                    'Throw New Exception(objTempAddCardPaymentResponseICOMS.Result.ReturnCode.ToString())
                    '#################################################################################
                    'MODIFICATION 6/5/2007 BY ROD COPELAND
                    '#################################################################################
                    'ALTHOUGH THIS WAS NOT THE PREFERRED FIX FOR ERROR MESSAGES. RATHER THAN RETURNING 
                    'THE MOST MEANINGFUL MESSAGE OF "EXCEPTION" BACK TO EXPLAIN WHAT HAPPEN ON THE APP 
                    'SERVER, LETS AT LEAST SEND SOMETHING A BIT MORE MEANING FULL BACK SO PEOPLE CAN 
                    'HAVE AN INDICATION WHAT THE HECK HAPPEN.  THE PREFERRED FIX WOULD BE TO INTEGRATE 
                    'THE ERROR CODE MAPPING SOLUTION INTO THE EBS SERVICE PROVIDER.  BECAUSE THE PM 
                    'AND BUSINES SPONSOR DONT GET THE TECH RATIONALE AS TO WHY THIS IS BONUS FOR EBS 
                    'PROVIDER, THEY WONT ALLOCATE TIME TO DO THE CHANGES.
                    '#################################################################################
                    Throw New Exception(objTempAddCardPaymentResponseICOMS.Result.ExceptionInfo.Message)
                End If

                If Not objTempAddCardPaymentResponseICOMS Is Nothing Then
                    objAddCardPaymentResponseICOMS = New AddCardPaymentResponseICOMS
                    If Not objTempAddCardPaymentResponseICOMS.Result Is Nothing Then
                        objAddCardPaymentResponseICOMS.Result = BuildResult(objTempAddCardPaymentResponseICOMS.Result)
                    End If
                    If Not objTempAddCardPaymentResponseICOMS.CardPayment Is Nothing Then
                        objAddCardPaymentResponseICOMS.CardPayment = BuildCardPaymentSingleResult(objTempAddCardPaymentResponseICOMS.CardPayment)
                    End If

                    Return CType(objAddCardPaymentResponseICOMS, IProviderResults)
                Else ' else of (If Not objTempAddCardPaymentResponseICOMS Is Nothing)
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If ' end of (If Not objTempAddCardPaymentResponseICOMS Is Nothing)
            Else ' else of (If Not lAddCardPaymentRequestICOMS Is Nothing)
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If ' end of (If Not lAddCardPaymentRequestICOMS Is Nothing)
        Catch ex As Exception
            objAddCardPaymentResponseICOMS.Exception = True
            objAddCardPaymentResponseICOMS.ExceptionMessage = ex.Message
            objAddCardPaymentResponseICOMS.ExceptionStackTrace = ex.StackTrace
            Return objAddCardPaymentResponseICOMS
        Finally

        End Try
    End Function
    Public Overrides Function AddEFTPaymentCSG(ByVal obj As IProviderParameters) As IProviderResults
        Dim lAddEFTPaymentRequestCSG As AddEFTPaymentRequestCSG
        Dim objAddEFTPaymentResponseCSG As New AddEFTPaymentResponseCSG
        Dim objAddEFTPaymentRequest As WSCSG_Payment.AddEFTPaymentRequest
        Dim objTempAddEFTPaymentResponseCSG As WSCSG_Payment.AddEFTPaymentResponse
        Try
            'Configure settings for CSG Account WebService
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsCSGPayment = New WSCSG_Payment.PaymentServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_URL))
            Me.wsCSGPayment.Url = uri.AbsoluteUri
            wsCSGPayment.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CSGPAYMENTWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsCSGPayment.Credentials = Me.Credentials
            End If

            lAddEFTPaymentRequestCSG = CType(obj, AddEFTPaymentRequestCSG)
            If Not lAddEFTPaymentRequestCSG Is Nothing Then
                objAddEFTPaymentRequest = New WSCSG_Payment.AddEFTPaymentRequest
                If Not lAddEFTPaymentRequestCSG.CsgHeaderInfo Is Nothing Then
                    objAddEFTPaymentRequest.CsgHeaderInfo = BuildCsgHeaderInfoPayment(lAddEFTPaymentRequestCSG.CsgHeaderInfo)
                End If

                If Not lAddEFTPaymentRequestCSG.Payment Is Nothing Then
                    objAddEFTPaymentRequest.Payment = BuildEFTPaymentRequest(lAddEFTPaymentRequestCSG.Payment)
                End If
                objTempAddEFTPaymentResponseCSG = wsCSGPayment.AddEFTPayment(objAddEFTPaymentRequest)
                If (objTempAddEFTPaymentResponseCSG Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempAddEFTPaymentResponseCSG.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempAddEFTPaymentResponseCSG.Result.ReturnCode = WSCSG_Payment.ResultReturnCode.Success) Then
                    'Throw New Exception(objTempAddEFTPaymentResponseCSG.Result.ReturnCode.ToString())
                    '#################################################################################
                    'MODIFICATION 6/5/2007 BY ROD COPELAND
                    '#################################################################################
                    'ALTHOUGH THIS WAS NOT THE PREFERRED FIX FOR ERROR MESSAGES. RATHER THAN RETURNING 
                    'THE MOST MEANINGFUL MESSAGE OF "EXCEPTION" BACK TO EXPLAIN WHAT HAPPEN ON THE APP 
                    'SERVER, LETS AT LEAST SEND SOMETHING A BIT MORE MEANING FULL BACK SO PEOPLE CAN 
                    'HAVE AN INDICATION WHAT THE HECK HAPPEN.  THE PREFERRED FIX WOULD BE TO INTEGRATE 
                    'THE ERROR CODE MAPPING SOLUTION INTO THE EBS SERVICE PROVIDER.  BECAUSE THE PM 
                    'AND BUSINES SPONSOR DONT GET THE TECH RATIONALE AS TO WHY THIS IS BONUS FOR EBS 
                    'PROVIDER, THEY WONT ALLOCATE TIME TO DO THE CHANGES.
                    '#################################################################################
                    Throw New Exception(objTempAddEFTPaymentResponseCSG.Result.ExceptionInfo.Message)
                End If
                If Not objTempAddEFTPaymentResponseCSG Is Nothing Then
                    objAddEFTPaymentResponseCSG = New AddEFTPaymentResponseCSG
                    If Not objTempAddEFTPaymentResponseCSG.Result Is Nothing Then
                        objAddEFTPaymentResponseCSG.Result = BuildResult(objTempAddEFTPaymentResponseCSG.Result)
                    End If
                    If Not objTempAddEFTPaymentResponseCSG.Payment Is Nothing Then
                        objAddEFTPaymentResponseCSG.Payment = BuildEFTPaymentResponse(objTempAddEFTPaymentResponseCSG.Payment)
                    End If
                    Return CType(objAddEFTPaymentResponseCSG, IProviderResults)
                Else ' else of (If Not objTempAddEFTPaymentResponseCSG Is Nothing)
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If ' end of (If Not objTempAddEFTPaymentResponseCSG Is Nothing)
            Else ' else of (If Not lAddEFTPaymentRequestCSG Is Nothing)
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If ' end of (If Not lAddEFTPaymentRequestCSG Is Nothing)

        Catch ex As Exception
            objAddEFTPaymentResponseCSG.Exception = True
            objAddEFTPaymentResponseCSG.ExceptionMessage = ex.Message
            objAddEFTPaymentResponseCSG.ExceptionStackTrace = ex.StackTrace
            Return objAddEFTPaymentResponseCSG
        Finally

        End Try
    End Function
    Public Overrides Function AddEFTPaymentICOMS(ByVal obj As IProviderParameters) As IProviderResults
        Dim lAddEFTPaymentRequestICOMS As AddEFTPaymentRequestICOMS
        Dim objAddEFTPaymentResponseICOMS As New AddEFTPaymentResponseICOMS
        Dim objAddEFTPaymentRequest As WSICOMS_CustomerAccount.AddEFTPaymentRequest
        Dim objTempAddEFTPaymentResponseICOMS As WSICOMS_CustomerAccount.AddEFTPaymentResponse
        Try
            'Configure settings for ICOMS Account webservice
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsICOMSPayment = New WSICOMS_CustomerAccount.AccountServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_URL))
            Me.wsICOMSPayment.Url = uri.AbsoluteUri
            wsICOMSPayment.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsICOMSPayment.Credentials = Me.Credentials
            End If

            lAddEFTPaymentRequestICOMS = CType(obj, AddEFTPaymentRequestICOMS)
            If Not lAddEFTPaymentRequestICOMS Is Nothing Then
                objAddEFTPaymentRequest = New WSICOMS_CustomerAccount.AddEFTPaymentRequest

                If Not lAddEFTPaymentRequestICOMS.IcomsHeaderInfo Is Nothing Then
                    objAddEFTPaymentRequest.IcomsHeaderInfo = BuildIcomsHeaderInfoAccount(lAddEFTPaymentRequestICOMS.IcomsHeaderInfo)
                End If
                If Not lAddEFTPaymentRequestICOMS.EFTPayment Is Nothing Then
                    objAddEFTPaymentRequest.EFTPayment = BuildEFTPayment(lAddEFTPaymentRequestICOMS.EFTPayment)
                End If
                objTempAddEFTPaymentResponseICOMS = wsICOMSPayment.AddEFTPayment(objAddEFTPaymentRequest)
                If (objTempAddEFTPaymentResponseICOMS Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If (objTempAddEFTPaymentResponseICOMS.Result Is Nothing) Then
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If
                If Not (objTempAddEFTPaymentResponseICOMS.Result.ReturnCode = WSICOMS_CustomerAccount.ResultReturnCode.Success) Then
                    'Throw New Exception(objTempAddEFTPaymentResponseICOMS.Result.ReturnCode.ToString())
                    '#################################################################################
                    'MODIFICATION 6/5/2007 BY ROD COPELAND
                    '#################################################################################
                    'ALTHOUGH THIS WAS NOT THE PREFERRED FIX FOR ERROR MESSAGES. RATHER THAN RETURNING 
                    'THE MOST MEANINGFUL MESSAGE OF "EXCEPTION" BACK TO EXPLAIN WHAT HAPPEN ON THE APP 
                    'SERVER, LETS AT LEAST SEND SOMETHING A BIT MORE MEANING FULL BACK SO PEOPLE CAN 
                    'HAVE AN INDICATION WHAT THE HECK HAPPEN.  THE PREFERRED FIX WOULD BE TO INTEGRATE 
                    'THE ERROR CODE MAPPING SOLUTION INTO THE EBS SERVICE PROVIDER.  BECAUSE THE PM 
                    'AND BUSINES SPONSOR DONT GET THE TECH RATIONALE AS TO WHY THIS IS BONUS FOR EBS 
                    'PROVIDER, THEY WONT ALLOCATE TIME TO DO THE CHANGES.
                    '#################################################################################
                    Throw New Exception(objTempAddEFTPaymentResponseICOMS.Result.ExceptionInfo.Message)
                End If

                If Not objTempAddEFTPaymentResponseICOMS Is Nothing Then
                    objAddEFTPaymentResponseICOMS = New AddEFTPaymentResponseICOMS
                    If Not objTempAddEFTPaymentResponseICOMS.Result Is Nothing Then
                        objAddEFTPaymentResponseICOMS.Result = BuildResult(objTempAddEFTPaymentResponseICOMS.Result)
                    End If
                    If Not objTempAddEFTPaymentResponseICOMS.EFTPayment Is Nothing Then
                        objAddEFTPaymentResponseICOMS.EFTPayment = BuildEFTPaymentSingleResult(objTempAddEFTPaymentResponseICOMS.EFTPayment)
                    End If
                    Return CType(objAddEFTPaymentResponseICOMS, IProviderResults)
                Else ' else of (If Not objTempAddEFTPaymentResponseICOMS Is Nothing)
                    Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                End If ' end of (If Not objTempAddEFTPaymentResponseICOMS Is Nothing)
            Else ' else of (If Not lAddEFTPaymentRequestICOMS Is Nothing)
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If ' end of (If Not lAddEFTPaymentRequestICOMS Is Nothing)

        Catch ex As Exception
            objAddEFTPaymentResponseICOMS.Exception = True
            objAddEFTPaymentResponseICOMS.ExceptionMessage = ex.Message
            objAddEFTPaymentResponseICOMS.ExceptionStackTrace = ex.StackTrace
            Return objAddEFTPaymentResponseICOMS
        Finally

        End Try
    End Function
    Public Overrides Function GetLocationByPhone(ByVal obj As IProviderParameters) As IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetLocationByPhoneRequest
        Dim objRequest As New WS_Location.GetLocationByPhoneRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WS_Location.GetLocationByPhoneResponse
        Dim objResponse As New GetLocationByPhoneResponse
        Dim acctCriteria As New AccountCriteriaCustomerAddress


        Try
            objTempRequest = CType(obj, GetLocationByPhoneRequest)



            '##########################################
            'Configure settings for  WebService
            '##########################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsLocation = New WS_Location.LocationServiceSchemaPort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_LOCATIONWEBSERVICE_URL))
            Me.wsLocation.Url = uri.AbsoluteUri
            wsLocation.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_LOCATIONWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                wsLocation.UseDefaultCredentials = False
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_LOCATIONWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_LOCATIONWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsLocation.Credentials = Me.Credentials
            End If


            objRequest.Telephone = objTempRequest.TelephoneNumber




            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            objTempResponse = Me.wsLocation.GetLocationByPhone(objRequest)





            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WS_Location.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If

            If Not (objTempResponse.LocationDetails Is Nothing) Then
                acctCriteria.AddressLine1 = objTempResponse.LocationDetails.Address1
                acctCriteria.AddressLine2 = objTempResponse.LocationDetails.Address2
                acctCriteria.City = objTempResponse.LocationDetails.City
                acctCriteria.State = objTempResponse.LocationDetails.State
                acctCriteria.ZipCode = objTempResponse.LocationDetails.Zip

                objResponse.Address = New AccountCriteriaCustomerAddress(0) {}
                objResponse.Address(0) = acctCriteria
            End If

            If Not (objTempResponse.Result Is Nothing) Then
                objResponse.Result = GetResultObj(objTempResponse)
            End If

            Return objResponse


        Catch ex As Exception
            If (objResponse Is Nothing) Then
                objResponse = New GetLocationByPhoneResponse
            End If
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function
    Public Overrides Function GetServiceability(ByVal obj As IProviderParameters) As IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetServiceabilityRequest
        Dim objRequest As New WSGetServiceability.GetServiceabilityRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WSGetServiceability.GetServiceabilityResponse
        Dim objResponse As New GetServiceabilityResponse



        Try
            objTempRequest = CType(obj, GetServiceabilityRequest)


            Select Case objTempRequest.Criteria.ItemElementName
                Case ItemChoiceType.AccountNumber
                    objRequest.Criteria = New WSGetServiceability.ServiceabilityCriteria
                    objRequest.Criteria.Item = objTempRequest.Criteria.Item
                    objRequest.Criteria.ItemElementName = WSGetServiceability.ItemChoiceType.AccountNumber
                Case ItemChoiceType.Address
                    objRequest.Criteria = New WSGetServiceability.ServiceabilityCriteria
                    Dim lAddress As New ServiceabilityCriteriaAddress
                    lAddress = objTempRequest.Criteria.Item

                    Dim objRequestAddress As New WSGetServiceability.ServiceabilityCriteriaAddress
                    objRequestAddress.AddressLine1 = lAddress.AddressLine1
                    objRequestAddress.AddressLine2 = lAddress.AddressLine2
                    objRequestAddress.CleansedAddress = lAddress.CleansedAddress
                    objRequestAddress.ZipCode = lAddress.ZipCode
                    objRequestAddress.ZipCode4 = lAddress.ZipCode4

                    objRequest.Criteria.Item = objRequestAddress
                    objRequest.Criteria.ItemElementName = WSGetServiceability.ItemChoiceType.Address

                Case ItemChoiceType.TelephoneNumber
                    objRequest.Criteria = New WSGetServiceability.ServiceabilityCriteria
                    objRequest.Criteria.Item = objTempRequest.Criteria.Item
                    objRequest.Criteria.ItemElementName = WSGetServiceability.ItemChoiceType.TelephoneNumber
            End Select

            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            'Configure settings for CSG Account WebService
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsServiceability = New WSGetServiceability.ServiceabilityServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_SERVICEABILITYWEBSERVICE_URL))
            Me.wsServiceability.Url = uri.AbsoluteUri
            wsServiceability.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_SERVICEABILITYWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                wsServiceability.UseDefaultCredentials = False
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_SERVICEABILITYWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_SERVICEABILITYWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsServiceability.Credentials = Me.Credentials
            End If

            objTempResponse = Me.wsServiceability.GetServiceability(objRequest)


            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WSGetServiceability.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If


            objResponse.ServiceabilityResult = New GetServiceabilityResponseServiceabilityResult() {}
            ReDim objResponse.ServiceabilityResult(objTempResponse.ServiceabilityResult.GetUpperBound(0))
            For r As Integer = 0 To objTempResponse.ServiceabilityResult.GetUpperBound(0)
                If Not (objTempResponse.ServiceabilityResult(r) Is Nothing) Then
                    objResponse.ServiceabilityResult(r) = New GetServiceabilityResponseServiceabilityResult
                    If Not (objTempResponse.ServiceabilityResult(r).LocationAvailableServices Is Nothing) Then
                        With objTempResponse.ServiceabilityResult(r).LocationAvailableServices
                            objResponse.ServiceabilityResult(r).LocationAvailableServices = New GetServiceabilityResponseServiceabilityResultLocationAvailableServices
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.AddressLine1 = .AddressLine1

                            objResponse.ServiceabilityResult(r).LocationAvailableServices.AddressLine2 = .AddressLine2
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.Agent = .Agent

                            objResponse.ServiceabilityResult(r).LocationAvailableServices.BillingProvider = .BillingProvider
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.BillingSystem = .BillingSystem
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.City = .City
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.Co = .Co
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.Div = .Div

                            objResponse.ServiceabilityResult(r).LocationAvailableServices.EntityID = .EntityID
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.FTA = .FTA
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.HouseRef = .HouseRef
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.Prin = .Prin
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.RateCenter = .RateCenter

                            If Not (objTempResponse.ServiceabilityResult(r).LocationAvailableServices.Service Is Nothing) Then
                                ReDim objResponse.ServiceabilityResult(r).LocationAvailableServices.Service(objTempResponse.ServiceabilityResult(r).LocationAvailableServices.Service.GetUpperBound(0))
                                For i As Integer = 0 To objTempResponse.ServiceabilityResult(r).LocationAvailableServices.Service.GetUpperBound(0)
                                    objResponse.ServiceabilityResult(r).LocationAvailableServices.Service(i) = New GetServiceabilityResponseServiceabilityResultLocationAvailableServicesService
                                    objResponse.ServiceabilityResult(r).LocationAvailableServices.Service(i).Available = objTempResponse.ServiceabilityResult(r).LocationAvailableServices.Service(i).Available
                                    objResponse.ServiceabilityResult(r).LocationAvailableServices.Service(i).Description = objTempResponse.ServiceabilityResult(r).LocationAvailableServices.Service(i).Description
                                Next
                            End If

                            objResponse.ServiceabilityResult(r).LocationAvailableServices.Site = .Site
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.State = .State

                            objResponse.ServiceabilityResult(r).LocationAvailableServices.Status = .Status
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.Sys = .Sys
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.ZipCode = .ZipCode
                            objResponse.ServiceabilityResult(r).LocationAvailableServices.ZipCode4 = .ZipCode4
                        End With
                        If Not objTempResponse.ServiceabilityResult(r).LocationResidentServices Is Nothing Then
                            ReDim objResponse.ServiceabilityResult(r).LocationResidentServices(objTempResponse.ServiceabilityResult(r).LocationResidentServices.GetUpperBound(0))
                            For i As Integer = 0 To objTempResponse.ServiceabilityResult(r).LocationResidentServices.GetUpperBound(0)
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i) = New GetServiceabilityResponseServiceabilityResultLocationResidentServices
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i).AccountNumber = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).AccountNumber
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i).EntityID = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).EntityID
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i).FirstName = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).FirstName
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i).HouseRef = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).HouseRef
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i).LastName = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).LastName
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i).ResidentRef = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).ResidentRef
                                objResponse.ServiceabilityResult(r).LocationResidentServices(i).TelephoneNumber = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).TelephoneNumber

                                If Not objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service Is Nothing Then
                                    ReDim objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service.GetUpperBound(0))
                                    For intServices As Integer = 0 To objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service.GetUpperBound(0)
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices) = New GetServiceabilityResponseServiceabilityResultLocationResidentServicesService
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Bill_Typ_Cd = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Bill_Typ_Cd
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Detail_Descr = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Detail_Descr
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Dtl_Prod_Cat_ID = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Dtl_Prod_Cat_ID
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).HSD_Speed_ID = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).HSD_Speed_ID
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).LOB_Descr = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).LOB_Descr
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).LOB_ID = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).LOB_ID
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Long_Descr = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Long_Descr
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).MSO_Serv_Cd = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).MSO_Serv_Cd
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Speed_Descr = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Speed_Descr
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Sum_Prod_Cat_ID = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Sum_Prod_Cat_ID
                                        objResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Summary_Descr = objTempResponse.ServiceabilityResult(r).LocationResidentServices(i).Service(intServices).Summary_Descr
                                    Next
                                End If

                            Next
                        End If
                    End If



                    If Not (objTempResponse.Result Is Nothing) Then
                        objResponse.Result = GetResultObj(objTempResponse)
                    End If


                End If   'END objTempResponse2 CONDITION
            Next


            Return objResponse


        Catch ex As Exception
            If (objResponse Is Nothing) Then
                objResponse = New GetServiceabilityResponse
            End If
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function


    Public Overrides Function GetLerg6ByNpaNxx(ByVal obj As CharterDotCom.CommonEntities.Library.IProviderParameters) As CharterDotCom.CommonEntities.Library.IProviderResults
        '##############################################
        Dim objRequest As New WS_Telephony.GetLerg6ByNpaNxxRequest
        Dim objTempResponse As New WS_Telephony.GetLerg6ByNpaNxxResponse
        Dim objResponse As New GetLerg6ByNpaNxxResponse
        '##############################################


        '#####################
        'temp local variable
        '#####################
        Dim lGetLerg6ByNpaNxxRequest As GetLerg6ByNpaNxxRequest
        Dim objResult As New WS_Telephony.Result


        ''######################################################
        ''cast the abstract class into the temp input 
        ''class with input values.
        ''######################################################
        lGetLerg6ByNpaNxxRequest = CType(obj, GetLerg6ByNpaNxxRequest)



        Try
            objRequest.NPA = lGetLerg6ByNpaNxxRequest.NPA
            objRequest.NXX = lGetLerg6ByNpaNxxRequest.NXX


            '################################################
            'Make the web service call and get the response
            '################################################
            'Configure settings for Telephony WebService
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsTelephony = New WS_Telephony.LergServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_TELEPHONYWEBSERVICE_URL))
            Me.wsTelephony.Url = uri.AbsoluteUri
            wsTelephony.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_TELEPHONYWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_TELEPHONYWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_TELEPHONYWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsTelephony.Credentials = Me.Credentials
            End If

            objTempResponse = Me.wsTelephony.GetLerg6ByNpaNxx(objRequest)



            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WS_Telephony.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If



            If Not (objTempResponse Is Nothing) Then
                '###########################################################
                'translate the response into BL Object and send back to BL.
                '###########################################################
                If Not (objTempResponse.LergItems Is Nothing) Then
                    Dim lLergItems() As LergItem = New LergItem() {}
                    ReDim lLergItems(objTempResponse.LergItems.GetUpperBound(0))

                    For i As Integer = 0 To objTempResponse.LergItems.GetUpperBound(0)
                        lLergItems(i) = New LergItem
                        lLergItems(i).AOCN = objTempResponse.LergItems(i).AOCN
                        lLergItems(i).BLK_POOL = objTempResponse.LergItems(i).BLK_POOL
                        lLergItems(i).Block_ID = objTempResponse.LergItems(i).Block_ID
                        lLergItems(i).COC_Type = objTempResponse.LergItems(i).COC_Type
                        lLergItems(i).Creation_Date = objTempResponse.LergItems(i).Creation_Date
                        lLergItems(i).Date = objTempResponse.LergItems(i).Date
                        lLergItems(i).DIND = objTempResponse.LergItems(i).DIND
                        lLergItems(i).E_Status_Date = objTempResponse.LergItems(i).E_Status_Date
                        lLergItems(i).Eff_Date = objTempResponse.LergItems(i).Eff_Date
                        lLergItems(i).Last_Mod = objTempResponse.LergItems(i).Last_Mod
                        lLergItems(i).Lata = objTempResponse.LergItems(i).Lata
                        lLergItems(i).Lata_Name = objTempResponse.LergItems(i).Lata_Name
                        lLergItems(i).Lerg6_ID = objTempResponse.LergItems(i).Lerg6_ID
                        lLergItems(i).LINE_FR = objTempResponse.LergItems(i).LINE_FR
                        lLergItems(i).LINE_TOSpecified = objTempResponse.LergItems(i).LINE_FRSpecified
                        lLergItems(i).LINE_TO = objTempResponse.LergItems(i).LINE_TO
                        lLergItems(i).LINE_TOSpecified = objTempResponse.LergItems(i).LINE_TOSpecified
                        lLergItems(i).LOC_COUNTY = objTempResponse.LergItems(i).LOC_COUNTY
                        lLergItems(i).LOC_NAME = objTempResponse.LergItems(i).LOC_NAME
                        lLergItems(i).LOC_STATE = objTempResponse.LergItems(i).LOC_STATE
                        lLergItems(i).NPA = objTempResponse.LergItems(i).NPA
                        lLergItems(i).NXX = objTempResponse.LergItems(i).NXX
                        lLergItems(i).OCN = objTempResponse.LergItems(i).OCN
                        lLergItems(i).Portable = objTempResponse.LergItems(i).Portable
                        lLergItems(i).RC_ABBRE = objTempResponse.LergItems(i).RC_ABBRE
                        lLergItems(i).RC_LATA = objTempResponse.LergItems(i).RC_LATA
                        lLergItems(i).RC_TYPE = objTempResponse.LergItems(i).RC_TYPE
                        lLergItems(i).SHA_INDICATOR = objTempResponse.LergItems(i).SHA_INDICATOR
                        lLergItems(i).SSC = objTempResponse.LergItems(i).SSC
                        lLergItems(i).Status = objTempResponse.LergItems(i).Status
                        lLergItems(i).Switch = objTempResponse.LergItems(i).Switch
                        lLergItems(i).TD_AT = objTempResponse.LergItems(i).TD_AT
                        lLergItems(i).TD_EO = objTempResponse.LergItems(i).TD_EO
                        lLergItems(i).Test_Line_Exp_Date = objTempResponse.LergItems(i).Test_Line_Exp_Date
                        lLergItems(i).Test_Line_Exp_DateSpecified = objTempResponse.LergItems(i).Test_Line_Exp_DateSpecified
                        lLergItems(i).Test_Line_Num = objTempResponse.LergItems(i).Test_Line_Num
                        lLergItems(i).Test_Line_Response = objTempResponse.LergItems(i).Test_Line_Response
                    Next
                    objResponse.LergItems = lLergItems
                End If



                If Not (objTempResponse.Result Is Nothing) Then
                    Dim lResult As New Result
                    lResult.DateTime = objTempResponse.Result.DateTime
                    lResult.Description = objTempResponse.Result.Description

                    If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                        Dim lExcepInfo As New ResultExceptionInfo
                        lExcepInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                        lExcepInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                        lExcepInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                        lExcepInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                        lResult.ExceptionInfo = lExcepInfo
                    End If

                    lResult.ReferenceCode = objTempResponse.Result.ReferenceCode
                    lResult.ReturnCode = objTempResponse.Result.ReturnCode
                    lResult.Server = objTempResponse.Result.Server
                    lResult.Source = objTempResponse.Result.Source

                    If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                        For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                            objResponse.Result.StatusMessages(i) = New CsgStatusMessage
                            objResponse.Result.StatusMessages(i).Code = objTempResponse.Result.StatusMessages(i).Code
                            objResponse.Result.StatusMessages(i).Message = objTempResponse.Result.StatusMessages(i).Message
                        Next
                    End If

                    lResult.Type = objTempResponse.Result.Type

                    objResponse.Result = lResult
                End If ' end objResponse.result test

            End If ' end objResponse test


            Return objResponse
        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function




    Public Overrides Function GetCustomerOrderCriteria(ByVal obj As CharterDotCom.CommonEntities.Library.IProviderParameters) As CharterDotCom.CommonEntities.Library.IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetCustomerOrderCriteriaRequest
        Dim objRequest As New WS_CustomerOrderCriteria.GetCustomerOrderCriteriaRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '####################################### 
        Dim objTempResponse As New WS_CustomerOrderCriteria.GetCustomerOrderCriteriaResponse
        Dim objResponse As New GetCustomerOrderCriteriaResponse



        Try
            objTempRequest = CType(obj, GetCustomerOrderCriteriaRequest)



            '############################################
            'BUILD THE REQUEST OBJECT FOR THE WEB SERVICE
            '############################################
            objRequest.Criteria = New WS_CustomerOrderCriteria.CustomerOrderCriteria
            If Not (objTempRequest Is Nothing) Then
                objRequest.Criteria.Item = New Object

                Select Case objTempRequest.Criteria.RequestType
                    Case CustomerOrderCriteriaRequestTYpe.RequestHouse
                        Dim lRequestItem As New CustomerOrderCriteriaHouse
                        lRequestItem = CType(objTempRequest.Criteria.Item, CustomerOrderCriteriaHouse)

                        If Not (lRequestItem Is Nothing) Then
                            Dim loutRequestItem As New WS_CustomerOrderCriteria.CustomerOrderCriteriaHouse
                            loutRequestItem.AccountID = lRequestItem.AccountID
                            loutRequestItem.EntityID = lRequestItem.EntityID
                            loutRequestItem.HouseRef = lRequestItem.HouseRef

                            Select Case lRequestItem.OccupantStatus
                                Case CustomerOrderCriteriaHouseOccupantStatus.All
                                    loutRequestItem.OccupantStatus = WS_CustomerOrderCriteria.CustomerOrderCriteriaHouseOccupantStatus.All
                                Case CustomerOrderCriteriaHouseOccupantStatus.Current
                                    loutRequestItem.OccupantStatus = WS_CustomerOrderCriteria.CustomerOrderCriteriaHouseOccupantStatus.Current
                                Case CustomerOrderCriteriaHouseOccupantStatus.Previous
                                    loutRequestItem.OccupantStatus = WS_CustomerOrderCriteria.CustomerOrderCriteriaHouseOccupantStatus.Previous
                            End Select
                            objRequest.Criteria.Item = loutRequestItem
                        End If
                    Case CustomerOrderCriteriaRequestTYpe.RequestNameAndPhone
                        Dim lRequestItem As New CustomerOrderCriteriaNameAndPhone
                        lRequestItem = CType(objTempRequest.Criteria.Item, CustomerOrderCriteriaNameAndPhone)

                        If Not (lRequestItem Is Nothing) Then
                            Dim loutRequestItem As New WS_CustomerOrderCriteria.CustomerOrderCriteriaNameAndPhone
                            loutRequestItem.FirstName = lRequestItem.FirstName
                            loutRequestItem.LastName = lRequestItem.LastName
                            loutRequestItem.PhoneNumber = lRequestItem.PhoneNumber
                            objRequest.Criteria.Item = loutRequestItem
                        End If
                End Select
            End If




            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            'Configure settings for customer order criteria WebService
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsCustomerOrderCriteria = New WS_CustomerOrderCriteria.CustomerOrderServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERORDERCRITERIAWEBSERVICE_URL))
            Me.wsCustomerOrderCriteria.Url = uri.AbsoluteUri
            wsCustomerOrderCriteria.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_ICOMSACCOUNTWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                wsCustomerOrderCriteria.UseDefaultCredentials = False
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERORDERCRITERIAWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERORDERCRITERIAWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsCustomerOrderCriteria.Credentials = Me.Credentials
            End If

            objTempResponse = Me.wsCustomerOrderCriteria.GetCustomerOrderCriteria(objRequest)




            ''#########################################################################################
            ''translate back to a common object in the gateway, visible from Provider and the BL both.
            ''#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            'If Not (objTempResponse.Result.ReturnCode = WS_CustomerOrderCriteria.ResultReturnCode.Success) Then
            '    Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            'End If


            If Not (objTempResponse Is Nothing) Then
                If Not (objTempResponse.House Is Nothing) Then
                    objResponse.House = New GetCustomerOrderCriteriaResponseHouse() {}
                    ReDim objResponse.House(objTempResponse.House.GetUpperBound(0))
                    For a As Integer = 0 To objTempResponse.House.GetUpperBound(0)
                        objResponse.House(a) = New GetCustomerOrderCriteriaResponseHouse
                        objResponse.House(a).AddressLine1 = objTempResponse.House(a).AddressLine1
                        objResponse.House(a).AddressLine2 = objTempResponse.House(a).AddressLine2
                        objResponse.House(a).Agent = objTempResponse.House(a).Agent
                        objResponse.House(a).BillingSystem = objTempResponse.House(a).BillingSystem
                        objResponse.House(a).City = objTempResponse.House(a).City
                        objResponse.House(a).Company = objTempResponse.House(a).Company
                        objResponse.House(a).Division = objTempResponse.House(a).Division

                        'OBJ
                        'objResponse.House(a).EntityID = objTempResponse.House(a).EntityID



                        objResponse.House(a).HouseRef = objTempResponse.House(a).HouseRef

                        If Not (objTempResponse.House(a).LOB Is Nothing) Then
                            objResponse.House(a).LOB = New GetCustomerOrderCriteriaResponseHouseLOB() {}
                            ReDim objResponse.House(a).LOB(objTempResponse.House(a).LOB.GetUpperBound(0))
                            For b As Integer = 0 To objTempResponse.House(a).LOB.GetUpperBound(0)
                                objResponse.House(a).LOB(b) = New GetCustomerOrderCriteriaResponseHouseLOB
                                objResponse.House(a).LOB(b).Code = objTempResponse.House(a).LOB(b).Code
                                objResponse.House(a).LOB(b).Code = objTempResponse.House(a).LOB(b).Description
                                objResponse.House(a).LOB(b).Code = objTempResponse.House(a).LOB(b).Status
                            Next
                        End If


                        objResponse.House(a).Principle = objTempResponse.House(a).Principle

                        If Not (objTempResponse.House(a).Resident Is Nothing) Then
                            objResponse.House(a).Resident = New GetCustomerOrderCriteriaResponseHouseResident() {}
                            ReDim objResponse.House(a).Resident(objTempResponse.House(a).Resident.GetUpperBound(0))
                            For c As Integer = 0 To objTempResponse.House(a).Resident.GetUpperBound(0)
                                objResponse.House(a).Resident(c) = New GetCustomerOrderCriteriaResponseHouseResident
                                objResponse.House(a).Resident(c).AccountID = objTempResponse.House(a).Resident(c).AccountID

                                If Not (objTempResponse.House(a).Resident(c).AccountsRecievable Is Nothing) Then
                                    objResponse.House(a).Resident(c).AccountsRecievable = New GetCustomerOrderCriteriaResponseHouseResidentAccountsRecievable() {}
                                    ReDim objResponse.House(a).Resident(c).AccountsRecievable(objTempResponse.House(a).Resident(c).AccountsRecievable.GetUpperBound(0))
                                    For d As Integer = 0 To objTempResponse.House(a).Resident(c).AccountsRecievable.GetUpperBound(0)
                                        objResponse.House(a).Resident(c).AccountsRecievable(d) = New GetCustomerOrderCriteriaResponseHouseResidentAccountsRecievable
                                        objResponse.House(a).Resident(c).AccountsRecievable(d).CurrentBalance = objTempResponse.House(a).Resident(c).AccountsRecievable(d).CurrentBalance

                                        If Not (objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency Is Nothing) Then
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency = New GetCustomerOrderCriteriaResponseHouseResidentAccountsRecievableDelinquency
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.Amount = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.Amount
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.NinetyDays = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.NinetyDays
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.NinetyDaysSpecified = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.NinetyDaysSpecified
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredFiftyDays = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredFiftyDays
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredFiftyDaysSpecified = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredFiftyDaysSpecified
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredTwentyDays = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredTwentyDays
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredTwentyDaysSpecified = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.OneHundredTwentyDaysSpecified
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.SixtyDays = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.SixtyDays
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.SixtyDaysSpecified = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.SixtyDaysSpecified
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.StartDate = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.StartDate
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.Status = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.Status
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.ThirtyDays = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.ThirtyDays
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.ThirtyDaysSpecified = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.ThirtyDaysSpecified
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.WriteOffBalance = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.WriteOffBalance
                                            objResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.WriteOffBalanceSpecified = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Delinquency.WriteOffBalanceSpecified
                                        End If

                                        objResponse.House(a).Resident(c).AccountsRecievable(d).Statement = objTempResponse.House(a).Resident(c).AccountsRecievable(d).Statement
                                    Next
                                End If

                                objResponse.House(a).Resident(c).CurrentResident = objTempResponse.House(a).Resident(c).CurrentResident
                                objResponse.House(a).Resident(c).CustomerID = objTempResponse.House(a).Resident(c).CustomerID
                                objResponse.House(a).Resident(c).FirstName = objTempResponse.House(a).Resident(c).FirstName
                                objResponse.House(a).Resident(c).LastName = objTempResponse.House(a).Resident(c).LastName

                                If Not (objTempResponse.House(a).Resident(c).Order Is Nothing) Then
                                    objResponse.House(a).Resident(c).Order = New GetCustomerOrderCriteriaResponseHouseResidentOrder() {}
                                    ReDim objResponse.House(a).Resident(c).Order(objTempResponse.House(a).Resident(c).Order.GetUpperBound(0))
                                    For e As Integer = 0 To objTempResponse.House(a).Resident(c).Order.GetUpperBound(0)
                                        objResponse.House(a).Resident(c).Order(e) = New GetCustomerOrderCriteriaResponseHouseResidentOrder
                                        objResponse.House(a).Resident(c).Order(e).ID = objTempResponse.House(a).Resident(c).Order(e).ID
                                        objResponse.House(a).Resident(c).Order(e).Status = objTempResponse.House(a).Resident(c).Order(e).Status
                                        objResponse.House(a).Resident(c).Order(e).Type = objTempResponse.House(a).Resident(c).Order(e).Type
                                        objResponse.House(a).Resident(c).Order(e).TypeDescription = objTempResponse.House(a).Resident(c).Order(e).TypeDescription
                                    Next
                                End If

                                objResponse.House(a).Resident(c).PhoneNumber = objTempResponse.House(a).Resident(c).PhoneNumber
                                objResponse.House(a).Resident(c).SSN = objTempResponse.House(a).Resident(c).SSN
                                objResponse.House(a).Resident(c).SubStatus = objTempResponse.House(a).Resident(c).SubStatus
                                objResponse.House(a).Resident(c).TypeCode = objTempResponse.House(a).Resident(c).TypeCode
                            Next
                        End If

                        objResponse.House(a).Site = objTempResponse.House(a).Site
                        objResponse.House(a).State = objTempResponse.House(a).State
                        objResponse.House(a).System = objTempResponse.House(a).System
                        objResponse.House(a).Zip = objTempResponse.House(a).Zip
                        objResponse.House(a).Zip4 = objTempResponse.House(a).Zip4
                    Next
                End If

                If Not (objTempResponse.Result Is Nothing) Then
                    objResponse.Result = GetCustomerOrderCriteriaResultObj(objTempResponse)
                End If
            End If

            Return objResponse


        Catch ex As Exception
            If (objResponse Is Nothing) Then
                objResponse = New GetCustomerOrderCriteriaResponse
            End If
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function

    Public Overrides Function GetTransferedAccounts(ByVal obj As IProviderParameters) As IProviderResults
        '###########################################################################
        'ADDITIONAL METHOD MARCH 18TH, 2010     ROD COPELAND    ISSUE ID 8241
        '###########################################################################

        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetDataRequest
        Dim objRequest As New WS_DataService.GetDataRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WS_DataService.GetDataResponse
        Dim objResponse As New GetDataResponse


        Try
            objTempRequest = CType(obj, GetDataRequest)



            '##########################################
            'Configure settings for  WebService
            '##########################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsDataService = New WS_DataService.DataServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_URL))
            Me.wsDataService.Url = uri.AbsoluteUri
            wsDataService.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                wsDataService.UseDefaultCredentials = False
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_LOCATIONWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsDataService.Credentials = Me.Credentials
            End If




            objRequest.DatabaseInfo = New WS_DataService.DatabaseInformation
            Dim aryParms(2) As WS_DataService.DBParameter
            objRequest.DBParameters = aryParms

            objRequest.ExecutionType = "Query"
            objRequest.ProcedureName = "uspGetCSGTransferedAccounts"
            objRequest.DatabaseInfo.DataProvider = "SqlServer"
            objRequest.DatabaseInfo.ConnectionID = context.Application("GetCSGTransferedAccountsConnectionID")


            Dim parm As WS_DataService.DBParameter
            parm = New WS_DataService.DBParameter
            parm.DBName = "@CUSTOMERID"
            parm.DBDataType = "VarChar"
            parm.DBValue = objTempRequest.CustomerId

            objRequest.DBParameters(0) = parm





            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            objTempResponse = Me.wsDataService.GetData(objRequest)





            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WS_Location.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If




            Dim ds As New DataSet
            Dim tr As IO.TextReader

            tr = New IO.StringReader(objTempResponse.Data)
            ds.ReadXml(tr)




            For Each table As DataTable In ds.Tables

                If table IsNot Nothing AndAlso _
                table.Rows IsNot Nothing AndAlso _
                table.Rows.Count > 0 Then

                    ReDim objResponse.TransferedAccounts(table.Rows.Count - 1)
                    For i As Integer = 0 To table.Rows.Count - 1
                        If table.Columns.Count > 0 AndAlso table.Columns.Contains("ACCOUNTID") Then
                            objResponse.TransferedAccounts(i) = table.Rows(i)("ACCOUNTID")
                        End If
                    Next

                End If
            Next




            Return objResponse




        Catch ex As Exception
            If (objResponse Is Nothing) Then
                objResponse = New GetDataResponse
            End If
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function


    Public Overrides Function FindCSGAccountNumber(ByVal obj As IProviderParameters) As IProviderResults
'###########################################################################
'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.
'###########################################################################

        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetDataRequest
        Dim objRequest As New WS_DataService.GetDataRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WS_DataService.GetDataResponse
        Dim objResponse As New GetDataResponse


        Try
            objTempRequest = CType(obj, GetDataRequest)



            '##########################################
            'Configure settings for  WebService
            '##########################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsDataService = New WS_DataService.DataServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_URL))
            Me.wsDataService.Url = uri.AbsoluteUri
            wsDataService.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                wsDataService.UseDefaultCredentials = False
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_LOCATIONWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsDataService.Credentials = Me.Credentials
            End If






            objRequest.DatabaseInfo = New WS_DataService.DatabaseInformation
            Dim aryParms(2) As WS_DataService.DBParameter
            objRequest.DBParameters = aryParms

            objRequest.ExecutionType = "Query"
            objRequest.ProcedureName = "chtr.sp_get_acct_xref"
            objRequest.DatabaseInfo.DataProvider = "Oracle"
            objRequest.DatabaseInfo.ConnectionID = "1BE4447A802141C29B87C4FA69AEF4"

            Dim parm As WS_DataService.DBParameter



            '##############################################################################
            'N O T A B L E  ALTHOUGH THIS CALL IS GOING THROUGH EAI AND THEY NORMALLY TREAT 
            'ICOMS ACCOUNT NUMBERS LIKE .Substring(3, 9).  THIS CALL ON THE OTHER SIDE OF 
            'EAI IS REALLY GOING TO AN OSS DATABASE SO WE NEED TO PASS IN THE FULL 16 DIGITS 
            'FOR NORMAL OSS INTERACTIONS.
            '##############################################################################
            parm = New WS_DataService.DBParameter
            parm.DBName = "in_account_number"
            parm.DBDataType = "VarChar"
            parm.DBSize = 30
            parm.DBValue = objTempRequest.AccountNumberICOMS
            parm.DBDirection = "Input"
            objRequest.DBParameters(0) = parm

            parm = New WS_DataService.DBParameter
            parm.DBName = "io_account_xfer_cur"
            parm.DBDataType = "Cursor"
            parm.DBDirection = "Output"
            objRequest.DBParameters(1) = parm

            parm = New WS_DataService.DBParameter
            parm.DBName = "io_error"
            parm.DBDataType = "VarChar"
            parm.DBDirection = "Output"
            parm.DBSize = 2000
            objRequest.DBParameters(2) = parm






            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            objTempResponse = Me.wsDataService.GetData(objRequest)





            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WS_Location.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If




            Dim ds As New DataSet
            Dim tr As IO.TextReader
        
            tr = New IO.StringReader(objTempResponse.Data)
            ds.ReadXml(tr)




            For Each table As DataTable In ds.Tables
                If table.Rows.Count > 0 Then
                    ReDim objResponse.ConvertedAccounts(table.Rows.Count - 1)
                    For i As Integer = 0 To table.Rows.Count - 1
                        objResponse.ConvertedAccounts(i) = New ConvertedBillingAccount

                        If table.Columns.Contains("NEW_ACCOUNT") Then
                            objResponse.ConvertedAccounts(i).AccountID = table.Rows(i)("NEW_ACCOUNT")
                        End If

                        If table.Columns.Contains("CTI") Then
                            objResponse.ConvertedAccounts(i).LinesOfBusiness = table.Rows(i)("CTI")
                        End If
                    Next
                End If
            Next




            Return objResponse




        Catch ex As Exception
            If (objResponse Is Nothing) Then
                objResponse = New GetDataResponse
            End If
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function


    Public Overrides Function FindICOMSAccountNumberFromCSGAccountNumber(ByVal obj As IProviderParameters) As IProviderResults
        '###########################################################################
        'PROJECT BIG SKY, OCT 2009     ROD COPELAND    ISSUE ID 7334      
        '###########################################################################
        'CONVERT THE CSG ACCOUNT NUMBER FROM ICOMS.
        '###########################################################################

        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetDataRequest
        Dim objRequest As New WS_DataService.GetDataRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WS_DataService.GetDataResponse
        Dim objResponse As New GetDataResponseCSGToICOMSConversion


        Try
            objTempRequest = CType(obj, GetDataRequest)



            '##########################################
            'Configure settings for  WebService
            '##########################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            wsDataService = New WS_DataService.DataServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_URL))
            Me.wsDataService.Url = uri.AbsoluteUri
            wsDataService.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                wsDataService.UseDefaultCredentials = False
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_LOCATIONWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_DATASERVICEWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsDataService.Credentials = Me.Credentials
            End If






            objRequest.DatabaseInfo = New WS_DataService.DatabaseInformation
            Dim aryParms(2) As WS_DataService.DBParameter
            objRequest.DBParameters = aryParms

            objRequest.ExecutionType = "Query"
            objRequest.ProcedureName = "uspGetICOMSAccountFromCsgAccount"
            objRequest.DatabaseInfo.DataProvider = "SQLServer"
            objRequest.DatabaseInfo.ConnectionID = "54C0DC28-0DA2-459A-BB81-33F758"

            Dim parm As WS_DataService.DBParameter



            '##############################################################################
            'N O T A B L E  ALTHOUGH THIS CALL IS GOING THROUGH EAI AND THEY NORMALLY TREAT 
            'ICOMS ACCOUNT NUMBERS LIKE .Substring(3, 9).  THIS CALL ON THE OTHER SIDE OF 
            'EAI IS REALLY GOING TO AN OSS DATABASE SO WE NEED TO PASS IN THE FULL 16 DIGITS 
            'FOR NORMAL OSS INTERACTIONS.
            '##############################################################################
            parm = New WS_DataService.DBParameter
            parm.DBName = "CSGACCOUNTNUMBER"
            parm.DBDataType = "VarChar"
            parm.DBSize = 25
            parm.DBValue = objTempRequest.AccountNumberCSG
            parm.DBDirection = "Input"
            objRequest.DBParameters(0) = parm





            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            objTempResponse = Me.wsDataService.GetData(objRequest)





            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WS_Location.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If




            Dim ds As New DataSet
            Dim tr As IO.TextReader

            tr = New IO.StringReader(objTempResponse.Data)
            ds.ReadXml(tr)




            For Each table As DataTable In ds.Tables
                If table.Rows.Count > 0 Then
                    If table.Columns.Contains("ICOMS_ACCOUNT") Then
                        objResponse.PreConversionICOMSAccountNumber = table.Rows(0)("ICOMS_ACCOUNT")
                    End If
                End If
            Next




            Return objResponse




        Catch ex As Exception
            If (objResponse Is Nothing) Then
                objResponse = New GetDataResponseCSGToICOMSConversion
            End If
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function


    Private Function BuildIcomsHeaderInfoAccount(ByVal lIcomsHeaderInfo As IcomsHeaderInfo) As WSICOMS_CustomerAccount.IcomsHeaderInfo
        Dim objIcomsHeaderInfo As New WSICOMS_CustomerAccount.IcomsHeaderInfo
        Try
            'objIcomsHeaderInfo.SiteId = CType(lIcomsHeaderInfo.SiteId, WSICOMS_CustomerAccount.SiteId)
            Select Case lIcomsHeaderInfo.SiteId
                Case SiteId.Site100
                    objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site100
                Case SiteId.Site200
                    objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site200
                Case SiteId.Site300
                    objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site300
                Case SiteId.Site400
                    objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site400
                Case SiteId.Site500
                    objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site500
                Case SiteId.Site600
                    objIcomsHeaderInfo.SiteId = WSICOMS_CustomerAccount.SiteId.Site600
            End Select
            Return objIcomsHeaderInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildEFTPayment(ByVal lEFTPayment() As EFTPayment) As WSICOMS_CustomerAccount.EFTPayment()
        Dim objEFTPayment() As WSICOMS_CustomerAccount.EFTPayment
        Try
            objEFTPayment = New WSICOMS_CustomerAccount.EFTPayment(lEFTPayment.GetUpperBound(0)) {}
            For i As Integer = 0 To lEFTPayment.GetUpperBound(0)
                objEFTPayment(i) = New WSICOMS_CustomerAccount.EFTPayment()
                objEFTPayment(i).AccountId = lEFTPayment(i).AccountID
                objEFTPayment(i).StatementCode = lEFTPayment(i).StatementCode
                objEFTPayment(i).BankAccountNo = lEFTPayment(i).BankAccountNo
                objEFTPayment(i).BankAccountRoutingNo = lEFTPayment(i).BankAccountRoutingNo
                objEFTPayment(i).BankAccountName = lEFTPayment(i).BankAccountName
                objEFTPayment(i).Amount = lEFTPayment(i).Amount

                'objEFTPayment(i).BankAccountType = CType(lEFTPayment(i).BankAccountType, WSICOMS_CustomerAccount.BankAccountType)
                Select Case lEFTPayment(i).BankAccountType
                    Case BankAccountType.Checking
                        objEFTPayment(i).BankAccountType = WSICOMS_CustomerAccount.BankAccountType.Checking
                    Case BankAccountType.Savings
                        objEFTPayment(i).BankAccountType = WSICOMS_CustomerAccount.BankAccountType.Savings
                End Select



            Next
            Return objEFTPayment
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildResult(ByVal lResult As WSICOMS_CustomerAccount.Result) As Result
        Dim objResult As New Result
        Try
            If (Not lResult.ExceptionInfo Is Nothing) Then
                objResult.ExceptionInfo = BuildResultExceptionInfo(lResult.ExceptionInfo)
            End If
            If Not lResult.StatusMessages Is Nothing Then
                objResult.StatusMessages = BuildCsgStatusMessage(lResult.StatusMessages)
            End If
            objResult.ReferenceCode = lResult.ReferenceCode
            objResult.Description = lResult.Description
            objResult.DateTime = lResult.DateTime
            objResult.Source = lResult.Source
            objResult.Server = lResult.Server
            'objResult.Type = CType(lResult.Type, ResultType)
            Select Case lResult.Type
                Case WSICOMS_CustomerAccount.ResultType.Error
                    objResult.Type = ResultType.Error
                Case WSICOMS_CustomerAccount.ResultType.Informational
                    objResult.Type = ResultType.Informational
            End Select

            'objResult.ReturnCode = CType(lResult.ReturnCode, ResultReturnCode)
            Select Case lResult.ReturnCode
                Case WSICOMS_CustomerAccount.ResultReturnCode.BusinessRuleNotMet
                    objResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                Case WSICOMS_CustomerAccount.ResultReturnCode.DatabaseError
                    objResult.ReturnCode = ResultReturnCode.DatabaseError
                Case WSICOMS_CustomerAccount.ResultReturnCode.Exception
                    objResult.ReturnCode = ResultReturnCode.Exception
                Case WSICOMS_CustomerAccount.ResultReturnCode.InvalidXml
                    objResult.ReturnCode = ResultReturnCode.InvalidXml
                Case WSICOMS_CustomerAccount.ResultReturnCode.NoDataFound
                    objResult.ReturnCode = ResultReturnCode.NoDataFound
                Case WSICOMS_CustomerAccount.ResultReturnCode.Success
                    objResult.ReturnCode = ResultReturnCode.Success
            End Select
            Return objResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildResult(ByVal lResult As WSCSG_Payment.Result) As Result
        Dim objResult As New Result
        Try
            If (Not lResult.ExceptionInfo Is Nothing) Then
                objResult.ExceptionInfo = BuildResultExceptionInfo(lResult.ExceptionInfo)
            End If
            If Not lResult.StatusMessages Is Nothing Then
                objResult.StatusMessages = BuildCsgStatusMessage(lResult.StatusMessages)
            End If
            objResult.ReferenceCode = lResult.ReferenceCode
            objResult.Description = lResult.Description
            objResult.DateTime = lResult.DateTime
            objResult.Source = lResult.Source
            objResult.Server = lResult.Server

            'objResult.Type = CType(lResult.Type, ResultType)
            Select Case lResult.Type
                Case WSICOMS_CustomerAccount.ResultType.Error
                    objResult.Type = ResultType.Error
                Case WSICOMS_CustomerAccount.ResultType.Informational
                    objResult.Type = ResultType.Informational
            End Select

            'objResult.ReturnCode = CType(lResult.ReturnCode, ResultReturnCode)
            Select Case lResult.ReturnCode
                Case WSICOMS_CustomerAccount.ResultReturnCode.BusinessRuleNotMet
                    objResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                Case WSICOMS_CustomerAccount.ResultReturnCode.DatabaseError
                    objResult.ReturnCode = ResultReturnCode.DatabaseError
                Case WSICOMS_CustomerAccount.ResultReturnCode.Exception
                    objResult.ReturnCode = ResultReturnCode.Exception
                Case WSICOMS_CustomerAccount.ResultReturnCode.InvalidXml
                    objResult.ReturnCode = ResultReturnCode.InvalidXml
                Case WSICOMS_CustomerAccount.ResultReturnCode.NoDataFound
                    objResult.ReturnCode = ResultReturnCode.NoDataFound
                Case WSICOMS_CustomerAccount.ResultReturnCode.Success
                    objResult.ReturnCode = ResultReturnCode.Success
            End Select



            Return objResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildResultExceptionInfo(ByVal lResultExceptionInfo As WSICOMS_CustomerAccount.ResultExceptionInfo) As ResultExceptionInfo
        Dim objResultExceptionInfo As New ResultExceptionInfo
        Try
            objResultExceptionInfo.Type = lResultExceptionInfo.Type
            objResultExceptionInfo.Message = lResultExceptionInfo.Message
            objResultExceptionInfo.StackTrace = lResultExceptionInfo.StackTrace
            objResultExceptionInfo.Code = lResultExceptionInfo.Code
            Return objResultExceptionInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildResultExceptionInfo(ByVal lResultExceptionInfo As WSCSG_Payment.ResultExceptionInfo) As ResultExceptionInfo
        Dim objResultExceptionInfo As New ResultExceptionInfo
        Try
            objResultExceptionInfo.Type = lResultExceptionInfo.Type
            objResultExceptionInfo.Message = lResultExceptionInfo.Message
            objResultExceptionInfo.StackTrace = lResultExceptionInfo.StackTrace
            objResultExceptionInfo.Code = lResultExceptionInfo.Code
            Return objResultExceptionInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildExceptionInfo(ByVal lExceptionInfo As WSICOMS_CustomerAccount.ExceptionInfo) As ExceptionInfo
        Dim objResultExceptionInfo As New ExceptionInfo
        Try
            objResultExceptionInfo.Type = lExceptionInfo.Type
            objResultExceptionInfo.Message = lExceptionInfo.Message
            objResultExceptionInfo.StackTrace = lExceptionInfo.StackTrace
            objResultExceptionInfo.Code = lExceptionInfo.Code
            Return objResultExceptionInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildExceptionInfo(ByVal lExceptionInfo As WSCSG_Payment.ResultExceptionInfo) As ExceptionInfo
        Dim objResultExceptionInfo As New ExceptionInfo
        Try
            objResultExceptionInfo.Type = lExceptionInfo.Type
            objResultExceptionInfo.Message = lExceptionInfo.Message
            objResultExceptionInfo.StackTrace = lExceptionInfo.StackTrace
            objResultExceptionInfo.Code = lExceptionInfo.Code
            Return objResultExceptionInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCsgStatusMessage(ByVal lCsgStatusMessage() As WSICOMS_CustomerAccount.CsgStatusMessage) As CsgStatusMessage()
        Dim objCsgStatusMessage() As CsgStatusMessage
        Try
            objCsgStatusMessage = New CsgStatusMessage(lCsgStatusMessage.GetUpperBound(0)) {}
            For i As Integer = 0 To lCsgStatusMessage.GetUpperBound(0)
                objCsgStatusMessage(i) = New CsgStatusMessage()
                objCsgStatusMessage(i).Code = lCsgStatusMessage(i).Code
                objCsgStatusMessage(i).Message = lCsgStatusMessage(i).Message
            Next
            Return objCsgStatusMessage
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCsgStatusMessage(ByVal lCsgStatusMessage() As WSCSG_Payment.CsgStatusMessage) As CsgStatusMessage()
        Dim objCsgStatusMessage() As CsgStatusMessage
        Try
            objCsgStatusMessage = New CsgStatusMessage(lCsgStatusMessage.GetUpperBound(0)) {}
            For i As Integer = 0 To lCsgStatusMessage.GetUpperBound(0)
                objCsgStatusMessage(i) = New CsgStatusMessage()
                objCsgStatusMessage(i).Code = lCsgStatusMessage(i).Code
                objCsgStatusMessage(i).Message = lCsgStatusMessage(i).Message
            Next
            Return objCsgStatusMessage
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildEFTPaymentSingleResult(ByVal lEFTPaymentSingleResult() As WSICOMS_CustomerAccount.EFTPaymentSingleResult) As EFTPaymentSingleResult()
        Dim objEFTPaymentSingleResult() As EFTPaymentSingleResult
        Try
            objEFTPaymentSingleResult = New EFTPaymentSingleResult(lEFTPaymentSingleResult.GetUpperBound(0)) {}
            For i As Integer = 0 To lEFTPaymentSingleResult.GetUpperBound(0)
                objEFTPaymentSingleResult(i) = New EFTPaymentSingleResult()
                objEFTPaymentSingleResult(i).AccountID = lEFTPaymentSingleResult(i).AccountId
                objEFTPaymentSingleResult(i).StatementCode = lEFTPaymentSingleResult(i).StatementCode
                If Not lEFTPaymentSingleResult(i).Result Is Nothing Then
                    objEFTPaymentSingleResult(i).Result = BuildMultiCallResult(lEFTPaymentSingleResult(i).Result)
                End If
            Next
            Return objEFTPaymentSingleResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildMultiCallResult(ByVal lMultiCallResult As WSICOMS_CustomerAccount.MultiCallResult) As MultiCallResult
        Dim objMultiCallResult As New MultiCallResult
        Try
            If Not lMultiCallResult.ExceptionInfo Is Nothing Then
                objMultiCallResult.ExceptionInfo = BuildExceptionInfo(lMultiCallResult.ExceptionInfo)
            End If
            Return objMultiCallResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildMultiCallResult(ByVal lMultiCallResult As WSCSG_Payment.MultiCallResult) As MultiCallResult
        Dim objMultiCallResult As New MultiCallResult
        Try
            If Not lMultiCallResult.ExceptionInfo Is Nothing Then
                objMultiCallResult.ExceptionInfo = BuildExceptionInfo(lMultiCallResult.ExceptionInfo)
            End If
            Return objMultiCallResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPaymentSingleResult(ByVal lCardPayment() As WSICOMS_CustomerAccount.CardPaymentSingleResult) As CardPaymentSingleResult()
        Dim objCardPayment() As CardPaymentSingleResult
        Try
            objCardPayment = New CardPaymentSingleResult(lCardPayment.GetUpperBound(0)) {}
            For i As Integer = 0 To lCardPayment.GetUpperBound(0)
                objCardPayment(i) = New CardPaymentSingleResult()
                objCardPayment(i).AccountID = lCardPayment(i).AccountId
                objCardPayment(i).StatementCode = lCardPayment(i).StatementCode
                objCardPayment(i).Result = BuildMultiCallResult(lCardPayment(i).Result)
                objCardPayment(i).AuthTransactionID = lCardPayment(i).AuthTransactionID
                objCardPayment(i).AuthCode = lCardPayment(i).AuthCode
                objCardPayment(i).AuthReason = lCardPayment(i).AuthReason
                objCardPayment(i).AuthMessage = lCardPayment(i).AuthMessage
                objCardPayment(i).AuthTime = lCardPayment(i).AuthTime
                objCardPayment(i).AuthDate = lCardPayment(i).AuthDate
            Next
            Return objCardPayment
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPayment(ByVal lCardPayment() As CardPayment) As WSICOMS_CustomerAccount.CardPayment()
        Dim objCardPayment() As WSICOMS_CustomerAccount.CardPayment
        Try
            objCardPayment = New WSICOMS_CustomerAccount.CardPayment(lCardPayment.GetUpperBound(0)) {}
            For i As Integer = 0 To lCardPayment.GetUpperBound(0)
                objCardPayment(i) = New WSICOMS_CustomerAccount.CardPayment()
                objCardPayment(i).AccountId = lCardPayment(i).AccountID
                objCardPayment(i).StatementCode = lCardPayment(i).StatementCode

                Select Case lCardPayment(i).CreditCardType
                    Case CreditCardType.Debit
                        objCardPayment(i).CreditCardType = WSICOMS_CustomerAccount.CreditCardType.Debit
                    Case CreditCardType.Discover
                        objCardPayment(i).CreditCardType = WSICOMS_CustomerAccount.CreditCardType.Discover
                    Case CreditCardType.Mastercard
                        objCardPayment(i).CreditCardType = WSICOMS_CustomerAccount.CreditCardType.Mastercard
                    Case CreditCardType.Visa
                        objCardPayment(i).CreditCardType = WSICOMS_CustomerAccount.CreditCardType.Visa
                End Select

                objCardPayment(i).CCNumber = lCardPayment(i).CCNumber
                objCardPayment(i).CCSecurityCode = lCardPayment(i).CCSecurityCode
                objCardPayment(i).CCName = lCardPayment(i).CCName
                objCardPayment(i).CCExpirationDate = lCardPayment(i).CCExpirationDate
                objCardPayment(i).Amount = lCardPayment(i).Amount
            Next
            Return objCardPayment
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCsgHeaderInfoPayment(ByVal lCsgHeaderInfo As CsgHeaderInfo) As WSCSG_Payment.CsgHeaderInfo
        Dim objCsgHeaderInfo As WSCSG_Payment.CsgHeaderInfo
        Try
            objCsgHeaderInfo = New WSCSG_Payment.CsgHeaderInfo()
            objCsgHeaderInfo.Region = lCsgHeaderInfo.Region
            objCsgHeaderInfo.RoutingArea = lCsgHeaderInfo.RoutingArea
            objCsgHeaderInfo.ConversationId = lCsgHeaderInfo.ConversationId
            Return objCsgHeaderInfo
        Catch ex As Exception

            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPaymentRequest(ByVal lPayment() As CardPaymentRequest) As WSCSG_Payment.CardPaymentRequest()
        Dim objCardPaymentRequest() As WSCSG_Payment.CardPaymentRequest
        Try
            objCardPaymentRequest = New WSCSG_Payment.CardPaymentRequest(lPayment.GetUpperBound(0)) {}
            For i As Integer = 0 To lPayment.GetUpperBound(0)
                objCardPaymentRequest(i) = New WSCSG_Payment.CardPaymentRequest()
                If Not lPayment(i).CsgHeaderInfo Is Nothing Then
                    objCardPaymentRequest(i).CsgHeaderInfo = BuildCsgHeaderInfoPayment(lPayment(i).CsgHeaderInfo)
                End If
                objCardPaymentRequest(i).AccountId = lPayment(i).AccountId
                objCardPaymentRequest(i).Batch = lPayment(i).Batch
                objCardPaymentRequest(i).PIN = lPayment(i).PIN
                objCardPaymentRequest(i).Source = lPayment(i).Source
                If Not lPayment(i).CreditCard Is Nothing Then
                    objCardPaymentRequest(i).CreditCard = BuildCardPaymentRequestCreditCard(lPayment(i).CreditCard)
                End If
            Next
            Return objCardPaymentRequest
        Catch ex As Exception

            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPaymentRequestCreditCard(ByVal lCardPaymentRequestCreditCard As CardPaymentRequestCreditCard) As WSCSG_Payment.CardPaymentRequestCreditCard
        Dim objCardPaymentRequestCreditCard As WSCSG_Payment.CardPaymentRequestCreditCard
        Try
            objCardPaymentRequestCreditCard = New WSCSG_Payment.CardPaymentRequestCreditCard

            Select Case lCardPaymentRequestCreditCard.Type
                Case CardPaymentRequestCreditCardType.AmericanExpress
                    objCardPaymentRequestCreditCard.Type = WSCSG_Payment.CardPaymentRequestCreditCardType.AmericanExpress
                Case CardPaymentRequestCreditCardType.Discover
                    objCardPaymentRequestCreditCard.Type = WSCSG_Payment.CardPaymentRequestCreditCardType.Discover
                Case CardPaymentRequestCreditCardType.Mastercard
                    objCardPaymentRequestCreditCard.Type = WSCSG_Payment.CardPaymentRequestCreditCardType.Mastercard
                Case CardPaymentRequestCreditCardType.Visa
                    objCardPaymentRequestCreditCard.Type = WSCSG_Payment.CardPaymentRequestCreditCardType.Visa
            End Select

            objCardPaymentRequestCreditCard.Number = lCardPaymentRequestCreditCard.Number
            objCardPaymentRequestCreditCard.SecurityCode = lCardPaymentRequestCreditCard.SecurityCode
            objCardPaymentRequestCreditCard.SecurityCodeOverride = lCardPaymentRequestCreditCard.SecurityCodeOverride
            objCardPaymentRequestCreditCard.ExpirationDate = lCardPaymentRequestCreditCard.ExpirationDate
            objCardPaymentRequestCreditCard.Amount = lCardPaymentRequestCreditCard.Amount
            Return objCardPaymentRequestCreditCard
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPaymentResponse(ByVal lCardPaymentResponse() As WSCSG_Payment.CardPaymentResponse) As CardPaymentResponse()
        Dim objCardPaymentResponse() As CardPaymentResponse
        Try
            objCardPaymentResponse = New CardPaymentResponse(lCardPaymentResponse.GetUpperBound(0)) {}
            For i As Integer = 0 To lCardPaymentResponse.GetUpperBound(0)
                objCardPaymentResponse(i) = New CardPaymentResponse()
                objCardPaymentResponse(i).AccountId = lCardPaymentResponse(i).AccountId
                If Not lCardPaymentResponse(i).Result Is Nothing Then
                    objCardPaymentResponse(i).Result = BuildMultiCallResult(lCardPaymentResponse(i).Result)
                End If
                If Not lCardPaymentResponse(i).Authorization Is Nothing Then
                    objCardPaymentResponse(i).Authorization = BuildCardPaymentResponseAuthorization(lCardPaymentResponse(i).Authorization)
                End If
            Next
            Return objCardPaymentResponse
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildEFTPaymentResponse(ByVal lEFTPaymentResponse() As WSCSG_Payment.EFTPaymentResponse) As EFTPaymentResponse()
        Dim objEFTPaymentResponse() As EFTPaymentResponse
        Try
            objEFTPaymentResponse = New EFTPaymentResponse(lEFTPaymentResponse.GetUpperBound(0)) {}
            For i As Integer = 0 To lEFTPaymentResponse.GetUpperBound(0)
                objEFTPaymentResponse(i) = New EFTPaymentResponse()
                objEFTPaymentResponse(i).AccountId = lEFTPaymentResponse(i).AccountId
                objEFTPaymentResponse(i).Batch = lEFTPaymentResponse(i).Batch
                objEFTPaymentResponse(i).BatchDetailNumber = lEFTPaymentResponse(i).BatchDetailNumber
                If Not lEFTPaymentResponse(i).Result Is Nothing Then
                    objEFTPaymentResponse(i).Result = BuildMultiCallResult(lEFTPaymentResponse(i).Result)
                End If
            Next
            Return objEFTPaymentResponse
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPaymentResponseAuthorization(ByVal lCardPaymentResponseAuthorization As WSCSG_Payment.CardPaymentResponseAuthorization) As CardPaymentResponseAuthorization
        Dim objCardPaymentResponseAuthorization As CardPaymentResponseAuthorization
        Try
            objCardPaymentResponseAuthorization = New CardPaymentResponseAuthorization()
            objCardPaymentResponseAuthorization.Response = lCardPaymentResponseAuthorization.Response
            objCardPaymentResponseAuthorization.Number = lCardPaymentResponseAuthorization.Number
            objCardPaymentResponseAuthorization.Amount = lCardPaymentResponseAuthorization.Amount
            objCardPaymentResponseAuthorization.RejectReason = lCardPaymentResponseAuthorization.RejectReason
            objCardPaymentResponseAuthorization.DebitCardIndicator = lCardPaymentResponseAuthorization.DebitCardIndicator
            If Not lCardPaymentResponseAuthorization.SecurityVerification Is Nothing Then
                objCardPaymentResponseAuthorization.SecurityVerification = BuildCardPaymentResponseAuthorizationSecurityVerification(lCardPaymentResponseAuthorization.SecurityVerification)
            End If
            If Not lCardPaymentResponseAuthorization.AddressVerification Is Nothing Then
                objCardPaymentResponseAuthorization.AddressVerification = BuildCardPaymentResponseAuthorizationAddressVerification(lCardPaymentResponseAuthorization.AddressVerification)
            End If
            Return objCardPaymentResponseAuthorization
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPaymentResponseAuthorizationSecurityVerification(ByVal lCardPaymentResponseAuthorizationSecurityVerification As WSCSG_Payment.CardPaymentResponseAuthorizationSecurityVerification) As CardPaymentResponseAuthorizationSecurityVerification
        Dim objCardPaymentResponseAuthorizationSecurityVerification As CardPaymentResponseAuthorizationSecurityVerification
        Try
            objCardPaymentResponseAuthorizationSecurityVerification = New CardPaymentResponseAuthorizationSecurityVerification()
            objCardPaymentResponseAuthorizationSecurityVerification.Code = lCardPaymentResponseAuthorizationSecurityVerification.Code
            objCardPaymentResponseAuthorizationSecurityVerification.Message = lCardPaymentResponseAuthorizationSecurityVerification.Message
            Return objCardPaymentResponseAuthorizationSecurityVerification
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCardPaymentResponseAuthorizationAddressVerification(ByVal lCardPaymentResponseAuthorizationAddressVerification As WSCSG_Payment.CardPaymentResponseAuthorizationAddressVerification) As CardPaymentResponseAuthorizationAddressVerification
        Dim objCardPaymentResponseAuthorizationAddressVerification As CardPaymentResponseAuthorizationAddressVerification
        Try
            objCardPaymentResponseAuthorizationAddressVerification = New CardPaymentResponseAuthorizationAddressVerification()
            objCardPaymentResponseAuthorizationAddressVerification.Code = lCardPaymentResponseAuthorizationAddressVerification.Code
            objCardPaymentResponseAuthorizationAddressVerification.Message = lCardPaymentResponseAuthorizationAddressVerification.Message
            Return objCardPaymentResponseAuthorizationAddressVerification
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildEFTPaymentRequest(ByVal lEFTPaymentRequest() As EFTPaymentRequest) As WSCSG_Payment.EFTPaymentRequest()
        Dim objEFTPaymentRequest() As WSCSG_Payment.EFTPaymentRequest
        Try
            objEFTPaymentRequest = New WSCSG_Payment.EFTPaymentRequest(lEFTPaymentRequest.GetUpperBound(0)) {}
            For i As Integer = 0 To lEFTPaymentRequest.GetUpperBound(0)
                objEFTPaymentRequest(i) = New WSCSG_Payment.EFTPaymentRequest()
                If Not lEFTPaymentRequest(i).CsgHeaderInfo Is Nothing Then
                    objEFTPaymentRequest(i).CsgHeaderInfo = BuildCsgHeaderInfoPayment(lEFTPaymentRequest(i).CsgHeaderInfo)
                End If
                objEFTPaymentRequest(i).AccountId = lEFTPaymentRequest(i).AccountId
                If Not lEFTPaymentRequest(i).BankAccount Is Nothing Then
                    objEFTPaymentRequest(i).BankAccount = BuildEFTPaymentRequestBankAccount(lEFTPaymentRequest(i).BankAccount)
                End If

            Next
            Return objEFTPaymentRequest
        Catch ex As Exception
            Throw ex
        Finally

        End Try

    End Function
    Private Function BuildEFTPaymentRequestBankAccount(ByVal lEFTPaymentRequestBankAccount As EFTPaymentRequestBankAccount) As WSCSG_Payment.EFTPaymentRequestBankAccount
        Dim objEFTPaymentRequestBankAccount As WSCSG_Payment.EFTPaymentRequestBankAccount
        Try
            objEFTPaymentRequestBankAccount = New WSCSG_Payment.EFTPaymentRequestBankAccount()
            objEFTPaymentRequestBankAccount.Number = lEFTPaymentRequestBankAccount.Number
            objEFTPaymentRequestBankAccount.RoutingNumber = lEFTPaymentRequestBankAccount.RoutingNumber

            'objEFTPaymentRequestBankAccount.Type = CType(lEFTPaymentRequestBankAccount.Type, WSCSG_Payment.EFTPaymentRequestBankAccountType)
            Select Case lEFTPaymentRequestBankAccount.Type
                Case EFTPaymentRequestBankAccountType.Checking
                    objEFTPaymentRequestBankAccount.Type = WSCSG_Payment.EFTPaymentRequestBankAccountType.Checking
                Case EFTPaymentRequestBankAccountType.Savings
                    objEFTPaymentRequestBankAccount.Type = WSCSG_Payment.EFTPaymentRequestBankAccountType.Savings
            End Select

            objEFTPaymentRequestBankAccount.Amount = lEFTPaymentRequestBankAccount.Amount
            objEFTPaymentRequestBankAccount.Source = lEFTPaymentRequestBankAccount.Source
            Return objEFTPaymentRequestBankAccount
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCsgHeaderInfo(ByVal lCsgHeaderInfo As CsgHeaderInfo) As WSCSG_Order.CsgHeaderInfo
        Dim objCsgHeaderInfo As WSCSG_Order.CsgHeaderInfo
        Try
            objCsgHeaderInfo = New WSCSG_Order.CsgHeaderInfo()
            objCsgHeaderInfo.Region = lCsgHeaderInfo.Region
            objCsgHeaderInfo.RoutingArea = lCsgHeaderInfo.RoutingArea
            objCsgHeaderInfo.ConversationId = lCsgHeaderInfo.ConversationId
            Return objCsgHeaderInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildResult(ByVal lResult As WSCSG_Order.Result) As Result
        Dim objResult As New Result
        Try
            If (Not lResult.ExceptionInfo Is Nothing) Then
                objResult.ExceptionInfo = BuildResultExceptionInfo(lResult.ExceptionInfo)
            End If
            If Not lResult.StatusMessages Is Nothing Then
                objResult.StatusMessages = BuildCsgStatusMessage(lResult.StatusMessages)
            End If
            objResult.ReferenceCode = lResult.ReferenceCode
            objResult.Description = lResult.Description
            objResult.DateTime = lResult.DateTime
            objResult.Source = lResult.Source
            objResult.Server = lResult.Server

            'objResult.Type = CType(lResult.Type, ResultType)
            Select Case lResult.Type
                Case WSICOMS_CustomerAccount.ResultType.Error
                    objResult.Type = ResultType.Error
                Case WSICOMS_CustomerAccount.ResultType.Informational
                    objResult.Type = ResultType.Informational
            End Select

            'objResult.ReturnCode = CType(lResult.ReturnCode, ResultReturnCode)
            Select Case lResult.ReturnCode
                Case WSICOMS_CustomerAccount.ResultReturnCode.BusinessRuleNotMet
                    objResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                Case WSICOMS_CustomerAccount.ResultReturnCode.DatabaseError
                    objResult.ReturnCode = ResultReturnCode.DatabaseError
                Case WSICOMS_CustomerAccount.ResultReturnCode.Exception
                    objResult.ReturnCode = ResultReturnCode.Exception
                Case WSICOMS_CustomerAccount.ResultReturnCode.InvalidXml
                    objResult.ReturnCode = ResultReturnCode.InvalidXml
                Case WSICOMS_CustomerAccount.ResultReturnCode.NoDataFound
                    objResult.ReturnCode = ResultReturnCode.NoDataFound
                Case WSICOMS_CustomerAccount.ResultReturnCode.Success
                    objResult.ReturnCode = ResultReturnCode.Success
            End Select



            Return objResult
        Catch ex As Exception

            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildResultExceptionInfo(ByVal lResultExceptionInfo As WSCSG_Order.ResultExceptionInfo) As ResultExceptionInfo
        Dim objResultExceptionInfo As New ResultExceptionInfo
        Try
            objResultExceptionInfo.Type = lResultExceptionInfo.Type
            objResultExceptionInfo.Message = lResultExceptionInfo.Message
            objResultExceptionInfo.StackTrace = lResultExceptionInfo.StackTrace
            objResultExceptionInfo.Code = lResultExceptionInfo.Code
            Return objResultExceptionInfo
        Catch ex As Exception

            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCsgStatusMessage(ByVal lCsgStatusMessage() As WSCSG_Order.CsgStatusMessage) As CsgStatusMessage()
        Dim objCsgStatusMessage() As CsgStatusMessage
        Try
            objCsgStatusMessage = New CsgStatusMessage(lCsgStatusMessage.GetUpperBound(0)) {}
            For i As Integer = 1 To lCsgStatusMessage.GetUpperBound(0)
                objCsgStatusMessage(i) = New CsgStatusMessage()
                objCsgStatusMessage(i).Code = lCsgStatusMessage(i).Code
                objCsgStatusMessage(i).Message = lCsgStatusMessage(i).Message
            Next
            Return objCsgStatusMessage
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildOrderInfo(ByVal lOrderInfo() As WSCSG_Order.OrderInfo) As OrderInfo()
        Dim objOrderInfo() As OrderInfo
        Try
            objOrderInfo = New OrderInfo(lOrderInfo.GetUpperBound(0)) {}
            For i As Integer = 0 To lOrderInfo.GetUpperBound(0)
                objOrderInfo(i) = New OrderInfo()
                objOrderInfo(i).CustomerId = lOrderInfo(i).CustomerId
                objOrderInfo(i).Salutation = lOrderInfo(i).Salutation
                objOrderInfo(i).FirstName = lOrderInfo(i).FirstName
                objOrderInfo(i).MiddleInitial = lOrderInfo(i).MiddleInitial
                objOrderInfo(i).LastName = lOrderInfo(i).LastName
                objOrderInfo(i).Company = lOrderInfo(i).Company
                objOrderInfo(i).LocationId = lOrderInfo(i).LocationId
                objOrderInfo(i).AddressLine1 = lOrderInfo(i).AddressLine1
                objOrderInfo(i).AddressLine2 = lOrderInfo(i).AddressLine2
                objOrderInfo(i).City = lOrderInfo(i).City
                objOrderInfo(i).State = lOrderInfo(i).State
                objOrderInfo(i).Zip = lOrderInfo(i).Zip
                objOrderInfo(i).Zip4 = lOrderInfo(i).Zip4
                objOrderInfo(i).OrderId = lOrderInfo(i).OrderId
                objOrderInfo(i).OrderClassSpecified = lOrderInfo(i).OrderClassSpecified
                objOrderInfo(i).OrderStatusSpecified = lOrderInfo(i).OrderStatusSpecified
                objOrderInfo(i).SalesRepresentative = lOrderInfo(i).SalesRepresentative
                objOrderInfo(i).DueDate = lOrderInfo(i).DueDate
                objOrderInfo(i).CompletionDate = lOrderInfo(i).CompletionDate
                objOrderInfo(i).CompletionTime = lOrderInfo(i).CompletionTime
                objOrderInfo(i).RepeatTroubleCall = lOrderInfo(i).RepeatTroubleCall
                objOrderInfo(i).BillingDate = lOrderInfo(i).BillingDate

                'objOrderInfo(i).OrderClass = CType(lOrderInfo(i).OrderClass, GetOrdersOrderClass)
                Select Case lOrderInfo(i).OrderClass
                    Case WSCSG_Order.GetOrdersOrderClass.ServiceRequest
                        objOrderInfo(i).OrderClass = GetOrdersOrderClass.ServiceRequest
                    Case WSCSG_Order.GetOrdersOrderClass.SpecialRequest
                        objOrderInfo(i).OrderClass = GetOrdersOrderClass.SpecialRequest
                    Case WSCSG_Order.GetOrdersOrderClass.TroubleCall
                        objOrderInfo(i).OrderClass = GetOrdersOrderClass.TroubleCall
                End Select


                'objOrderInfo(i).OrderStatus = CType(lOrderInfo(i).OrderStatus, GetOrdersOrderStatus)
                Select Case lOrderInfo(i).OrderStatus
                    Case WSCSG_Order.GetOrdersOrderStatus.Cancelled
                        objOrderInfo(i).OrderStatus = GetOrdersOrderStatus.Cancelled
                    Case WSCSG_Order.GetOrdersOrderStatus.Completed
                        objOrderInfo(i).OrderStatus = GetOrdersOrderStatus.Completed
                    Case WSCSG_Order.GetOrdersOrderStatus.NotSpecified
                        objOrderInfo(i).OrderStatus = GetOrdersOrderStatus.NotSpecified
                    Case WSCSG_Order.GetOrdersOrderStatus.Open
                        objOrderInfo(i).OrderStatus = GetOrdersOrderStatus.Open
                End Select


                If Not lOrderInfo(i).LinesOfBusiness Is Nothing Then
                    objOrderInfo(i).LinesOfBusiness = BuildOrderInfoLineOfBusiness(lOrderInfo(i).LinesOfBusiness)
                End If
                If Not lOrderInfo(i).Reasons Is Nothing Then
                    objOrderInfo(i).Reasons = BuildOrderReason(lOrderInfo(i).Reasons)
                End If
                If Not lOrderInfo(i).AuditCreation Is Nothing Then
                    objOrderInfo(i).AuditCreation = BuildAudit(lOrderInfo(i).AuditCreation)
                End If
                If Not lOrderInfo(i).AuditLastUpdate Is Nothing Then
                    objOrderInfo(i).AuditLastUpdate = BuildAudit(lOrderInfo(i).AuditLastUpdate)
                End If
                If Not lOrderInfo(i).Items Is Nothing Then
                    objOrderInfo(i).Items = BuildOrderInfoItem(lOrderInfo(i).Items)
                End If
                If Not lOrderInfo(i).Jobs Is Nothing Then
                    objOrderInfo(i).Jobs = BuildOrderInfoJob(lOrderInfo(i).Jobs)
                End If
                If Not lOrderInfo(i).Resolutions Is Nothing Then
                    Dim Resolutions() As String = New String(lOrderInfo(i).Resolutions.GetUpperBound(0)) {}
                    Dim CounterK As Integer
                    For Each resolution As String In lOrderInfo(i).Resolutions
                        Resolutions(CounterK) = resolution
                        CounterK += 1
                    Next
                    objOrderInfo(i).Resolutions = Resolutions
                End If
            Next
            Return objOrderInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildOrderInfoLineOfBusiness(ByVal lOrderInfoLineOfBusiness() As WSCSG_Order.OrderInfoLineOfBusiness) As OrderInfoLineOfBusiness()
        Dim objOrderInfoLineOfBusiness() As OrderInfoLineOfBusiness
        Try
            objOrderInfoLineOfBusiness = New OrderInfoLineOfBusiness(lOrderInfoLineOfBusiness.GetUpperBound(0)) {}
            For i As Integer = 0 To lOrderInfoLineOfBusiness.GetUpperBound(0)
                objOrderInfoLineOfBusiness(i) = New OrderInfoLineOfBusiness()
                'objOrderInfoLineOfBusiness(i).Type = CType(lOrderInfoLineOfBusiness(i).Type, LineOfBusinessType)
                Select Case lOrderInfoLineOfBusiness(i).Type
                    Case WSCSG_Order.LineOfBusinessType.Data
                        objOrderInfoLineOfBusiness(i).Type = LineOfBusinessType.Data
                    Case WSCSG_Order.LineOfBusinessType.Telephony
                        objOrderInfoLineOfBusiness(i).Type = LineOfBusinessType.Telephony
                    Case WSCSG_Order.LineOfBusinessType.Video
                        objOrderInfoLineOfBusiness(i).Type = LineOfBusinessType.Video
                End Select

                objOrderInfoLineOfBusiness(i).TypeSpecified = lOrderInfoLineOfBusiness(i).TypeSpecified

                'objOrderInfoLineOfBusiness(i).Action =  CType(lOrderInfoLineOfBusiness(i).Action, OrderInfoLineOfBusinessAction)
                Select Case lOrderInfoLineOfBusiness(i).Action
                    Case WSCSG_Order.OrderInfoLineOfBusinessAction.Cancelled
                        objOrderInfoLineOfBusiness(i).Action = OrderInfoLineOfBusinessAction.Cancelled
                    Case WSCSG_Order.OrderInfoLineOfBusinessAction.Connect
                        objOrderInfoLineOfBusiness(i).Action = OrderInfoLineOfBusinessAction.Connect
                    Case WSCSG_Order.OrderInfoLineOfBusinessAction.Disconnect
                        objOrderInfoLineOfBusiness(i).Action = OrderInfoLineOfBusinessAction.Disconnect
                    Case WSCSG_Order.OrderInfoLineOfBusinessAction.Downgrade
                        objOrderInfoLineOfBusiness(i).Action = OrderInfoLineOfBusinessAction.Downgrade
                    Case WSCSG_Order.OrderInfoLineOfBusinessAction.Restart
                        objOrderInfoLineOfBusiness(i).Action = OrderInfoLineOfBusinessAction.Restart
                    Case WSCSG_Order.OrderInfoLineOfBusinessAction.Sidegrade
                        objOrderInfoLineOfBusiness(i).Action = OrderInfoLineOfBusinessAction.Sidegrade
                    Case WSCSG_Order.OrderInfoLineOfBusinessAction.Upgrade
                        objOrderInfoLineOfBusiness(i).Action = OrderInfoLineOfBusinessAction.Upgrade
                End Select
                objOrderInfoLineOfBusiness(i).ActionSpecified = lOrderInfoLineOfBusiness(i).ActionSpecified
            Next
            Return objOrderInfoLineOfBusiness
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildOrderReason(ByVal lOrderReason() As WSCSG_Order.OrderReason) As OrderReason()
        Dim objOrderReason() As OrderReason
        Try
            objOrderReason = New OrderReason(lOrderReason.GetUpperBound(0)) {}
            For i As Integer = 0 To lOrderReason.GetUpperBound(0)
                objOrderReason(i) = New OrderReason()
                objOrderReason(i).Code = lOrderReason(i).Code
                objOrderReason(i).Description = lOrderReason(i).Description
            Next
            Return objOrderReason
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildAudit(ByVal lAudit As WSCSG_Order.Audit) As Audit
        Dim objAudit As Audit
        Try
            objAudit = New Audit
            objAudit.Date = lAudit.Date
            objAudit.Time = lAudit.Time
            objAudit.Operator = lAudit.Operator
            objAudit.Terminal = lAudit.Terminal
            objAudit.Transaction = lAudit.Transaction
            Return objAudit
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildOrderInfoItem(ByVal lOrderInfoItem() As WSCSG_Order.OrderInfoItem) As OrderInfoItem()
        Dim objOrderInfoItem() As OrderInfoItem
        Try
            objOrderInfoItem = New OrderInfoItem(lOrderInfoItem.GetUpperBound(0)) {}
            For i As Integer = 0 To lOrderInfoItem.GetUpperBound(0)
                objOrderInfoItem(i).Code = lOrderInfoItem(i).Code
                objOrderInfoItem(i).CodeDescription = lOrderInfoItem(i).CodeDescription
                objOrderInfoItem(i).BillingDiscount = lOrderInfoItem(i).BillingDiscount

                '#############################################################################
                'EAI - GREG KOCH SAID THIS PROPERTY IS ONE THAT IS NOT DILIBERATLY 
                'SPECIFIED IN THE WSDL, YET .NET SEEMS TO ADD IT FOR WHATEVER REASON. 
                'HE SAID TO GO AHEAD AND COMMENT IT OUT SINCE NO VALUE WILL BE PASSED.
                '#############################################################################
                'objOrderInfoItem(i).BillingDiscountSpecified = lOrderInfoItem(i).BillingDiscountSpecified

                objOrderInfoItem(i).BillingDiscountDescription = lOrderInfoItem(i).BillingDiscountDescription
                objOrderInfoItem(i).ChangeIndicator = lOrderInfoItem(i).ChangeIndicator
                objOrderInfoItem(i).CompleteIndicator = lOrderInfoItem(i).CompleteIndicator
            Next
            Return objOrderInfoItem
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildOrderInfoJob(ByVal lOrderInfoJob() As WSCSG_Order.OrderInfoJob) As OrderInfoJob()
        Dim objOrderInfoJob() As OrderInfoJob
        Try
            objOrderInfoJob = New OrderInfoJob(lOrderInfoJob.GetUpperBound(0)) {}
            For i As Integer = 0 To lOrderInfoJob.GetUpperBound(0)
                objOrderInfoJob(i).Sequence = lOrderInfoJob(i).Sequence

                '#############################################################################
                'EAI - GREG KOCH SAID THIS PROPERTY IS ONE THAT IS NOT DILIBERATLY 
                'SPECIFIED IN THE WSDL, YET .NET SEEMS TO ADD IT FOR WHATEVER REASON. 
                'HE SAID TO GO AHEAD AND COMMENT IT OUT SINCE NO VALUE WILL BE PASSED.
                '#############################################################################
                'objOrderInfoJob(i).SequenceSpecified = lOrderInfoJob(i).SequenceSpecified

                objOrderInfoJob(i).Number = lOrderInfoJob(i).Number
                objOrderInfoJob(i).NumberSpecified = lOrderInfoJob(i).NumberSpecified
                objOrderInfoJob(i).Type = lOrderInfoJob(i).Type
                objOrderInfoJob(i).Status = lOrderInfoJob(i).Status
                objOrderInfoJob(i).Class = lOrderInfoJob(i).Class
                objOrderInfoJob(i).ScheduleDate = lOrderInfoJob(i).ScheduleDate
                objOrderInfoJob(i).ScheduleTimeCode = lOrderInfoJob(i).ScheduleTimeCode
                objOrderInfoJob(i).ScheduleTimeDescription = lOrderInfoJob(i).ScheduleTimeDescription
                objOrderInfoJob(i).Technician = lOrderInfoJob(i).Technician
                objOrderInfoJob(i).CompletionDate = lOrderInfoJob(i).CompletionDate
            Next
            Return objOrderInfoJob
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildIcomsHeaderInfo(ByVal lIcomsHeaderInfo As IcomsHeaderInfo) As WSICOMS_Order.IcomsHeaderInfo
        Dim objIcomsHeaderInfo As New WSICOMS_Order.IcomsHeaderInfo
        Try

            'objIcomsHeaderInfo.SiteId = CType(lIcomsHeaderInfo.SiteId, WSICOMS_Order.SiteId)
            Select Case lIcomsHeaderInfo.SiteId
                Case SiteId.Site100
                    objIcomsHeaderInfo.SiteId = WSICOMS_Order.SiteId.Site100
                Case SiteId.Site200
                    objIcomsHeaderInfo.SiteId = WSICOMS_Order.SiteId.Site200
                Case SiteId.Site300
                    objIcomsHeaderInfo.SiteId = WSICOMS_Order.SiteId.Site300
                Case SiteId.Site400
                    objIcomsHeaderInfo.SiteId = WSICOMS_Order.SiteId.Site400
                Case SiteId.Site500
                    objIcomsHeaderInfo.SiteId = WSICOMS_Order.SiteId.Site500
                Case SiteId.Site600
                    objIcomsHeaderInfo.SiteId = WSICOMS_Order.SiteId.Site600
            End Select

            Return objIcomsHeaderInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildResult(ByVal lResult As WSICOMS_Order.Result) As Result
        Dim objResult As New Result
        Try
            If (Not lResult.ExceptionInfo Is Nothing) Then
                objResult.ExceptionInfo = BuildResultExceptionInfo(lResult.ExceptionInfo)
            End If
            If Not lResult.StatusMessages Is Nothing Then
                objResult.StatusMessages = BuildCsgStatusMessage(lResult.StatusMessages)
            End If
            objResult.ReferenceCode = lResult.ReferenceCode
            objResult.Description = lResult.Description
            objResult.DateTime = lResult.DateTime
            objResult.Source = lResult.Source
            objResult.Server = lResult.Server

            'objResult.Type = CType(lResult.Type, ResultType)
            Select Case lResult.Type
                Case WSICOMS_CustomerAccount.ResultType.Error
                    objResult.Type = ResultType.Error
                Case WSICOMS_CustomerAccount.ResultType.Informational
                    objResult.Type = ResultType.Informational
            End Select

            'objResult.ReturnCode = CType(lResult.ReturnCode, ResultReturnCode)
            Select Case lResult.ReturnCode
                Case WSICOMS_CustomerAccount.ResultReturnCode.BusinessRuleNotMet
                    objResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                Case WSICOMS_CustomerAccount.ResultReturnCode.DatabaseError
                    objResult.ReturnCode = ResultReturnCode.DatabaseError
                Case WSICOMS_CustomerAccount.ResultReturnCode.Exception
                    objResult.ReturnCode = ResultReturnCode.Exception
                Case WSICOMS_CustomerAccount.ResultReturnCode.InvalidXml
                    objResult.ReturnCode = ResultReturnCode.InvalidXml
                Case WSICOMS_CustomerAccount.ResultReturnCode.NoDataFound
                    objResult.ReturnCode = ResultReturnCode.NoDataFound
                Case WSICOMS_CustomerAccount.ResultReturnCode.Success
                    objResult.ReturnCode = ResultReturnCode.Success
            End Select


            Return objResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try


    End Function
    Private Function BuildResultExceptionInfo(ByVal lResultExceptionInfo As WSICOMS_Order.ResultExceptionInfo) As ResultExceptionInfo
        Dim objResultExceptionInfo As New ResultExceptionInfo
        Try
            objResultExceptionInfo.Type = lResultExceptionInfo.Type
            objResultExceptionInfo.Message = lResultExceptionInfo.Message
            objResultExceptionInfo.StackTrace = lResultExceptionInfo.StackTrace
            objResultExceptionInfo.Code = lResultExceptionInfo.Code
            Return objResultExceptionInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildCsgStatusMessage(ByVal lCsgStatusMessage() As WSICOMS_Order.CsgStatusMessage) As CsgStatusMessage()
        Dim objCsgStatusMessage() As CsgStatusMessage
        Try
            objCsgStatusMessage = New CsgStatusMessage(lCsgStatusMessage.GetUpperBound(0)) {}
            For i As Integer = 0 To lCsgStatusMessage.GetUpperBound(0)
                objCsgStatusMessage(i) = New CsgStatusMessage()
                objCsgStatusMessage(i).Code = lCsgStatusMessage(i).Code
                objCsgStatusMessage(i).Message = lCsgStatusMessage(i).Message
            Next
            Return objCsgStatusMessage
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildGetOrdersResult(ByVal lGetOrdersResult As WSICOMS_Order.GetOrdersResult) As GetOrdersResult
        Dim objGetOrdersResult As GetOrdersResult
        Try
            objGetOrdersResult = New GetOrdersResult
            objGetOrdersResult.AccountId = lGetOrdersResult.AccountId
            If Not lGetOrdersResult.OrderInfo Is Nothing Then
                objGetOrdersResult.OrderInfo = BuildWorkOrderInfo(lGetOrdersResult.OrderInfo)
            End If
            Return objGetOrdersResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildWorkOrderInfo(ByVal lWorkOrderInfo() As WSICOMS_Order.WorkOrderInfo) As WorkOrderInfo()
        Dim objWorkOrderInfo() As WorkOrderInfo
        Try
            objWorkOrderInfo = New WorkOrderInfo(lWorkOrderInfo.GetUpperBound(0)) {}
            For i As Integer = 0 To lWorkOrderInfo.GetUpperBound(0)
                objWorkOrderInfo(i).WorkOrderNumber = lWorkOrderInfo(i).WorkOrderNumber
                objWorkOrderInfo(i).OrderType = lWorkOrderInfo(i).OrderType
                objWorkOrderInfo(i).OrderStatus = lWorkOrderInfo(i).OrderStatus
                objWorkOrderInfo(i).CommentLine1 = lWorkOrderInfo(i).CommentLine1
                objWorkOrderInfo(i).CommentLine2 = lWorkOrderInfo(i).CommentLine2
                objWorkOrderInfo(i).CommentLine3 = lWorkOrderInfo(i).CommentLine3
                objWorkOrderInfo(i).ScheduledDate = lWorkOrderInfo(i).ScheduledDate
                objWorkOrderInfo(i).UserID = lWorkOrderInfo(i).UserID
                objWorkOrderInfo(i).ReasonCode = lWorkOrderInfo(i).ReasonCode
                objWorkOrderInfo(i).PrimaryLocatorCode = lWorkOrderInfo(i).PrimaryLocatorCode
                objWorkOrderInfo(i).SecondaryLocatorCode = lWorkOrderInfo(i).SecondaryLocatorCode
                objWorkOrderInfo(i).Node = lWorkOrderInfo(i).Node
            Next
            Return objWorkOrderInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildServiceInfo(ByVal lServiceInfo() As WSICOMS_Order.ServiceInfo) As ServiceInfo()
        Dim objServiceInfo() As ServiceInfo
        Try
            objServiceInfo = New ServiceInfo(lServiceInfo.GetUpperBound(0)) {}
            For i As Integer = 0 To lServiceInfo.GetUpperBound(0)
                objServiceInfo(i).ServiceCode = lServiceInfo(i).ServiceCode
                objServiceInfo(i).ServiceCategoryCode = lServiceInfo(i).ServiceCategoryCode
                objServiceInfo(i).WorkOrderOccurCode = lServiceInfo(i).WorkOrderOccurCode
                objServiceInfo(i).ShortDescription = lServiceInfo(i).ShortDescription
                objServiceInfo(i).LongDescription = lServiceInfo(i).LongDescription
                objServiceInfo(i).InitialQuantity = lServiceInfo(i).InitialQuantity
                objServiceInfo(i).FinalQuantity = lServiceInfo(i).FinalQuantity
                objServiceInfo(i).Amount = lServiceInfo(i).Amount
                objServiceInfo(i).Points = lServiceInfo(i).Points
                objServiceInfo(i).SalesmanNumber = lServiceInfo(i).SalesmanNumber
                objServiceInfo(i).CSRUserID = lServiceInfo(i).CSRUserID
            Next
            Return objServiceInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function
    Private Function BuildScheduleInfo(ByVal lScheduleInfo As WSICOMS_Order.ScheduleInfo) As ScheduleInfo
        Dim objScheduleInfo As ScheduleInfo
        Try
            objScheduleInfo = New ScheduleInfo
            objScheduleInfo.Date = lScheduleInfo.Date
            objScheduleInfo.Day = lScheduleInfo.Day
            objScheduleInfo.TimeSlot = lScheduleInfo.TimeSlot
            objScheduleInfo.Description = lScheduleInfo.Description
            Return objScheduleInfo
        Catch ex As Exception
            Throw ex
        Finally

        End Try
    End Function

    Private Function GetResultObj(ByVal objTempResponse As WS_Location.GetLocationByPhoneResponse) As Result
        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objResult As Result
        Dim objexceptionInfo As ResultExceptionInfo
        Dim objstatusMessages() As CsgStatusMessage = New CsgStatusMessage() {}

        Try

            objResult = New Result
            objResult.ReferenceCode = objTempResponse.Result.ReferenceCode
            objResult.Description = objTempResponse.Result.Description
            objResult.DateTime = objTempResponse.Result.DateTime
            objResult.Source = objTempResponse.Result.Source
            objResult.Server = objTempResponse.Result.Server
            objResult.ReturnCode = objTempResponse.Result.ReturnCode
            If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                objexceptionInfo = New ResultExceptionInfo
                objexceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                objexceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                objResult.ExceptionInfo = objexceptionInfo
            End If
            If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                ReDim objstatusMessages(objTempResponse.Result.StatusMessages.Length)
                For i As Integer = 0 To objTempResponse.Result.StatusMessages.Length - 1
                    objstatusMessages(i) = New CsgStatusMessage()
                    objstatusMessages(i).Code = objTempResponse.Result.StatusMessages(i).Code
                    objstatusMessages(i).Message = objTempResponse.Result.StatusMessages(i).Message
                Next
                objResult.StatusMessages = objstatusMessages
            End If
            objResult.Type = objTempResponse.Result.Type

            Return objResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try


    End Function

    Private Function GetResultObj(ByVal objTempResponse As WSGetServiceability.GetServiceabilityResponse) As Result
        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objResult As Result
        Dim objexceptionInfo As ResultExceptionInfo
        Dim objstatusMessages() As CsgStatusMessage = New CsgStatusMessage() {}

        Try

            objResult = New Result
            objResult.ReferenceCode = objTempResponse.Result.ReferenceCode
            objResult.Description = objTempResponse.Result.Description
            objResult.DateTime = objTempResponse.Result.DateTime
            objResult.Source = objTempResponse.Result.Source
            objResult.Server = objTempResponse.Result.Server
            objResult.ReturnCode = objTempResponse.Result.ReturnCode
            If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                objexceptionInfo = New ResultExceptionInfo
                objexceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                objexceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                objResult.ExceptionInfo = objexceptionInfo
            End If
            If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                ReDim objstatusMessages(objTempResponse.Result.StatusMessages.GetUpperBound(0))
                For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                    objstatusMessages(i) = New CsgStatusMessage()
                    objstatusMessages(i).Code = objTempResponse.Result.StatusMessages(i).Code
                    objstatusMessages(i).Message = objTempResponse.Result.StatusMessages(i).Message
                Next
                objResult.StatusMessages = objstatusMessages
            End If
            objResult.Type = objTempResponse.Result.Type

            Return objResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try


    End Function
    Private Function GetCustomerOrderCriteriaResultObj(ByVal objTempResponse As WS_CustomerOrderCriteria.GetCustomerOrderCriteriaResponse) As Result
        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objResult As Result
        Dim objexceptionInfo As ResultExceptionInfo
        Dim objstatusMessages() As CsgStatusMessage = New CsgStatusMessage() {}

        Try

            objResult = New Result
            objResult.ReferenceCode = objTempResponse.Result.ReferenceCode
            objResult.Description = objTempResponse.Result.Description
            objResult.DateTime = objTempResponse.Result.DateTime
            objResult.Source = objTempResponse.Result.Source
            objResult.Server = objTempResponse.Result.Server
            objResult.ReturnCode = objTempResponse.Result.ReturnCode
            If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                objexceptionInfo = New ResultExceptionInfo
                objexceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                objexceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                objResult.ExceptionInfo = objexceptionInfo
            End If
            If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                ReDim objstatusMessages(objTempResponse.Result.StatusMessages.GetUpperBound(0))
                For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                    objstatusMessages(i) = New CsgStatusMessage()
                    objstatusMessages(i).Code = objTempResponse.Result.StatusMessages(i).Code
                    objstatusMessages(i).Message = objTempResponse.Result.StatusMessages(i).Message
                Next
                objResult.StatusMessages = objstatusMessages
            End If
            objResult.Type = objTempResponse.Result.Type

            Return objResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try


    End Function

    Public Overrides Function GetELOA(ByVal obj As CharterDotCom.CommonEntities.Library.IProviderParameters) As CharterDotCom.CommonEntities.Library.IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetELOARequest
        Dim objRequest As New WS_ELOA.GetTPVRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As New WS_ELOA.GetTPVResponse
        Dim objResponse As New GetELOAResponse


        Try
            If Not (obj Is Nothing) Then
                objTempRequest = CType(obj, GetELOARequest)

                objRequest.AffiliateID = objTempRequest.AffiliateID
                objRequest.AffiliateName = objTempRequest.AffiliateName
                objRequest.AffiliateType = objTempRequest.AffiliateType
                objRequest.DecisionMaker = objTempRequest.DecisionMaker
                objRequest.DNIS = objTempRequest.DNIS
                objRequest.E911 = objTempRequest.E911
                objRequest.ELOAName = objTempRequest.ELOAName
                objRequest.FirstName = objTempRequest.FirstName
                objRequest.LastName = objTempRequest.LastName
                objRequest.Local = objTempRequest.Local
                objRequest.LocalToll = objTempRequest.LocalToll
                objRequest.LongDistance = objTempRequest.LongDistance
                objRequest.Password = objTempRequest.Password
                objRequest.ReasonCode = objTempRequest.ReasonCode
                objRequest.SecurityType = objTempRequest.SecurityType

                objRequest.SecurityValue = objTempRequest.SecurityValue
                objRequest.Status = objTempRequest.Status
                objRequest.TelephoneNbr = objTempRequest.TelephoneNbr
                objRequest.UserID = objTempRequest.UserID
                objRequest.Version = objTempRequest.Version


                objRequest.WTNs = objTempRequest.WTNs
                'If Not (objTempRequest.WTNs Is Nothing) Then
                '    ReDim objRequest.WTNs(objTempRequest.WTNs.GetUpperBound(0))
                '    For i As Integer = 0 To objTempRequest.WTNs.GetUpperBound(0)
                '        objRequest.WTNs(i) = New 
                '        objRequest.WTNs(i).Available = objTempResponse.ServiceabilityResult(r).LocationAvailableServices.Service(i).Available
                '        objRequest.WTNs(i).Description = objTempResponse.ServiceabilityResult(r).LocationAvailableServices.Service(i).Description
                '    Next
                'End If

            End If



            '##############################################
            'CONFIGURE SETTINGS FOR CSG ACCOUNT WEBSERVICE
            '##############################################
            Dim context As HttpContext = HttpContext.Current
            Dim netCredential As NetworkCredential
            Dim uri As Uri
            Me.wsELOA = New WS_ELOA.EBSTPVServicePort
            uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_ELOAWEBSERVICE_URL))
            Me.wsELOA.Url = uri.AbsoluteUri
            wsELOA.PreAuthenticate = True
            If CBool(context.Application(Constant.EBSSERVICESPROVIDER_ELOAWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                Me.wsELOA.UseDefaultCredentials = False
                netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_ELOAWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_ELOAWEBSERVICE_PASSWORD).ToString)
                Me.Credentials = netCredential.GetCredential(uri, "Basic")
                wsELOA.Credentials = Me.Credentials
            End If

            '########################
            'EXECUTE THE WEB SERVICE
            '########################
            objTempResponse = Me.wsELOA.GetVoiceLogInquiry(objRequest)




            '#########################################################################################
            'translate back to a common object in the gateway, visible from Provider and the BL both.
            '#########################################################################################
            If (objTempResponse Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If (objTempResponse.Result Is Nothing) Then
                Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
            End If
            If Not (objTempResponse.Result.ReturnCode = WS_ELOA.ResultReturnCode.Success) Then
                Throw New Exception(objTempResponse.Result.ReturnCode.ToString())
            End If


            objResponse.TPVResponse = New TPVResponse
            objResponse.TPVResponse.ReasonCode = objTempResponse.TPVResponse.ReasonCode
            objResponse.TPVResponse.ReasonDescription = objTempResponse.TPVResponse.ReasonDescription
            objResponse.TPVResponse.Status = objTempResponse.TPVResponse.Status
            objResponse.TPVResponse.TelephoneNbr = objTempResponse.TPVResponse.TelephoneNbr
            objResponse.TPVResponse.TransactionID = objTempResponse.TPVResponse.TransactionID

            If Not (objTempResponse.Result Is Nothing) Then
                objResponse.Result = GetResultObj_ELOA(objTempResponse)
            End If


            Return objResponse


        Catch ex As Exception
            If (objResponse Is Nothing) Then
                objResponse = New GetELOAResponse
            End If
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try
    End Function

    Private Function GetResultObj_ELOA(ByVal objTempResponse As WS_ELOA.GetTPVResponse) As Result
        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objResult As Result
        Dim objexceptionInfo As ResultExceptionInfo
        Dim objstatusMessages() As CsgStatusMessage = New CsgStatusMessage() {}

        Try

            objResult = New Result
            objResult.ReferenceCode = objTempResponse.Result.ReferenceCode
            objResult.Description = objTempResponse.Result.Description
            objResult.DateTime = objTempResponse.Result.DateTime
            objResult.Source = objTempResponse.Result.Source
            objResult.Server = objTempResponse.Result.Server
            objResult.ReturnCode = objTempResponse.Result.ReturnCode
            If Not (objTempResponse.Result.ExceptionInfo Is Nothing) Then
                objexceptionInfo = New ResultExceptionInfo
                objexceptionInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                objexceptionInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                objResult.ExceptionInfo = objexceptionInfo
            End If
            If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                ReDim objstatusMessages(objTempResponse.Result.StatusMessages.GetUpperBound(0))
                For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                    objstatusMessages(i) = New CsgStatusMessage()
                    objstatusMessages(i).Code = objTempResponse.Result.StatusMessages(i).Code
                    objstatusMessages(i).Message = objTempResponse.Result.StatusMessages(i).Message
                Next
                objResult.StatusMessages = objstatusMessages
            End If
            objResult.Type = objTempResponse.Result.Type

            Return objResult
        Catch ex As Exception
            Throw ex
        Finally

        End Try


    End Function
    '################################################################################################
    'MODIFICATION	Sriman kanuri		CSG get/update security code - My Account 
    '################################################################################################    
    Public Overrides Function GetCustomer(ByVal obj As CharterDotCom.CommonEntities.Library.IProviderParameters) As CharterDotCom.CommonEntities.Library.IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As GetCustomerRequest
        Dim objRequest As WS_Customer.GetCustomerRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As WS_Customer.GetCustomerResponse
        Dim objResponse As New GetCustomerResponse

        Try
            objTempRequest = CType(obj, GetCustomerRequest)

            '#################################################
            'BUILD REQUEST OBJECT FOR THE WEB SERVICE REQUEST
            '#################################################
            If Not objTempRequest Is Nothing Then
                objRequest = New WS_Customer.GetCustomerRequest

                If Not objTempRequest.csgHeaderInfo Is Nothing Then
                    Dim objCSGHeaderInfo As New WS_Customer.CsgHeaderInfo()
                    objCSGHeaderInfo.ConversationId = objTempRequest.csgHeaderInfo.ConversationId
                    objCSGHeaderInfo.Region = objTempRequest.csgHeaderInfo.Region
                    objCSGHeaderInfo.RoutingArea = objTempRequest.csgHeaderInfo.RoutingArea

                    objCSGHeaderInfo.RealTime = True
                    objRequest.CsgHeaderInfo = objCSGHeaderInfo
                End If


                objRequest.CustomerID = objTempRequest.customerID



                '#################################################
                'Configure settings for EAI Customer service webservice
                '#################################################
                Dim context As HttpContext = HttpContext.Current
                Dim netCredential As NetworkCredential
                Dim uri As Uri
                wsCustomer = New WS_Customer.CustomerServicePort
                uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_URL))
                Me.wsCustomer.Url = uri.AbsoluteUri
                wsCustomer.PreAuthenticate = True
                If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                    netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_PASSWORD).ToString)
                    Me.Credentials = netCredential.GetCredential(uri, "Basic")
                    wsCustomer.Credentials = Me.Credentials
                End If





                If Not objTempRequest Is Nothing Then



                    '#############################
                    'EXECUTE THE WS CALL TO EAI
                    '#############################
                    objTempResponse = Me.wsCustomer.GetCustomer(objRequest)






                    '#########################################################################################
                    'translate back to a common object in the gateway, visible from Provider and the BL both.
                    '#########################################################################################
                    If (objTempResponse Is Nothing) Then
                        Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                    End If
                    If (objTempResponse.Result Is Nothing) Then
                        Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                    End If
                    If Not (objTempResponse.Result.ReturnCode = WS_Customer.ResultReturnCode.Success) Then
                        Throw New Exception(objTempResponse.Result.ExceptionInfo.Message.ToString())
                    End If


                    If Not objTempResponse.Result Is Nothing Then
                        If Not (objTempResponse.Result Is Nothing) Then
                            Dim lResult As New Result
                            lResult.DateTime = objTempResponse.Result.DateTime
                            lResult.Description = objTempResponse.Result.Description

                            If Not objTempResponse.Result.ExceptionInfo Is Nothing Then
                                Dim lExcepInfo As New ResultExceptionInfo
                                lExcepInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                                lExcepInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                                lExcepInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                                lExcepInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                                lResult.ExceptionInfo = lExcepInfo
                            End If

                            lResult.ReferenceCode = objTempResponse.Result.ReferenceCode

                            Select Case objTempResponse.Result.ReturnCode
                                Case WS_Customer.ResultReturnCode.BusinessRuleNotMet
                                    lResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                                Case WS_Customer.ResultReturnCode.DatabaseError
                                    lResult.ReturnCode = ResultReturnCode.DatabaseError
                                Case WS_Customer.ResultReturnCode.Exception
                                    lResult.ReturnCode = ResultReturnCode.Exception
                                Case WS_Customer.ResultReturnCode.InvalidXml
                                    lResult.ReturnCode = ResultReturnCode.InvalidXml
                                Case WS_Customer.ResultReturnCode.NoDataFound
                                    lResult.ReturnCode = ResultReturnCode.NoDataFound
                                Case WS_Customer.ResultReturnCode.Success
                                    lResult.ReturnCode = ResultReturnCode.Success
                            End Select

                            lResult.Server = objTempResponse.Result.Server
                            lResult.Source = objTempResponse.Result.Source

                            If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                                Dim objCsgStatusMessage() As CsgStatusMessage = New CsgStatusMessage() {}
                                ReDim objCsgStatusMessage(objTempResponse.Result.StatusMessages.GetUpperBound(0))
                                For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                                    objCsgStatusMessage(i) = New CsgStatusMessage
                                    objCsgStatusMessage(i).Code = objTempResponse.Result.StatusMessages(i).Code
                                    objCsgStatusMessage(i).Message = objTempResponse.Result.StatusMessages(i).Message
                                Next
                                lResult.StatusMessages = objCsgStatusMessage
                            End If

                            Select Case objTempResponse.Result.Type
                                Case WS_Customer.ResultType.Error
                                    lResult.Type = ResultType.Error
                                Case WS_Customer.ResultType.Informational
                                    lResult.Type = ResultType.Informational
                            End Select

                            objResponse.Result = lResult
                        End If
                    End If


                    'temporarily we are only bringing this data, as this is the only thing we need for now
                    'from this resultset
                    objResponse.BusinessUnit = objTempResponse.BusinessUnit
                    objResponse.CorporationNumber = objTempResponse.CorporationNumber
                    objResponse.CustomerID = objTempResponse.CustomerID
                    objResponse.CustomerType = objTempResponse.CustomerType
                    objResponse.LocationId = objTempResponse.LocationId
                    objResponse.TrackingId = objTempResponse.TrackingId
                    objResponse.Status = objTempResponse.Status
                    objResponse.SecurityCode = objTempResponse.SecurityCode
                    ''set Name
                    If Not (objTempResponse.Name.Items Is Nothing) Then
                        If objTempResponse.Name.Items.Length > 0 Then
                            Dim tempName As New nameA
                            tempName.Title = objTempResponse.Name.Title
                            tempName.Salutation = objTempResponse.Name.Salutation
                            tempName.Title = objTempResponse.Name.Title
                            Dim objItemsElementName() As ItemsChoiceType = New ItemsChoiceType() {}
                            Dim objItems() As String = New String() {}
                            ReDim objItemsElementName(objTempResponse.Name.Items.GetUpperBound(0))
                            ReDim objItems(objTempResponse.Name.Items.GetUpperBound(0))

                            For i As Integer = 0 To objTempResponse.Name.Items.GetUpperBound(0)
                                Select Case objTempResponse.Name.ItemsElementName(i)
                                    Case ItemsChoiceType.Company

                                        objItemsElementName(i) = WS_Customer.ItemsChoiceType.Company
                                    Case ItemsChoiceType.First
                                        objItemsElementName(i) = WS_Customer.ItemsChoiceType.First
                                    Case ItemsChoiceType.Full
                                        objItemsElementName(i) = WS_Customer.ItemsChoiceType.Full
                                    Case ItemsChoiceType.Last
                                        objItemsElementName(i) = WS_Customer.ItemsChoiceType.Last
                                    Case ItemsChoiceType.Middle
                                        objItemsElementName(i) = WS_Customer.ItemsChoiceType.Middle

                                End Select
                                objItems(i) = objTempResponse.Name.Items(i)


                            Next
                            tempName.Items = objItems
                            tempName.ItemsElementName = objItemsElementName
                            objResponse.Name = tempName
                        End If
                    End If

                    If Not (objTempResponse.Phone Is Nothing) Then
                        Dim tempPhone As New phoneUpdate
                        tempPhone.Home = objTempResponse.Phone.Home
                        tempPhone.Business = objTempResponse.Phone.Business
                        objResponse.Phone = tempPhone
                    End If

                    If Not (objTempResponse.Address Is Nothing) Then
                        Dim tempAddress As New customeraddress
                        tempAddress.Line1 = objTempResponse.Address.Line1
                        tempAddress.Line2 = objTempResponse.Address.Line2
                        tempAddress.City = objTempResponse.Address.City
                        tempAddress.State = objTempResponse.Address.State

                        tempAddress.PostalCode = objTempResponse.Address.PostalCode
                        tempAddress.CanadianForceIndicator = objTempResponse.Address.CanadianForceIndicator
                        objResponse.Address = tempAddress

                    End If

                    If Not (objTempResponse.Identification Is Nothing) Then
                        Dim tempIdentification As New identificationD
                        tempIdentification.BirthDate = objTempResponse.Identification.BirthDate
                        tempIdentification.BirthDateSpecified = objTempResponse.Identification.BirthDateSpecified
                        tempIdentification.DriversLicenseNumber = objTempResponse.Identification.DriversLicenseNumber
                        tempIdentification.DriversLicenseState = objTempResponse.Identification.DriversLicenseState
                        tempIdentification.TaxIdentifier = objTempResponse.Identification.TaxIdentifier
                        tempIdentification.TaxType = objTempResponse.Identification.TaxType
                        objResponse.Identification = tempIdentification

                    End If

                    If Not (objTempResponse.Email Is Nothing) Then
                        Dim tempEmail As New GetCustomerResponseEmail
                        tempEmail.Address = objTempResponse.Email.Address
                        objResponse.Email = tempEmail
                    End If

                    If Not (objTempResponse.Balance Is Nothing) Then
                        Dim tempBalance As New GetCustomerResponseBalance
                        tempBalance.Current = objTempResponse.Balance.Current
                        objResponse.Balance = tempBalance
                    End If

                    If Not (objTempResponse.Billing Is Nothing) Then
                        Dim tempBilling As New GetCustomerResponseBilling
                        tempBilling.CycleDay = objTempResponse.Billing.CycleDay
                        objResponse.Billing = tempBilling
                    End If


                    objResponse.Privacy = objTempResponse.Privacy

                    If Not (objTempResponse.Comment Is Nothing) Then
                        Dim objComment() As text = New text() {}
                        ReDim objComment(objTempResponse.Comment.GetUpperBound(0))
                        For i As Integer = 0 To objTempResponse.Comment.GetUpperBound(0)
                            Dim tempComment As New text
                            tempComment.Index = objTempResponse.Comment(i).Index
                            tempComment.Text = objTempResponse.Comment(i).Text
                            objComment(i) = tempComment
                        Next

                        objResponse.Comment = objComment
                    End If

                    If Not (objTempResponse.CustomField Is Nothing) Then
                        Dim objCustomField() As customField = New customField() {}
                        ReDim objCustomField(objTempResponse.CustomField.GetUpperBound(0))
                        For i As Integer = 0 To objTempResponse.CustomField.GetUpperBound(0)
                            Dim tempCustomField As New customField
                            tempCustomField.Index = objTempResponse.CustomField(i).Index
                            tempCustomField.Name = objTempResponse.CustomField(i).Name
                            tempCustomField.Value = objTempResponse.CustomField(i).Value
                            objCustomField(i) = tempCustomField
                        Next

                        objResponse.CustomField = objCustomField
                    End If



                    If Not (objTempResponse.Audit Is Nothing) Then
                        Dim tempAudit As New GetCustomerResponseAudit
                        Dim tempAuditCreation As New Audit
                        If Not (objTempResponse.Audit.Creation Is Nothing) Then

                            tempAuditCreation.Date = objTempResponse.Audit.Creation.Date

                            If Not (objTempResponse.Audit.Creation.Operator Is Nothing) Then
                                tempAuditCreation.Operator = objTempResponse.Audit.Creation.Operator
                            End If
                            tempAuditCreation.Terminal = objTempResponse.Audit.Creation.Terminal
                            tempAuditCreation.Time = objTempResponse.Audit.Creation.Time
                            tempAuditCreation.TimeSpecified = objTempResponse.Audit.Creation.TimeSpecified
                            tempAuditCreation.Transaction = objTempResponse.Audit.Creation.Transaction
                            tempAudit.Creation = tempAuditCreation
                        End If

                        If Not (objTempResponse.Audit.LastUpdate Is Nothing) Then
                            Dim tempAuditLastUpdate As New Audit
                            tempAuditLastUpdate.Date = objTempResponse.Audit.LastUpdate.Date
                            If Not (objTempResponse.Audit.LastUpdate.Operator Is Nothing) Then
                                tempAuditLastUpdate.Operator = objTempResponse.Audit.LastUpdate.Operator
                            End If
                            tempAuditLastUpdate.Terminal = objTempResponse.Audit.LastUpdate.Terminal
                            tempAuditLastUpdate.Time = objTempResponse.Audit.LastUpdate.Time
                            tempAuditLastUpdate.TimeSpecified = objTempResponse.Audit.LastUpdate.TimeSpecified
                            tempAuditLastUpdate.Transaction = objTempResponse.Audit.LastUpdate.Transaction
                            tempAudit.LastUpdate = tempAuditLastUpdate
                        End If

                        objResponse.Audit = tempAudit
                    End If

                    objResponse.AccountCount = objTempResponse.AccountCount
                    objResponse.HistoryCount = objTempResponse.HistoryCount
                End If
                '############################
                Return objResponse
                '############################


            Else
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If




        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try

    End Function


    '################################################################################################
    'MODIFICATION	Sriman kanuri		CSG get/update security code - My Account 
    '################################################################################################    
    Public Overrides Function UpdateCustomField(ByVal obj As CharterDotCom.CommonEntities.Library.IProviderParameters) As CharterDotCom.CommonEntities.Library.IProviderResults
        '#######################################
        'TEMP LOCAL VARIABLES FOR REQUEST OBJECT
        '#######################################
        Dim objTempRequest As UpdateCustomFieldRequest
        Dim objRequest As WS_Customer.UpdateCustomFieldRequest

        '#######################################
        'TEMP LOCAL VARIABLES FOR RESPONSE OBJECT
        '#######################################
        Dim objTempResponse As WS_Customer.UpdateCustomFieldResponse
        Dim objResponse As New UpdateCustomFieldResponse

        Try
            objTempRequest = CType(obj, UpdateCustomFieldRequest)

            '#################################################
            'BUILD REQUEST OBJECT FOR THE WEB SERVICE REQUEST
            '#################################################
            If Not objTempRequest Is Nothing Then
                objRequest = New WS_Customer.UpdateCustomFieldRequest

                If Not objTempRequest.csgHeaderInfo Is Nothing Then
                    Dim objCSGHeaderInfo As New WS_Customer.CsgHeaderInfo()
                    objCSGHeaderInfo.ConversationId = objTempRequest.csgHeaderInfo.ConversationId
                    objCSGHeaderInfo.Region = objTempRequest.csgHeaderInfo.Region
                    objCSGHeaderInfo.RoutingArea = objTempRequest.csgHeaderInfo.RoutingArea

                    If Not String.IsNullOrEmpty(HttpContext.Current.Application("CSGOperatorIDForCharterDotCom")) Then
                        objCSGHeaderInfo.Operator = HttpContext.Current.Application("CSGOperatorIDForCharterDotCom").ToString().Trim()
                    End If

                    objCSGHeaderInfo.RealTime = True
                    objRequest.CsgHeaderInfo = objCSGHeaderInfo
                End If


                objRequest.CustomerID = objTempRequest.customerID

                If Not objTempRequest.CustomField Is Nothing Then
                    Dim objcustomField As New WS_Customer.customFieldUpdate

                    objcustomField.Index = objTempRequest.CustomField.Index
                    objcustomField.Value = objTempRequest.CustomField.Value

                    objRequest.CustomField = objcustomField
                End If



                '#################################################
                'Configure settings for EAI Customer service webservice
                '#################################################
                Dim context As HttpContext = HttpContext.Current
                Dim netCredential As NetworkCredential
                Dim uri As Uri
                wsCustomer = New WS_Customer.CustomerServicePort
                uri = New Uri(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_URL))
                Me.wsCustomer.Url = uri.AbsoluteUri
                wsCustomer.PreAuthenticate = True
                If CBool(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_AUTHENTICATIONREQUIRED)) Then
                    netCredential = New NetworkCredential(context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_USER).ToString, context.Application(Constant.EBSSERVICESPROVIDER_CUSTOMERWEBSERVICE_PASSWORD).ToString)
                    Me.Credentials = netCredential.GetCredential(uri, "Basic")
                    wsCustomer.Credentials = Me.Credentials
                End If


                If Not objTempRequest Is Nothing Then

                    '#############################
                    'EXECUTE THE WS CALL TO EAI
                    '#############################
                    objTempResponse = Me.wsCustomer.UpdateCustomField(objRequest)

                    '#########################################################################################
                    'translate back to a common object in the gateway, visible from Provider and the BL both.
                    '#########################################################################################
                    If (objTempResponse Is Nothing) Then
                        Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                    End If
                    If (objTempResponse.Result Is Nothing) Then
                        Throw New Exception(Constant.EXCEPTION_NODATA_RETURNED)
                    End If
                    If Not (objTempResponse.Result.ReturnCode = WS_Customer.ResultReturnCode.Success) Then
                        Throw New Exception(objTempResponse.Result.ExceptionInfo.Message.ToString())
                    End If


                    If Not objTempResponse.Result Is Nothing Then
                        If Not (objTempResponse.Result Is Nothing) Then
                            Dim lResult As New Result
                            lResult.DateTime = objTempResponse.Result.DateTime
                            lResult.Description = objTempResponse.Result.Description

                            If Not objTempResponse.Result.ExceptionInfo Is Nothing Then
                                Dim lExcepInfo As New ResultExceptionInfo
                                lExcepInfo.Code = objTempResponse.Result.ExceptionInfo.Code
                                lExcepInfo.Message = objTempResponse.Result.ExceptionInfo.Message
                                lExcepInfo.StackTrace = objTempResponse.Result.ExceptionInfo.StackTrace
                                lExcepInfo.Type = objTempResponse.Result.ExceptionInfo.Type
                                lResult.ExceptionInfo = lExcepInfo
                            End If

                            lResult.ReferenceCode = objTempResponse.Result.ReferenceCode

                            Select Case objTempResponse.Result.ReturnCode
                                Case WS_Customer.ResultReturnCode.BusinessRuleNotMet
                                    lResult.ReturnCode = ResultReturnCode.BusinessRuleNotMet
                                Case WS_Customer.ResultReturnCode.DatabaseError
                                    lResult.ReturnCode = ResultReturnCode.DatabaseError
                                Case WS_Customer.ResultReturnCode.Exception
                                    lResult.ReturnCode = ResultReturnCode.Exception
                                Case WS_Customer.ResultReturnCode.InvalidXml
                                    lResult.ReturnCode = ResultReturnCode.InvalidXml
                                Case WS_Customer.ResultReturnCode.NoDataFound
                                    lResult.ReturnCode = ResultReturnCode.NoDataFound
                                Case WS_Customer.ResultReturnCode.Success
                                    lResult.ReturnCode = ResultReturnCode.Success
                            End Select

                            lResult.Server = objTempResponse.Result.Server
                            lResult.Source = objTempResponse.Result.Source

                            If Not (objTempResponse.Result.StatusMessages Is Nothing) Then
                                Dim objCsgStatusMessage() As CsgStatusMessage = New CsgStatusMessage() {}
                                ReDim objCsgStatusMessage(objTempResponse.Result.StatusMessages.GetUpperBound(0))
                                For i As Integer = 0 To objTempResponse.Result.StatusMessages.GetUpperBound(0)
                                    objCsgStatusMessage(i) = New CsgStatusMessage
                                    objCsgStatusMessage(i).Code = objTempResponse.Result.StatusMessages(i).Code
                                    objCsgStatusMessage(i).Message = objTempResponse.Result.StatusMessages(i).Message
                                Next
                                lResult.StatusMessages = objCsgStatusMessage
                            End If

                            Select Case objTempResponse.Result.Type
                                Case WS_Customer.ResultType.Error
                                    lResult.Type = ResultType.Error
                                Case WS_Customer.ResultType.Informational
                                    lResult.Type = ResultType.Informational
                            End Select

                            objResponse.Result = lResult
                        End If
                    End If


                    objResponse.CustomerID = objTempResponse.CustomerID
                    Dim objCustomField() As customField = New customField() {}
                    ReDim objCustomField(objTempResponse.CustomField.GetUpperBound(0))

                    For icustomfield As Integer = 0 To objTempResponse.CustomField.GetUpperBound(0)
                        Dim tempcustomField As New customField
                        tempcustomField.Name = objTempResponse.CustomField(icustomfield).Name
                        tempcustomField.Index = objTempResponse.CustomField(icustomfield).Index
                        tempcustomField.Value = objTempResponse.CustomField(icustomfield).Value

                        objCustomField(icustomfield) = tempcustomField

                    Next
                    objResponse.CustomField = objCustomField

                End If

                '############################
                Return objResponse
                '############################


            Else
                Throw New Exception(Constant.EXCEPTION_INVALID_INPUT)
            End If


        Catch ex As Exception
            objResponse.Exception = True
            objResponse.ExceptionMessage = ex.Message
            objResponse.ExceptionStackTrace = ex.StackTrace
            Return objResponse
        Finally

        End Try

    End Function
End Class