'' ------------------------------------------------------------------------------
''  <auto-generated>
''    Generated by Xsd2Code++. Version 5.0.0.47. www.xsd2code.com
''    <NameSpace>MIC_IMPORT</NameSpace><Collection>List</Collection><codeType>VisualBasic</codeType><EnableDataBinding>False</EnableDataBinding><GenerateCloneMethod>False</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><DataMemberNameArg>OnlyIfDifferent</DataMemberNameArg><DataMemberOnXmlIgnore>False</DataMemberOnXmlIgnore><CodeBaseTag>Net45</CodeBaseTag><InitializeFields>All</InitializeFields><GenerateUnusedComplexTypes>True</GenerateUnusedComplexTypes><GenerateUnusedSimpleTypes>True</GenerateUnusedSimpleTypes><GenerateXMLAttributes>True</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableLazyLoading>False</EnableLazyLoading><VirtualProp>False</VirtualProp><PascalCase>False</PascalCase><AutomaticProperties>False</AutomaticProperties><PropNameSpecified>None</PropNameSpecified><PrivateFieldName>StartWithUnderscore</PrivateFieldName><PrivateFieldNamePrefix></PrivateFieldNamePrefix><EnableRestriction>False</EnableRestriction><RestrictionMaxLenght>False</RestrictionMaxLenght><RestrictionRegEx>False</RestrictionRegEx><RestrictionRange>False</RestrictionRange><ValidateProperty>False</ValidateProperty><ClassNamePrefix></ClassNamePrefix><ClassLevel>Public</ClassLevel><PartialClass>True</PartialClass><ClassesInSeparateFiles>False</ClassesInSeparateFiles><ClassesInSeparateFilesDir></ClassesInSeparateFilesDir><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>False</EnableSummaryComment><EnableAppInfoSettings>False</EnableAppInfoSettings><EnableExternalSchemasCache>False</EnableExternalSchemasCache><EnableDebug>False</EnableDebug><EnableWarn>True</EnableWarn><ExcludeImportedTypes>True</ExcludeImportedTypes><ExpandNesteadAttributeGroup>True</ExpandNesteadAttributeGroup><CleanupCode>False</CleanupCode><EnableXmlSerialization>True</EnableXmlSerialization><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><EnableEncoding>False</EnableEncoding><EnableXMLIndent>True</EnableXMLIndent><IndentChar>Indent2Space</IndentChar><NewLineAttr>False</NewLineAttr><OmitXML>False</OmitXML><Encoder>UTF8</Encoder><Serializer>XmlSerializer</Serializer><sspNullable>False</sspNullable><sspString>False</sspString><sspCollection>False</sspCollection><sspComplexType>False</sspComplexType><sspSimpleType>False</sspSimpleType><sspEnumType>False</sspEnumType><XmlSerializerEvent>False</XmlSerializerEvent><BaseClassName>EntityBase</BaseClassName><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><CustomUsings></CustomUsings><AttributesToExlude></AttributesToExlude>
''  </auto-generated>
'' ------------------------------------------------------------------------------
Imports System
Imports System.Diagnostics
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Xml.Schema
Imports System.ComponentModel
Imports System.IO
Imports System.Text
Imports System.Xml
Imports System.Collections.Generic
Imports VERAG_PROG_ALLGEMEIN.MIC_IMPORT_Invoice

