'' ------------------------------------------------------------------------------ '' '' Generated by Xsd2Code++. Version 5.0.0.47. www.xsd2code.com '' MIC_EXPORT_ShipmentListVisualBasicFalseFalseFalseOnlyIfDifferentFalseNet45AllTrueTrueTrueFalseFalseFalseFalseFalseNoneStartWithUnderscoreFalseFalseFalseFalseFalsePublicTrueFalseFalseFalseFalseFalseFalseFalseFalseTrueTrueTrueFalseTrueSerializeDeserializeSaveToFileLoadFromFileFalseTrueIndent2SpaceFalseFalseUTF8XmlSerializerFalseFalseFalseFalseFalseFalseFalseEntityBaseFalseFalse '' '' ------------------------------------------------------------------------------ Imports System Imports System.Diagnostics Imports System.Xml.Serialization Imports System.Collections Imports System.Xml.Schema Imports System.ComponentModel Imports System.IO Imports System.Text Imports System.Xml Imports System.Collections.Generic Imports VERAG_PROG_ALLGEMEIN.MIC_EXPORT_Basic Imports VERAG_PROG_ALLGEMEIN.MIC_EXPORT_Components Imports VERAG_PROG_ALLGEMEIN.MIC_EXPORT_InvoiceTypes Namespace MIC_EXPORT_Shipment Partial Public Class ExportShipment #Region "Private fields" Private _shipmentHead As TShipmentHead Private _invoices As List(Of TInvoice) Private _packages As List(Of TPackageHead) Private _schemaVersion As Decimal Private Shared sSerializer As XmlSerializer #End Region Public Sub New() MyBase.New Me._packages = New List(Of TPackageHead)() 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 TPackageHead) 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 Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(ExportShipment)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current ExportShipment object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an ExportShipment object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.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 System.IO.Stream) As ExportShipment Return CType(Serializer.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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ExportShipment object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class TShipmentHead #Region "Private fields" Private _company As String Private _plant As String Private _shipmentId 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 _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 _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 _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 String) Private _erpData As TErpShipmentData Private Shared sSerializer As XmlSerializer #End Region Public Sub New() MyBase.New Me._erpData = New TErpShipmentData() Me._stateOfAffairs = New List(Of String)() 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._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() 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 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 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 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 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 String) 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 Private Shared ReadOnly Property Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHead)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current TShipmentHead object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an TShipmentHead object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), TShipmentHead) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As TShipmentHead Return CType(Serializer.Deserialize(s), TShipmentHead) End Function #End Region ''' ''' 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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHead object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Public Enum TShipmentHeadEndUserInEam ''' Item ''' Item0 ''' Item1 End Enum 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 sSerializer 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 Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadAuthorisation)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current TShipmentHeadAuthorisation object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an TShipmentHeadAuthorisation object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.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 System.IO.Stream) As TShipmentHeadAuthorisation Return CType(Serializer.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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadAuthorisation object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class 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 sSerializer 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 Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadPostExportDeclaration)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current TShipmentHeadPostExportDeclaration object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an TShipmentHeadPostExportDeclaration object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.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 System.IO.Stream) As TShipmentHeadPostExportDeclaration Return CType(Serializer.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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadPostExportDeclaration object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class 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 sSerializer 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 Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprData)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current TShipmentHeadOprData object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an TShipmentHeadOprData object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.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 System.IO.Stream) As TShipmentHeadOprData Return CType(Serializer.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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprData object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class TShipmentHeadOprDataReImport #Region "Private fields" Private _ctry As String Private Shared sSerializer 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 Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprDataReImport)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current TShipmentHeadOprDataReImport object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an TShipmentHeadOprDataReImport object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.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 System.IO.Stream) As TShipmentHeadOprDataReImport Return CType(Serializer.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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprDataReImport object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class TShipmentHeadOprDataMeansOfIdentification #Region "Private fields" Private _type As String Private _description As String Private Shared sSerializer 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 Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprDataMeansOfIdentification)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current TShipmentHeadOprDataMeansOfIdentification object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an TShipmentHeadOprDataMeansOfIdentification object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.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 System.IO.Stream) As TShipmentHeadOprDataMeansOfIdentification Return CType(Serializer.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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprDataMeansOfIdentification object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class TShipmentHeadOprDataProduct #Region "Private fields" Private _commodityCode As String Private _partDescription As String Private Shared sSerializer 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 Serializer() As XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(TShipmentHeadOprDataProduct)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' ''' Serializes current TShipmentHeadOprDataProduct object into an XML string ''' ''' string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() xmlWriterSettings.Indent = True xmlWriterSettings.IndentChars = " " Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) Serializer.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes workflow markup into an TShipmentHeadOprDataProduct object ''' ''' string workflow markup 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 System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(Serializer.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 System.IO.Stream) As TShipmentHeadOprDataProduct Return CType(Serializer.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 System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TShipmentHeadOprDataProduct object ''' ''' string xml 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 System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class End Namespace