'' ------------------------------------------------------------------------------ '' '' Generated by Xsd2Code++. Version 6.0.0.0. www.xsd2code.com '' {"TargetFramework":"Net48","NameSpace":"MicCustExportShipment","Language":"VisualBasic","Properties":{},"XmlAttribute":{"Enabled":true},"ClassParams":{},"Serialization":{"ShouldSerialize":{},"AdditionalSerializers":{},"XmlSerializerEvent":{},"XmlOutput":{},"JsonOutput":{},"Enabled":true},"Miscellaneous":{}} '' '' ------------------------------------------------------------------------------ #Disable Warning Imports System Imports System.Diagnostics Imports System.Xml.Serialization Imports System.Runtime.Serialization Imports System.Collections Imports System.Xml.Schema Imports System.ComponentModel Imports System.Xml Imports System.IO Imports System.Text Imports System.Collections.Generic Namespace MicCustExportShipment Partial Public Class ExportShipment #Region "Private fields" Private _shipmentHead As TShipmentHead Private _invoices As List(Of TInvoice) Private _packages As List(Of TPackage) Private _schemaVersion As Decimal Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._packages = New List(Of TPackage)() Me._invoices = New List(Of TInvoice)() Me._shipmentHead = New TShipmentHead() End Sub Public Property ShipmentHead() As TShipmentHead Get Return Me._shipmentHead End Get Set Me._shipmentHead = Value End Set End Property Public Property Invoices() As List(Of TInvoice) Get Return Me._invoices End Get Set Me._invoices = Value End Set End Property Public Property Packages() As List(Of TPackage) Get Return Me._packages End Get Set Me._packages = Value End Set End Property Public Property schemaVersion() As Decimal Get Return Me._schemaVersion End Get Set Me._schemaVersion = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ExportShipment)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ExportShipment object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes ExportShipment object ''' ''' string to deserialize ''' Output ExportShipment object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As ExportShipment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ExportShipment) 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 ExportShipment) 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 ExportShipment Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ExportShipment) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ExportShipment Return CType(SerializerXml.Deserialize(s), ExportShipment) End Function #End Region ''' ''' Serializes current ExportShipment object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ExportShipment object ''' ''' File to load and deserialize ''' Output ExportShipment object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ExportShipment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ExportShipment) 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 ExportShipment) 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 ExportShipment Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHead #Region "Private fields" Private _company As String Private _plant As String Private _shipmentId As String Private _shipmentVersion As String Private _shipmentIdPart As String Private _shipmentType As String Private _mrn As String Private _deliveryDate As Date Private _cod As String Private _exportCountry As String Private _contCode As ContainerCode Private _gWeight As Decimal Private _dateStartPack As Date Private _dateEndPack As Date Private _partyConst As String Private _security As String Private _consigneeEndUserFlag As String Private _endUserInEam As TShipmentHeadEndUserInEam Private _estimatedArrivalDate As Date Private _nctsIndicator As Boolean Private _motInl As TMotInl Private _text As List(Of String) Private _partners As List(Of TPartner) Private _locGoods As TLocationOfGoods Private _officeDepart As TCustomsOffice Private _officeBorder As TCustomsOffice Private _officeSupervising As TCustomsOffice Private _motBorder As TMot Private _seals As List(Of TSeal) Private _declType As TDeclType Private _placeDest As String Private _authLocation As String Private _declPlace As String Private _agreedLocationOfGoodsCd As String Private _agreedLocationOfGoods As String Private _custSubPlace As String Private _codFirst As String Private _broker As String Private _waybillNumber As String Private _waybillDate As Date Private _houseWaybillNumber As String Private _houseWaybillDate As Date Private _officeDest As TCustomsOffice Private _carrier As String Private _containers As List(Of TContainer) Private _freightCost As TFreight Private _addCosts As List(Of TAddCosts) Private _assurCost As TAssurance Private _groupID As String Private _documents As List(Of TDocuments) Private _regNoExt As String Private _customerFields As TCustomerFields Private _attributes As List(Of TAttribute) Private _coe As String Private _specCircum As String Private _carriageCosts As String Private _shipmentIdentification As String Private _conveyRefNr As String Private _unloadingPlace As String Private _route As List(Of TRoute) Private _express As String Private _routeName As String Private _authorisationNo As String Private _authorisation As TShipmentHeadAuthorisation Private _postExportDeclaration As TShipmentHeadPostExportDeclaration Private _oprData As TShipmentHeadOprData Private _additionalInformation As List(Of TAttribute) Private _stateOfAffairs As List(Of TStateOfAffairs) Private _erpData As TErpShipmentData Private _authorisations As List(Of TAuthorisation) Private _prevDoc As List(Of TShipmentPreviousDocument) Private _departureTransportMeans As List(Of TShipmentHeadDepartureTransportMeans) Private _officePresentation As TCustomsOffice Private _deliveryType As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._officePresentation = New TCustomsOffice() Me._departureTransportMeans = New List(Of TShipmentHeadDepartureTransportMeans)() Me._prevDoc = New List(Of TShipmentPreviousDocument)() Me._authorisations = New List(Of TAuthorisation)() Me._erpData = New TErpShipmentData() Me._stateOfAffairs = New List(Of TStateOfAffairs)() Me._additionalInformation = New List(Of TAttribute)() Me._oprData = New TShipmentHeadOprData() Me._postExportDeclaration = New TShipmentHeadPostExportDeclaration() Me._authorisation = New TShipmentHeadAuthorisation() Me._route = New List(Of TRoute)() Me._attributes = New List(Of TAttribute)() Me._customerFields = New TCustomerFields() Me._documents = New List(Of TDocuments)() Me._assurCost = New TAssurance() Me._addCosts = New List(Of TAddCosts)() Me._freightCost = New TFreight() Me._containers = New List(Of TContainer)() Me._officeDest = New TCustomsOffice() Me._declType = New TDeclType() Me._seals = New List(Of TSeal)() Me._motBorder = New TMot() Me._officeSupervising = New TCustomsOffice() Me._officeBorder = New TCustomsOffice() Me._officeDepart = New TCustomsOffice() Me._locGoods = New TLocationOfGoods() Me._partners = New List(Of TPartner)() Me._text = New List(Of String)() Me._motInl = New TMotInl() Me._shipmentVersion = "1" 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 shipmentVersion() As String Get Return Me._shipmentVersion End Get Set Me._shipmentVersion = Value End Set End Property Public Property shipmentIdPart() As String Get Return Me._shipmentIdPart End Get Set Me._shipmentIdPart = Value End Set End Property Public Property shipmentType() As String Get Return Me._shipmentType End Get Set Me._shipmentType = 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 deliveryDate() As Date Get Return Me._deliveryDate End Get Set Me._deliveryDate = Value End Set End Property Public Property cod() As String Get Return Me._cod End Get Set Me._cod = Value End Set End Property Public Property exportCountry() As String Get Return Me._exportCountry End Get Set Me._exportCountry = Value End Set End Property Public Property contCode() As ContainerCode Get Return Me._contCode End Get Set Me._contCode = Value End Set End Property Public Property gWeight() As Decimal Get Return Me._gWeight End Get Set Me._gWeight = Value End Set End Property Public Property dateStartPack() As Date Get Return Me._dateStartPack End Get Set Me._dateStartPack = Value End Set End Property Public Property dateEndPack() As Date Get Return Me._dateEndPack End Get Set Me._dateEndPack = 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 security() As String Get Return Me._security End Get Set Me._security = Value End Set End Property Public Property consigneeEndUserFlag() As String Get Return Me._consigneeEndUserFlag End Get Set Me._consigneeEndUserFlag = Value End Set End Property Public Property endUserInEam() As TShipmentHeadEndUserInEam Get Return Me._endUserInEam End Get Set Me._endUserInEam = Value End Set End Property Public Property estimatedArrivalDate() As Date Get Return Me._estimatedArrivalDate End Get Set Me._estimatedArrivalDate = Value End Set End Property Public Property nctsIndicator() As Boolean Get Return Me._nctsIndicator End Get Set Me._nctsIndicator = Value End Set End Property Public Property motInl() As TMotInl Get Return Me._motInl End Get Set Me._motInl = Value End Set End Property Public Property text() As List(Of String) Get Return Me._text End Get Set Me._text = Value End Set End Property Public Property partners() As List(Of TPartner) Get Return Me._partners End Get Set Me._partners = Value End Set End Property Public Property locGoods() As TLocationOfGoods Get Return Me._locGoods End Get Set Me._locGoods = Value End Set End Property Public Property officeDepart() As TCustomsOffice Get Return Me._officeDepart End Get Set Me._officeDepart = Value End Set End Property Public Property officeBorder() As TCustomsOffice Get Return Me._officeBorder End Get Set Me._officeBorder = Value End Set End Property Public Property officeSupervising() As TCustomsOffice Get Return Me._officeSupervising End Get Set Me._officeSupervising = 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 seals() As List(Of TSeal) Get Return Me._seals End Get Set Me._seals = 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 placeDest() As String Get Return Me._placeDest End Get Set Me._placeDest = Value End Set End Property Public Property authLocation() As String Get Return Me._authLocation End Get Set Me._authLocation = Value End Set End Property Public Property declPlace() As String Get Return Me._declPlace End Get Set Me._declPlace = Value End Set End Property Public Property agreedLocationOfGoodsCd() As String Get Return Me._agreedLocationOfGoodsCd End Get Set Me._agreedLocationOfGoodsCd = Value End Set End Property Public Property agreedLocationOfGoods() As String Get Return Me._agreedLocationOfGoods End Get Set Me._agreedLocationOfGoods = Value End Set End Property Public Property custSubPlace() As String Get Return Me._custSubPlace End Get Set Me._custSubPlace = Value End Set End Property Public Property codFirst() As String Get Return Me._codFirst End Get Set Me._codFirst = Value End Set End Property Public Property broker() As String Get Return Me._broker End Get Set Me._broker = Value End Set End Property Public Property waybillNumber() As String Get Return Me._waybillNumber End Get Set Me._waybillNumber = Value End Set End Property Public Property waybillDate() As Date Get Return Me._waybillDate End Get Set Me._waybillDate = Value End Set End Property Public Property houseWaybillNumber() As String Get Return Me._houseWaybillNumber End Get Set Me._houseWaybillNumber = Value End Set End Property Public Property houseWaybillDate() As Date Get Return Me._houseWaybillDate End Get Set Me._houseWaybillDate = Value End Set End Property Public Property officeDest() As TCustomsOffice Get Return Me._officeDest End Get Set Me._officeDest = Value End Set End Property Public Property carrier() As String Get Return Me._carrier End Get Set Me._carrier = Value End Set End Property Public Property containers() As List(Of TContainer) Get Return Me._containers End Get Set Me._containers = Value End Set End Property Public Property freightCost() As TFreight Get Return Me._freightCost End Get Set Me._freightCost = Value End Set End Property Public Property addCosts() As List(Of TAddCosts) Get Return Me._addCosts End Get Set Me._addCosts = Value End Set End Property Public Property assurCost() As TAssurance Get Return Me._assurCost End Get Set Me._assurCost = Value End Set End Property Public Property groupID() As String Get Return Me._groupID End Get Set Me._groupID = Value End Set End Property Public Property documents() As List(Of TDocuments) Get Return Me._documents End Get Set Me._documents = Value End Set End Property Public Property regNoExt() As String Get Return Me._regNoExt End Get Set Me._regNoExt = 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 attributes() As List(Of TAttribute) Get Return Me._attributes End Get Set Me._attributes = Value End Set End Property Public Property coe() As String Get Return Me._coe End Get Set Me._coe = Value End Set End Property Public Property specCircum() As String Get Return Me._specCircum End Get Set Me._specCircum = Value End Set End Property Public Property carriageCosts() As String Get Return Me._carriageCosts End Get Set Me._carriageCosts = Value End Set End Property Public Property shipmentIdentification() As String Get Return Me._shipmentIdentification End Get Set Me._shipmentIdentification = Value End Set End Property Public Property conveyRefNr() As String Get Return Me._conveyRefNr End Get Set Me._conveyRefNr = Value End Set End Property Public Property unloadingPlace() As String Get Return Me._unloadingPlace End Get Set Me._unloadingPlace = Value End Set End Property Public Property route() As List(Of TRoute) Get Return Me._route End Get Set Me._route = Value End Set End Property Public Property express() As String Get Return Me._express End Get Set Me._express = Value End Set End Property Public Property routeName() As String Get Return Me._routeName End Get Set Me._routeName = Value End Set End Property Public Property authorisationNo() As String Get Return Me._authorisationNo End Get Set Me._authorisationNo = Value End Set End Property Public Property authorisation() As TShipmentHeadAuthorisation Get Return Me._authorisation End Get Set Me._authorisation = Value End Set End Property Public Property postExportDeclaration() As TShipmentHeadPostExportDeclaration Get Return Me._postExportDeclaration End Get Set Me._postExportDeclaration = Value End Set End Property Public Property oprData() As TShipmentHeadOprData Get Return Me._oprData End Get Set Me._oprData = Value End Set End Property Public Property additionalInformation() As List(Of TAttribute) Get Return Me._additionalInformation End Get Set Me._additionalInformation = Value End Set End Property Public Property stateOfAffairs() As List(Of TStateOfAffairs) Get Return Me._stateOfAffairs End Get Set Me._stateOfAffairs = Value End Set End Property Public Property erpData() As TErpShipmentData Get Return Me._erpData End Get Set Me._erpData = Value End Set End Property Public Property authorisations() As List(Of TAuthorisation) Get Return Me._authorisations End Get Set Me._authorisations = Value End Set End Property Public Property prevDoc() As List(Of TShipmentPreviousDocument) Get Return Me._prevDoc End Get Set Me._prevDoc = Value End Set End Property Public Property departureTransportMeans() As List(Of TShipmentHeadDepartureTransportMeans) Get Return Me._departureTransportMeans End Get Set Me._departureTransportMeans = Value End Set End Property Public Property officePresentation() As TCustomsOffice Get Return Me._officePresentation End Get Set Me._officePresentation = Value End Set End Property Public Property deliveryType() As String Get Return Me._deliveryType End Get Set Me._deliveryType = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHead)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHead object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHead object ''' ''' string to deserialize ''' Output TShipmentHead object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false 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 StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.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 Stream) As TShipmentHead Return CType(SerializerXml.Deserialize(s), TShipmentHead) End Function #End Region ''' ''' Serializes current TShipmentHead object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHead object ''' ''' File to load and deserialize ''' Output TShipmentHead object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false 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 FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Public Enum ContainerCode Item1 Item0 End Enum Public Enum TShipmentHeadEndUserInEam Item Item0 Item1 End Enum Partial Public Class TMotInl #Region "Private fields" Private _mot As String Private _nat As String Private _type As String Private _licNo As String Private Shared _serializerXml As XmlSerializer #End Region Public Property mot() As String Get Return Me._mot End Get Set Me._mot = Value End Set End Property Public Property nat() As String Get Return Me._nat End Get Set Me._nat = Value End Set End Property Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property licNo() As String Get Return Me._licNo End Get Set Me._licNo = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TMotInl)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TMotInl object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TMotInl object ''' ''' string to deserialize ''' Output TMotInl object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TMotInl, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMotInl) 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 TMotInl) 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 TMotInl Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TMotInl) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TMotInl Return CType(SerializerXml.Deserialize(s), TMotInl) End Function #End Region ''' ''' Serializes current TMotInl object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TMotInl object ''' ''' File to load and deserialize ''' Output TMotInl object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMotInl, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMotInl) 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 TMotInl) 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 TMotInl Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TPackageLine #Region "Private fields" Private _invNo As String Private _invoiceVersion As String Private _invPos As String Private _quantity As Decimal Private _unit As String Private _nWeight As Decimal Private _numberOfPackages As Long Private _itemQuantity As Long Private _itemUnit As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._invoiceVersion = "1" End Sub Public Property invNo() As String Get Return Me._invNo End Get Set Me._invNo = Value End Set End Property Public Property invoiceVersion() As String Get Return Me._invoiceVersion End Get Set Me._invoiceVersion = Value End Set End Property Public Property invPos() As String Get Return Me._invPos End Get Set Me._invPos = Value End Set End Property Public Property quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = Value End Set End Property Public Property unit() As String Get Return Me._unit End Get Set Me._unit = Value End Set End Property Public Property nWeight() As Decimal Get Return Me._nWeight End Get Set Me._nWeight = Value End Set End Property Public Property numberOfPackages() As Long Get Return Me._numberOfPackages End Get Set Me._numberOfPackages = Value End Set End Property Public Property itemQuantity() As Long Get Return Me._itemQuantity End Get Set Me._itemQuantity = Value End Set End Property Public Property itemUnit() As String Get Return Me._itemUnit End Get Set Me._itemUnit = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TPackageLine)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TPackageLine object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TPackageLine object ''' ''' string to deserialize ''' Output TPackageLine object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TPackageLine, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPackageLine) 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 TPackageLine) 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 TPackageLine Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TPackageLine) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TPackageLine Return CType(SerializerXml.Deserialize(s), TPackageLine) End Function #End Region ''' ''' Serializes current TPackageLine object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TPackageLine object ''' ''' File to load and deserialize ''' Output TPackageLine object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPackageLine, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPackageLine) 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 TPackageLine) 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 TPackageLine Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TPackageHead #Region "Private fields" Private _packageNo As String Private _pType As String Private _unit As String Private _packageNoExt As String Private _gWeight As Decimal Private _nWeight As Decimal Private _tara As Decimal Private _unitWeight As String Private _volume As Decimal Private _grossVolume As Decimal Private _netVolume As Decimal Private _unitVolume As String Private _length As Decimal Private _width As Decimal Private _height As Decimal Private _unitlwh As String Private _description As String Private Shared _serializerXml As XmlSerializer #End Region Public Property packageNo() As String Get Return Me._packageNo End Get Set Me._packageNo = Value End Set End Property Public Property pType() As String Get Return Me._pType End Get Set Me._pType = Value End Set End Property Public Property unit() As String Get Return Me._unit End Get Set Me._unit = Value End Set End Property Public Property packageNoExt() As String Get Return Me._packageNoExt End Get Set Me._packageNoExt = Value End Set End Property Public Property gWeight() As Decimal Get Return Me._gWeight End Get Set Me._gWeight = Value End Set End Property Public Property nWeight() As Decimal Get Return Me._nWeight End Get Set Me._nWeight = Value End Set End Property Public Property tara() As Decimal Get Return Me._tara End Get Set Me._tara = Value End Set End Property Public Property unitWeight() As String Get Return Me._unitWeight End Get Set Me._unitWeight = Value End Set End Property Public Property volume() As Decimal Get Return Me._volume End Get Set Me._volume = Value End Set End Property Public Property grossVolume() As Decimal Get Return Me._grossVolume End Get Set Me._grossVolume = Value End Set End Property Public Property netVolume() As Decimal Get Return Me._netVolume End Get Set Me._netVolume = Value End Set End Property Public Property unitVolume() As String Get Return Me._unitVolume End Get Set Me._unitVolume = Value End Set End Property Public Property length() As Decimal Get Return Me._length End Get Set Me._length = Value End Set End Property Public Property width() As Decimal Get Return Me._width End Get Set Me._width = Value End Set End Property Public Property height() As Decimal Get Return Me._height End Get Set Me._height = Value End Set End Property Public Property unitlwh() As String Get Return Me._unitlwh End Get Set Me._unitlwh = Value End Set End Property Public Property description() As String Get Return Me._description End Get Set Me._description = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TPackageHead)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TPackageHead object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TPackageHead object ''' ''' string to deserialize ''' Output TPackageHead object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TPackageHead, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPackageHead) 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 TPackageHead) 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 TPackageHead Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TPackageHead) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TPackageHead Return CType(SerializerXml.Deserialize(s), TPackageHead) End Function #End Region ''' ''' Serializes current TPackageHead object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TPackageHead object ''' ''' File to load and deserialize ''' Output TPackageHead object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPackageHead, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPackageHead) 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 TPackageHead) 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 TPackageHead Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TPackage #Region "Private fields" Private _packageHead As TPackageHead Private _packageLine As List(Of TPackageLine) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._packageLine = New List(Of TPackageLine)() Me._packageHead = New TPackageHead() End Sub Public Property packageHead() As TPackageHead Get Return Me._packageHead End Get Set Me._packageHead = Value End Set End Property Public Property packageLine() As List(Of TPackageLine) Get Return Me._packageLine End Get Set Me._packageLine = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TPackage)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TPackage object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TPackage object ''' ''' string to deserialize ''' Output TPackage object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TPackage, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPackage) 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 TPackage) 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 TPackage Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TPackage) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TPackage Return CType(SerializerXml.Deserialize(s), TPackage) End Function #End Region ''' ''' Serializes current TPackage object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TPackage object ''' ''' File to load and deserialize ''' Output TPackage object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPackage, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPackage) 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 TPackage) 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 TPackage Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TMicDutyTax #Region "Private fields" Private _type As String Private _calculationBase As Decimal Private _calculationBaseUom As String Private _code As String Private _rate As Decimal Private _dutyAmount As Decimal Private _additionalCosts As Decimal Private _calculatedDuties As Decimal Private _paymentCode As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property calculationBase() As Decimal Get Return Me._calculationBase End Get Set Me._calculationBase = Value End Set End Property Public Property calculationBaseUom() As String Get Return Me._calculationBaseUom End Get Set Me._calculationBaseUom = Value End Set End Property Public Property code() As String Get Return Me._code End Get Set Me._code = Value End Set End Property Public Property rate() As Decimal Get Return Me._rate End Get Set Me._rate = Value End Set End Property Public Property dutyAmount() As Decimal Get Return Me._dutyAmount End Get Set Me._dutyAmount = Value End Set End Property Public Property additionalCosts() As Decimal Get Return Me._additionalCosts End Get Set Me._additionalCosts = Value End Set End Property Public Property calculatedDuties() As Decimal Get Return Me._calculatedDuties End Get Set Me._calculatedDuties = Value End Set End Property Public Property paymentCode() As String Get Return Me._paymentCode End Get Set Me._paymentCode = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TMicDutyTax)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TMicDutyTax object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TMicDutyTax object ''' ''' string to deserialize ''' Output TMicDutyTax object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TMicDutyTax, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDutyTax) 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 TMicDutyTax) 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 TMicDutyTax Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TMicDutyTax) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TMicDutyTax Return CType(SerializerXml.Deserialize(s), TMicDutyTax) End Function #End Region ''' ''' Serializes current TMicDutyTax object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TMicDutyTax object ''' ''' File to load and deserialize ''' Output TMicDutyTax object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMicDutyTax, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDutyTax) 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 TMicDutyTax) 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 TMicDutyTax Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TMicDutyTaxes #Region "Private fields" Private _dutyTax As List(Of TMicDutyTax) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._dutyTax = New List(Of TMicDutyTax)() End Sub Public Property DutyTax() As List(Of TMicDutyTax) Get Return Me._dutyTax End Get Set Me._dutyTax = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TMicDutyTaxes)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TMicDutyTaxes object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TMicDutyTaxes object ''' ''' string to deserialize ''' Output TMicDutyTaxes object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TMicDutyTaxes, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDutyTaxes) 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 TMicDutyTaxes) 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 TMicDutyTaxes Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TMicDutyTaxes) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TMicDutyTaxes Return CType(SerializerXml.Deserialize(s), TMicDutyTaxes) End Function #End Region ''' ''' Serializes current TMicDutyTaxes object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TMicDutyTaxes object ''' ''' File to load and deserialize ''' Output TMicDutyTaxes object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMicDutyTaxes, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDutyTaxes) 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 TMicDutyTaxes) 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 TMicDutyTaxes Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TMicDuty #Region "Private fields" Private _type As String Private _calculatedDutyBase As Decimal Private _currency As String Private _code As String Private _rate As Decimal Private _amount As Decimal Private _addDeduct As Decimal Private _calculatedDuty As Decimal Private _duty As Decimal Private _dutyBase As Decimal Private _measureCode As String Private _measure As String Private _authorityDutyCode As String Private _territory As String Private _typeAddCode As String Private _numberAddCode As String Private _tariffRateQuota As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property calculatedDutyBase() As Decimal Get Return Me._calculatedDutyBase End Get Set Me._calculatedDutyBase = Value End Set End Property Public Property currency() As String Get Return Me._currency End Get Set Me._currency = Value End Set End Property Public Property code() As String Get Return Me._code End Get Set Me._code = Value End Set End Property Public Property rate() As Decimal Get Return Me._rate End Get Set Me._rate = Value End Set End Property Public Property amount() As Decimal Get Return Me._amount End Get Set Me._amount = Value End Set End Property Public Property addDeduct() As Decimal Get Return Me._addDeduct End Get Set Me._addDeduct = Value End Set End Property Public Property calculatedDuty() As Decimal Get Return Me._calculatedDuty End Get Set Me._calculatedDuty = Value End Set End Property Public Property duty() As Decimal Get Return Me._duty End Get Set Me._duty = Value End Set End Property Public Property dutyBase() As Decimal Get Return Me._dutyBase End Get Set Me._dutyBase = Value End Set End Property Public Property measureCode() As String Get Return Me._measureCode End Get Set Me._measureCode = Value End Set End Property Public Property measure() As String Get Return Me._measure End Get Set Me._measure = Value End Set End Property Public Property authorityDutyCode() As String Get Return Me._authorityDutyCode End Get Set Me._authorityDutyCode = Value End Set End Property Public Property territory() As String Get Return Me._territory End Get Set Me._territory = Value End Set End Property Public Property typeAddCode() As String Get Return Me._typeAddCode End Get Set Me._typeAddCode = Value End Set End Property Public Property numberAddCode() As String Get Return Me._numberAddCode End Get Set Me._numberAddCode = Value End Set End Property Public Property tariffRateQuota() As String Get Return Me._tariffRateQuota End Get Set Me._tariffRateQuota = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TMicDuty)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TMicDuty object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TMicDuty object ''' ''' string to deserialize ''' Output TMicDuty object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TMicDuty, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDuty) 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 TMicDuty) 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 TMicDuty Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TMicDuty) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TMicDuty Return CType(SerializerXml.Deserialize(s), TMicDuty) End Function #End Region ''' ''' Serializes current TMicDuty object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TMicDuty object ''' ''' File to load and deserialize ''' Output TMicDuty object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMicDuty, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDuty) 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 TMicDuty) 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 TMicDuty Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TMicDuties #Region "Private fields" Private _duty As List(Of TMicDuty) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._duty = New List(Of TMicDuty)() End Sub Public Property Duty() As List(Of TMicDuty) Get Return Me._duty End Get Set Me._duty = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TMicDuties)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TMicDuties object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TMicDuties object ''' ''' string to deserialize ''' Output TMicDuties object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TMicDuties, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDuties) 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 TMicDuties) 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 TMicDuties Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TMicDuties) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TMicDuties Return CType(SerializerXml.Deserialize(s), TMicDuties) End Function #End Region ''' ''' Serializes current TMicDuties object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TMicDuties object ''' ''' File to load and deserialize ''' Output TMicDuties object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMicDuties, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMicDuties) 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 TMicDuties) 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 TMicDuties Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TErpLineData #Region "Private fields" Private _legalRegulation As String Private _exportControlClass As String Private _embargo As String Private _licenseType As String Private _licenseNumber As String Private _profitCenter As String Private _vZTA As String Private _erpInvoicelinenumber As String Private _erpPartnumber As String Private Shared _serializerXml As XmlSerializer #End Region Public Property legalRegulation() As String Get Return Me._legalRegulation End Get Set Me._legalRegulation = Value End Set End Property Public Property exportControlClass() As String Get Return Me._exportControlClass End Get Set Me._exportControlClass = Value End Set End Property Public Property embargo() As String Get Return Me._embargo End Get Set Me._embargo = Value End Set End Property Public Property licenseType() As String Get Return Me._licenseType End Get Set Me._licenseType = Value End Set End Property Public Property licenseNumber() As String Get Return Me._licenseNumber End Get Set Me._licenseNumber = Value End Set End Property Public Property profitCenter() As String Get Return Me._profitCenter End Get Set Me._profitCenter = Value End Set End Property Public Property vZTA() As String Get Return Me._vZTA End Get Set Me._vZTA = Value End Set End Property Public Property erpInvoicelinenumber() As String Get Return Me._erpInvoicelinenumber End Get Set Me._erpInvoicelinenumber = Value End Set End Property Public Property erpPartnumber() As String Get Return Me._erpPartnumber End Get Set Me._erpPartnumber = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TErpLineData)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TErpLineData object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TErpLineData object ''' ''' string to deserialize ''' Output TErpLineData object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TErpLineData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErpLineData) 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 TErpLineData) 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 TErpLineData Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TErpLineData) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TErpLineData Return CType(SerializerXml.Deserialize(s), TErpLineData) End Function #End Region ''' ''' Serializes current TErpLineData object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TErpLineData object ''' ''' File to load and deserialize ''' Output TErpLineData object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpLineData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErpLineData) 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 TErpLineData) 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 TErpLineData Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TRegInfo #Region "Private fields" Private _registrationNumber1 As String Private _registrationNumber2 As String Private _registrationNumber3 As String Private _referenceNumber1 As String Private _referenceNumber2 As String Private _referenceNumber3 As String Private _registrationDate As Date Private _acceptanceDate As Date Private _releaseDate As Date Private Shared _serializerXml As XmlSerializer #End Region Public Property registrationNumber1() As String Get Return Me._registrationNumber1 End Get Set Me._registrationNumber1 = Value End Set End Property Public Property registrationNumber2() As String Get Return Me._registrationNumber2 End Get Set Me._registrationNumber2 = Value End Set End Property Public Property registrationNumber3() As String Get Return Me._registrationNumber3 End Get Set Me._registrationNumber3 = Value End Set End Property Public Property referenceNumber1() As String Get Return Me._referenceNumber1 End Get Set Me._referenceNumber1 = Value End Set End Property Public Property referenceNumber2() As String Get Return Me._referenceNumber2 End Get Set Me._referenceNumber2 = Value End Set End Property Public Property referenceNumber3() As String Get Return Me._referenceNumber3 End Get Set Me._referenceNumber3 = Value End Set End Property Public Property registrationDate() As Date Get Return Me._registrationDate End Get Set Me._registrationDate = Value End Set End Property Public Property acceptanceDate() As Date Get Return Me._acceptanceDate End Get Set Me._acceptanceDate = Value End Set End Property Public Property releaseDate() As Date Get Return Me._releaseDate End Get Set Me._releaseDate = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TRegInfo)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TRegInfo object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TRegInfo object ''' ''' string to deserialize ''' Output TRegInfo object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TRegInfo, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TRegInfo) 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 TRegInfo) 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 TRegInfo Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TRegInfo) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TRegInfo Return CType(SerializerXml.Deserialize(s), TRegInfo) End Function #End Region ''' ''' Serializes current TRegInfo object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TRegInfo object ''' ''' File to load and deserialize ''' Output TRegInfo object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TRegInfo, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TRegInfo) 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 TRegInfo) 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 TRegInfo Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TImportQuantity #Region "Private fields" Private _qualifier As String Private _unit As String Private _value As Decimal Private Shared _serializerXml As XmlSerializer #End Region Public Property qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = Value End Set End Property Public Property unit() As String Get Return Me._unit End Get Set Me._unit = Value End Set End Property Public Property value() As Decimal Get Return Me._value End Get Set Me._value = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TImportQuantity)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TImportQuantity object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TImportQuantity object ''' ''' string to deserialize ''' Output TImportQuantity object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TImportQuantity, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TImportQuantity) 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 TImportQuantity) 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 TImportQuantity Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TImportQuantity) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TImportQuantity Return CType(SerializerXml.Deserialize(s), TImportQuantity) End Function #End Region ''' ''' Serializes current TImportQuantity object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TImportQuantity object ''' ''' File to load and deserialize ''' Output TImportQuantity object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportQuantity, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TImportQuantity) 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 TImportQuantity) 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 TImportQuantity Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TImportReference #Region "Private fields" Private _type As String Private _authType As String Private _authNr As String Private _mrn As String Private _impShpNr As String Private _lineNo As String Private _authRegistryNo As String Private _commCode As String Private _usualTreatment As String Private _importAtlas As String Private _addInfo As String Private _quantity As TImportQuantity Private _tradeQuantity As TImportQuantity Private _packageQuantity As Decimal Private _netMass As Decimal Private _grossMass As Decimal Private _statisticalQuantity As Decimal Private _simpleIprApplication As String Private _supervisingOffice As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._tradeQuantity = New TImportQuantity() Me._quantity = New TImportQuantity() End Sub Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property authType() As String Get Return Me._authType End Get Set Me._authType = Value End Set End Property Public Property authNr() As String Get Return Me._authNr End Get Set Me._authNr = 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 impShpNr() As String Get Return Me._impShpNr End Get Set Me._impShpNr = Value End Set End Property Public Property lineNo() As String Get Return Me._lineNo End Get Set Me._lineNo = Value End Set End Property Public Property authRegistryNo() As String Get Return Me._authRegistryNo End Get Set Me._authRegistryNo = Value End Set End Property Public Property commCode() As String Get Return Me._commCode End Get Set Me._commCode = Value End Set End Property Public Property usualTreatment() As String Get Return Me._usualTreatment End Get Set Me._usualTreatment = Value End Set End Property Public Property importAtlas() As String Get Return Me._importAtlas End Get Set Me._importAtlas = Value End Set End Property Public Property addInfo() As String Get Return Me._addInfo End Get Set Me._addInfo = Value End Set End Property Public Property quantity() As TImportQuantity Get Return Me._quantity End Get Set Me._quantity = Value End Set End Property Public Property tradeQuantity() As TImportQuantity Get Return Me._tradeQuantity End Get Set Me._tradeQuantity = Value End Set End Property Public Property packageQuantity() As Decimal Get Return Me._packageQuantity End Get Set Me._packageQuantity = Value End Set End Property Public Property netMass() As Decimal Get Return Me._netMass End Get Set Me._netMass = Value End Set End Property Public Property grossMass() As Decimal Get Return Me._grossMass End Get Set Me._grossMass = Value End Set End Property Public Property statisticalQuantity() As Decimal Get Return Me._statisticalQuantity End Get Set Me._statisticalQuantity = Value End Set End Property Public Property simpleIprApplication() As String Get Return Me._simpleIprApplication End Get Set Me._simpleIprApplication = Value End Set End Property Public Property supervisingOffice() As String Get Return Me._supervisingOffice End Get Set Me._supervisingOffice = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TImportReference)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TImportReference object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TImportReference object ''' ''' string to deserialize ''' Output TImportReference object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TImportReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TImportReference) 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 TImportReference) 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 TImportReference Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TImportReference) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TImportReference Return CType(SerializerXml.Deserialize(s), TImportReference) End Function #End Region ''' ''' Serializes current TImportReference object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TImportReference object ''' ''' File to load and deserialize ''' Output TImportReference object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TImportReference) 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 TImportReference) 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 TImportReference Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TBomNo #Region "Private fields" Private _no As String Private _var As String Private Shared _serializerXml As XmlSerializer #End Region Public Property no() As String Get Return Me._no End Get Set Me._no = Value End Set End Property Public Property var() As String Get Return Me._var End Get Set Me._var = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TBomNo)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TBomNo object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TBomNo object ''' ''' string to deserialize ''' Output TBomNo object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TBomNo, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TBomNo) 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 TBomNo) 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 TBomNo Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TBomNo) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TBomNo Return CType(SerializerXml.Deserialize(s), TBomNo) End Function #End Region ''' ''' Serializes current TBomNo object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TBomNo object ''' ''' File to load and deserialize ''' Output TBomNo object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TBomNo, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TBomNo) 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 TBomNo) 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 TBomNo Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TOrder #Region "Private fields" Private _ordNo As String Private _ordDate As Date Private Shared _serializerXml As XmlSerializer #End Region Public Property ordNo() As String Get Return Me._ordNo End Get Set Me._ordNo = Value End Set End Property Public Property ordDate() As Date Get Return Me._ordDate End Get Set Me._ordDate = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TOrder)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TOrder object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TOrder object ''' ''' string to deserialize ''' Output TOrder object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TOrder, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TOrder) 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 TOrder) 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 TOrder Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TOrder) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TOrder Return CType(SerializerXml.Deserialize(s), TOrder) End Function #End Region ''' ''' Serializes current TOrder object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TOrder object ''' ''' File to load and deserialize ''' Output TOrder object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TOrder, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TOrder) 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 TOrder) 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 TOrder Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TDelNote #Region "Private fields" Private _delNo As String Private _position As Long Private _delDate As Date Private Shared _serializerXml As XmlSerializer #End Region Public Property delNo() As String Get Return Me._delNo End Get Set Me._delNo = Value End Set End Property Public Property position() As Long Get Return Me._position End Get Set Me._position = Value End Set End Property Public Property delDate() As Date Get Return Me._delDate End Get Set Me._delDate = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TDelNote)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TDelNote object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TDelNote object ''' ''' string to deserialize ''' Output TDelNote object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDelNote, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDelNote) 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 TDelNote) 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 TDelNote Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TDelNote) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TDelNote Return CType(SerializerXml.Deserialize(s), TDelNote) End Function #End Region ''' ''' Serializes current TDelNote object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TDelNote object ''' ''' File to load and deserialize ''' Output TDelNote object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelNote, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDelNote) 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 TDelNote) 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 TDelNote Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TItem #Region "Private fields" Private _itemNo As String Private _itemDesc As String Private _commCode As String Private _prodGr As String Private _cusCode As String Private Shared _serializerXml As XmlSerializer #End Region Public Property itemNo() As String Get Return Me._itemNo End Get Set Me._itemNo = Value End Set End Property Public Property itemDesc() As String Get Return Me._itemDesc End Get Set Me._itemDesc = Value End Set End Property Public Property commCode() As String Get Return Me._commCode End Get Set Me._commCode = Value End Set End Property Public Property prodGr() As String Get Return Me._prodGr End Get Set Me._prodGr = Value End Set End Property Public Property cusCode() As String Get Return Me._cusCode End Get Set Me._cusCode = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TItem)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TItem object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TItem object ''' ''' string to deserialize ''' Output TItem object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TItem) 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 TItem) 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 TItem Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TItem) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TItem Return CType(SerializerXml.Deserialize(s), TItem) End Function #End Region ''' ''' Serializes current TItem object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TItem object ''' ''' File to load and deserialize ''' Output TItem object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TItem) 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 TItem) 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 TItem Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TPreviousDocument #Region "Private fields" Private _docType As String Private _docQual As String Private _docNo As String Private _docAddText As String Private _docCategory As String Private _itemNumber As String Private _unit As String Private _quantity As Decimal Private _numberOfPackages As String Private _packageType As String Private Shared _serializerXml As XmlSerializer #End Region Public Property docType() As String Get Return Me._docType End Get Set Me._docType = Value End Set End Property Public Property docQual() As String Get Return Me._docQual End Get Set Me._docQual = Value End Set End Property Public Property docNo() As String Get Return Me._docNo End Get Set Me._docNo = Value End Set End Property Public Property docAddText() As String Get Return Me._docAddText End Get Set Me._docAddText = Value End Set End Property Public Property docCategory() As String Get Return Me._docCategory End Get Set Me._docCategory = Value End Set End Property Public Property itemNumber() As String Get Return Me._itemNumber End Get Set Me._itemNumber = Value End Set End Property Public Property unit() As String Get Return Me._unit End Get Set Me._unit = Value End Set End Property Public Property quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = Value End Set End Property Public Property numberOfPackages() As String Get Return Me._numberOfPackages End Get Set Me._numberOfPackages = Value End Set End Property Public Property packageType() As String Get Return Me._packageType End Get Set Me._packageType = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TPreviousDocument)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TPreviousDocument object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TPreviousDocument object ''' ''' string to deserialize ''' Output TPreviousDocument object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TPreviousDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPreviousDocument) 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 TPreviousDocument) 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 TPreviousDocument Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TPreviousDocument) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TPreviousDocument Return CType(SerializerXml.Deserialize(s), TPreviousDocument) End Function #End Region ''' ''' Serializes current TPreviousDocument object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TPreviousDocument object ''' ''' File to load and deserialize ''' Output TPreviousDocument object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPreviousDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPreviousDocument) 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 TPreviousDocument) 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 TPreviousDocument Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceLine #Region "Private fields" Private _lineNo As String Private _unitPrice As Decimal Private _amount As Decimal Private _nWeight As Decimal Private _gWeight As Decimal Private _statQuant As Decimal Private _statUnit As String Private _statVal As Decimal Private _custProc As String Private _eUCode As String Private _statCode As String Private _transType As String Private _exportCountry As String Private _coo As String Private _cooState As String Private _addText As List(Of String) Private _prevDoc As List(Of TPreviousDocument) Private _item As TItem Private _taricAddCode As List(Of TInvoiceLineTaricAddCode) Private _dangerousGoods As List(Of TInvoiceLineDangerousGoods) Private _documents As List(Of TDocuments) Private _delTerm As TInvoiceLineDelTerm Private _quantity As Decimal Private _unit As String Private _specialQuantity As Decimal Private _specialQuantityUnit As String Private _delnote As TDelNote Private _order As TOrder Private _itemRef As String Private _addCosts As List(Of TAddCosts) Private _addCode As List(Of String) Private _natCode As List(Of String) Private _stockTypeAdd As String Private _stockTypeDed As String Private _bom As TBomNo Private _accountNo As String Private _customerFields As TCustomerFields Private _attributes As List(Of TAttribute) Private _containers As List(Of TContainer) Private _shipmentIdentification As String Private _uNDG As String Private _consigneeEndUserFlag As String Private _endUserInEam As TInvoiceLineEndUserInEam Private _carriageCosts As String Private _shipTo As TInvoiceLineShipTo Private _endUser As TInvoiceLineEndUser Private _importReference As List(Of TImportReference) Private _registrationInfo As TRegInfo Private _serialNo As String Private _referenceValue As Decimal Private _model As String Private _brand As String Private _addedValue As Decimal Private _ctoId As String Private _infoText2 As String Private _branchNo As String Private _additionalInformation As List(Of TAttribute) Private _trackingNumber As String Private _erpData As TErpLineData Private _outwardProcessing As TInvoiceLineOutwardProcessing Private _partners As List(Of TPartner) Private _authorisations As List(Of TAuthorisation) Private _eudr As TInvoiceLineEudr Private _duties As TMicDuties Private _dutyTaxes As TMicDutyTaxes Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._dutyTaxes = New TMicDutyTaxes() Me._duties = New TMicDuties() Me._eudr = New TInvoiceLineEudr() Me._authorisations = New List(Of TAuthorisation)() Me._partners = New List(Of TPartner)() Me._outwardProcessing = New TInvoiceLineOutwardProcessing() Me._erpData = New TErpLineData() Me._additionalInformation = New List(Of TAttribute)() Me._registrationInfo = New TRegInfo() Me._importReference = New List(Of TImportReference)() Me._endUser = New TInvoiceLineEndUser() Me._shipTo = New TInvoiceLineShipTo() Me._containers = New List(Of TContainer)() Me._attributes = New List(Of TAttribute)() Me._customerFields = New TCustomerFields() Me._bom = New TBomNo() Me._natCode = New List(Of String)() Me._addCode = New List(Of String)() Me._addCosts = New List(Of TAddCosts)() Me._order = New TOrder() Me._delnote = New TDelNote() Me._delTerm = New TInvoiceLineDelTerm() Me._documents = New List(Of TDocuments)() Me._dangerousGoods = New List(Of TInvoiceLineDangerousGoods)() Me._taricAddCode = New List(Of TInvoiceLineTaricAddCode)() Me._item = New TItem() Me._prevDoc = New List(Of TPreviousDocument)() Me._addText = New List(Of String)() End Sub Public Property lineNo() As String Get Return Me._lineNo End Get Set Me._lineNo = Value End Set End Property Public Property unitPrice() As Decimal Get Return Me._unitPrice End Get Set Me._unitPrice = Value End Set End Property Public Property amount() As Decimal Get Return Me._amount End Get Set Me._amount = Value End Set End Property Public Property nWeight() As Decimal Get Return Me._nWeight End Get Set Me._nWeight = Value End Set End Property Public Property gWeight() As Decimal Get Return Me._gWeight End Get Set Me._gWeight = Value End Set End Property Public Property statQuant() As Decimal Get Return Me._statQuant End Get Set Me._statQuant = Value End Set End Property Public Property statUnit() As String Get Return Me._statUnit End Get Set Me._statUnit = Value End Set End Property Public Property statVal() As Decimal Get Return Me._statVal End Get Set Me._statVal = Value End Set End Property Public Property custProc() As String Get Return Me._custProc End Get Set Me._custProc = Value End Set End Property Public Property EUCode() As String Get Return Me._eUCode End Get Set Me._eUCode = Value End Set End Property Public Property statCode() As String Get Return Me._statCode End Get Set Me._statCode = Value End Set End Property Public Property transType() As String Get Return Me._transType End Get Set Me._transType = Value End Set End Property Public Property exportCountry() As String Get Return Me._exportCountry End Get Set Me._exportCountry = Value End Set End Property Public Property coo() As String Get Return Me._coo End Get Set Me._coo = Value End Set End Property Public Property cooState() As String Get Return Me._cooState End Get Set Me._cooState = Value End Set End Property Public Property addText() As List(Of String) Get Return Me._addText End Get Set Me._addText = Value End Set End Property Public Property prevDoc() As List(Of TPreviousDocument) Get Return Me._prevDoc End Get Set Me._prevDoc = Value End Set End Property Public Property item() As TItem Get Return Me._item End Get Set Me._item = Value End Set End Property Public Property taricAddCode() As List(Of TInvoiceLineTaricAddCode) Get Return Me._taricAddCode End Get Set Me._taricAddCode = Value End Set End Property Public Property dangerousGoods() As List(Of TInvoiceLineDangerousGoods) Get Return Me._dangerousGoods End Get Set Me._dangerousGoods = Value End Set End Property Public Property documents() As List(Of TDocuments) Get Return Me._documents End Get Set Me._documents = Value End Set End Property Public Property delTerm() As TInvoiceLineDelTerm Get Return Me._delTerm End Get Set Me._delTerm = Value End Set End Property Public Property quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = Value End Set End Property Public Property unit() As String Get Return Me._unit End Get Set Me._unit = Value End Set End Property Public Property specialQuantity() As Decimal Get Return Me._specialQuantity End Get Set Me._specialQuantity = Value End Set End Property Public Property specialQuantityUnit() As String Get Return Me._specialQuantityUnit End Get Set Me._specialQuantityUnit = Value End Set End Property Public Property delnote() As TDelNote Get Return Me._delnote End Get Set Me._delnote = Value End Set End Property Public Property order() As TOrder Get Return Me._order End Get Set Me._order = Value End Set End Property Public Property itemRef() As String Get Return Me._itemRef End Get Set Me._itemRef = Value End Set End Property Public Property addCosts() As List(Of TAddCosts) Get Return Me._addCosts End Get Set Me._addCosts = Value End Set End Property Public Property addCode() As List(Of String) Get Return Me._addCode End Get Set Me._addCode = Value End Set End Property Public Property natCode() As List(Of String) Get Return Me._natCode End Get Set Me._natCode = Value End Set End Property Public Property stockTypeAdd() As String Get Return Me._stockTypeAdd End Get Set Me._stockTypeAdd = Value End Set End Property Public Property stockTypeDed() As String Get Return Me._stockTypeDed End Get Set Me._stockTypeDed = Value End Set End Property Public Property bom() As TBomNo Get Return Me._bom End Get Set Me._bom = Value End Set End Property Public Property accountNo() As String Get Return Me._accountNo End Get Set Me._accountNo = 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 attributes() As List(Of TAttribute) Get Return Me._attributes End Get Set Me._attributes = Value End Set End Property Public Property containers() As List(Of TContainer) Get Return Me._containers End Get Set Me._containers = Value End Set End Property Public Property shipmentIdentification() As String Get Return Me._shipmentIdentification End Get Set Me._shipmentIdentification = Value End Set End Property Public Property UNDG() As String Get Return Me._uNDG End Get Set Me._uNDG = Value End Set End Property Public Property consigneeEndUserFlag() As String Get Return Me._consigneeEndUserFlag End Get Set Me._consigneeEndUserFlag = Value End Set End Property Public Property endUserInEam() As TInvoiceLineEndUserInEam Get Return Me._endUserInEam End Get Set Me._endUserInEam = Value End Set End Property Public Property carriageCosts() As String Get Return Me._carriageCosts End Get Set Me._carriageCosts = Value End Set End Property Public Property shipTo() As TInvoiceLineShipTo Get Return Me._shipTo End Get Set Me._shipTo = Value End Set End Property Public Property endUser() As TInvoiceLineEndUser Get Return Me._endUser End Get Set Me._endUser = Value End Set End Property Public Property importReference() As List(Of TImportReference) Get Return Me._importReference End Get Set Me._importReference = Value End Set End Property Public Property registrationInfo() As TRegInfo Get Return Me._registrationInfo End Get Set Me._registrationInfo = Value End Set End Property Public Property serialNo() As String Get Return Me._serialNo End Get Set Me._serialNo = Value End Set End Property Public Property referenceValue() As Decimal Get Return Me._referenceValue End Get Set Me._referenceValue = Value End Set End Property Public Property model() As String Get Return Me._model End Get Set Me._model = Value End Set End Property Public Property brand() As String Get Return Me._brand End Get Set Me._brand = Value End Set End Property Public Property addedValue() As Decimal Get Return Me._addedValue End Get Set Me._addedValue = Value End Set End Property Public Property ctoId() As String Get Return Me._ctoId End Get Set Me._ctoId = Value End Set End Property Public Property infoText2() As String Get Return Me._infoText2 End Get Set Me._infoText2 = Value End Set End Property Public Property branchNo() As String Get Return Me._branchNo End Get Set Me._branchNo = Value End Set End Property Public Property additionalInformation() As List(Of TAttribute) Get Return Me._additionalInformation End Get Set Me._additionalInformation = Value End Set End Property Public Property trackingNumber() As String Get Return Me._trackingNumber End Get Set Me._trackingNumber = Value End Set End Property Public Property erpData() As TErpLineData Get Return Me._erpData End Get Set Me._erpData = Value End Set End Property Public Property outwardProcessing() As TInvoiceLineOutwardProcessing Get Return Me._outwardProcessing End Get Set Me._outwardProcessing = Value End Set End Property Public Property partners() As List(Of TPartner) Get Return Me._partners End Get Set Me._partners = Value End Set End Property Public Property authorisations() As List(Of TAuthorisation) Get Return Me._authorisations End Get Set Me._authorisations = Value End Set End Property Public Property eudr() As TInvoiceLineEudr Get Return Me._eudr End Get Set Me._eudr = Value End Set End Property Public Property Duties() As TMicDuties Get Return Me._duties End Get Set Me._duties = Value End Set End Property Public Property DutyTaxes() As TMicDutyTaxes Get Return Me._dutyTaxes End Get Set Me._dutyTaxes = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLine)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLine object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLine object ''' ''' string to deserialize ''' Output TInvoiceLine object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLine, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLine) 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 TInvoiceLine) 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 TInvoiceLine Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLine) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLine Return CType(SerializerXml.Deserialize(s), TInvoiceLine) End Function #End Region ''' ''' Serializes current TInvoiceLine object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLine object ''' ''' File to load and deserialize ''' Output TInvoiceLine object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLine, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLine) 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 TInvoiceLine) 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 TInvoiceLine Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceLineTaricAddCode #Region "Private fields" Private _additionalCode As String Private Shared _serializerXml As XmlSerializer #End Region Public Property additionalCode() As String Get Return Me._additionalCode End Get Set Me._additionalCode = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLineTaricAddCode)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLineTaricAddCode object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLineTaricAddCode object ''' ''' string to deserialize ''' Output TInvoiceLineTaricAddCode object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLineTaricAddCode, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineTaricAddCode) 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 TInvoiceLineTaricAddCode) 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 TInvoiceLineTaricAddCode Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLineTaricAddCode) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLineTaricAddCode Return CType(SerializerXml.Deserialize(s), TInvoiceLineTaricAddCode) End Function #End Region ''' ''' Serializes current TInvoiceLineTaricAddCode object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLineTaricAddCode object ''' ''' File to load and deserialize ''' Output TInvoiceLineTaricAddCode object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLineTaricAddCode, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineTaricAddCode) 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 TInvoiceLineTaricAddCode) 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 TInvoiceLineTaricAddCode Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceLineDangerousGoods #Region "Private fields" Private _unNumber As String Private Shared _serializerXml As XmlSerializer #End Region Public Property unNumber() As String Get Return Me._unNumber End Get Set Me._unNumber = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLineDangerousGoods)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLineDangerousGoods object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLineDangerousGoods object ''' ''' string to deserialize ''' Output TInvoiceLineDangerousGoods object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLineDangerousGoods, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineDangerousGoods) 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 TInvoiceLineDangerousGoods) 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 TInvoiceLineDangerousGoods Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLineDangerousGoods) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLineDangerousGoods Return CType(SerializerXml.Deserialize(s), TInvoiceLineDangerousGoods) End Function #End Region ''' ''' Serializes current TInvoiceLineDangerousGoods object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLineDangerousGoods object ''' ''' File to load and deserialize ''' Output TInvoiceLineDangerousGoods object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLineDangerousGoods, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineDangerousGoods) 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 TInvoiceLineDangerousGoods) 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 TInvoiceLineDangerousGoods Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TDocuments #Region "Private fields" Private _docNo As String Private _docDate As Date Private _docType As String Private _docQual As String Private _docValidFrom As Date Private _docValidTo As Date Private _docAddText As String Private _docQuantity As Decimal Private _docUnit As String Private _docDetail As String Private _docValue As Decimal Private _docUnitQual As String Private _docStatUnit As String Private _docDepreciateQuantity As Decimal Private _docSupplier As String Private _docSupplierName As String Private _docCategory As String Private _docCurrency As String Private _docLineItemNo As Integer Private _docQuantityMax As Decimal Private Shared _serializerXml As XmlSerializer #End Region Public Property docNo() As String Get Return Me._docNo End Get Set Me._docNo = Value End Set End Property Public Property docDate() As Date Get Return Me._docDate End Get Set Me._docDate = Value End Set End Property Public Property docType() As String Get Return Me._docType End Get Set Me._docType = Value End Set End Property Public Property docQual() As String Get Return Me._docQual End Get Set Me._docQual = Value End Set End Property Public Property docValidFrom() As Date Get Return Me._docValidFrom End Get Set Me._docValidFrom = Value End Set End Property Public Property docValidTo() As Date Get Return Me._docValidTo End Get Set Me._docValidTo = Value End Set End Property Public Property docAddText() As String Get Return Me._docAddText End Get Set Me._docAddText = Value End Set End Property Public Property docQuantity() As Decimal Get Return Me._docQuantity End Get Set Me._docQuantity = Value End Set End Property Public Property docUnit() As String Get Return Me._docUnit End Get Set Me._docUnit = Value End Set End Property Public Property docDetail() As String Get Return Me._docDetail End Get Set Me._docDetail = Value End Set End Property Public Property docValue() As Decimal Get Return Me._docValue End Get Set Me._docValue = Value End Set End Property Public Property docUnitQual() As String Get Return Me._docUnitQual End Get Set Me._docUnitQual = Value End Set End Property Public Property docStatUnit() As String Get Return Me._docStatUnit End Get Set Me._docStatUnit = Value End Set End Property Public Property docDepreciateQuantity() As Decimal Get Return Me._docDepreciateQuantity End Get Set Me._docDepreciateQuantity = Value End Set End Property Public Property docSupplier() As String Get Return Me._docSupplier End Get Set Me._docSupplier = Value End Set End Property Public Property docSupplierName() As String Get Return Me._docSupplierName End Get Set Me._docSupplierName = Value End Set End Property Public Property docCategory() As String Get Return Me._docCategory End Get Set Me._docCategory = Value End Set End Property Public Property docCurrency() As String Get Return Me._docCurrency End Get Set Me._docCurrency = Value End Set End Property Public Property docLineItemNo() As Integer Get Return Me._docLineItemNo End Get Set Me._docLineItemNo = Value End Set End Property Public Property docQuantityMax() As Decimal Get Return Me._docQuantityMax End Get Set Me._docQuantityMax = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TDocuments)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TDocuments object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TDocuments object ''' ''' string to deserialize ''' Output TDocuments object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDocuments, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDocuments) 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 TDocuments) 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 TDocuments Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TDocuments) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TDocuments Return CType(SerializerXml.Deserialize(s), TDocuments) End Function #End Region ''' ''' Serializes current TDocuments object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TDocuments object ''' ''' File to load and deserialize ''' Output TDocuments object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDocuments, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDocuments) 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 TDocuments) 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 TDocuments Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceLineDelTerm #Region "Private fields" Private _code As String Private _desc As String Private Shared _serializerXml As XmlSerializer #End Region Public Property code() As String Get Return Me._code End Get Set Me._code = Value End Set End Property Public Property desc() As String Get Return Me._desc End Get Set Me._desc = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLineDelTerm)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLineDelTerm object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLineDelTerm object ''' ''' string to deserialize ''' Output TInvoiceLineDelTerm object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLineDelTerm, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineDelTerm) 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 TInvoiceLineDelTerm) 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 TInvoiceLineDelTerm Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLineDelTerm) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLineDelTerm Return CType(SerializerXml.Deserialize(s), TInvoiceLineDelTerm) End Function #End Region ''' ''' Serializes current TInvoiceLineDelTerm object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLineDelTerm object ''' ''' File to load and deserialize ''' Output TInvoiceLineDelTerm object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLineDelTerm, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineDelTerm) 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 TInvoiceLineDelTerm) 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 TInvoiceLineDelTerm Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TAddCosts #Region "Private fields" Private _type As String Private _flag As TAddCostsFlag Private _amount As Decimal Private _curr As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property flag() As TAddCostsFlag Get Return Me._flag End Get Set Me._flag = Value End Set End Property Public Property amount() As Decimal Get Return Me._amount End Get Set Me._amount = Value End Set End Property Public Property curr() As String Get Return Me._curr End Get Set Me._curr = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TAddCosts)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TAddCosts object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TAddCosts object ''' ''' string to deserialize ''' Output TAddCosts object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAddCosts, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAddCosts) 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 TAddCosts) 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 TAddCosts Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TAddCosts) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TAddCosts Return CType(SerializerXml.Deserialize(s), TAddCosts) End Function #End Region ''' ''' Serializes current TAddCosts object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TAddCosts object ''' ''' File to load and deserialize ''' Output TAddCosts object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddCosts, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAddCosts) 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 TAddCosts) 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 TAddCosts Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Public Enum TAddCostsFlag P V End Enum Partial Public Class TCustomerFields #Region "Private fields" Private _texts As List(Of TCustomerText) Private _dates As List(Of TCustomerDate) Private _flags As List(Of TCustomerFlag) Private _numbers As List(Of TCustomerNumber) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._numbers = New List(Of TCustomerNumber)() Me._flags = New List(Of TCustomerFlag)() Me._dates = New List(Of TCustomerDate)() Me._texts = New List(Of TCustomerText)() End Sub Public Property texts() As List(Of TCustomerText) Get Return Me._texts End Get Set Me._texts = Value End Set End Property Public Property dates() As List(Of TCustomerDate) Get Return Me._dates End Get Set Me._dates = Value End Set End Property Public Property flags() As List(Of TCustomerFlag) Get Return Me._flags End Get Set Me._flags = Value End Set End Property Public Property numbers() As List(Of TCustomerNumber) Get Return Me._numbers End Get Set Me._numbers = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TCustomerFields)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TCustomerFields object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TCustomerFields object ''' ''' string to deserialize ''' Output TCustomerFields object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TCustomerFields, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerFields) 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 TCustomerFields) 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 TCustomerFields Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TCustomerFields) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TCustomerFields Return CType(SerializerXml.Deserialize(s), TCustomerFields) End Function #End Region ''' ''' Serializes current TCustomerFields object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TCustomerFields object ''' ''' File to load and deserialize ''' Output TCustomerFields object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerFields, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerFields) 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 TCustomerFields) 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 TCustomerFields Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TCustomerText #Region "Private fields" Private _key As Integer Private _value As String Private Shared _serializerXml As XmlSerializer #End Region Public Property key() As Integer Get Return Me._key End Get Set Me._key = Value End Set End Property Public Property value() As String Get Return Me._value End Get Set Me._value = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TCustomerText)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TCustomerText object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TCustomerText object ''' ''' string to deserialize ''' Output TCustomerText object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TCustomerText, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerText) 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 TCustomerText) 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 TCustomerText Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TCustomerText) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TCustomerText Return CType(SerializerXml.Deserialize(s), TCustomerText) End Function #End Region ''' ''' Serializes current TCustomerText object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TCustomerText object ''' ''' File to load and deserialize ''' Output TCustomerText object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerText, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerText) 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 TCustomerText) 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 TCustomerText Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TCustomerDate #Region "Private fields" Private _key As Integer Private _value As Date Private Shared _serializerXml As XmlSerializer #End Region Public Property key() As Integer Get Return Me._key End Get Set Me._key = Value End Set End Property Public Property value() As Date Get Return Me._value End Get Set Me._value = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TCustomerDate)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TCustomerDate object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TCustomerDate object ''' ''' string to deserialize ''' Output TCustomerDate object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TCustomerDate, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerDate) 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 TCustomerDate) 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 TCustomerDate Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TCustomerDate) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TCustomerDate Return CType(SerializerXml.Deserialize(s), TCustomerDate) End Function #End Region ''' ''' Serializes current TCustomerDate object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TCustomerDate object ''' ''' File to load and deserialize ''' Output TCustomerDate object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerDate, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerDate) 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 TCustomerDate) 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 TCustomerDate Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TCustomerFlag #Region "Private fields" Private _key As Integer Private _value As Boolean Private Shared _serializerXml As XmlSerializer #End Region Public Property key() As Integer Get Return Me._key End Get Set Me._key = Value End Set End Property Public Property value() As Boolean Get Return Me._value End Get Set Me._value = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TCustomerFlag)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TCustomerFlag object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TCustomerFlag object ''' ''' string to deserialize ''' Output TCustomerFlag object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TCustomerFlag, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerFlag) 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 TCustomerFlag) 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 TCustomerFlag Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TCustomerFlag) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TCustomerFlag Return CType(SerializerXml.Deserialize(s), TCustomerFlag) End Function #End Region ''' ''' Serializes current TCustomerFlag object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TCustomerFlag object ''' ''' File to load and deserialize ''' Output TCustomerFlag object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerFlag, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerFlag) 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 TCustomerFlag) 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 TCustomerFlag Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TCustomerNumber #Region "Private fields" Private _key As Integer Private _value As Decimal Private Shared _serializerXml As XmlSerializer #End Region Public Property key() As Integer Get Return Me._key End Get Set Me._key = Value End Set End Property Public Property value() As Decimal Get Return Me._value End Get Set Me._value = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TCustomerNumber)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TCustomerNumber object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TCustomerNumber object ''' ''' string to deserialize ''' Output TCustomerNumber object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TCustomerNumber, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerNumber) 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 TCustomerNumber) 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 TCustomerNumber Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TCustomerNumber) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TCustomerNumber Return CType(SerializerXml.Deserialize(s), TCustomerNumber) End Function #End Region ''' ''' Serializes current TCustomerNumber object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TCustomerNumber object ''' ''' File to load and deserialize ''' Output TCustomerNumber object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerNumber, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomerNumber) 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 TCustomerNumber) 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 TCustomerNumber Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TAttribute #Region "Private fields" Private _attribType As String Private _attribText As String Private Shared _serializerXml As XmlSerializer #End Region Public Property attribType() As String Get Return Me._attribType End Get Set Me._attribType = Value End Set End Property Public Property attribText() As String Get Return Me._attribText End Get Set Me._attribText = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TAttribute)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TAttribute object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TAttribute object ''' ''' string to deserialize ''' Output TAttribute object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAttribute, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAttribute) 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 TAttribute) 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 TAttribute Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TAttribute) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TAttribute Return CType(SerializerXml.Deserialize(s), TAttribute) End Function #End Region ''' ''' Serializes current TAttribute object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TAttribute object ''' ''' File to load and deserialize ''' Output TAttribute object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAttribute, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAttribute) 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 TAttribute) 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 TAttribute Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TContainer #Region "Private fields" Private _contNo As String Private _contType As String Private _sealNumber As String Private _goodsReference As List(Of TContainerGoodsReference) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._goodsReference = New List(Of TContainerGoodsReference)() End Sub Public Property contNo() As String Get Return Me._contNo End Get Set Me._contNo = Value End Set End Property Public Property contType() As String Get Return Me._contType End Get Set Me._contType = Value End Set End Property Public Property sealNumber() As String Get Return Me._sealNumber End Get Set Me._sealNumber = Value End Set End Property Public Property goodsReference() As List(Of TContainerGoodsReference) Get Return Me._goodsReference End Get Set Me._goodsReference = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TContainer)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TContainer object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TContainer object ''' ''' string to deserialize ''' Output TContainer object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TContainer, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TContainer) 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 TContainer) 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 TContainer Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TContainer) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TContainer Return CType(SerializerXml.Deserialize(s), TContainer) End Function #End Region ''' ''' Serializes current TContainer object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TContainer object ''' ''' File to load and deserialize ''' Output TContainer object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TContainer, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TContainer) 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 TContainer) 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 TContainer Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TContainerGoodsReference #Region "Private fields" Private _itemNumber As String Private Shared _serializerXml As XmlSerializer #End Region Public Property itemNumber() As String Get Return Me._itemNumber End Get Set Me._itemNumber = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TContainerGoodsReference)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TContainerGoodsReference object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TContainerGoodsReference object ''' ''' string to deserialize ''' Output TContainerGoodsReference object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TContainerGoodsReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TContainerGoodsReference) 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 TContainerGoodsReference) 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 TContainerGoodsReference Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TContainerGoodsReference) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TContainerGoodsReference Return CType(SerializerXml.Deserialize(s), TContainerGoodsReference) End Function #End Region ''' ''' Serializes current TContainerGoodsReference object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TContainerGoodsReference object ''' ''' File to load and deserialize ''' Output TContainerGoodsReference object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TContainerGoodsReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TContainerGoodsReference) 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 TContainerGoodsReference) 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 TContainerGoodsReference Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Public Enum TInvoiceLineEndUserInEam Item Item0 Item1 End Enum Partial Public Class TInvoiceLineShipTo #Region "Private fields" Private _addrNo As String Private _addrName As List(Of String) Private _addrStreet As String Private _addrLoc As String Private _addrCtry As String Private _addrState As String Private _addrZip As String Private _addrTin As String Private _addrEori As String Private _addrNatT As String Private _branchNo As String Private _addrKvb As String Private _contactPerson As TContactPerson Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._contactPerson = New TContactPerson() Me._addrName = New List(Of String)() End Sub Public Property addrNo() As String Get Return Me._addrNo End Get Set Me._addrNo = Value End Set End Property Public Property addrName() As List(Of String) Get Return Me._addrName End Get Set Me._addrName = Value End Set End Property Public Property addrStreet() As String Get Return Me._addrStreet End Get Set Me._addrStreet = Value End Set End Property Public Property addrLoc() As String Get Return Me._addrLoc End Get Set Me._addrLoc = Value End Set End Property Public Property addrCtry() As String Get Return Me._addrCtry End Get Set Me._addrCtry = Value End Set End Property Public Property addrState() As String Get Return Me._addrState End Get Set Me._addrState = Value End Set End Property Public Property addrZip() As String Get Return Me._addrZip End Get Set Me._addrZip = Value End Set End Property Public Property addrTin() As String Get Return Me._addrTin End Get Set Me._addrTin = Value End Set End Property Public Property addrEori() As String Get Return Me._addrEori End Get Set Me._addrEori = Value End Set End Property Public Property addrNatT() As String Get Return Me._addrNatT End Get Set Me._addrNatT = Value End Set End Property Public Property branchNo() As String Get Return Me._branchNo End Get Set Me._branchNo = Value End Set End Property Public Property addrKvb() As String Get Return Me._addrKvb End Get Set Me._addrKvb = Value End Set End Property Public Property contactPerson() As TContactPerson Get Return Me._contactPerson End Get Set Me._contactPerson = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLineShipTo)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLineShipTo object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLineShipTo object ''' ''' string to deserialize ''' Output TInvoiceLineShipTo object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLineShipTo, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineShipTo) 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 TInvoiceLineShipTo) 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 TInvoiceLineShipTo Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLineShipTo) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLineShipTo Return CType(SerializerXml.Deserialize(s), TInvoiceLineShipTo) End Function #End Region ''' ''' Serializes current TInvoiceLineShipTo object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLineShipTo object ''' ''' File to load and deserialize ''' Output TInvoiceLineShipTo object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLineShipTo, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineShipTo) 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 TInvoiceLineShipTo) 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 TInvoiceLineShipTo Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TContactPerson #Region "Private fields" Private _job As String Private _name As String Private _email As String Private _phone As String Private _fax As String Private Shared _serializerXml As XmlSerializer #End Region Public Property job() As String Get Return Me._job End Get Set Me._job = Value End Set End Property Public Property name() As String Get Return Me._name End Get Set Me._name = Value End Set End Property Public Property email() As String Get Return Me._email End Get Set Me._email = Value End Set End Property Public Property phone() As String Get Return Me._phone End Get Set Me._phone = Value End Set End Property Public Property fax() As String Get Return Me._fax End Get Set Me._fax = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TContactPerson)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TContactPerson object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TContactPerson object ''' ''' string to deserialize ''' Output TContactPerson object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TContactPerson, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TContactPerson) 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 TContactPerson) 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 TContactPerson Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TContactPerson) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TContactPerson Return CType(SerializerXml.Deserialize(s), TContactPerson) End Function #End Region ''' ''' Serializes current TContactPerson object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TContactPerson object ''' ''' File to load and deserialize ''' Output TContactPerson object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TContactPerson, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TContactPerson) 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 TContactPerson) 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 TContactPerson Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceLineEndUser #Region "Private fields" Private _addrNo As String Private _addrName As List(Of String) Private _addrStreet As String Private _addrLoc As String Private _addrCtry As String Private _addrZip As String Private _addrTin As String Private _addrEori As String Private _addrNatT As String Private _branchNo As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._addrName = New List(Of String)() End Sub Public Property addrNo() As String Get Return Me._addrNo End Get Set Me._addrNo = Value End Set End Property Public Property addrName() As List(Of String) Get Return Me._addrName End Get Set Me._addrName = Value End Set End Property Public Property addrStreet() As String Get Return Me._addrStreet End Get Set Me._addrStreet = Value End Set End Property Public Property addrLoc() As String Get Return Me._addrLoc End Get Set Me._addrLoc = Value End Set End Property Public Property addrCtry() As String Get Return Me._addrCtry End Get Set Me._addrCtry = Value End Set End Property Public Property addrZip() As String Get Return Me._addrZip End Get Set Me._addrZip = Value End Set End Property Public Property addrTin() As String Get Return Me._addrTin End Get Set Me._addrTin = Value End Set End Property Public Property addrEori() As String Get Return Me._addrEori End Get Set Me._addrEori = Value End Set End Property Public Property addrNatT() As String Get Return Me._addrNatT End Get Set Me._addrNatT = Value End Set End Property Public Property branchNo() As String Get Return Me._branchNo End Get Set Me._branchNo = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLineEndUser)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLineEndUser object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLineEndUser object ''' ''' string to deserialize ''' Output TInvoiceLineEndUser object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLineEndUser, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineEndUser) 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 TInvoiceLineEndUser) 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 TInvoiceLineEndUser Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLineEndUser) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLineEndUser Return CType(SerializerXml.Deserialize(s), TInvoiceLineEndUser) End Function #End Region ''' ''' Serializes current TInvoiceLineEndUser object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLineEndUser object ''' ''' File to load and deserialize ''' Output TInvoiceLineEndUser object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLineEndUser, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineEndUser) 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 TInvoiceLineEndUser) 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 TInvoiceLineEndUser Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceLineOutwardProcessing #Region "Private fields" Private _replacement As String Private _reimportDate As Date Private Shared _serializerXml As XmlSerializer #End Region Public Property replacement() As String Get Return Me._replacement End Get Set Me._replacement = Value End Set End Property Public Property reimportDate() As Date Get Return Me._reimportDate End Get Set Me._reimportDate = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLineOutwardProcessing)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLineOutwardProcessing object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLineOutwardProcessing object ''' ''' string to deserialize ''' Output TInvoiceLineOutwardProcessing object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLineOutwardProcessing, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineOutwardProcessing) 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 TInvoiceLineOutwardProcessing) 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 TInvoiceLineOutwardProcessing Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLineOutwardProcessing) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLineOutwardProcessing Return CType(SerializerXml.Deserialize(s), TInvoiceLineOutwardProcessing) End Function #End Region ''' ''' Serializes current TInvoiceLineOutwardProcessing object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLineOutwardProcessing object ''' ''' File to load and deserialize ''' Output TInvoiceLineOutwardProcessing object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLineOutwardProcessing, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineOutwardProcessing) 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 TInvoiceLineOutwardProcessing) 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 TInvoiceLineOutwardProcessing Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TPartner #Region "Private fields" Private _partnerTyp As String Private _partnerAddress As TPartnerPartnerAddress Private _partnerRelation As String Private _customerFields As TCustomerFields Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._customerFields = New TCustomerFields() Me._partnerAddress = New TPartnerPartnerAddress() End Sub Public Property partnerTyp() As String Get Return Me._partnerTyp End Get Set Me._partnerTyp = Value End Set End Property Public Property partnerAddress() As TPartnerPartnerAddress Get Return Me._partnerAddress End Get Set Me._partnerAddress = Value End Set End Property Public Property partnerRelation() As String Get Return Me._partnerRelation End Get Set Me._partnerRelation = Value End Set End Property Public Property customerFields() As TCustomerFields Get Return Me._customerFields End Get Set Me._customerFields = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TPartner)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TPartner object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TPartner object ''' ''' string to deserialize ''' Output TPartner object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TPartner, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPartner) 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 TPartner) 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 TPartner Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TPartner) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TPartner Return CType(SerializerXml.Deserialize(s), TPartner) End Function #End Region ''' ''' Serializes current TPartner object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TPartner object ''' ''' File to load and deserialize ''' Output TPartner object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartner, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPartner) 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 TPartner) 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 TPartner Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TPartnerPartnerAddress #Region "Private fields" Private _addrNo As String Private _addrNoType As String Private _addrName As List(Of String) Private _addrStreet As String Private _addrStreet2 As String Private _addrLoc As String Private _addrCtry As String Private _addrState As String Private _addrZip As String Private _addrTin As String Private _addrEori As String Private _addrNatT As String Private _branchNo As String Private _addrKvb As String Private _addrInfo As String Private _addrRole As String Private _contactPerson As TContactPerson Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._contactPerson = New TContactPerson() Me._addrName = New List(Of String)() End Sub Public Property addrNo() As String Get Return Me._addrNo End Get Set Me._addrNo = Value End Set End Property Public Property addrNoType() As String Get Return Me._addrNoType End Get Set Me._addrNoType = Value End Set End Property Public Property addrName() As List(Of String) Get Return Me._addrName End Get Set Me._addrName = Value End Set End Property Public Property addrStreet() As String Get Return Me._addrStreet End Get Set Me._addrStreet = Value End Set End Property Public Property addrStreet2() As String Get Return Me._addrStreet2 End Get Set Me._addrStreet2 = Value End Set End Property Public Property addrLoc() As String Get Return Me._addrLoc End Get Set Me._addrLoc = Value End Set End Property Public Property addrCtry() As String Get Return Me._addrCtry End Get Set Me._addrCtry = Value End Set End Property Public Property addrState() As String Get Return Me._addrState End Get Set Me._addrState = Value End Set End Property Public Property addrZip() As String Get Return Me._addrZip End Get Set Me._addrZip = Value End Set End Property Public Property addrTin() As String Get Return Me._addrTin End Get Set Me._addrTin = Value End Set End Property Public Property addrEori() As String Get Return Me._addrEori End Get Set Me._addrEori = Value End Set End Property Public Property addrNatT() As String Get Return Me._addrNatT End Get Set Me._addrNatT = Value End Set End Property Public Property branchNo() As String Get Return Me._branchNo End Get Set Me._branchNo = Value End Set End Property Public Property addrKvb() As String Get Return Me._addrKvb End Get Set Me._addrKvb = Value End Set End Property Public Property addrInfo() As String Get Return Me._addrInfo End Get Set Me._addrInfo = Value End Set End Property Public Property addrRole() As String Get Return Me._addrRole End Get Set Me._addrRole = Value End Set End Property Public Property contactPerson() As TContactPerson Get Return Me._contactPerson End Get Set Me._contactPerson = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TPartnerPartnerAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TPartnerPartnerAddress object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TPartnerPartnerAddress object ''' ''' string to deserialize ''' Output TPartnerPartnerAddress object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TPartnerPartnerAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPartnerPartnerAddress) 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 TPartnerPartnerAddress) 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 TPartnerPartnerAddress Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TPartnerPartnerAddress) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TPartnerPartnerAddress Return CType(SerializerXml.Deserialize(s), TPartnerPartnerAddress) End Function #End Region ''' ''' Serializes current TPartnerPartnerAddress object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TPartnerPartnerAddress object ''' ''' File to load and deserialize ''' Output TPartnerPartnerAddress object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartnerPartnerAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TPartnerPartnerAddress) 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 TPartnerPartnerAddress) 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 TPartnerPartnerAddress Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TAuthorisation #Region "Private fields" Private _type As String Private _referenceNumber As String Private _id As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property referenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = Value End Set End Property Public Property id() As String Get Return Me._id End Get Set Me._id = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TAuthorisation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TAuthorisation object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TAuthorisation object ''' ''' string to deserialize ''' Output TAuthorisation object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAuthorisation) 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 TAuthorisation) 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 TAuthorisation Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TAuthorisation) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TAuthorisation Return CType(SerializerXml.Deserialize(s), TAuthorisation) End Function #End Region ''' ''' Serializes current TAuthorisation object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TAuthorisation object ''' ''' File to load and deserialize ''' Output TAuthorisation object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAuthorisation) 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 TAuthorisation) 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 TAuthorisation Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceLineEudr #Region "Private fields" Private _supplierNumber As String Private _countryOfProduction As String Private Shared _serializerXml As XmlSerializer #End Region Public Property supplierNumber() As String Get Return Me._supplierNumber End Get Set Me._supplierNumber = Value End Set End Property Public Property countryOfProduction() As String Get Return Me._countryOfProduction End Get Set Me._countryOfProduction = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceLineEudr)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceLineEudr object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceLineEudr object ''' ''' string to deserialize ''' Output TInvoiceLineEudr object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceLineEudr, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineEudr) 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 TInvoiceLineEudr) 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 TInvoiceLineEudr Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceLineEudr) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceLineEudr Return CType(SerializerXml.Deserialize(s), TInvoiceLineEudr) End Function #End Region ''' ''' Serializes current TInvoiceLineEudr object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceLineEudr object ''' ''' File to load and deserialize ''' Output TInvoiceLineEudr object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceLineEudr, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceLineEudr) 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 TInvoiceLineEudr) 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 TInvoiceLineEudr Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TDelTerm #Region "Private fields" Private _code As String Private _unlocode As String Private _desc As String Private _country As String Private _text As String Private _code2 As String Private Shared _serializerXml As XmlSerializer #End Region Public Property code() As String Get Return Me._code End Get Set Me._code = Value End Set End Property Public Property unlocode() As String Get Return Me._unlocode End Get Set Me._unlocode = Value End Set End Property Public Property desc() As String Get Return Me._desc End Get Set Me._desc = Value End Set End Property Public Property country() As String Get Return Me._country End Get Set Me._country = Value End Set End Property Public Property text() As String Get Return Me._text End Get Set Me._text = Value End Set End Property Public Property code2() As String Get Return Me._code2 End Get Set Me._code2 = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TDelTerm)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TDelTerm object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TDelTerm object ''' ''' string to deserialize ''' Output TDelTerm object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDelTerm, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDelTerm) 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 TDelTerm) 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 TDelTerm Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TDelTerm) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TDelTerm Return CType(SerializerXml.Deserialize(s), TDelTerm) End Function #End Region ''' ''' Serializes current TDelTerm object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TDelTerm object ''' ''' File to load and deserialize ''' Output TDelTerm object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelTerm, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDelTerm) 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 TDelTerm) 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 TDelTerm Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TAddress #Region "Private fields" Private _addrNo As String Private _addrName As List(Of String) Private _addrStreet As String Private _addrLoc As String Private _addrCtry As String Private _addrState As String Private _addrZip As String Private _addrTin As String Private _addrVatId As String Private _addrEori As String Private _addrNatT As String Private _branchNo As String Private _addrKvb As String Private _contactPerson As TContactPerson Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._contactPerson = New TContactPerson() Me._addrName = New List(Of String)() End Sub Public Property addrNo() As String Get Return Me._addrNo End Get Set Me._addrNo = Value End Set End Property Public Property addrName() As List(Of String) Get Return Me._addrName End Get Set Me._addrName = Value End Set End Property Public Property addrStreet() As String Get Return Me._addrStreet End Get Set Me._addrStreet = Value End Set End Property Public Property addrLoc() As String Get Return Me._addrLoc End Get Set Me._addrLoc = Value End Set End Property Public Property addrCtry() As String Get Return Me._addrCtry End Get Set Me._addrCtry = Value End Set End Property Public Property addrState() As String Get Return Me._addrState End Get Set Me._addrState = Value End Set End Property Public Property addrZip() As String Get Return Me._addrZip End Get Set Me._addrZip = Value End Set End Property Public Property addrTin() As String Get Return Me._addrTin End Get Set Me._addrTin = Value End Set End Property Public Property addrVatId() As String Get Return Me._addrVatId End Get Set Me._addrVatId = Value End Set End Property Public Property addrEori() As String Get Return Me._addrEori End Get Set Me._addrEori = Value End Set End Property Public Property addrNatT() As String Get Return Me._addrNatT End Get Set Me._addrNatT = Value End Set End Property Public Property branchNo() As String Get Return Me._branchNo End Get Set Me._branchNo = Value End Set End Property Public Property addrKvb() As String Get Return Me._addrKvb End Get Set Me._addrKvb = Value End Set End Property Public Property contactPerson() As TContactPerson Get Return Me._contactPerson End Get Set Me._contactPerson = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TAddress object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TAddress object ''' ''' string to deserialize ''' Output TAddress object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAddress) 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 TAddress) 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 TAddress Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TAddress) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TAddress Return CType(SerializerXml.Deserialize(s), TAddress) End Function #End Region ''' ''' Serializes current TAddress object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TAddress object ''' ''' File to load and deserialize ''' Output TAddress object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAddress) 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 TAddress) 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 TAddress Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceHead #Region "Private fields" Private _invoiceNo As String Private _invoiceVersion As String Private _invoiceDate As Date Private _invType As String Private _totAmount As Decimal Private _curr As String Private _exchangeRate As Decimal Private _shipTo As TAddress Private _endUser As TInvoiceHeadEndUser Private _delTerm As TDelTerm Private _billTo As TAddress Private _ref As String Private _tradeCtry As String Private _gWeight As Decimal Private _nWeight As Decimal Private _addCosts As List(Of TAddCosts) Private _bol As String Private _transpNr As String Private _addtext As List(Of String) Private _documents As List(Of TDocuments) Private _mrnExt As String Private _numberOfPackages As Decimal Private _packageDescription As String Private _transportType As String Private _invoiceReferenceNumber As String Private _nctsIndicator As Boolean Private _deliveryType As String Private _crossingBorderDate As Date Private _customerFields As TCustomerFields Private _partners As List(Of TPartner) Private _attributes As List(Of TAttribute) Private _natureOfTransaction As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._attributes = New List(Of TAttribute)() Me._partners = New List(Of TPartner)() Me._customerFields = New TCustomerFields() Me._documents = New List(Of TDocuments)() Me._addtext = New List(Of String)() Me._addCosts = New List(Of TAddCosts)() Me._billTo = New TAddress() Me._delTerm = New TDelTerm() Me._endUser = New TInvoiceHeadEndUser() Me._shipTo = New TAddress() Me._invoiceVersion = "1" End Sub Public Property invoiceNo() As String Get Return Me._invoiceNo End Get Set Me._invoiceNo = Value End Set End Property Public Property invoiceVersion() As String Get Return Me._invoiceVersion End Get Set Me._invoiceVersion = Value End Set End Property Public Property invoiceDate() As Date Get Return Me._invoiceDate End Get Set Me._invoiceDate = Value End Set End Property Public Property invType() As String Get Return Me._invType End Get Set Me._invType = Value End Set End Property Public Property totAmount() As Decimal Get Return Me._totAmount End Get Set Me._totAmount = Value End Set End Property Public Property curr() As String Get Return Me._curr End Get Set Me._curr = Value End Set End Property Public Property exchangeRate() As Decimal Get Return Me._exchangeRate End Get Set Me._exchangeRate = Value End Set End Property Public Property shipTo() As TAddress Get Return Me._shipTo End Get Set Me._shipTo = Value End Set End Property Public Property endUser() As TInvoiceHeadEndUser Get Return Me._endUser End Get Set Me._endUser = Value End Set End Property Public Property delTerm() As TDelTerm Get Return Me._delTerm End Get Set Me._delTerm = Value End Set End Property Public Property billTo() As TAddress Get Return Me._billTo End Get Set Me._billTo = Value End Set End Property Public Property ref() As String Get Return Me._ref End Get Set Me._ref = Value End Set End Property Public Property tradeCtry() As String Get Return Me._tradeCtry End Get Set Me._tradeCtry = Value End Set End Property Public Property gWeight() As Decimal Get Return Me._gWeight End Get Set Me._gWeight = Value End Set End Property Public Property nWeight() As Decimal Get Return Me._nWeight End Get Set Me._nWeight = Value End Set End Property Public Property addCosts() As List(Of TAddCosts) Get Return Me._addCosts End Get Set Me._addCosts = Value End Set End Property Public Property bol() As String Get Return Me._bol End Get Set Me._bol = Value End Set End Property Public Property transpNr() As String Get Return Me._transpNr End Get Set Me._transpNr = Value End Set End Property Public Property addtext() As List(Of String) Get Return Me._addtext End Get Set Me._addtext = Value End Set End Property Public Property documents() As List(Of TDocuments) Get Return Me._documents End Get Set Me._documents = Value End Set End Property Public Property mrnExt() As String Get Return Me._mrnExt End Get Set Me._mrnExt = Value End Set End Property Public Property numberOfPackages() As Decimal Get Return Me._numberOfPackages End Get Set Me._numberOfPackages = Value End Set End Property Public Property packageDescription() As String Get Return Me._packageDescription End Get Set Me._packageDescription = Value End Set End Property Public Property transportType() As String Get Return Me._transportType End Get Set Me._transportType = Value End Set End Property Public Property invoiceReferenceNumber() As String Get Return Me._invoiceReferenceNumber End Get Set Me._invoiceReferenceNumber = Value End Set End Property Public Property nctsIndicator() As Boolean Get Return Me._nctsIndicator End Get Set Me._nctsIndicator = Value End Set End Property Public Property deliveryType() As String Get Return Me._deliveryType End Get Set Me._deliveryType = Value End Set End Property Public Property crossingBorderDate() As Date Get Return Me._crossingBorderDate End Get Set Me._crossingBorderDate = 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 partners() As List(Of TPartner) Get Return Me._partners End Get Set Me._partners = Value End Set End Property Public Property attributes() As List(Of TAttribute) Get Return Me._attributes End Get Set Me._attributes = Value End Set End Property Public Property natureOfTransaction() As String Get Return Me._natureOfTransaction End Get Set Me._natureOfTransaction = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceHead)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceHead object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceHead object ''' ''' string to deserialize ''' Output TInvoiceHead object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceHead, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceHead) 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 TInvoiceHead) 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 TInvoiceHead Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceHead) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceHead Return CType(SerializerXml.Deserialize(s), TInvoiceHead) End Function #End Region ''' ''' Serializes current TInvoiceHead object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceHead object ''' ''' File to load and deserialize ''' Output TInvoiceHead object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceHead, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceHead) 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 TInvoiceHead) 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 TInvoiceHead Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoiceHeadEndUser #Region "Private fields" Private _addrNo As String Private _addrName As List(Of String) Private _addrStreet As String Private _addrLoc As String Private _addrCtry As String Private _addrZip As String Private _addrTin As String Private _addrEori As String Private _addrNatT As String Private _branchNo As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._addrName = New List(Of String)() End Sub Public Property addrNo() As String Get Return Me._addrNo End Get Set Me._addrNo = Value End Set End Property Public Property addrName() As List(Of String) Get Return Me._addrName End Get Set Me._addrName = Value End Set End Property Public Property addrStreet() As String Get Return Me._addrStreet End Get Set Me._addrStreet = Value End Set End Property Public Property addrLoc() As String Get Return Me._addrLoc End Get Set Me._addrLoc = Value End Set End Property Public Property addrCtry() As String Get Return Me._addrCtry End Get Set Me._addrCtry = Value End Set End Property Public Property addrZip() As String Get Return Me._addrZip End Get Set Me._addrZip = Value End Set End Property Public Property addrTin() As String Get Return Me._addrTin End Get Set Me._addrTin = Value End Set End Property Public Property addrEori() As String Get Return Me._addrEori End Get Set Me._addrEori = Value End Set End Property Public Property addrNatT() As String Get Return Me._addrNatT End Get Set Me._addrNatT = Value End Set End Property Public Property branchNo() As String Get Return Me._branchNo End Get Set Me._branchNo = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoiceHeadEndUser)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoiceHeadEndUser object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoiceHeadEndUser object ''' ''' string to deserialize ''' Output TInvoiceHeadEndUser object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoiceHeadEndUser, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceHeadEndUser) 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 TInvoiceHeadEndUser) 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 TInvoiceHeadEndUser Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoiceHeadEndUser) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoiceHeadEndUser Return CType(SerializerXml.Deserialize(s), TInvoiceHeadEndUser) End Function #End Region ''' ''' Serializes current TInvoiceHeadEndUser object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoiceHeadEndUser object ''' ''' File to load and deserialize ''' Output TInvoiceHeadEndUser object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoiceHeadEndUser, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoiceHeadEndUser) 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 TInvoiceHeadEndUser) 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 TInvoiceHeadEndUser Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TInvoice #Region "Private fields" Private _invoiceHead As TInvoiceHead Private _invoiceLine As List(Of TInvoiceLine) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._invoiceLine = New List(Of TInvoiceLine)() Me._invoiceHead = New TInvoiceHead() End Sub Public Property InvoiceHead() As TInvoiceHead Get Return Me._invoiceHead End Get Set Me._invoiceHead = Value End Set End Property Public Property InvoiceLine() As List(Of TInvoiceLine) Get Return Me._invoiceLine End Get Set Me._invoiceLine = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TInvoice)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TInvoice object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TInvoice object ''' ''' string to deserialize ''' Output TInvoice object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TInvoice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoice) 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 TInvoice) 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 TInvoice Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TInvoice) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TInvoice Return CType(SerializerXml.Deserialize(s), TInvoice) End Function #End Region ''' ''' Serializes current TInvoice object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TInvoice object ''' ''' File to load and deserialize ''' Output TInvoice object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInvoice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TInvoice) 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 TInvoice) 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 TInvoice Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentPreviousDocument #Region "Private fields" Private _docType As String Private _docQual As String Private _docNo As String Private Shared _serializerXml As XmlSerializer #End Region Public Property docType() As String Get Return Me._docType End Get Set Me._docType = Value End Set End Property Public Property docQual() As String Get Return Me._docQual End Get Set Me._docQual = Value End Set End Property Public Property docNo() As String Get Return Me._docNo End Get Set Me._docNo = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentPreviousDocument)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentPreviousDocument object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentPreviousDocument object ''' ''' string to deserialize ''' Output TShipmentPreviousDocument object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentPreviousDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentPreviousDocument) 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 TShipmentPreviousDocument) 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 TShipmentPreviousDocument Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentPreviousDocument) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentPreviousDocument Return CType(SerializerXml.Deserialize(s), TShipmentPreviousDocument) End Function #End Region ''' ''' Serializes current TShipmentPreviousDocument object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentPreviousDocument object ''' ''' File to load and deserialize ''' Output TShipmentPreviousDocument object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentPreviousDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentPreviousDocument) 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 TShipmentPreviousDocument) 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 TShipmentPreviousDocument Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TErpShipmentData #Region "Private fields" Private _erpSystemId As String Private _client As String Private _companyCode As String Private _customerId As String Private _consolidationCompanyId As String Private _accountGroup As String Private _shippingPoint As String Private _loadingPoint As String Private _offshore As Boolean Private _route As String Private _salesOrganization As String Private _distributionChannel As String Private Shared _serializerXml As XmlSerializer #End Region Public Property erpSystemId() As String Get Return Me._erpSystemId End Get Set Me._erpSystemId = Value End Set End Property Public Property client() As String Get Return Me._client End Get Set Me._client = Value End Set End Property Public Property companyCode() As String Get Return Me._companyCode End Get Set Me._companyCode = Value End Set End Property Public Property customerId() As String Get Return Me._customerId End Get Set Me._customerId = Value End Set End Property Public Property consolidationCompanyId() As String Get Return Me._consolidationCompanyId End Get Set Me._consolidationCompanyId = Value End Set End Property Public Property accountGroup() As String Get Return Me._accountGroup End Get Set Me._accountGroup = Value End Set End Property Public Property shippingPoint() As String Get Return Me._shippingPoint End Get Set Me._shippingPoint = Value End Set End Property Public Property loadingPoint() As String Get Return Me._loadingPoint End Get Set Me._loadingPoint = Value End Set End Property Public Property offshore() As Boolean Get Return Me._offshore End Get Set Me._offshore = Value End Set End Property Public Property route() As String Get Return Me._route End Get Set Me._route = Value End Set End Property Public Property salesOrganization() As String Get Return Me._salesOrganization End Get Set Me._salesOrganization = Value End Set End Property Public Property distributionChannel() As String Get Return Me._distributionChannel End Get Set Me._distributionChannel = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TErpShipmentData)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TErpShipmentData object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TErpShipmentData object ''' ''' string to deserialize ''' Output TErpShipmentData object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TErpShipmentData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErpShipmentData) 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 TErpShipmentData) 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 TErpShipmentData Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TErpShipmentData) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TErpShipmentData Return CType(SerializerXml.Deserialize(s), TErpShipmentData) End Function #End Region ''' ''' Serializes current TErpShipmentData object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TErpShipmentData object ''' ''' File to load and deserialize ''' Output TErpShipmentData object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpShipmentData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErpShipmentData) 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 TErpShipmentData) 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 TErpShipmentData Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TStateOfAffairs #Region "Private fields" Private _stateOfAffairsCode As List(Of String) Private _text As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._stateOfAffairsCode = New List(Of String)() End Sub Public Property stateOfAffairsCode() As List(Of String) Get Return Me._stateOfAffairsCode End Get Set Me._stateOfAffairsCode = Value End Set End Property Public Property text() As String Get Return Me._text End Get Set Me._text = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TStateOfAffairs)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TStateOfAffairs object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TStateOfAffairs object ''' ''' string to deserialize ''' Output TStateOfAffairs object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TStateOfAffairs, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TStateOfAffairs) 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 TStateOfAffairs) 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 TStateOfAffairs Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TStateOfAffairs) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TStateOfAffairs Return CType(SerializerXml.Deserialize(s), TStateOfAffairs) End Function #End Region ''' ''' Serializes current TStateOfAffairs object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TStateOfAffairs object ''' ''' File to load and deserialize ''' Output TStateOfAffairs object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TStateOfAffairs, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TStateOfAffairs) 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 TStateOfAffairs) 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 TStateOfAffairs Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TRoute #Region "Private fields" Private _country As String Private Shared _serializerXml As XmlSerializer #End Region Public Property country() As String Get Return Me._country End Get Set Me._country = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TRoute)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TRoute object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TRoute object ''' ''' string to deserialize ''' Output TRoute object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TRoute, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TRoute) 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 TRoute) 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 TRoute Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TRoute) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TRoute Return CType(SerializerXml.Deserialize(s), TRoute) End Function #End Region ''' ''' Serializes current TRoute object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TRoute object ''' ''' File to load and deserialize ''' Output TRoute object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TRoute, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TRoute) 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 TRoute) 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 TRoute Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TAssurance #Region "Private fields" Private _flag As String Private _amount As Decimal Private _curr As String Private Shared _serializerXml As XmlSerializer #End Region Public Property flag() As String Get Return Me._flag End Get Set Me._flag = Value End Set End Property Public Property amount() As Decimal Get Return Me._amount End Get Set Me._amount = Value End Set End Property Public Property curr() As String Get Return Me._curr End Get Set Me._curr = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TAssurance)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TAssurance object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TAssurance object ''' ''' string to deserialize ''' Output TAssurance object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TAssurance, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAssurance) 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 TAssurance) 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 TAssurance Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TAssurance) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TAssurance Return CType(SerializerXml.Deserialize(s), TAssurance) End Function #End Region ''' ''' Serializes current TAssurance object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TAssurance object ''' ''' File to load and deserialize ''' Output TAssurance object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAssurance, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TAssurance) 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 TAssurance) 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 TAssurance Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TFreight #Region "Private fields" Private _flag As String Private _amount As Decimal Private _curr As String Private _noneu As Decimal Private _eunat As Decimal Private _nat As Decimal Private _frtInternationalAbs As Decimal Private _frtIntCurrency As String Private _frtCommunityAbs As Decimal Private _frtCommunityCurrency As String Private _frtNatAbs As Decimal Private _frtNatCurrency As String Private Shared _serializerXml As XmlSerializer #End Region Public Property flag() As String Get Return Me._flag End Get Set Me._flag = Value End Set End Property Public Property amount() As Decimal Get Return Me._amount End Get Set Me._amount = Value End Set End Property Public Property curr() As String Get Return Me._curr End Get Set Me._curr = Value End Set End Property Public Property noneu() As Decimal Get Return Me._noneu End Get Set Me._noneu = Value End Set End Property Public Property eunat() As Decimal Get Return Me._eunat End Get Set Me._eunat = Value End Set End Property Public Property nat() As Decimal Get Return Me._nat End Get Set Me._nat = Value End Set End Property Public Property frtInternationalAbs() As Decimal Get Return Me._frtInternationalAbs End Get Set Me._frtInternationalAbs = Value End Set End Property Public Property frtIntCurrency() As String Get Return Me._frtIntCurrency End Get Set Me._frtIntCurrency = Value End Set End Property Public Property frtCommunityAbs() As Decimal Get Return Me._frtCommunityAbs End Get Set Me._frtCommunityAbs = Value End Set End Property Public Property frtCommunityCurrency() As String Get Return Me._frtCommunityCurrency End Get Set Me._frtCommunityCurrency = Value End Set End Property Public Property frtNatAbs() As Decimal Get Return Me._frtNatAbs End Get Set Me._frtNatAbs = Value End Set End Property Public Property frtNatCurrency() As String Get Return Me._frtNatCurrency End Get Set Me._frtNatCurrency = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TFreight)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TFreight object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TFreight object ''' ''' string to deserialize ''' Output TFreight object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TFreight, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TFreight) 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 TFreight) 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 TFreight Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TFreight) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TFreight Return CType(SerializerXml.Deserialize(s), TFreight) End Function #End Region ''' ''' Serializes current TFreight object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TFreight object ''' ''' File to load and deserialize ''' Output TFreight object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TFreight, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TFreight) 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 TFreight) 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 TFreight Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TDeclType #Region "Private fields" Private _type1 As String Private _type2 As String Private _type3 As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type1() As String Get Return Me._type1 End Get Set Me._type1 = Value End Set End Property Public Property type2() As String Get Return Me._type2 End Get Set Me._type2 = Value End Set End Property Public Property type3() As String Get Return Me._type3 End Get Set Me._type3 = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TDeclType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TDeclType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TDeclType object ''' ''' string to deserialize ''' Output TDeclType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TDeclType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDeclType) 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 TDeclType) 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 TDeclType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TDeclType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TDeclType Return CType(SerializerXml.Deserialize(s), TDeclType) End Function #End Region ''' ''' Serializes current TDeclType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TDeclType object ''' ''' File to load and deserialize ''' Output TDeclType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeclType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TDeclType) 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 TDeclType) 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 TDeclType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TSeal #Region "Private fields" Private _type As String Private _quantity As UInteger Private _sign As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property quantity() As UInteger Get Return Me._quantity End Get Set Me._quantity = Value End Set End Property Public Property sign() As String Get Return Me._sign End Get Set Me._sign = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TSeal)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TSeal object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TSeal object ''' ''' string to deserialize ''' Output TSeal object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TSeal, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TSeal) 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 TSeal) 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 TSeal Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TSeal) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TSeal Return CType(SerializerXml.Deserialize(s), TSeal) End Function #End Region ''' ''' Serializes current TSeal object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TSeal object ''' ''' File to load and deserialize ''' Output TSeal object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TSeal, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TSeal) 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 TSeal) 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 TSeal Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TMot #Region "Private fields" Private _mot As String Private _typeIdentBorder As Integer Private _nat As String Private _type As String Private _licNo As String Private Shared _serializerXml As XmlSerializer #End Region Public Property mot() As String Get Return Me._mot End Get Set Me._mot = Value End Set End Property Public Property typeIdentBorder() As Integer Get Return Me._typeIdentBorder End Get Set Me._typeIdentBorder = Value End Set End Property Public Property nat() As String Get Return Me._nat End Get Set Me._nat = Value End Set End Property Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property licNo() As String Get Return Me._licNo End Get Set Me._licNo = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TMot)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TMot object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TMot object ''' ''' string to deserialize ''' Output TMot object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TMot, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMot) 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 TMot) 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 TMot Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TMot) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TMot Return CType(SerializerXml.Deserialize(s), TMot) End Function #End Region ''' ''' Serializes current TMot object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TMot object ''' ''' File to load and deserialize ''' Output TMot object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMot, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TMot) 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 TMot) 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 TMot Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TCustomsOffice #Region "Private fields" Private _codeOff As String Private _offCtry As String Private Shared _serializerXml As XmlSerializer #End Region Public Property codeOff() As String Get Return Me._codeOff End Get Set Me._codeOff = Value End Set End Property Public Property offCtry() As String Get Return Me._offCtry End Get Set Me._offCtry = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TCustomsOffice)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TCustomsOffice object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TCustomsOffice object ''' ''' string to deserialize ''' Output TCustomsOffice object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TCustomsOffice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomsOffice) 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 TCustomsOffice) 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 TCustomsOffice Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TCustomsOffice) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TCustomsOffice Return CType(SerializerXml.Deserialize(s), TCustomsOffice) End Function #End Region ''' ''' Serializes current TCustomsOffice object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TCustomsOffice object ''' ''' File to load and deserialize ''' Output TCustomsOffice object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomsOffice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TCustomsOffice) 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 TCustomsOffice) 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 TCustomsOffice Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TGnss #Region "Private fields" Private _latitude As String Private _longitude As String Private Shared _serializerXml As XmlSerializer #End Region Public Property latitude() As String Get Return Me._latitude End Get Set Me._latitude = Value End Set End Property Public Property longitude() As String Get Return Me._longitude End Get Set Me._longitude = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TGnss)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TGnss object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TGnss object ''' ''' string to deserialize ''' Output TGnss object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TGnss, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TGnss) 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 TGnss) 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 TGnss Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TGnss) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TGnss Return CType(SerializerXml.Deserialize(s), TGnss) End Function #End Region ''' ''' Serializes current TGnss object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TGnss object ''' ''' File to load and deserialize ''' Output TGnss object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TGnss, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TGnss) 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 TGnss) 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 TGnss Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TLocationOfGoods #Region "Private fields" Private _qual As String Private _authNo As String Private _additionIdentifier As String Private _code As String Private _gnss As TGnss Private _street As String Private _zip As String Private _loc As String Private _ctry As String Private _name As String Private _email As String Private _phone As String Private _addit As String Private _type As String Private _customsOffice As TCustomsOffice Private _country As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._customsOffice = New TCustomsOffice() Me._gnss = New TGnss() End Sub Public Property qual() As String Get Return Me._qual End Get Set Me._qual = Value End Set End Property Public Property authNo() As String Get Return Me._authNo End Get Set Me._authNo = Value End Set End Property Public Property additionIdentifier() As String Get Return Me._additionIdentifier End Get Set Me._additionIdentifier = Value End Set End Property Public Property code() As String Get Return Me._code End Get Set Me._code = Value End Set End Property Public Property gnss() As TGnss Get Return Me._gnss End Get Set Me._gnss = Value End Set End Property Public Property street() As String Get Return Me._street End Get Set Me._street = Value End Set End Property Public Property zip() As String Get Return Me._zip End Get Set Me._zip = Value End Set End Property Public Property loc() As String Get Return Me._loc End Get Set Me._loc = Value End Set End Property Public Property ctry() As String Get Return Me._ctry End Get Set Me._ctry = Value End Set End Property Public Property name() As String Get Return Me._name End Get Set Me._name = Value End Set End Property Public Property email() As String Get Return Me._email End Get Set Me._email = Value End Set End Property Public Property phone() As String Get Return Me._phone End Get Set Me._phone = Value End Set End Property Public Property addit() As String Get Return Me._addit End Get Set Me._addit = Value End Set End Property Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property customsOffice() As TCustomsOffice Get Return Me._customsOffice End Get Set Me._customsOffice = Value End Set End Property Public Property country() As String Get Return Me._country End Get Set Me._country = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TLocationOfGoods)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TLocationOfGoods object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TLocationOfGoods object ''' ''' string to deserialize ''' Output TLocationOfGoods object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TLocationOfGoods, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TLocationOfGoods) 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 TLocationOfGoods) 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 TLocationOfGoods Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TLocationOfGoods) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TLocationOfGoods Return CType(SerializerXml.Deserialize(s), TLocationOfGoods) End Function #End Region ''' ''' Serializes current TLocationOfGoods object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TLocationOfGoods object ''' ''' File to load and deserialize ''' Output TLocationOfGoods object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TLocationOfGoods, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TLocationOfGoods) 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 TLocationOfGoods) 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 TLocationOfGoods Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHeadAuthorisation #Region "Private fields" Private _oprEntryInTheRecords As String Private _opr As String Private _trustworthyExporter As String Private _authorisedExporter As String Private Shared _serializerXml As XmlSerializer #End Region Public Property oprEntryInTheRecords() As String Get Return Me._oprEntryInTheRecords End Get Set Me._oprEntryInTheRecords = Value End Set End Property Public Property opr() As String Get Return Me._opr End Get Set Me._opr = Value End Set End Property Public Property trustworthyExporter() As String Get Return Me._trustworthyExporter End Get Set Me._trustworthyExporter = Value End Set End Property Public Property authorisedExporter() As String Get Return Me._authorisedExporter End Get Set Me._authorisedExporter = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadAuthorisation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHeadAuthorisation object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHeadAuthorisation object ''' ''' string to deserialize ''' Output TShipmentHeadAuthorisation object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHeadAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadAuthorisation) 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 TShipmentHeadAuthorisation) 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 TShipmentHeadAuthorisation Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentHeadAuthorisation) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentHeadAuthorisation Return CType(SerializerXml.Deserialize(s), TShipmentHeadAuthorisation) End Function #End Region ''' ''' Serializes current TShipmentHeadAuthorisation object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadAuthorisation object ''' ''' File to load and deserialize ''' Output TShipmentHeadAuthorisation object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHeadAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadAuthorisation) 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 TShipmentHeadAuthorisation) 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 TShipmentHeadAuthorisation Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHeadPostExportDeclaration #Region "Private fields" Private _dateOfExit As Date Private _dateOfExport As Date Private _statisticDecl As String Private _officeExit As TCustomsOffice Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._officeExit = New TCustomsOffice() End Sub Public Property dateOfExit() As Date Get Return Me._dateOfExit End Get Set Me._dateOfExit = Value End Set End Property Public Property dateOfExport() As Date Get Return Me._dateOfExport End Get Set Me._dateOfExport = Value End Set End Property Public Property statisticDecl() As String Get Return Me._statisticDecl End Get Set Me._statisticDecl = Value End Set End Property Public Property officeExit() As TCustomsOffice Get Return Me._officeExit End Get Set Me._officeExit = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadPostExportDeclaration)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHeadPostExportDeclaration object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHeadPostExportDeclaration object ''' ''' string to deserialize ''' Output TShipmentHeadPostExportDeclaration object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHeadPostExportDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadPostExportDeclaration) 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 TShipmentHeadPostExportDeclaration) 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 TShipmentHeadPostExportDeclaration Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentHeadPostExportDeclaration) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentHeadPostExportDeclaration Return CType(SerializerXml.Deserialize(s), TShipmentHeadPostExportDeclaration) End Function #End Region ''' ''' Serializes current TShipmentHeadPostExportDeclaration object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadPostExportDeclaration object ''' ''' File to load and deserialize ''' Output TShipmentHeadPostExportDeclaration object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHeadPostExportDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadPostExportDeclaration) 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 TShipmentHeadPostExportDeclaration) 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 TShipmentHeadPostExportDeclaration Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHeadOprData #Region "Private fields" Private _reimportDeadline As Date Private _standardExchange As String Private _reImport As List(Of TShipmentHeadOprDataReImport) Private _meansOfIdentification As List(Of TShipmentHeadOprDataMeansOfIdentification) Private _product As List(Of TShipmentHeadOprDataProduct) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._product = New List(Of TShipmentHeadOprDataProduct)() Me._meansOfIdentification = New List(Of TShipmentHeadOprDataMeansOfIdentification)() Me._reImport = New List(Of TShipmentHeadOprDataReImport)() End Sub Public Property reimportDeadline() As Date Get Return Me._reimportDeadline End Get Set Me._reimportDeadline = Value End Set End Property Public Property standardExchange() As String Get Return Me._standardExchange End Get Set Me._standardExchange = Value End Set End Property Public Property reImport() As List(Of TShipmentHeadOprDataReImport) Get Return Me._reImport End Get Set Me._reImport = Value End Set End Property Public Property meansOfIdentification() As List(Of TShipmentHeadOprDataMeansOfIdentification) Get Return Me._meansOfIdentification End Get Set Me._meansOfIdentification = Value End Set End Property Public Property product() As List(Of TShipmentHeadOprDataProduct) Get Return Me._product End Get Set Me._product = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprData)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHeadOprData object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHeadOprData object ''' ''' string to deserialize ''' Output TShipmentHeadOprData object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHeadOprData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprData) 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 TShipmentHeadOprData) 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 TShipmentHeadOprData Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentHeadOprData) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentHeadOprData Return CType(SerializerXml.Deserialize(s), TShipmentHeadOprData) End Function #End Region ''' ''' Serializes current TShipmentHeadOprData object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprData object ''' ''' File to load and deserialize ''' Output TShipmentHeadOprData object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHeadOprData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprData) 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 TShipmentHeadOprData) 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 TShipmentHeadOprData Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHeadOprDataReImport #Region "Private fields" Private _ctry As String Private Shared _serializerXml As XmlSerializer #End Region Public Property ctry() As String Get Return Me._ctry End Get Set Me._ctry = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprDataReImport)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHeadOprDataReImport object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHeadOprDataReImport object ''' ''' string to deserialize ''' Output TShipmentHeadOprDataReImport object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHeadOprDataReImport, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprDataReImport) 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 TShipmentHeadOprDataReImport) 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 TShipmentHeadOprDataReImport Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentHeadOprDataReImport) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentHeadOprDataReImport Return CType(SerializerXml.Deserialize(s), TShipmentHeadOprDataReImport) End Function #End Region ''' ''' Serializes current TShipmentHeadOprDataReImport object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprDataReImport object ''' ''' File to load and deserialize ''' Output TShipmentHeadOprDataReImport object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHeadOprDataReImport, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprDataReImport) 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 TShipmentHeadOprDataReImport) 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 TShipmentHeadOprDataReImport Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHeadOprDataMeansOfIdentification #Region "Private fields" Private _type As String Private _description As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property description() As String Get Return Me._description End Get Set Me._description = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprDataMeansOfIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHeadOprDataMeansOfIdentification object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHeadOprDataMeansOfIdentification object ''' ''' string to deserialize ''' Output TShipmentHeadOprDataMeansOfIdentification object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHeadOprDataMeansOfIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprDataMeansOfIdentification) 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 TShipmentHeadOprDataMeansOfIdentification) 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 TShipmentHeadOprDataMeansOfIdentification Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentHeadOprDataMeansOfIdentification) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentHeadOprDataMeansOfIdentification Return CType(SerializerXml.Deserialize(s), TShipmentHeadOprDataMeansOfIdentification) End Function #End Region ''' ''' Serializes current TShipmentHeadOprDataMeansOfIdentification object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprDataMeansOfIdentification object ''' ''' File to load and deserialize ''' Output TShipmentHeadOprDataMeansOfIdentification object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHeadOprDataMeansOfIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprDataMeansOfIdentification) 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 TShipmentHeadOprDataMeansOfIdentification) 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 TShipmentHeadOprDataMeansOfIdentification Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHeadOprDataProduct #Region "Private fields" Private _commodityCode As String Private _partDescription As String Private Shared _serializerXml As XmlSerializer #End Region Public Property commodityCode() As String Get Return Me._commodityCode End Get Set Me._commodityCode = Value End Set End Property Public Property partDescription() As String Get Return Me._partDescription End Get Set Me._partDescription = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprDataProduct)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHeadOprDataProduct object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHeadOprDataProduct object ''' ''' string to deserialize ''' Output TShipmentHeadOprDataProduct object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHeadOprDataProduct, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprDataProduct) 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 TShipmentHeadOprDataProduct) 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 TShipmentHeadOprDataProduct Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentHeadOprDataProduct) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentHeadOprDataProduct Return CType(SerializerXml.Deserialize(s), TShipmentHeadOprDataProduct) End Function #End Region ''' ''' Serializes current TShipmentHeadOprDataProduct object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprDataProduct object ''' ''' File to load and deserialize ''' Output TShipmentHeadOprDataProduct object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHeadOprDataProduct, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadOprDataProduct) 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 TShipmentHeadOprDataProduct) 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 TShipmentHeadOprDataProduct Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 Partial Public Class TShipmentHeadDepartureTransportMeans #Region "Private fields" Private _type As String Private _identificationNumber As String Private _nationality As String Private Shared _serializerXml As XmlSerializer #End Region Public Property type() As String Get Return Me._type End Get Set Me._type = Value End Set End Property Public Property identificationNumber() As String Get Return Me._identificationNumber End Get Set Me._identificationNumber = Value End Set End Property Public Property nationality() As String Get Return Me._nationality End Get Set Me._nationality = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadDepartureTransportMeans)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TShipmentHeadDepartureTransportMeans object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New 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 ''' ''' Deserializes TShipmentHeadDepartureTransportMeans object ''' ''' string to deserialize ''' Output TShipmentHeadDepartureTransportMeans object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As TShipmentHeadDepartureTransportMeans, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadDepartureTransportMeans) 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 TShipmentHeadDepartureTransportMeans) 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 TShipmentHeadDepartureTransportMeans Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TShipmentHeadDepartureTransportMeans) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TShipmentHeadDepartureTransportMeans Return CType(SerializerXml.Deserialize(s), TShipmentHeadDepartureTransportMeans) End Function #End Region ''' ''' Serializes current TShipmentHeadDepartureTransportMeans object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false 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 StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadDepartureTransportMeans object ''' ''' File to load and deserialize ''' Output TShipmentHeadDepartureTransportMeans object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHeadDepartureTransportMeans, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TShipmentHeadDepartureTransportMeans) 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 TShipmentHeadDepartureTransportMeans) 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 TShipmentHeadDepartureTransportMeans Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) 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 #Enable Warning