Namespace MIC_IMPORT

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True, [Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1"),
     System.Xml.Serialization.XmlRootAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1", IsNullable:=False)>
    Partial Public Class ImportShipment

#Region "Private fields"
        Private _shipment As TShipment

        Private _invoice As List(Of TInvoice)

        Private _schemaVersion As Decimal

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._invoice = New List(Of TInvoice)()
            Me._shipment = New TShipment()
        End Sub

        Public Property Shipment() As TShipment
            Get
                Return Me._shipment
            End Get
            Set
                Me._shipment = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute("Invoice")>
        Public Property Invoice() As List(Of TInvoice)
            Get
                Return Me._invoice
            End Get
            Set
                Me._invoice = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlAttributeAttribute()>
        Public Property schemaVersion() As Decimal
            Get
                Return Me._schemaVersion
            End Get
            Set
                Me._schemaVersion = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(ImportShipment))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current ImportShipment object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an ImportShipment object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output ImportShipment object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As ImportShipment, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, ImportShipment)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As ImportShipment) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As ImportShipment
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), ImportShipment)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As ImportShipment
            Return CType(Serializer.Deserialize(s), ImportShipment)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current ImportShipment object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an ImportShipment object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output ImportShipment object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportShipment, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, ImportShipment)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportShipment) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As ImportShipment
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TShipment

#Region "Private fields"
        Private _company As String

        Private _plant As String

        Private _shipmentId As String

        Private _shipmentPartial As String

        Private _shipmentVersion As String

        Private _documentNumber As Decimal

        Private _shipmentHead As TShipmentHead

        Private _containers As List(Of TDetailContainerInfo)

        Private _documents As List(Of TDocument)

        Private _attributes As List(Of TAttribute)

        Private _partners As List(Of TPartner)

        Private _previousDocuments As List(Of TPrevDoc)

        Private _atlasCompletionSumDs As List(Of TAtlasCompSumDEntry)

        Private _additionalInformation As List(Of TAttribute)

        Private _authorisationHolders As TAuthHolders

        Private _defermentAccounts As TDeferAccs

        Private _guarantees As TGuarantees

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._guarantees = New TGuarantees()
            Me._defermentAccounts = New TDeferAccs()
            Me._authorisationHolders = New TAuthHolders()
            Me._additionalInformation = New List(Of TAttribute)()
            Me._atlasCompletionSumDs = New List(Of TAtlasCompSumDEntry)()
            Me._previousDocuments = New List(Of TPrevDoc)()
            Me._partners = New List(Of TPartner)()
            Me._attributes = New List(Of TAttribute)()
            Me._documents = New List(Of TDocument)()
            Me._containers = New List(Of TDetailContainerInfo)()
            Me._shipmentHead = New TShipmentHead()
            Me._shipmentVersion = "1"
            Me._documentNumber = CType(1D, Decimal)
        End Sub

        Public Property company() As String
            Get
                Return Me._company
            End Get
            Set
                Me._company = Value
            End Set
        End Property

        Public Property plant() As String
            Get
                Return Me._plant
            End Get
            Set
                Me._plant = Value
            End Set
        End Property

        Public Property shipmentId() As String
            Get
                Return Me._shipmentId
            End Get
            Set
                Me._shipmentId = Value
            End Set
        End Property

        Public Property shipmentPartial() As String
            Get
                Return Me._shipmentPartial
            End Get
            Set
                Me._shipmentPartial = Value
            End Set
        End Property

        <System.ComponentModel.DefaultValueAttribute("1")>
        Public Property shipmentVersion() As String
            Get
                Return Me._shipmentVersion
            End Get
            Set
                Me._shipmentVersion = Value
            End Set
        End Property

        <System.ComponentModel.DefaultValueAttribute(GetType(Decimal), "1")>
        Public Property documentNumber() As Decimal
            Get
                Return Me._documentNumber
            End Get
            Set
                Me._documentNumber = Value
            End Set
        End Property

        Public Property ShipmentHead() As TShipmentHead
            Get
                Return Me._shipmentHead
            End Get
            Set
                Me._shipmentHead = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlArrayItemAttribute("DetailContainerInfo", IsNullable:=False)>
        Public Property Containers() As List(Of TDetailContainerInfo)
            Get
                Return Me._containers
            End Get
            Set
                Me._containers = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlArrayItemAttribute("Document", IsNullable:=False)>
        Public Property Documents() As List(Of TDocument)
            Get
                Return Me._documents
            End Get
            Set
                Me._documents = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlArrayItemAttribute("Attribute", IsNullable:=False)>
        Public Property Attributes() As List(Of TAttribute)
            Get
                Return Me._attributes
            End Get
            Set
                Me._attributes = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlArrayItemAttribute("Partner", IsNullable:=False)>
        Public Property Partners() As List(Of TPartner)
            Get
                Return Me._partners
            End Get
            Set
                Me._partners = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlArrayItemAttribute("PreviousDocument", IsNullable:=False)>
        Public Property PreviousDocuments() As List(Of TPrevDoc)
            Get
                Return Me._previousDocuments
            End Get
            Set
                Me._previousDocuments = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlArrayItemAttribute("AtlasCompletionSumD", IsNullable:=False)>
        Public Property AtlasCompletionSumDs() As List(Of TAtlasCompSumDEntry)
            Get
                Return Me._atlasCompletionSumDs
            End Get
            Set
                Me._atlasCompletionSumDs = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlArrayItemAttribute("Attribute", IsNullable:=False)>
        Public Property AdditionalInformation() As List(Of TAttribute)
            Get
                Return Me._additionalInformation
            End Get
            Set
                Me._additionalInformation = Value
            End Set
        End Property

        Public Property AuthorisationHolders() As TAuthHolders
            Get
                Return Me._authorisationHolders
            End Get
            Set
                Me._authorisationHolders = Value
            End Set
        End Property

        Public Property DefermentAccounts() As TDeferAccs
            Get
                Return Me._defermentAccounts
            End Get
            Set
                Me._defermentAccounts = Value
            End Set
        End Property

        Public Property Guarantees() As TGuarantees
            Get
                Return Me._guarantees
            End Get
            Set
                Me._guarantees = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipment))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TShipment object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TShipment object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TShipment object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipment, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TShipment)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipment) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TShipment
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TShipment)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TShipment
            Return CType(Serializer.Deserialize(s), TShipment)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TShipment object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TShipment object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TShipment object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipment, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TShipment)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipment) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TShipment
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TShipmentHead

#Region "Private fields"
        Private _shipmentType As TShipmentHeadShipmentType

        Private _customsDate As Date

        Private _declType As TDeclType

        Private _mrn As String

        Private _grossWeight As Decimal

        Private _departurePlace As String

        Private _dispatchCountry As String

        Private _lastDispatchCountry As String

        Private _destinationPlace As String

        Private _destinationRegion As String

        Private _officeEntry As String

        Private _importState As String

        Private _substituteFlag As String

        Private _typeOfImport As String

        Private _authorizationNumber As String

        Private _placeOfDispatchDescription As String

        Private _typeOfAirTransportation As String

        Private _motBorder As TMot

        Private _motBorderCrossing As TMot

        Private _motInland As TMot

        Private _containerIndicator As String

        Private _container As TContainer

        Private _freight As TFreightCosts

        Private _insurance As TInsuranceCosts

        Private _additionalCosts As List(Of TAddCosts)

        Private _additionalCostVAT As Decimal

        Private _text As String

        Private _exportDate As Date

        Private _importDate As Date

        Private _estArrivalDate As Date

        Private _partyConst As String

        Private _period As String

        Private _customerFields As TCustomerFields

        Private _countryDestination As String

        Private _clearenceType As String

        Private _previousDocType As String

        Private _previousDocNumber As String

        Private _customsOfficeOfDestination As String

        Private _carrierNumber As String

        Private _creationUser As String

        Private _creationDate As Date

        Private _modificationUser As String

        Private _modificationDate As Date

        Private _supervisingOffice As String

        Private _typeIdentificationOfTransportArrival As String

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._customerFields = New TCustomerFields()
            Me._additionalCosts = New List(Of TAddCosts)()
            Me._insurance = New TInsuranceCosts()
            Me._freight = New TFreightCosts()
            Me._container = New TContainer()
            Me._motInland = New TMot()
            Me._motBorderCrossing = New TMot()
            Me._motBorder = New TMot()
            Me._declType = New TDeclType()
            Me._shipmentType = TShipmentHeadShipmentType.E
            Me._containerIndicator = "0"
        End Sub

        <System.ComponentModel.DefaultValueAttribute(TShipmentHeadShipmentType.E)>
        Public Property shipmentType() As TShipmentHeadShipmentType
            Get
                Return Me._shipmentType
            End Get
            Set
                Me._shipmentType = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(DataType:="date")>
        Public Property customsDate() As Date
            Get
                Return Me._customsDate
            End Get
            Set
                Me._customsDate = Value
            End Set
        End Property

        Public Property declType() As TDeclType
            Get
                Return Me._declType
            End Get
            Set
                Me._declType = Value
            End Set
        End Property

        Public Property mrn() As String
            Get
                Return Me._mrn
            End Get
            Set
                Me._mrn = Value
            End Set
        End Property

        Public Property grossWeight() As Decimal
            Get
                Return Me._grossWeight
            End Get
            Set
                Me._grossWeight = Value
            End Set
        End Property

        Public Property departurePlace() As String
            Get
                Return Me._departurePlace
            End Get
            Set
                Me._departurePlace = Value
            End Set
        End Property

        Public Property dispatchCountry() As String
            Get
                Return Me._dispatchCountry
            End Get
            Set
                Me._dispatchCountry = Value
            End Set
        End Property

        Public Property lastDispatchCountry() As String
            Get
                Return Me._lastDispatchCountry
            End Get
            Set
                Me._lastDispatchCountry = Value
            End Set
        End Property

        Public Property destinationPlace() As String
            Get
                Return Me._destinationPlace
            End Get
            Set
                Me._destinationPlace = Value
            End Set
        End Property

        Public Property destinationRegion() As String
            Get
                Return Me._destinationRegion
            End Get
            Set
                Me._destinationRegion = Value
            End Set
        End Property

        Public Property officeEntry() As String
            Get
                Return Me._officeEntry
            End Get
            Set
                Me._officeEntry = Value
            End Set
        End Property

        Public Property importState() As String
            Get
                Return Me._importState
            End Get
            Set
                Me._importState = Value
            End Set
        End Property

        Public Property substituteFlag() As String
            Get
                Return Me._substituteFlag
            End Get
            Set
                Me._substituteFlag = Value
            End Set
        End Property

        Public Property typeOfImport() As String
            Get
                Return Me._typeOfImport
            End Get
            Set
                Me._typeOfImport = Value
            End Set
        End Property

        Public Property authorizationNumber() As String
            Get
                Return Me._authorizationNumber
            End Get
            Set
                Me._authorizationNumber = Value
            End Set
        End Property

        Public Property placeOfDispatchDescription() As String
            Get
                Return Me._placeOfDispatchDescription
            End Get
            Set
                Me._placeOfDispatchDescription = Value
            End Set
        End Property

        Public Property typeOfAirTransportation() As String
            Get
                Return Me._typeOfAirTransportation
            End Get
            Set
                Me._typeOfAirTransportation = Value
            End Set
        End Property

        Public Property MotBorder() As TMot
            Get
                Return Me._motBorder
            End Get
            Set
                Me._motBorder = Value
            End Set
        End Property

        Public Property MotBorderCrossing() As TMot
            Get
                Return Me._motBorderCrossing
            End Get
            Set
                Me._motBorderCrossing = Value
            End Set
        End Property

        Public Property MotInland() As TMot
            Get
                Return Me._motInland
            End Get
            Set
                Me._motInland = Value
            End Set
        End Property

        <System.ComponentModel.DefaultValueAttribute("0")>
        Public Property containerIndicator() As String
            Get
                Return Me._containerIndicator
            End Get
            Set
                Me._containerIndicator = Value
            End Set
        End Property

        Public Property Container() As TContainer
            Get
                Return Me._container
            End Get
            Set
                Me._container = Value
            End Set
        End Property

        Public Property Freight() As TFreightCosts
            Get
                Return Me._freight
            End Get
            Set
                Me._freight = Value
            End Set
        End Property

        Public Property Insurance() As TInsuranceCosts
            Get
                Return Me._insurance
            End Get
            Set
                Me._insurance = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute("AdditionalCosts")>
        Public Property AdditionalCosts() As List(Of TAddCosts)
            Get
                Return Me._additionalCosts
            End Get
            Set
                Me._additionalCosts = Value
            End Set
        End Property

        Public Property additionalCostVAT() As Decimal
            Get
                Return Me._additionalCostVAT
            End Get
            Set
                Me._additionalCostVAT = Value
            End Set
        End Property

        Public Property text() As String
            Get
                Return Me._text
            End Get
            Set
                Me._text = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(DataType:="date")>
        Public Property exportDate() As Date
            Get
                Return Me._exportDate
            End Get
            Set
                Me._exportDate = Value
            End Set
        End Property

        <System.Xml.Serialization.XmlElementAttribute(DataType:="date")>
        Public Property importDate() As Date
            Get
                Return Me._importDate
            End Get
            Set
                Me._importDate = Value
            End Set
        End Property

        Public Property estArrivalDate() As Date
            Get
                Return Me._estArrivalDate
            End Get
            Set
                Me._estArrivalDate = Value
            End Set
        End Property

        Public Property partyConst() As String
            Get
                Return Me._partyConst
            End Get
            Set
                Me._partyConst = Value
            End Set
        End Property

        Public Property period() As String
            Get
                Return Me._period
            End Get
            Set
                Me._period = Value
            End Set
        End Property

        Public Property CustomerFields() As TCustomerFields
            Get
                Return Me._customerFields
            End Get
            Set
                Me._customerFields = Value
            End Set
        End Property

        Public Property countryDestination() As String
            Get
                Return Me._countryDestination
            End Get
            Set
                Me._countryDestination = Value
            End Set
        End Property

        Public Property clearenceType() As String
            Get
                Return Me._clearenceType
            End Get
            Set
                Me._clearenceType = Value
            End Set
        End Property

        Public Property previousDocType() As String
            Get
                Return Me._previousDocType
            End Get
            Set
                Me._previousDocType = Value
            End Set
        End Property

        Public Property previousDocNumber() As String
            Get
                Return Me._previousDocNumber
            End Get
            Set
                Me._previousDocNumber = Value
            End Set
        End Property

        Public Property customsOfficeOfDestination() As String
            Get
                Return Me._customsOfficeOfDestination
            End Get
            Set
                Me._customsOfficeOfDestination = Value
            End Set
        End Property

        Public Property carrierNumber() As String
            Get
                Return Me._carrierNumber
            End Get
            Set
                Me._carrierNumber = Value
            End Set
        End Property

        Public Property creationUser() As String
            Get
                Return Me._creationUser
            End Get
            Set
                Me._creationUser = Value
            End Set
        End Property

        Public Property creationDate() As Date
            Get
                Return Me._creationDate
            End Get
            Set
                Me._creationDate = Value
            End Set
        End Property

        Public Property modificationUser() As String
            Get
                Return Me._modificationUser
            End Get
            Set
                Me._modificationUser = Value
            End Set
        End Property

        Public Property modificationDate() As Date
            Get
                Return Me._modificationDate
            End Get
            Set
                Me._modificationDate = Value
            End Set
        End Property

        Public Property supervisingOffice() As String
            Get
                Return Me._supervisingOffice
            End Get
            Set
                Me._supervisingOffice = Value
            End Set
        End Property

        Public Property typeIdentificationOfTransportArrival() As String
            Get
                Return Me._typeIdentificationOfTransportArrival
            End Get
            Set
                Me._typeIdentificationOfTransportArrival = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHead))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TShipmentHead object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TShipmentHead object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TShipmentHead object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHead, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TShipmentHead)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHead) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TShipmentHead
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TShipmentHead)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TShipmentHead
            Return CType(Serializer.Deserialize(s), TShipmentHead)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TShipmentHead object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TShipmentHead object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TShipmentHead object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHead, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TShipmentHead)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHead) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TShipmentHead
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True, [Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Public Enum TShipmentHeadShipmentType

        '''<remarks/>
        E

        '''<remarks/>
        B

        '''<remarks/>
        U

        '''<remarks/>
        X

        '''<remarks/>
        I
    End Enum

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TGuarantee

#Region "Private fields"
        Private _guaranteeNumber As Long

        Private _guaranteeCode As String

        Private _guaranteeType As String

        Private _guaranteeAmount As Decimal

        Private _guaranteeCurrency As String

        Private _guaranteeReference As String

        Private _guaranteeCustomsOffice As String

        Private _localBase As Decimal

        Private _factoringBase As String

        Private _customsRate As Decimal

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Property guaranteeNumber() As Long
            Get
                Return Me._guaranteeNumber
            End Get
            Set
                Me._guaranteeNumber = Value
            End Set
        End Property

        Public Property guaranteeCode() As String
            Get
                Return Me._guaranteeCode
            End Get
            Set
                Me._guaranteeCode = Value
            End Set
        End Property

        Public Property guaranteeType() As String
            Get
                Return Me._guaranteeType
            End Get
            Set
                Me._guaranteeType = Value
            End Set
        End Property

        Public Property guaranteeAmount() As Decimal
            Get
                Return Me._guaranteeAmount
            End Get
            Set
                Me._guaranteeAmount = Value
            End Set
        End Property

        Public Property guaranteeCurrency() As String
            Get
                Return Me._guaranteeCurrency
            End Get
            Set
                Me._guaranteeCurrency = Value
            End Set
        End Property

        Public Property guaranteeReference() As String
            Get
                Return Me._guaranteeReference
            End Get
            Set
                Me._guaranteeReference = Value
            End Set
        End Property

        Public Property guaranteeCustomsOffice() As String
            Get
                Return Me._guaranteeCustomsOffice
            End Get
            Set
                Me._guaranteeCustomsOffice = Value
            End Set
        End Property

        Public Property localBase() As Decimal
            Get
                Return Me._localBase
            End Get
            Set
                Me._localBase = Value
            End Set
        End Property

        Public Property factoringBase() As String
            Get
                Return Me._factoringBase
            End Get
            Set
                Me._factoringBase = Value
            End Set
        End Property

        Public Property customsRate() As Decimal
            Get
                Return Me._customsRate
            End Get
            Set
                Me._customsRate = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TGuarantee))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TGuarantee object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TGuarantee object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TGuarantee object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TGuarantee, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TGuarantee)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TGuarantee) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TGuarantee
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TGuarantee)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TGuarantee
            Return CType(Serializer.Deserialize(s), TGuarantee)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TGuarantee object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TGuarantee object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TGuarantee object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TGuarantee, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TGuarantee)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TGuarantee) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TGuarantee
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TGuarantees

#Region "Private fields"
        Private _guarantee As List(Of TGuarantee)

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._guarantee = New List(Of TGuarantee)()
        End Sub

        <System.Xml.Serialization.XmlElementAttribute("Guarantee")>
        Public Property Guarantee() As List(Of TGuarantee)
            Get
                Return Me._guarantee
            End Get
            Set
                Me._guarantee = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TGuarantees))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TGuarantees object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TGuarantees object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TGuarantees object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TGuarantees, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TGuarantees)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TGuarantees) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TGuarantees
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TGuarantees)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TGuarantees
            Return CType(Serializer.Deserialize(s), TGuarantees)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TGuarantees object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TGuarantees object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TGuarantees object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TGuarantees, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TGuarantees)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TGuarantees) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TGuarantees
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TDeferAcc

#Region "Private fields"
        Private _accountNumber1 As String

        Private _accountNumber2 As String

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Property accountNumber1() As String
            Get
                Return Me._accountNumber1
            End Get
            Set
                Me._accountNumber1 = Value
            End Set
        End Property

        Public Property accountNumber2() As String
            Get
                Return Me._accountNumber2
            End Get
            Set
                Me._accountNumber2 = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TDeferAcc))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TDeferAcc object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TDeferAcc object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TDeferAcc object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDeferAcc, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TDeferAcc)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDeferAcc) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TDeferAcc
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TDeferAcc)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TDeferAcc
            Return CType(Serializer.Deserialize(s), TDeferAcc)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TDeferAcc object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TDeferAcc object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TDeferAcc object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeferAcc, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TDeferAcc)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeferAcc) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDeferAcc
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TDeferAccs

#Region "Private fields"
        Private _defermentAccount As TDeferAcc

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._defermentAccount = New TDeferAcc()
        End Sub

        Public Property DefermentAccount() As TDeferAcc
            Get
                Return Me._defermentAccount
            End Get
            Set
                Me._defermentAccount = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TDeferAccs))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TDeferAccs object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TDeferAccs object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TDeferAccs object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDeferAccs, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TDeferAccs)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDeferAccs) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TDeferAccs
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TDeferAccs)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TDeferAccs
            Return CType(Serializer.Deserialize(s), TDeferAccs)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TDeferAccs object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TDeferAccs object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TDeferAccs object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeferAccs, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TDeferAccs)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeferAccs) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDeferAccs
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TAuthHolder

#Region "Private fields"
        Private _typeCode As String

        Private _identifier As String

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Property typeCode() As String
            Get
                Return Me._typeCode
            End Get
            Set
                Me._typeCode = Value
            End Set
        End Property

        Public Property identifier() As String
            Get
                Return Me._identifier
            End Get
            Set
                Me._identifier = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TAuthHolder))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TAuthHolder object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TAuthHolder object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TAuthHolder object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAuthHolder, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TAuthHolder)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAuthHolder) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TAuthHolder
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TAuthHolder)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TAuthHolder
            Return CType(Serializer.Deserialize(s), TAuthHolder)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TAuthHolder object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TAuthHolder object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TAuthHolder object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAuthHolder, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TAuthHolder)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAuthHolder) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAuthHolder
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class

    <System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
     System.SerializableAttribute(),
     System.Diagnostics.DebuggerStepThroughAttribute(),
     System.ComponentModel.DesignerCategoryAttribute("code"),
     System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:http://www.mic-cust.com/MicCustImportShipment/6.1")>
    Partial Public Class TAuthHolders

#Region "Private fields"
        Private _authorisationHolder As List(Of TAuthHolder)

        Private Shared sSerializer As XmlSerializer
#End Region

        Public Sub New()
            MyBase.New
            Me._authorisationHolder = New List(Of TAuthHolder)()
        End Sub

        <System.Xml.Serialization.XmlElementAttribute("AuthorisationHolder")>
        Public Property AuthorisationHolder() As List(Of TAuthHolder)
            Get
                Return Me._authorisationHolder
            End Get
            Set
                Me._authorisationHolder = Value
            End Set
        End Property

        Private Shared ReadOnly Property Serializer() As XmlSerializer
            Get
                If (sSerializer Is Nothing) Then
                    sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TAuthHolders))
                End If
                Return sSerializer
            End Get
        End Property

#Region "Serialize/Deserialize"
        ''' <summary>
        ''' Serializes current TAuthHolders object into an XML string
        ''' </summary>
        ''' <returns>string XML value</returns>
        Public Overridable Function Serialize() As String
            Dim streamReader As System.IO.StreamReader = Nothing
            Dim memoryStream As System.IO.MemoryStream = Nothing
            Try
                memoryStream = New System.IO.MemoryStream()
                Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
                xmlWriterSettings.Indent = True
                xmlWriterSettings.IndentChars = "  "
                Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
                Serializer.Serialize(xmlWriter, Me)
                memoryStream.Seek(0, SeekOrigin.Begin)
                streamReader = New System.IO.StreamReader(memoryStream)
                Return streamReader.ReadToEnd
            Finally
                If (Not (streamReader) Is Nothing) Then
                    streamReader.Dispose()
                End If
                If (Not (memoryStream) Is Nothing) Then
                    memoryStream.Dispose()
                End If
            End Try
        End Function

        ''' <summary>
        ''' Deserializes workflow markup into an TAuthHolders object
        ''' </summary>
        ''' <param name="input">string workflow markup to deserialize</param>
        ''' <param name="obj">Output TAuthHolders object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAuthHolders, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TAuthHolders)
            Try
                obj = Deserialize(input)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAuthHolders) As Boolean
            Dim exception As System.Exception = Nothing
            Return Deserialize(input, obj, exception)
        End Function

        Public Overloads Shared Function Deserialize(ByVal input As String) As TAuthHolders
            Dim stringReader As System.IO.StringReader = Nothing
            Try
                stringReader = New System.IO.StringReader(input)
                Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TAuthHolders)
            Finally
                If (Not (stringReader) Is Nothing) Then
                    stringReader.Dispose()
                End If
            End Try
        End Function

        Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TAuthHolders
            Return CType(Serializer.Deserialize(s), TAuthHolders)
        End Function
#End Region

        ''' <summary>
        ''' Serializes current TAuthHolders object into file
        ''' </summary>
        ''' <param name="fileName">full path of outupt xml file</param>
        ''' <param name="exception">output Exception value if failed</param>
        ''' <returns>true if can serialize and save into file; otherwise, false</returns>
        Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            Try
                SaveToFile(fileName)
                Return True
            Catch e As System.Exception
                exception = e
                Return False
            End Try
        End Function

        Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
            Dim streamWriter As System.IO.StreamWriter = Nothing
            Try
                Dim xmlString As String = Serialize()
                Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
                streamWriter = xmlFile.CreateText
                streamWriter.WriteLine(xmlString)
                streamWriter.Close()
            Finally
                If (Not (streamWriter) Is Nothing) Then
                    streamWriter.Dispose()
                End If
            End Try
        End Sub

        ''' <summary>
        ''' Deserializes xml markup from file into an TAuthHolders object
        ''' </summary>
        ''' <param name="fileName">string xml file to load and deserialize</param>
        ''' <param name="obj">Output TAuthHolders object</param>
        ''' <param name="exception">output Exception value if deserialize failed</param>
        ''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAuthHolders, ByRef exception As System.Exception) As Boolean
            exception = Nothing
            obj = CType(Nothing, TAuthHolders)
            Try
                obj = LoadFromFile(fileName)
                Return True
            Catch ex As System.Exception
                exception = ex
                Return False
            End Try
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAuthHolders) As Boolean
            Dim exception As System.Exception = Nothing
            Return LoadFromFile(fileName, obj, exception)
        End Function

        Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAuthHolders
            Dim file As System.IO.FileStream = Nothing
            Dim sr As System.IO.StreamReader = Nothing
            Try
                file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
                sr = New System.IO.StreamReader(file)
                Dim xmlString As String = sr.ReadToEnd
                sr.Close()
                file.Close()
                Return Deserialize(xmlString)
            Finally
                If (Not (file) Is Nothing) Then
                    file.Dispose()
                End If
                If (Not (sr) Is Nothing) Then
                    sr.Dispose()
                End If
            End Try
        End Function
    End Class
End Namespace
