'' ------------------------------------------------------------------------------ '' '' Generated by Xsd2Code++. Version 6.0.0.0. www.xsd2code.com '' {"TargetFramework":"Net20","NameSpace":"FCFCDF","Language":"VisualBasic","CollectionBase":"","Properties":{"PrivateFieldCustomPrefix":""},"XmlAttribute":{"Enabled":true,"GenerateOrderXmlAttributes":true},"ClassParams":{"GenerateInSeparateFilesDirectory":""},"Serialization":{"ShouldSerialize":{},"AdditionalSerializers":{},"XmlSerializerEvent":{},"XmlOutput":{"IndentChars":"Indent1Space"},"JsonOutput":{},"Enabled":true,"EnableEncoding":true},"Miscellaneous":{"CleanupCode":false}} '' '' ------------------------------------------------------------------------------ #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 FCFCDF _ Partial Public Class FCFCDF #Region "Private fields" Private _metaData As FCFCDFMetaData Private _header As FCFCDFHeader Private _declarant As FCFCDFDeclarant Private _representative As FCFCDFRepresentative Private _principal As FCFCDFPrincipal Private _contactPerson As FCFCDFContactPerson Private _dutyDefermentApproval As List(Of FCFCDFDutyDefermentApproval) Private _borderTransportMeans As FCFCDFBorderTransportMeans Private _arrivalTransportMeans As FCFCDFArrivalTransportMeans Private _previousAdministrativeReferences As FCFCDFPreviousAdministrativeReferences Private _summaryDeclaration As FCFCDFSummaryDeclaration Private _customsWarehouse As FCFCDFCustomsWarehouse Private _inwardProcessing As FCFCDFInwardProcessing Private _body As FCFCDFBody Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._body = New FCFCDFBody() Me._inwardProcessing = New FCFCDFInwardProcessing() Me._customsWarehouse = New FCFCDFCustomsWarehouse() Me._summaryDeclaration = New FCFCDFSummaryDeclaration() Me._previousAdministrativeReferences = New FCFCDFPreviousAdministrativeReferences() Me._arrivalTransportMeans = New FCFCDFArrivalTransportMeans() Me._borderTransportMeans = New FCFCDFBorderTransportMeans() Me._dutyDefermentApproval = New List(Of FCFCDFDutyDefermentApproval)() Me._contactPerson = New FCFCDFContactPerson() Me._principal = New FCFCDFPrincipal() Me._representative = New FCFCDFRepresentative() Me._declarant = New FCFCDFDeclarant() Me._header = New FCFCDFHeader() Me._metaData = New FCFCDFMetaData() End Sub _ Public Property MetaData() As FCFCDFMetaData Get Return Me._metaData End Get Set Me._metaData = value End Set End Property _ Public Property Header() As FCFCDFHeader Get Return Me._header End Get Set Me._header = value End Set End Property _ Public Property Declarant() As FCFCDFDeclarant Get Return Me._declarant End Get Set Me._declarant = value End Set End Property _ Public Property Representative() As FCFCDFRepresentative Get Return Me._representative End Get Set Me._representative = value End Set End Property _ Public Property Principal() As FCFCDFPrincipal Get Return Me._principal End Get Set Me._principal = value End Set End Property _ Public Property ContactPerson() As FCFCDFContactPerson Get Return Me._contactPerson End Get Set Me._contactPerson = value End Set End Property _ Public Property DutyDefermentApproval() As List(Of FCFCDFDutyDefermentApproval) Get Return Me._dutyDefermentApproval End Get Set Me._dutyDefermentApproval = value End Set End Property _ Public Property BorderTransportMeans() As FCFCDFBorderTransportMeans Get Return Me._borderTransportMeans End Get Set Me._borderTransportMeans = value End Set End Property _ Public Property ArrivalTransportMeans() As FCFCDFArrivalTransportMeans Get Return Me._arrivalTransportMeans End Get Set Me._arrivalTransportMeans = value End Set End Property _ Public Property PreviousAdministrativeReferences() As FCFCDFPreviousAdministrativeReferences Get Return Me._previousAdministrativeReferences End Get Set Me._previousAdministrativeReferences = value End Set End Property _ Public Property SummaryDeclaration() As FCFCDFSummaryDeclaration Get Return Me._summaryDeclaration End Get Set Me._summaryDeclaration = value End Set End Property _ Public Property CustomsWarehouse() As FCFCDFCustomsWarehouse Get Return Me._customsWarehouse End Get Set Me._customsWarehouse = value End Set End Property _ Public Property InwardProcessing() As FCFCDFInwardProcessing Get Return Me._inwardProcessing End Get Set Me._inwardProcessing = value End Set End Property _ Public Property Body() As FCFCDFBody Get Return Me._body End Get Set Me._body = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDF)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDF object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDF object ''' ''' string to deserialize ''' Output FCFCDF 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 FCFCDF, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDF) 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 FCFCDF) 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 FCFCDF Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDF) 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 FCFCDF Return CType(SerializerXml.Deserialize(s),FCFCDF) End Function #End Region ''' ''' Serializes current FCFCDF 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDF object ''' ''' File to load and deserialize ''' Output FCFCDF 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDF, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDF) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDF, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDF) 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 FCFCDF Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDF 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, encoding) 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 FCFCDFMetaData #Region "Private fields" Private _preparation As FCFCDFMetaDataPreparation Private _interchangeControlReference As String Private _messageReferenceNumber As String Private _messageIdentifier As String Private _messageGroup As FCFCDFMetaDataMessageGroup Private _testIndicator As FCFCDFMetaDataTestIndicator Private _messageType As FCFCDFMetaDataMessageType Private _interchangeSender As FCFCDFMetaDataInterchangeSender Private _interchangeRecipient As FCFCDFMetaDataInterchangeRecipient Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._interchangeRecipient = New FCFCDFMetaDataInterchangeRecipient() Me._interchangeSender = New FCFCDFMetaDataInterchangeSender() Me._preparation = New FCFCDFMetaDataPreparation() End Sub _ Public Property Preparation() As FCFCDFMetaDataPreparation Get Return Me._preparation End Get Set Me._preparation = value End Set End Property _ Public Property InterchangeControlReference() As String Get Return Me._interchangeControlReference End Get Set Me._interchangeControlReference = value End Set End Property _ Public Property MessageReferenceNumber() As String Get Return Me._messageReferenceNumber End Get Set Me._messageReferenceNumber = value End Set End Property _ Public Property MessageIdentifier() As String Get Return Me._messageIdentifier End Get Set Me._messageIdentifier = value End Set End Property _ Public Property MessageGroup() As FCFCDFMetaDataMessageGroup Get Return Me._messageGroup End Get Set Me._messageGroup = value End Set End Property _ Public Property TestIndicator() As FCFCDFMetaDataTestIndicator Get Return Me._testIndicator End Get Set Me._testIndicator = value End Set End Property _ Public Property MessageType() As FCFCDFMetaDataMessageType Get Return Me._messageType End Get Set Me._messageType = value End Set End Property _ Public Property InterchangeSender() As FCFCDFMetaDataInterchangeSender Get Return Me._interchangeSender End Get Set Me._interchangeSender = value End Set End Property _ Public Property InterchangeRecipient() As FCFCDFMetaDataInterchangeRecipient Get Return Me._interchangeRecipient End Get Set Me._interchangeRecipient = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFMetaData)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFMetaData object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFMetaData object ''' ''' string to deserialize ''' Output FCFCDFMetaData 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 FCFCDFMetaData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaData) 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 FCFCDFMetaData) 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 FCFCDFMetaData Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFMetaData) 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 FCFCDFMetaData Return CType(SerializerXml.Deserialize(s),FCFCDFMetaData) End Function #End Region ''' ''' Serializes current FCFCDFMetaData 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFMetaData object ''' ''' File to load and deserialize ''' Output FCFCDFMetaData 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFMetaData, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaData) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFMetaData, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFMetaData) 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 FCFCDFMetaData Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFMetaData 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, encoding) 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 FCFCDFMetaDataPreparation #Region "Private fields" Private _date As Date Private _time As Date Private Shared _serializerXml As XmlSerializer #End Region _ Public Property [Date]() As Date Get Return Me._date End Get Set Me._date = value End Set End Property _ Public Property Time() As Date Get Return Me._time End Get Set Me._time = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFMetaDataPreparation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFMetaDataPreparation object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFMetaDataPreparation object ''' ''' string to deserialize ''' Output FCFCDFMetaDataPreparation 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 FCFCDFMetaDataPreparation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataPreparation) 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 FCFCDFMetaDataPreparation) 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 FCFCDFMetaDataPreparation Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFMetaDataPreparation) 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 FCFCDFMetaDataPreparation Return CType(SerializerXml.Deserialize(s),FCFCDFMetaDataPreparation) End Function #End Region ''' ''' Serializes current FCFCDFMetaDataPreparation 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFMetaDataPreparation object ''' ''' File to load and deserialize ''' Output FCFCDFMetaDataPreparation 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFMetaDataPreparation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataPreparation) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFMetaDataPreparation, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFMetaDataPreparation) 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 FCFCDFMetaDataPreparation Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFMetaDataPreparation 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, encoding) 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 FCFCDFMetaDataMessageGroup ''' ZBE ''' ZBV End Enum _ Public Enum FCFCDFMetaDataTestIndicator ''' _ Item1 End Enum _ Public Enum FCFCDFMetaDataMessageType ''' FCFCDF End Enum _ Partial Public Class FCFCDFMetaDataInterchangeSender #Region "Private fields" Private _identification As FCFCDFMetaDataInterchangeSenderIdentification Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._identification = New FCFCDFMetaDataInterchangeSenderIdentification() End Sub _ Public Property Identification() As FCFCDFMetaDataInterchangeSenderIdentification Get Return Me._identification End Get Set Me._identification = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFMetaDataInterchangeSender)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFMetaDataInterchangeSender object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFMetaDataInterchangeSender object ''' ''' string to deserialize ''' Output FCFCDFMetaDataInterchangeSender 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 FCFCDFMetaDataInterchangeSender, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeSender) 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 FCFCDFMetaDataInterchangeSender) 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 FCFCDFMetaDataInterchangeSender Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFMetaDataInterchangeSender) 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 FCFCDFMetaDataInterchangeSender Return CType(SerializerXml.Deserialize(s),FCFCDFMetaDataInterchangeSender) End Function #End Region ''' ''' Serializes current FCFCDFMetaDataInterchangeSender 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFMetaDataInterchangeSender object ''' ''' File to load and deserialize ''' Output FCFCDFMetaDataInterchangeSender 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFMetaDataInterchangeSender, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeSender) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFMetaDataInterchangeSender, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFMetaDataInterchangeSender) 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 FCFCDFMetaDataInterchangeSender Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFMetaDataInterchangeSender 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, encoding) 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 FCFCDFMetaDataInterchangeSenderIdentification #Region "Private fields" Private _referenceNumber As String Private _subsidiaryNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property SubsidiaryNumber() As String Get Return Me._subsidiaryNumber End Get Set Me._subsidiaryNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFMetaDataInterchangeSenderIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFMetaDataInterchangeSenderIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFMetaDataInterchangeSenderIdentification object ''' ''' string to deserialize ''' Output FCFCDFMetaDataInterchangeSenderIdentification 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 FCFCDFMetaDataInterchangeSenderIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeSenderIdentification) 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 FCFCDFMetaDataInterchangeSenderIdentification) 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 FCFCDFMetaDataInterchangeSenderIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFMetaDataInterchangeSenderIdentification) 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 FCFCDFMetaDataInterchangeSenderIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFMetaDataInterchangeSenderIdentification) End Function #End Region ''' ''' Serializes current FCFCDFMetaDataInterchangeSenderIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFMetaDataInterchangeSenderIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFMetaDataInterchangeSenderIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFMetaDataInterchangeSenderIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeSenderIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFMetaDataInterchangeSenderIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFMetaDataInterchangeSenderIdentification) 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 FCFCDFMetaDataInterchangeSenderIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFMetaDataInterchangeSenderIdentification 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, encoding) 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 FCFCDFMetaDataInterchangeRecipient #Region "Private fields" Private _identification As FCFCDFMetaDataInterchangeRecipientIdentification Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._identification = New FCFCDFMetaDataInterchangeRecipientIdentification() End Sub _ Public Property Identification() As FCFCDFMetaDataInterchangeRecipientIdentification Get Return Me._identification End Get Set Me._identification = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFMetaDataInterchangeRecipient)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFMetaDataInterchangeRecipient object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFMetaDataInterchangeRecipient object ''' ''' string to deserialize ''' Output FCFCDFMetaDataInterchangeRecipient 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 FCFCDFMetaDataInterchangeRecipient, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeRecipient) 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 FCFCDFMetaDataInterchangeRecipient) 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 FCFCDFMetaDataInterchangeRecipient Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFMetaDataInterchangeRecipient) 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 FCFCDFMetaDataInterchangeRecipient Return CType(SerializerXml.Deserialize(s),FCFCDFMetaDataInterchangeRecipient) End Function #End Region ''' ''' Serializes current FCFCDFMetaDataInterchangeRecipient 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFMetaDataInterchangeRecipient object ''' ''' File to load and deserialize ''' Output FCFCDFMetaDataInterchangeRecipient 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFMetaDataInterchangeRecipient, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeRecipient) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFMetaDataInterchangeRecipient, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFMetaDataInterchangeRecipient) 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 FCFCDFMetaDataInterchangeRecipient Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFMetaDataInterchangeRecipient 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, encoding) 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 FCFCDFMetaDataInterchangeRecipientIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFMetaDataInterchangeRecipientIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFMetaDataInterchangeRecipientIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFMetaDataInterchangeRecipientIdentification object ''' ''' string to deserialize ''' Output FCFCDFMetaDataInterchangeRecipientIdentification 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 FCFCDFMetaDataInterchangeRecipientIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeRecipientIdentification) 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 FCFCDFMetaDataInterchangeRecipientIdentification) 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 FCFCDFMetaDataInterchangeRecipientIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFMetaDataInterchangeRecipientIdentification) 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 FCFCDFMetaDataInterchangeRecipientIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFMetaDataInterchangeRecipientIdentification) End Function #End Region ''' ''' Serializes current FCFCDFMetaDataInterchangeRecipientIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFMetaDataInterchangeRecipientIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFMetaDataInterchangeRecipientIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFMetaDataInterchangeRecipientIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFMetaDataInterchangeRecipientIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFMetaDataInterchangeRecipientIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFMetaDataInterchangeRecipientIdentification) 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 FCFCDFMetaDataInterchangeRecipientIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFMetaDataInterchangeRecipientIdentification 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, encoding) 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 FCFCDFHeader #Region "Private fields" Private _messageVersion As String Private _messageCreationDate As Date Private _lRN As String Private _declaration As FCFCDFHeaderDeclaration Private _prematureInputFlag As String Private _goodsItemQuantity As String Private _customsGoodsStatus As String Private _declarantIsConsigneeFlag As String Private _customsAuthorisation As FCFCDFHeaderCustomsAuthorisation Private _inputTaxDeductionFlag As String Private _goodsLocation As String Private _departureCountry As String Private _paymentMethod As FCFCDFHeaderPaymentMethod Private _currencyCode As FCFCDFHeaderCurrencyCode Private _additionalInformation As String Private _taxOffice As String Private _representativeRelationshipFlag As String Private _declarationPlace As String Private _authorisationNumber As String Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._customsAuthorisation = New FCFCDFHeaderCustomsAuthorisation() Me._declaration = New FCFCDFHeaderDeclaration() End Sub _ Public Property MessageVersion() As String Get Return Me._messageVersion End Get Set Me._messageVersion = value End Set End Property _ Public Property MessageCreationDate() As Date Get Return Me._messageCreationDate End Get Set Me._messageCreationDate = value End Set End Property _ Public Property LRN() As String Get Return Me._lRN End Get Set Me._lRN = value End Set End Property _ Public Property Declaration() As FCFCDFHeaderDeclaration Get Return Me._declaration End Get Set Me._declaration = value End Set End Property _ Public Property PrematureInputFlag() As String Get Return Me._prematureInputFlag End Get Set Me._prematureInputFlag = value End Set End Property _ Public Property GoodsItemQuantity() As String Get Return Me._goodsItemQuantity End Get Set Me._goodsItemQuantity = value End Set End Property _ Public Property CustomsGoodsStatus() As String Get Return Me._customsGoodsStatus End Get Set Me._customsGoodsStatus = value End Set End Property _ Public Property DeclarantIsConsigneeFlag() As String Get Return Me._declarantIsConsigneeFlag End Get Set Me._declarantIsConsigneeFlag = value End Set End Property _ Public Property CustomsAuthorisation() As FCFCDFHeaderCustomsAuthorisation Get Return Me._customsAuthorisation End Get Set Me._customsAuthorisation = value End Set End Property _ Public Property InputTaxDeductionFlag() As String Get Return Me._inputTaxDeductionFlag End Get Set Me._inputTaxDeductionFlag = value End Set End Property _ Public Property GoodsLocation() As String Get Return Me._goodsLocation End Get Set Me._goodsLocation = value End Set End Property _ Public Property DepartureCountry() As String Get Return Me._departureCountry End Get Set Me._departureCountry = value End Set End Property _ Public Property PaymentMethod() As FCFCDFHeaderPaymentMethod Get Return Me._paymentMethod End Get Set Me._paymentMethod = value End Set End Property _ Public Property CurrencyCode() As FCFCDFHeaderCurrencyCode Get Return Me._currencyCode End Get Set Me._currencyCode = value End Set End Property _ Public Property AdditionalInformation() As String Get Return Me._additionalInformation End Get Set Me._additionalInformation = value End Set End Property _ Public Property TaxOffice() As String Get Return Me._taxOffice End Get Set Me._taxOffice = value End Set End Property _ Public Property RepresentativeRelationshipFlag() As String Get Return Me._representativeRelationshipFlag End Get Set Me._representativeRelationshipFlag = value End Set End Property _ Public Property DeclarationPlace() As String Get Return Me._declarationPlace End Get Set Me._declarationPlace = value End Set End Property _ Public Property AuthorisationNumber() As String Get Return Me._authorisationNumber End Get Set Me._authorisationNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFHeader)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFHeader object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFHeader object ''' ''' string to deserialize ''' Output FCFCDFHeader 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 FCFCDFHeader, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFHeader) 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 FCFCDFHeader) 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 FCFCDFHeader Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFHeader) 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 FCFCDFHeader Return CType(SerializerXml.Deserialize(s),FCFCDFHeader) End Function #End Region ''' ''' Serializes current FCFCDFHeader 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFHeader object ''' ''' File to load and deserialize ''' Output FCFCDFHeader 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFHeader, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFHeader) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFHeader, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFHeader) 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 FCFCDFHeader Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFHeader 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, encoding) 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 FCFCDFHeaderDeclaration #Region "Private fields" Private _kind As FCFCDFHeaderDeclarationKind Private _type As FCFCDFHeaderDeclarationType Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Kind() As FCFCDFHeaderDeclarationKind Get Return Me._kind End Get Set Me._kind = value End Set End Property _ Public Property Type() As FCFCDFHeaderDeclarationType Get Return Me._type End Get Set Me._type = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFHeaderDeclaration)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFHeaderDeclaration object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFHeaderDeclaration object ''' ''' string to deserialize ''' Output FCFCDFHeaderDeclaration 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 FCFCDFHeaderDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFHeaderDeclaration) 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 FCFCDFHeaderDeclaration) 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 FCFCDFHeaderDeclaration Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFHeaderDeclaration) 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 FCFCDFHeaderDeclaration Return CType(SerializerXml.Deserialize(s),FCFCDFHeaderDeclaration) End Function #End Region ''' ''' Serializes current FCFCDFHeaderDeclaration 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFHeaderDeclaration object ''' ''' File to load and deserialize ''' Output FCFCDFHeaderDeclaration 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFHeaderDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFHeaderDeclaration) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFHeaderDeclaration, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFHeaderDeclaration) 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 FCFCDFHeaderDeclaration Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFHeaderDeclaration 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, encoding) 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 FCFCDFHeaderDeclarationKind ''' A ''' B ''' D ''' E End Enum _ Public Enum FCFCDFHeaderDeclarationType ''' EZA End Enum _ Partial Public Class FCFCDFHeaderCustomsAuthorisation #Region "Private fields" Private _endUse As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property EndUse() As String Get Return Me._endUse End Get Set Me._endUse = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFHeaderCustomsAuthorisation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFHeaderCustomsAuthorisation object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFHeaderCustomsAuthorisation object ''' ''' string to deserialize ''' Output FCFCDFHeaderCustomsAuthorisation 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 FCFCDFHeaderCustomsAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFHeaderCustomsAuthorisation) 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 FCFCDFHeaderCustomsAuthorisation) 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 FCFCDFHeaderCustomsAuthorisation Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFHeaderCustomsAuthorisation) 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 FCFCDFHeaderCustomsAuthorisation Return CType(SerializerXml.Deserialize(s),FCFCDFHeaderCustomsAuthorisation) End Function #End Region ''' ''' Serializes current FCFCDFHeaderCustomsAuthorisation 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFHeaderCustomsAuthorisation object ''' ''' File to load and deserialize ''' Output FCFCDFHeaderCustomsAuthorisation 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFHeaderCustomsAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFHeaderCustomsAuthorisation) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFHeaderCustomsAuthorisation, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFHeaderCustomsAuthorisation) 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 FCFCDFHeaderCustomsAuthorisation Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFHeaderCustomsAuthorisation 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, encoding) 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 FCFCDFHeaderPaymentMethod ''' A ''' C ''' D ''' E ''' F ''' G End Enum _ Public Enum FCFCDFHeaderCurrencyCode ''' EUR End Enum _ Partial Public Class FCFCDFDeclarant #Region "Private fields" Private _identification As FCFCDFDeclarantIdentification Private _name As String Private _address As FCFCDFDeclarantAddress Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New FCFCDFDeclarantAddress() Me._identification = New FCFCDFDeclarantIdentification() End Sub _ Public Property Identification() As FCFCDFDeclarantIdentification Get Return Me._identification End Get Set Me._identification = 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 Address() As FCFCDFDeclarantAddress Get Return Me._address End Get Set Me._address = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFDeclarant)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFDeclarant object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFDeclarant object ''' ''' string to deserialize ''' Output FCFCDFDeclarant 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 FCFCDFDeclarant, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDeclarant) 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 FCFCDFDeclarant) 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 FCFCDFDeclarant Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFDeclarant) 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 FCFCDFDeclarant Return CType(SerializerXml.Deserialize(s),FCFCDFDeclarant) End Function #End Region ''' ''' Serializes current FCFCDFDeclarant 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFDeclarant object ''' ''' File to load and deserialize ''' Output FCFCDFDeclarant 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFDeclarant, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDeclarant) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFDeclarant, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFDeclarant) 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 FCFCDFDeclarant Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFDeclarant 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, encoding) 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 FCFCDFDeclarantIdentification #Region "Private fields" Private _referenceNumber As String Private _subsidiaryNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property SubsidiaryNumber() As String Get Return Me._subsidiaryNumber End Get Set Me._subsidiaryNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFDeclarantIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFDeclarantIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFDeclarantIdentification object ''' ''' string to deserialize ''' Output FCFCDFDeclarantIdentification 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 FCFCDFDeclarantIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDeclarantIdentification) 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 FCFCDFDeclarantIdentification) 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 FCFCDFDeclarantIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFDeclarantIdentification) 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 FCFCDFDeclarantIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFDeclarantIdentification) End Function #End Region ''' ''' Serializes current FCFCDFDeclarantIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFDeclarantIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFDeclarantIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFDeclarantIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDeclarantIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFDeclarantIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFDeclarantIdentification) 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 FCFCDFDeclarantIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFDeclarantIdentification 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, encoding) 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 FCFCDFDeclarantAddress #Region "Private fields" Private _line As String Private _country As String Private _postcode As String Private _city As String Private _district As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Line() As String Get Return Me._line End Get Set Me._line = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = value End Set End Property _ Public Property City() As String Get Return Me._city End Get Set Me._city = value End Set End Property _ Public Property District() As String Get Return Me._district End Get Set Me._district = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFDeclarantAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFDeclarantAddress object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFDeclarantAddress object ''' ''' string to deserialize ''' Output FCFCDFDeclarantAddress 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 FCFCDFDeclarantAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDeclarantAddress) 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 FCFCDFDeclarantAddress) 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 FCFCDFDeclarantAddress Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFDeclarantAddress) 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 FCFCDFDeclarantAddress Return CType(SerializerXml.Deserialize(s),FCFCDFDeclarantAddress) End Function #End Region ''' ''' Serializes current FCFCDFDeclarantAddress 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFDeclarantAddress object ''' ''' File to load and deserialize ''' Output FCFCDFDeclarantAddress 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFDeclarantAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDeclarantAddress) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFDeclarantAddress, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFDeclarantAddress) 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 FCFCDFDeclarantAddress Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFDeclarantAddress 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, encoding) 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 FCFCDFRepresentative #Region "Private fields" Private _identification As FCFCDFRepresentativeIdentification Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._identification = New FCFCDFRepresentativeIdentification() End Sub _ Public Property Identification() As FCFCDFRepresentativeIdentification Get Return Me._identification End Get Set Me._identification = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFRepresentative)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFRepresentative object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFRepresentative object ''' ''' string to deserialize ''' Output FCFCDFRepresentative 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 FCFCDFRepresentative, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFRepresentative) 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 FCFCDFRepresentative) 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 FCFCDFRepresentative Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFRepresentative) 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 FCFCDFRepresentative Return CType(SerializerXml.Deserialize(s),FCFCDFRepresentative) End Function #End Region ''' ''' Serializes current FCFCDFRepresentative 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFRepresentative object ''' ''' File to load and deserialize ''' Output FCFCDFRepresentative 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFRepresentative, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFRepresentative) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFRepresentative, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFRepresentative) 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 FCFCDFRepresentative Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFRepresentative 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, encoding) 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 FCFCDFRepresentativeIdentification #Region "Private fields" Private _referenceNumber As String Private _subsidiaryNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property SubsidiaryNumber() As String Get Return Me._subsidiaryNumber End Get Set Me._subsidiaryNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFRepresentativeIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFRepresentativeIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFRepresentativeIdentification object ''' ''' string to deserialize ''' Output FCFCDFRepresentativeIdentification 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 FCFCDFRepresentativeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFRepresentativeIdentification) 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 FCFCDFRepresentativeIdentification) 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 FCFCDFRepresentativeIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFRepresentativeIdentification) 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 FCFCDFRepresentativeIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFRepresentativeIdentification) End Function #End Region ''' ''' Serializes current FCFCDFRepresentativeIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFRepresentativeIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFRepresentativeIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFRepresentativeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFRepresentativeIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFRepresentativeIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFRepresentativeIdentification) 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 FCFCDFRepresentativeIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFRepresentativeIdentification 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, encoding) 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 FCFCDFPrincipal #Region "Private fields" Private _identification As FCFCDFPrincipalIdentification Private _name As String Private _address As FCFCDFPrincipalAddress Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New FCFCDFPrincipalAddress() Me._identification = New FCFCDFPrincipalIdentification() End Sub _ Public Property Identification() As FCFCDFPrincipalIdentification Get Return Me._identification End Get Set Me._identification = 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 Address() As FCFCDFPrincipalAddress Get Return Me._address End Get Set Me._address = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFPrincipal)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFPrincipal object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFPrincipal object ''' ''' string to deserialize ''' Output FCFCDFPrincipal 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 FCFCDFPrincipal, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPrincipal) 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 FCFCDFPrincipal) 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 FCFCDFPrincipal Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFPrincipal) 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 FCFCDFPrincipal Return CType(SerializerXml.Deserialize(s),FCFCDFPrincipal) End Function #End Region ''' ''' Serializes current FCFCDFPrincipal 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFPrincipal object ''' ''' File to load and deserialize ''' Output FCFCDFPrincipal 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFPrincipal, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPrincipal) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFPrincipal, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFPrincipal) 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 FCFCDFPrincipal Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFPrincipal 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, encoding) 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 FCFCDFPrincipalIdentification #Region "Private fields" Private _referenceNumber As String Private _subsidiaryNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property SubsidiaryNumber() As String Get Return Me._subsidiaryNumber End Get Set Me._subsidiaryNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFPrincipalIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFPrincipalIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFPrincipalIdentification object ''' ''' string to deserialize ''' Output FCFCDFPrincipalIdentification 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 FCFCDFPrincipalIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPrincipalIdentification) 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 FCFCDFPrincipalIdentification) 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 FCFCDFPrincipalIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFPrincipalIdentification) 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 FCFCDFPrincipalIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFPrincipalIdentification) End Function #End Region ''' ''' Serializes current FCFCDFPrincipalIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFPrincipalIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFPrincipalIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFPrincipalIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPrincipalIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFPrincipalIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFPrincipalIdentification) 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 FCFCDFPrincipalIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFPrincipalIdentification 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, encoding) 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 FCFCDFPrincipalAddress #Region "Private fields" Private _line As String Private _country As String Private _postcode As String Private _city As String Private _district As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Line() As String Get Return Me._line End Get Set Me._line = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = value End Set End Property _ Public Property City() As String Get Return Me._city End Get Set Me._city = value End Set End Property _ Public Property District() As String Get Return Me._district End Get Set Me._district = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFPrincipalAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFPrincipalAddress object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFPrincipalAddress object ''' ''' string to deserialize ''' Output FCFCDFPrincipalAddress 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 FCFCDFPrincipalAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPrincipalAddress) 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 FCFCDFPrincipalAddress) 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 FCFCDFPrincipalAddress Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFPrincipalAddress) 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 FCFCDFPrincipalAddress Return CType(SerializerXml.Deserialize(s),FCFCDFPrincipalAddress) End Function #End Region ''' ''' Serializes current FCFCDFPrincipalAddress 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFPrincipalAddress object ''' ''' File to load and deserialize ''' Output FCFCDFPrincipalAddress 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFPrincipalAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPrincipalAddress) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFPrincipalAddress, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFPrincipalAddress) 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 FCFCDFPrincipalAddress Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFPrincipalAddress 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, encoding) 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 FCFCDFContactPerson #Region "Private fields" Private _name As String Private _position As String Private _phoneNumber As String Private _mailAddress As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Name() As String Get Return Me._name End Get Set Me._name = value End Set End Property _ Public Property Position() As String Get Return Me._position End Get Set Me._position = value End Set End Property _ Public Property PhoneNumber() As String Get Return Me._phoneNumber End Get Set Me._phoneNumber = value End Set End Property _ Public Property MailAddress() As String Get Return Me._mailAddress End Get Set Me._mailAddress = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFContactPerson)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFContactPerson object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFContactPerson object ''' ''' string to deserialize ''' Output FCFCDFContactPerson 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 FCFCDFContactPerson, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFContactPerson) 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 FCFCDFContactPerson) 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 FCFCDFContactPerson Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFContactPerson) 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 FCFCDFContactPerson Return CType(SerializerXml.Deserialize(s),FCFCDFContactPerson) End Function #End Region ''' ''' Serializes current FCFCDFContactPerson 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFContactPerson object ''' ''' File to load and deserialize ''' Output FCFCDFContactPerson 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFContactPerson, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFContactPerson) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFContactPerson, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFContactPerson) 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 FCFCDFContactPerson Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFContactPerson 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, encoding) 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 FCFCDFDutyDefermentApproval #Region "Private fields" Private _type As String Private _applicationType As String Private _accountPrefix As String Private _accountNumber As String Private _authorisationNumber As String Private _dutyDefermentApplicant As FCFCDFDutyDefermentApprovalDutyDefermentApplicant Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._dutyDefermentApplicant = New FCFCDFDutyDefermentApprovalDutyDefermentApplicant() End Sub _ Public Property Type() As String Get Return Me._type End Get Set Me._type = value End Set End Property _ Public Property ApplicationType() As String Get Return Me._applicationType End Get Set Me._applicationType = value End Set End Property _ Public Property AccountPrefix() As String Get Return Me._accountPrefix End Get Set Me._accountPrefix = value End Set End Property _ Public Property AccountNumber() As String Get Return Me._accountNumber End Get Set Me._accountNumber = value End Set End Property _ Public Property AuthorisationNumber() As String Get Return Me._authorisationNumber End Get Set Me._authorisationNumber = value End Set End Property _ Public Property DutyDefermentApplicant() As FCFCDFDutyDefermentApprovalDutyDefermentApplicant Get Return Me._dutyDefermentApplicant End Get Set Me._dutyDefermentApplicant = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFDutyDefermentApproval)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFDutyDefermentApproval object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFDutyDefermentApproval object ''' ''' string to deserialize ''' Output FCFCDFDutyDefermentApproval 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 FCFCDFDutyDefermentApproval, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDutyDefermentApproval) 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 FCFCDFDutyDefermentApproval) 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 FCFCDFDutyDefermentApproval Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFDutyDefermentApproval) 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 FCFCDFDutyDefermentApproval Return CType(SerializerXml.Deserialize(s),FCFCDFDutyDefermentApproval) End Function #End Region ''' ''' Serializes current FCFCDFDutyDefermentApproval 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFDutyDefermentApproval object ''' ''' File to load and deserialize ''' Output FCFCDFDutyDefermentApproval 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFDutyDefermentApproval, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDutyDefermentApproval) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFDutyDefermentApproval, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFDutyDefermentApproval) 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 FCFCDFDutyDefermentApproval Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFDutyDefermentApproval 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, encoding) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant #Region "Private fields" Private _identification As FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._identification = New FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification() End Sub _ Public Property Identification() As FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification Get Return Me._identification End Get Set Me._identification = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFDutyDefermentApprovalDutyDefermentApplicant)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFDutyDefermentApprovalDutyDefermentApplicant object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFDutyDefermentApprovalDutyDefermentApplicant object ''' ''' string to deserialize ''' Output FCFCDFDutyDefermentApprovalDutyDefermentApplicant 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDutyDefermentApprovalDutyDefermentApplicant) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFDutyDefermentApprovalDutyDefermentApplicant) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant Return CType(SerializerXml.Deserialize(s),FCFCDFDutyDefermentApprovalDutyDefermentApplicant) End Function #End Region ''' ''' Serializes current FCFCDFDutyDefermentApprovalDutyDefermentApplicant 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant object ''' ''' File to load and deserialize ''' Output FCFCDFDutyDefermentApprovalDutyDefermentApplicant 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFDutyDefermentApprovalDutyDefermentApplicant, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDutyDefermentApprovalDutyDefermentApplicant) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFDutyDefermentApprovalDutyDefermentApplicant) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicant Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFDutyDefermentApprovalDutyDefermentApplicant 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, encoding) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification object ''' ''' string to deserialize ''' Output FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification) End Function #End Region ''' ''' Serializes current FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification) 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 FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFDutyDefermentApprovalDutyDefermentApplicantIdentification 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, encoding) 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 FCFCDFBorderTransportMeans #Region "Private fields" Private _mode As String Private _type As String Private _information As String Private _nationality As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Mode() As String Get Return Me._mode End Get Set Me._mode = 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 Information() As String Get Return Me._information End Get Set Me._information = 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(FCFCDFBorderTransportMeans)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBorderTransportMeans object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBorderTransportMeans object ''' ''' string to deserialize ''' Output FCFCDFBorderTransportMeans 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 FCFCDFBorderTransportMeans, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBorderTransportMeans) 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 FCFCDFBorderTransportMeans) 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 FCFCDFBorderTransportMeans Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBorderTransportMeans) 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 FCFCDFBorderTransportMeans Return CType(SerializerXml.Deserialize(s),FCFCDFBorderTransportMeans) End Function #End Region ''' ''' Serializes current FCFCDFBorderTransportMeans 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBorderTransportMeans object ''' ''' File to load and deserialize ''' Output FCFCDFBorderTransportMeans 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBorderTransportMeans, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBorderTransportMeans) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBorderTransportMeans, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBorderTransportMeans) 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 FCFCDFBorderTransportMeans Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBorderTransportMeans 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, encoding) 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 FCFCDFArrivalTransportMeans #Region "Private fields" Private _identity As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Identity() As String Get Return Me._identity End Get Set Me._identity = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFArrivalTransportMeans)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFArrivalTransportMeans object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFArrivalTransportMeans object ''' ''' string to deserialize ''' Output FCFCDFArrivalTransportMeans 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 FCFCDFArrivalTransportMeans, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFArrivalTransportMeans) 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 FCFCDFArrivalTransportMeans) 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 FCFCDFArrivalTransportMeans Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFArrivalTransportMeans) 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 FCFCDFArrivalTransportMeans Return CType(SerializerXml.Deserialize(s),FCFCDFArrivalTransportMeans) End Function #End Region ''' ''' Serializes current FCFCDFArrivalTransportMeans 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFArrivalTransportMeans object ''' ''' File to load and deserialize ''' Output FCFCDFArrivalTransportMeans 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFArrivalTransportMeans, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFArrivalTransportMeans) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFArrivalTransportMeans, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFArrivalTransportMeans) 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 FCFCDFArrivalTransportMeans Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFArrivalTransportMeans 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, encoding) 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 FCFCDFPreviousAdministrativeReferences #Region "Private fields" Private _type As String Private _previousAdministrativeReference As FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._previousAdministrativeReference = New FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference() End Sub _ Public Property Type() As String Get Return Me._type End Get Set Me._type = value End Set End Property _ Public Property PreviousAdministrativeReference() As FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference Get Return Me._previousAdministrativeReference End Get Set Me._previousAdministrativeReference = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFPreviousAdministrativeReferences)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFPreviousAdministrativeReferences object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFPreviousAdministrativeReferences object ''' ''' string to deserialize ''' Output FCFCDFPreviousAdministrativeReferences 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 FCFCDFPreviousAdministrativeReferences, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPreviousAdministrativeReferences) 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 FCFCDFPreviousAdministrativeReferences) 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 FCFCDFPreviousAdministrativeReferences Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFPreviousAdministrativeReferences) 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 FCFCDFPreviousAdministrativeReferences Return CType(SerializerXml.Deserialize(s),FCFCDFPreviousAdministrativeReferences) End Function #End Region ''' ''' Serializes current FCFCDFPreviousAdministrativeReferences 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFPreviousAdministrativeReferences object ''' ''' File to load and deserialize ''' Output FCFCDFPreviousAdministrativeReferences 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFPreviousAdministrativeReferences, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPreviousAdministrativeReferences) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFPreviousAdministrativeReferences, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFPreviousAdministrativeReferences) 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 FCFCDFPreviousAdministrativeReferences Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFPreviousAdministrativeReferences 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, encoding) 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference object ''' ''' string to deserialize ''' Output FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference) 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference) 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference) 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference Return CType(SerializerXml.Deserialize(s),FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference) End Function #End Region ''' ''' Serializes current FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference object ''' ''' File to load and deserialize ''' Output FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference) 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 FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFPreviousAdministrativeReferencesPreviousAdministrativeReference 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, encoding) 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 FCFCDFSummaryDeclaration #Region "Private fields" Private _identificationIndicator As FCFCDFSummaryDeclarationIdentificationIndicator Private _goodsItem As List(Of FCFCDFSummaryDeclarationGoodsItem) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._goodsItem = New List(Of FCFCDFSummaryDeclarationGoodsItem)() End Sub _ Public Property IdentificationIndicator() As FCFCDFSummaryDeclarationIdentificationIndicator Get Return Me._identificationIndicator End Get Set Me._identificationIndicator = value End Set End Property _ Public Property GoodsItem() As List(Of FCFCDFSummaryDeclarationGoodsItem) Get Return Me._goodsItem End Get Set Me._goodsItem = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFSummaryDeclaration)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFSummaryDeclaration object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFSummaryDeclaration object ''' ''' string to deserialize ''' Output FCFCDFSummaryDeclaration 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 FCFCDFSummaryDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclaration) 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 FCFCDFSummaryDeclaration) 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 FCFCDFSummaryDeclaration Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFSummaryDeclaration) 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 FCFCDFSummaryDeclaration Return CType(SerializerXml.Deserialize(s),FCFCDFSummaryDeclaration) End Function #End Region ''' ''' Serializes current FCFCDFSummaryDeclaration 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFSummaryDeclaration object ''' ''' File to load and deserialize ''' Output FCFCDFSummaryDeclaration 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFSummaryDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclaration) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFSummaryDeclaration, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFSummaryDeclaration) 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 FCFCDFSummaryDeclaration Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFSummaryDeclaration 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, encoding) 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 FCFCDFSummaryDeclarationIdentificationIndicator ''' AWB ''' REG End Enum _ Partial Public Class FCFCDFSummaryDeclarationGoodsItem #Region "Private fields" Private _quantity As String Private _identificationByKey As FCFCDFSummaryDeclarationGoodsItemIdentificationByKey Private _identificationByRegistration As FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._identificationByRegistration = New FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration() Me._identificationByKey = New FCFCDFSummaryDeclarationGoodsItemIdentificationByKey() End Sub _ Public Property Quantity() As String Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property IdentificationByKey() As FCFCDFSummaryDeclarationGoodsItemIdentificationByKey Get Return Me._identificationByKey End Get Set Me._identificationByKey = value End Set End Property _ Public Property IdentificationByRegistration() As FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration Get Return Me._identificationByRegistration End Get Set Me._identificationByRegistration = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFSummaryDeclarationGoodsItem)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFSummaryDeclarationGoodsItem object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFSummaryDeclarationGoodsItem object ''' ''' string to deserialize ''' Output FCFCDFSummaryDeclarationGoodsItem 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 FCFCDFSummaryDeclarationGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItem) 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 FCFCDFSummaryDeclarationGoodsItem) 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 FCFCDFSummaryDeclarationGoodsItem Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFSummaryDeclarationGoodsItem) 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 FCFCDFSummaryDeclarationGoodsItem Return CType(SerializerXml.Deserialize(s),FCFCDFSummaryDeclarationGoodsItem) End Function #End Region ''' ''' Serializes current FCFCDFSummaryDeclarationGoodsItem 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFSummaryDeclarationGoodsItem object ''' ''' File to load and deserialize ''' Output FCFCDFSummaryDeclarationGoodsItem 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFSummaryDeclarationGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItem) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFSummaryDeclarationGoodsItem, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFSummaryDeclarationGoodsItem) 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 FCFCDFSummaryDeclarationGoodsItem Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFSummaryDeclarationGoodsItem 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, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey #Region "Private fields" Private _kind As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyKind Private _number As String Private _custodian As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._custodian = New FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian() End Sub _ Public Property Kind() As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyKind Get Return Me._kind End Get Set Me._kind = value End Set End Property _ Public Property Number() As String Get Return Me._number End Get Set Me._number = value End Set End Property _ Public Property Custodian() As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian Get Return Me._custodian End Get Set Me._custodian = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFSummaryDeclarationGoodsItemIdentificationByKey)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFSummaryDeclarationGoodsItemIdentificationByKey object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFSummaryDeclarationGoodsItemIdentificationByKey object ''' ''' string to deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByKey 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByKey) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFSummaryDeclarationGoodsItemIdentificationByKey) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey Return CType(SerializerXml.Deserialize(s),FCFCDFSummaryDeclarationGoodsItemIdentificationByKey) End Function #End Region ''' ''' Serializes current FCFCDFSummaryDeclarationGoodsItemIdentificationByKey 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey object ''' ''' File to load and deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByKey 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByKey, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByKey) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByKey) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKey Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFSummaryDeclarationGoodsItemIdentificationByKey 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, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyKind ''' AWB ''' ULD End Enum _ Partial Public Class FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian #Region "Private fields" Private _identification As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._identification = New FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification() End Sub _ Public Property Identification() As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification Get Return Me._identification End Get Set Me._identification = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian object ''' ''' string to deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian Return CType(SerializerXml.Deserialize(s),FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian) End Function #End Region ''' ''' Serializes current FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian object ''' ''' File to load and deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodian 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, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification object ''' ''' string to deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification) End Function #End Region ''' ''' Serializes current FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFSummaryDeclarationGoodsItemIdentificationByKeyCustodianIdentification 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, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration #Region "Private fields" Private _mRN As String Private _referencedRegistrationNumber As String Private _referencedSequenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property MRN() As String Get Return Me._mRN End Get Set Me._mRN = value End Set End Property _ Public Property ReferencedRegistrationNumber() As String Get Return Me._referencedRegistrationNumber End Get Set Me._referencedRegistrationNumber = value End Set End Property _ Public Property ReferencedSequenceNumber() As String Get Return Me._referencedSequenceNumber End Get Set Me._referencedSequenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration object ''' ''' string to deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration Return CType(SerializerXml.Deserialize(s),FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration) End Function #End Region ''' ''' Serializes current FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration object ''' ''' File to load and deserialize ''' Output FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration) 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 FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFSummaryDeclarationGoodsItemIdentificationByRegistration 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, encoding) 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 FCFCDFCustomsWarehouse #Region "Private fields" Private _lRN As String Private _sequenceNumber As FCFCDFCustomsWarehouseSequenceNumber Private _goodsItemQuantity As String Private _customsAuthorisation As FCFCDFCustomsWarehouseCustomsAuthorisation Private _goodsItem As List(Of FCFCDFCustomsWarehouseGoodsItem) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._goodsItem = New List(Of FCFCDFCustomsWarehouseGoodsItem)() Me._customsAuthorisation = New FCFCDFCustomsWarehouseCustomsAuthorisation() End Sub _ Public Property LRN() As String Get Return Me._lRN End Get Set Me._lRN = value End Set End Property _ Public Property SequenceNumber() As FCFCDFCustomsWarehouseSequenceNumber Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = value End Set End Property _ Public Property GoodsItemQuantity() As String Get Return Me._goodsItemQuantity End Get Set Me._goodsItemQuantity = value End Set End Property _ Public Property CustomsAuthorisation() As FCFCDFCustomsWarehouseCustomsAuthorisation Get Return Me._customsAuthorisation End Get Set Me._customsAuthorisation = value End Set End Property _ Public Property GoodsItem() As List(Of FCFCDFCustomsWarehouseGoodsItem) Get Return Me._goodsItem End Get Set Me._goodsItem = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFCustomsWarehouse)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFCustomsWarehouse object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFCustomsWarehouse object ''' ''' string to deserialize ''' Output FCFCDFCustomsWarehouse 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 FCFCDFCustomsWarehouse, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouse) 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 FCFCDFCustomsWarehouse) 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 FCFCDFCustomsWarehouse Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFCustomsWarehouse) 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 FCFCDFCustomsWarehouse Return CType(SerializerXml.Deserialize(s),FCFCDFCustomsWarehouse) End Function #End Region ''' ''' Serializes current FCFCDFCustomsWarehouse 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFCustomsWarehouse object ''' ''' File to load and deserialize ''' Output FCFCDFCustomsWarehouse 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFCustomsWarehouse, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouse) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFCustomsWarehouse, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFCustomsWarehouse) 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 FCFCDFCustomsWarehouse Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFCustomsWarehouse 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, encoding) 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 FCFCDFCustomsWarehouseSequenceNumber ''' _ Item1 End Enum _ Partial Public Class FCFCDFCustomsWarehouseCustomsAuthorisation #Region "Private fields" Private _warehouseOwner As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property WarehouseOwner() As String Get Return Me._warehouseOwner End Get Set Me._warehouseOwner = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFCustomsWarehouseCustomsAuthorisation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFCustomsWarehouseCustomsAuthorisation object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFCustomsWarehouseCustomsAuthorisation object ''' ''' string to deserialize ''' Output FCFCDFCustomsWarehouseCustomsAuthorisation 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 FCFCDFCustomsWarehouseCustomsAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseCustomsAuthorisation) 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 FCFCDFCustomsWarehouseCustomsAuthorisation) 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 FCFCDFCustomsWarehouseCustomsAuthorisation Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFCustomsWarehouseCustomsAuthorisation) 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 FCFCDFCustomsWarehouseCustomsAuthorisation Return CType(SerializerXml.Deserialize(s),FCFCDFCustomsWarehouseCustomsAuthorisation) End Function #End Region ''' ''' Serializes current FCFCDFCustomsWarehouseCustomsAuthorisation 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFCustomsWarehouseCustomsAuthorisation object ''' ''' File to load and deserialize ''' Output FCFCDFCustomsWarehouseCustomsAuthorisation 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFCustomsWarehouseCustomsAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseCustomsAuthorisation) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFCustomsWarehouseCustomsAuthorisation, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFCustomsWarehouseCustomsAuthorisation) 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 FCFCDFCustomsWarehouseCustomsAuthorisation Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFCustomsWarehouseCustomsAuthorisation 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, encoding) 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 FCFCDFCustomsWarehouseGoodsItem #Region "Private fields" Private _sequenceNumber As String Private _mRN As String Private _referencedRegistrationNumber As String Private _referencedSequenceNumber As String Private _accessViaAtlasFlag As String Private _commodityCode As String Private _usualProcessingFlag As String Private _complement As String Private _commercialAmount As FCFCDFCustomsWarehouseGoodsItemCommercialAmount Private _debitAmount As FCFCDFCustomsWarehouseGoodsItemDebitAmount Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._debitAmount = New FCFCDFCustomsWarehouseGoodsItemDebitAmount() Me._commercialAmount = New FCFCDFCustomsWarehouseGoodsItemCommercialAmount() End Sub _ Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = 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 ReferencedRegistrationNumber() As String Get Return Me._referencedRegistrationNumber End Get Set Me._referencedRegistrationNumber = value End Set End Property _ Public Property ReferencedSequenceNumber() As String Get Return Me._referencedSequenceNumber End Get Set Me._referencedSequenceNumber = value End Set End Property _ Public Property AccessViaAtlasFlag() As String Get Return Me._accessViaAtlasFlag End Get Set Me._accessViaAtlasFlag = value End Set End Property _ Public Property CommodityCode() As String Get Return Me._commodityCode End Get Set Me._commodityCode = value End Set End Property _ Public Property UsualProcessingFlag() As String Get Return Me._usualProcessingFlag End Get Set Me._usualProcessingFlag = value End Set End Property _ Public Property Complement() As String Get Return Me._complement End Get Set Me._complement = value End Set End Property _ Public Property CommercialAmount() As FCFCDFCustomsWarehouseGoodsItemCommercialAmount Get Return Me._commercialAmount End Get Set Me._commercialAmount = value End Set End Property _ Public Property DebitAmount() As FCFCDFCustomsWarehouseGoodsItemDebitAmount Get Return Me._debitAmount End Get Set Me._debitAmount = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFCustomsWarehouseGoodsItem)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFCustomsWarehouseGoodsItem object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFCustomsWarehouseGoodsItem object ''' ''' string to deserialize ''' Output FCFCDFCustomsWarehouseGoodsItem 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 FCFCDFCustomsWarehouseGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseGoodsItem) 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 FCFCDFCustomsWarehouseGoodsItem) 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 FCFCDFCustomsWarehouseGoodsItem Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFCustomsWarehouseGoodsItem) 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 FCFCDFCustomsWarehouseGoodsItem Return CType(SerializerXml.Deserialize(s),FCFCDFCustomsWarehouseGoodsItem) End Function #End Region ''' ''' Serializes current FCFCDFCustomsWarehouseGoodsItem 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFCustomsWarehouseGoodsItem object ''' ''' File to load and deserialize ''' Output FCFCDFCustomsWarehouseGoodsItem 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFCustomsWarehouseGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseGoodsItem) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFCustomsWarehouseGoodsItem, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFCustomsWarehouseGoodsItem) 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 FCFCDFCustomsWarehouseGoodsItem Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFCustomsWarehouseGoodsItem 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, encoding) 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount #Region "Private fields" Private _quantity As Decimal Private _measurementUnit As String Private _qualifier As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = value End Set End Property _ Public Property Qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFCustomsWarehouseGoodsItemCommercialAmount)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFCustomsWarehouseGoodsItemCommercialAmount object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFCustomsWarehouseGoodsItemCommercialAmount object ''' ''' string to deserialize ''' Output FCFCDFCustomsWarehouseGoodsItemCommercialAmount 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseGoodsItemCommercialAmount) 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount) 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFCustomsWarehouseGoodsItemCommercialAmount) 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount Return CType(SerializerXml.Deserialize(s),FCFCDFCustomsWarehouseGoodsItemCommercialAmount) End Function #End Region ''' ''' Serializes current FCFCDFCustomsWarehouseGoodsItemCommercialAmount 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount object ''' ''' File to load and deserialize ''' Output FCFCDFCustomsWarehouseGoodsItemCommercialAmount 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFCustomsWarehouseGoodsItemCommercialAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseGoodsItemCommercialAmount) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFCustomsWarehouseGoodsItemCommercialAmount) 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 FCFCDFCustomsWarehouseGoodsItemCommercialAmount Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFCustomsWarehouseGoodsItemCommercialAmount 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, encoding) 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount #Region "Private fields" Private _quantity As Decimal Private _measurementUnit As String Private _qualifier As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = value End Set End Property _ Public Property Qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFCustomsWarehouseGoodsItemDebitAmount)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFCustomsWarehouseGoodsItemDebitAmount object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFCustomsWarehouseGoodsItemDebitAmount object ''' ''' string to deserialize ''' Output FCFCDFCustomsWarehouseGoodsItemDebitAmount 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseGoodsItemDebitAmount) 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount) 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFCustomsWarehouseGoodsItemDebitAmount) 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount Return CType(SerializerXml.Deserialize(s),FCFCDFCustomsWarehouseGoodsItemDebitAmount) End Function #End Region ''' ''' Serializes current FCFCDFCustomsWarehouseGoodsItemDebitAmount 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount object ''' ''' File to load and deserialize ''' Output FCFCDFCustomsWarehouseGoodsItemDebitAmount 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFCustomsWarehouseGoodsItemDebitAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFCustomsWarehouseGoodsItemDebitAmount) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFCustomsWarehouseGoodsItemDebitAmount) 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 FCFCDFCustomsWarehouseGoodsItemDebitAmount Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFCustomsWarehouseGoodsItemDebitAmount 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, encoding) 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 FCFCDFInwardProcessing #Region "Private fields" Private _sequenceNumber As FCFCDFInwardProcessingSequenceNumber Private _goodsItemQuantity As String Private _customsAuthorisation As FCFCDFInwardProcessingCustomsAuthorisation Private _simplifiedGrantAuthorisationFlag As String Private _monitoringCustomsOffice As FCFCDFInwardProcessingMonitoringCustomsOffice Private _goodsItem As List(Of FCFCDFInwardProcessingGoodsItem) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._goodsItem = New List(Of FCFCDFInwardProcessingGoodsItem)() Me._monitoringCustomsOffice = New FCFCDFInwardProcessingMonitoringCustomsOffice() Me._customsAuthorisation = New FCFCDFInwardProcessingCustomsAuthorisation() End Sub _ Public Property SequenceNumber() As FCFCDFInwardProcessingSequenceNumber Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = value End Set End Property _ Public Property GoodsItemQuantity() As String Get Return Me._goodsItemQuantity End Get Set Me._goodsItemQuantity = value End Set End Property _ Public Property CustomsAuthorisation() As FCFCDFInwardProcessingCustomsAuthorisation Get Return Me._customsAuthorisation End Get Set Me._customsAuthorisation = value End Set End Property _ Public Property SimplifiedGrantAuthorisationFlag() As String Get Return Me._simplifiedGrantAuthorisationFlag End Get Set Me._simplifiedGrantAuthorisationFlag = value End Set End Property _ Public Property MonitoringCustomsOffice() As FCFCDFInwardProcessingMonitoringCustomsOffice Get Return Me._monitoringCustomsOffice End Get Set Me._monitoringCustomsOffice = value End Set End Property _ Public Property GoodsItem() As List(Of FCFCDFInwardProcessingGoodsItem) Get Return Me._goodsItem End Get Set Me._goodsItem = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFInwardProcessing)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFInwardProcessing object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFInwardProcessing object ''' ''' string to deserialize ''' Output FCFCDFInwardProcessing 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 FCFCDFInwardProcessing, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessing) 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 FCFCDFInwardProcessing) 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 FCFCDFInwardProcessing Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFInwardProcessing) 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 FCFCDFInwardProcessing Return CType(SerializerXml.Deserialize(s),FCFCDFInwardProcessing) End Function #End Region ''' ''' Serializes current FCFCDFInwardProcessing 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFInwardProcessing object ''' ''' File to load and deserialize ''' Output FCFCDFInwardProcessing 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFInwardProcessing, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessing) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFInwardProcessing, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFInwardProcessing) 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 FCFCDFInwardProcessing Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFInwardProcessing 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, encoding) 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 FCFCDFInwardProcessingSequenceNumber ''' _ Item1 End Enum _ Partial Public Class FCFCDFInwardProcessingCustomsAuthorisation #Region "Private fields" Private _processingOwner As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ProcessingOwner() As String Get Return Me._processingOwner End Get Set Me._processingOwner = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFInwardProcessingCustomsAuthorisation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFInwardProcessingCustomsAuthorisation object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFInwardProcessingCustomsAuthorisation object ''' ''' string to deserialize ''' Output FCFCDFInwardProcessingCustomsAuthorisation 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 FCFCDFInwardProcessingCustomsAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingCustomsAuthorisation) 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 FCFCDFInwardProcessingCustomsAuthorisation) 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 FCFCDFInwardProcessingCustomsAuthorisation Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFInwardProcessingCustomsAuthorisation) 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 FCFCDFInwardProcessingCustomsAuthorisation Return CType(SerializerXml.Deserialize(s),FCFCDFInwardProcessingCustomsAuthorisation) End Function #End Region ''' ''' Serializes current FCFCDFInwardProcessingCustomsAuthorisation 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFInwardProcessingCustomsAuthorisation object ''' ''' File to load and deserialize ''' Output FCFCDFInwardProcessingCustomsAuthorisation 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFInwardProcessingCustomsAuthorisation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingCustomsAuthorisation) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFInwardProcessingCustomsAuthorisation, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFInwardProcessingCustomsAuthorisation) 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 FCFCDFInwardProcessingCustomsAuthorisation Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFInwardProcessingCustomsAuthorisation 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, encoding) 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 FCFCDFInwardProcessingMonitoringCustomsOffice #Region "Private fields" Private _identification As FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._identification = New FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification() End Sub _ Public Property Identification() As FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification Get Return Me._identification End Get Set Me._identification = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFInwardProcessingMonitoringCustomsOffice)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFInwardProcessingMonitoringCustomsOffice object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFInwardProcessingMonitoringCustomsOffice object ''' ''' string to deserialize ''' Output FCFCDFInwardProcessingMonitoringCustomsOffice 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 FCFCDFInwardProcessingMonitoringCustomsOffice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingMonitoringCustomsOffice) 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 FCFCDFInwardProcessingMonitoringCustomsOffice) 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 FCFCDFInwardProcessingMonitoringCustomsOffice Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFInwardProcessingMonitoringCustomsOffice) 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 FCFCDFInwardProcessingMonitoringCustomsOffice Return CType(SerializerXml.Deserialize(s),FCFCDFInwardProcessingMonitoringCustomsOffice) End Function #End Region ''' ''' Serializes current FCFCDFInwardProcessingMonitoringCustomsOffice 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFInwardProcessingMonitoringCustomsOffice object ''' ''' File to load and deserialize ''' Output FCFCDFInwardProcessingMonitoringCustomsOffice 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFInwardProcessingMonitoringCustomsOffice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingMonitoringCustomsOffice) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFInwardProcessingMonitoringCustomsOffice, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFInwardProcessingMonitoringCustomsOffice) 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 FCFCDFInwardProcessingMonitoringCustomsOffice Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFInwardProcessingMonitoringCustomsOffice 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, encoding) 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification object ''' ''' string to deserialize ''' Output FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification) 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification) 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification) 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification) End Function #End Region ''' ''' Serializes current FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification) 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 FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFInwardProcessingMonitoringCustomsOfficeIdentification 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, encoding) 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 FCFCDFInwardProcessingGoodsItem #Region "Private fields" Private _sequenceNumber As String Private _mRN As String Private _referencedRegistrationNumber As String Private _referencedSequenceNumber As String Private _accessViaAtlasFlag As String Private _goodsRelatedInformation As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = 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 ReferencedRegistrationNumber() As String Get Return Me._referencedRegistrationNumber End Get Set Me._referencedRegistrationNumber = value End Set End Property _ Public Property ReferencedSequenceNumber() As String Get Return Me._referencedSequenceNumber End Get Set Me._referencedSequenceNumber = value End Set End Property _ Public Property AccessViaAtlasFlag() As String Get Return Me._accessViaAtlasFlag End Get Set Me._accessViaAtlasFlag = value End Set End Property _ Public Property GoodsRelatedInformation() As String Get Return Me._goodsRelatedInformation End Get Set Me._goodsRelatedInformation = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFInwardProcessingGoodsItem)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFInwardProcessingGoodsItem object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFInwardProcessingGoodsItem object ''' ''' string to deserialize ''' Output FCFCDFInwardProcessingGoodsItem 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 FCFCDFInwardProcessingGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingGoodsItem) 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 FCFCDFInwardProcessingGoodsItem) 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 FCFCDFInwardProcessingGoodsItem Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFInwardProcessingGoodsItem) 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 FCFCDFInwardProcessingGoodsItem Return CType(SerializerXml.Deserialize(s),FCFCDFInwardProcessingGoodsItem) End Function #End Region ''' ''' Serializes current FCFCDFInwardProcessingGoodsItem 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFInwardProcessingGoodsItem object ''' ''' File to load and deserialize ''' Output FCFCDFInwardProcessingGoodsItem 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFInwardProcessingGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFInwardProcessingGoodsItem) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFInwardProcessingGoodsItem, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFInwardProcessingGoodsItem) 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 FCFCDFInwardProcessingGoodsItem Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFInwardProcessingGoodsItem 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, encoding) 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 FCFCDFBody #Region "Private fields" Private _customsValueFlag As String Private _consignor As FCFCDFBodyConsignor Private _consignee As FCFCDFBodyConsignee Private _additionalDutyReferences As List(Of FCFCDFBodyAdditionalDutyReferences) Private _containers As FCFCDFBodyContainers Private _deliveryTerms As FCFCDFBodyDeliveryTerms Private _paymentTransaction As FCFCDFBodyPaymentTransaction Private _foreignTradeStatistics As FCFCDFBodyForeignTradeStatistics Private _customsValue As FCFCDFBodyCustomsValue Private _document As List(Of FCFCDFBodyDocument) Private _goodsItem As List(Of FCFCDFBodyGoodsItem) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._goodsItem = New List(Of FCFCDFBodyGoodsItem)() Me._document = New List(Of FCFCDFBodyDocument)() Me._customsValue = New FCFCDFBodyCustomsValue() Me._foreignTradeStatistics = New FCFCDFBodyForeignTradeStatistics() Me._paymentTransaction = New FCFCDFBodyPaymentTransaction() Me._deliveryTerms = New FCFCDFBodyDeliveryTerms() Me._containers = New FCFCDFBodyContainers() Me._additionalDutyReferences = New List(Of FCFCDFBodyAdditionalDutyReferences)() Me._consignee = New FCFCDFBodyConsignee() Me._consignor = New FCFCDFBodyConsignor() End Sub _ Public Property CustomsValueFlag() As String Get Return Me._customsValueFlag End Get Set Me._customsValueFlag = value End Set End Property _ Public Property Consignor() As FCFCDFBodyConsignor Get Return Me._consignor End Get Set Me._consignor = value End Set End Property _ Public Property Consignee() As FCFCDFBodyConsignee Get Return Me._consignee End Get Set Me._consignee = value End Set End Property _ Public Property AdditionalDutyReferences() As List(Of FCFCDFBodyAdditionalDutyReferences) Get Return Me._additionalDutyReferences End Get Set Me._additionalDutyReferences = value End Set End Property _ Public Property Containers() As FCFCDFBodyContainers Get Return Me._containers End Get Set Me._containers = value End Set End Property _ Public Property DeliveryTerms() As FCFCDFBodyDeliveryTerms Get Return Me._deliveryTerms End Get Set Me._deliveryTerms = value End Set End Property _ Public Property PaymentTransaction() As FCFCDFBodyPaymentTransaction Get Return Me._paymentTransaction End Get Set Me._paymentTransaction = value End Set End Property _ Public Property ForeignTradeStatistics() As FCFCDFBodyForeignTradeStatistics Get Return Me._foreignTradeStatistics End Get Set Me._foreignTradeStatistics = value End Set End Property _ Public Property CustomsValue() As FCFCDFBodyCustomsValue Get Return Me._customsValue End Get Set Me._customsValue = value End Set End Property _ Public Property Document() As List(Of FCFCDFBodyDocument) Get Return Me._document End Get Set Me._document = value End Set End Property _ Public Property GoodsItem() As List(Of FCFCDFBodyGoodsItem) Get Return Me._goodsItem End Get Set Me._goodsItem = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBody)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBody object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBody object ''' ''' string to deserialize ''' Output FCFCDFBody 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 FCFCDFBody, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBody) 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 FCFCDFBody) 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 FCFCDFBody Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBody) 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 FCFCDFBody Return CType(SerializerXml.Deserialize(s),FCFCDFBody) End Function #End Region ''' ''' Serializes current FCFCDFBody 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBody object ''' ''' File to load and deserialize ''' Output FCFCDFBody 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBody, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBody) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBody, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBody) 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 FCFCDFBody Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBody 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, encoding) 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 FCFCDFBodyConsignor #Region "Private fields" Private _identification As FCFCDFBodyConsignorIdentification Private _name As String Private _address As FCFCDFBodyConsignorAddress Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New FCFCDFBodyConsignorAddress() Me._identification = New FCFCDFBodyConsignorIdentification() End Sub _ Public Property Identification() As FCFCDFBodyConsignorIdentification Get Return Me._identification End Get Set Me._identification = 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 Address() As FCFCDFBodyConsignorAddress Get Return Me._address End Get Set Me._address = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyConsignor)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyConsignor object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyConsignor object ''' ''' string to deserialize ''' Output FCFCDFBodyConsignor 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 FCFCDFBodyConsignor, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignor) 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 FCFCDFBodyConsignor) 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 FCFCDFBodyConsignor Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyConsignor) 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 FCFCDFBodyConsignor Return CType(SerializerXml.Deserialize(s),FCFCDFBodyConsignor) End Function #End Region ''' ''' Serializes current FCFCDFBodyConsignor 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyConsignor object ''' ''' File to load and deserialize ''' Output FCFCDFBodyConsignor 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyConsignor, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignor) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyConsignor, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyConsignor) 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 FCFCDFBodyConsignor Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyConsignor 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, encoding) 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 FCFCDFBodyConsignorIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyConsignorIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyConsignorIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyConsignorIdentification object ''' ''' string to deserialize ''' Output FCFCDFBodyConsignorIdentification 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 FCFCDFBodyConsignorIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignorIdentification) 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 FCFCDFBodyConsignorIdentification) 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 FCFCDFBodyConsignorIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyConsignorIdentification) 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 FCFCDFBodyConsignorIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFBodyConsignorIdentification) End Function #End Region ''' ''' Serializes current FCFCDFBodyConsignorIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyConsignorIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFBodyConsignorIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyConsignorIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignorIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyConsignorIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyConsignorIdentification) 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 FCFCDFBodyConsignorIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyConsignorIdentification 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, encoding) 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 FCFCDFBodyConsignorAddress #Region "Private fields" Private _line As String Private _country As String Private _postcode As String Private _city As String Private _district As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Line() As String Get Return Me._line End Get Set Me._line = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = value End Set End Property _ Public Property City() As String Get Return Me._city End Get Set Me._city = value End Set End Property _ Public Property District() As String Get Return Me._district End Get Set Me._district = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyConsignorAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyConsignorAddress object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyConsignorAddress object ''' ''' string to deserialize ''' Output FCFCDFBodyConsignorAddress 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 FCFCDFBodyConsignorAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignorAddress) 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 FCFCDFBodyConsignorAddress) 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 FCFCDFBodyConsignorAddress Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyConsignorAddress) 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 FCFCDFBodyConsignorAddress Return CType(SerializerXml.Deserialize(s),FCFCDFBodyConsignorAddress) End Function #End Region ''' ''' Serializes current FCFCDFBodyConsignorAddress 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyConsignorAddress object ''' ''' File to load and deserialize ''' Output FCFCDFBodyConsignorAddress 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyConsignorAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignorAddress) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyConsignorAddress, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyConsignorAddress) 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 FCFCDFBodyConsignorAddress Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyConsignorAddress 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, encoding) 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 FCFCDFBodyConsignee #Region "Private fields" Private _identification As FCFCDFBodyConsigneeIdentification Private _name As String Private _address As FCFCDFBodyConsigneeAddress Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New FCFCDFBodyConsigneeAddress() Me._identification = New FCFCDFBodyConsigneeIdentification() End Sub _ Public Property Identification() As FCFCDFBodyConsigneeIdentification Get Return Me._identification End Get Set Me._identification = 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 Address() As FCFCDFBodyConsigneeAddress Get Return Me._address End Get Set Me._address = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyConsignee)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyConsignee object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyConsignee object ''' ''' string to deserialize ''' Output FCFCDFBodyConsignee 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 FCFCDFBodyConsignee, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignee) 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 FCFCDFBodyConsignee) 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 FCFCDFBodyConsignee Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyConsignee) 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 FCFCDFBodyConsignee Return CType(SerializerXml.Deserialize(s),FCFCDFBodyConsignee) End Function #End Region ''' ''' Serializes current FCFCDFBodyConsignee 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyConsignee object ''' ''' File to load and deserialize ''' Output FCFCDFBodyConsignee 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyConsignee, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsignee) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyConsignee, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyConsignee) 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 FCFCDFBodyConsignee Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyConsignee 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, encoding) 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 FCFCDFBodyConsigneeIdentification #Region "Private fields" Private _referenceNumber As String Private _subsidiaryNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property SubsidiaryNumber() As String Get Return Me._subsidiaryNumber End Get Set Me._subsidiaryNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyConsigneeIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyConsigneeIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyConsigneeIdentification object ''' ''' string to deserialize ''' Output FCFCDFBodyConsigneeIdentification 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 FCFCDFBodyConsigneeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsigneeIdentification) 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 FCFCDFBodyConsigneeIdentification) 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 FCFCDFBodyConsigneeIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyConsigneeIdentification) 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 FCFCDFBodyConsigneeIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFBodyConsigneeIdentification) End Function #End Region ''' ''' Serializes current FCFCDFBodyConsigneeIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyConsigneeIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFBodyConsigneeIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyConsigneeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsigneeIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyConsigneeIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyConsigneeIdentification) 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 FCFCDFBodyConsigneeIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyConsigneeIdentification 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, encoding) 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 FCFCDFBodyConsigneeAddress #Region "Private fields" Private _line As String Private _country As String Private _postcode As String Private _city As String Private _district As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Line() As String Get Return Me._line End Get Set Me._line = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = value End Set End Property _ Public Property City() As String Get Return Me._city End Get Set Me._city = value End Set End Property _ Public Property District() As String Get Return Me._district End Get Set Me._district = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyConsigneeAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyConsigneeAddress object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyConsigneeAddress object ''' ''' string to deserialize ''' Output FCFCDFBodyConsigneeAddress 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 FCFCDFBodyConsigneeAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsigneeAddress) 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 FCFCDFBodyConsigneeAddress) 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 FCFCDFBodyConsigneeAddress Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyConsigneeAddress) 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 FCFCDFBodyConsigneeAddress Return CType(SerializerXml.Deserialize(s),FCFCDFBodyConsigneeAddress) End Function #End Region ''' ''' Serializes current FCFCDFBodyConsigneeAddress 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyConsigneeAddress object ''' ''' File to load and deserialize ''' Output FCFCDFBodyConsigneeAddress 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyConsigneeAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyConsigneeAddress) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyConsigneeAddress, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyConsigneeAddress) 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 FCFCDFBodyConsigneeAddress Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyConsigneeAddress 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, encoding) 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 FCFCDFBodyAdditionalDutyReferences #Region "Private fields" Private _referenceNumber As String Private _dutyInterestedParty As FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._dutyInterestedParty = New FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty() End Sub _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property DutyInterestedParty() As FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty Get Return Me._dutyInterestedParty End Get Set Me._dutyInterestedParty = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyAdditionalDutyReferences)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyAdditionalDutyReferences object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyAdditionalDutyReferences object ''' ''' string to deserialize ''' Output FCFCDFBodyAdditionalDutyReferences 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 FCFCDFBodyAdditionalDutyReferences, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferences) 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 FCFCDFBodyAdditionalDutyReferences) 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 FCFCDFBodyAdditionalDutyReferences Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyAdditionalDutyReferences) 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 FCFCDFBodyAdditionalDutyReferences Return CType(SerializerXml.Deserialize(s),FCFCDFBodyAdditionalDutyReferences) End Function #End Region ''' ''' Serializes current FCFCDFBodyAdditionalDutyReferences 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyAdditionalDutyReferences object ''' ''' File to load and deserialize ''' Output FCFCDFBodyAdditionalDutyReferences 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyAdditionalDutyReferences, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferences) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyAdditionalDutyReferences, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyAdditionalDutyReferences) 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 FCFCDFBodyAdditionalDutyReferences Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyAdditionalDutyReferences 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, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty #Region "Private fields" Private _identification As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification Private _name As String Private _address As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress() Me._identification = New FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification() End Sub _ Public Property Identification() As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification Get Return Me._identification End Get Set Me._identification = 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 Address() As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress Get Return Me._address End Get Set Me._address = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty object ''' ''' string to deserialize ''' Output FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty Return CType(SerializerXml.Deserialize(s),FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty) End Function #End Region ''' ''' Serializes current FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty object ''' ''' File to load and deserialize ''' Output FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyAdditionalDutyReferencesDutyInterestedParty 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, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification object ''' ''' string to deserialize ''' Output FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification) End Function #End Region ''' ''' Serializes current FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyIdentification 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, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress #Region "Private fields" Private _line As String Private _country As String Private _postcode As String Private _city As String Private _district As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Line() As String Get Return Me._line End Get Set Me._line = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = value End Set End Property _ Public Property City() As String Get Return Me._city End Get Set Me._city = value End Set End Property _ Public Property District() As String Get Return Me._district End Get Set Me._district = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress object ''' ''' string to deserialize ''' Output FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress Return CType(SerializerXml.Deserialize(s),FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress) End Function #End Region ''' ''' Serializes current FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress object ''' ''' File to load and deserialize ''' Output FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress) 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 FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyAdditionalDutyReferencesDutyInterestedPartyAddress 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, encoding) 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 FCFCDFBodyContainers #Region "Private fields" Private _containerFlag As String Private _container As List(Of FCFCDFBodyContainersContainer) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._container = New List(Of FCFCDFBodyContainersContainer)() End Sub _ Public Property ContainerFlag() As String Get Return Me._containerFlag End Get Set Me._containerFlag = value End Set End Property _ Public Property Container() As List(Of FCFCDFBodyContainersContainer) Get Return Me._container End Get Set Me._container = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyContainers)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyContainers object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyContainers object ''' ''' string to deserialize ''' Output FCFCDFBodyContainers 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 FCFCDFBodyContainers, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyContainers) 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 FCFCDFBodyContainers) 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 FCFCDFBodyContainers Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyContainers) 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 FCFCDFBodyContainers Return CType(SerializerXml.Deserialize(s),FCFCDFBodyContainers) End Function #End Region ''' ''' Serializes current FCFCDFBodyContainers 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyContainers object ''' ''' File to load and deserialize ''' Output FCFCDFBodyContainers 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyContainers, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyContainers) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyContainers, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyContainers) 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 FCFCDFBodyContainers Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyContainers 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, encoding) 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 FCFCDFBodyContainersContainer #Region "Private fields" Private _identificationNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property IdentificationNumber() As String Get Return Me._identificationNumber End Get Set Me._identificationNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyContainersContainer)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyContainersContainer object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyContainersContainer object ''' ''' string to deserialize ''' Output FCFCDFBodyContainersContainer 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 FCFCDFBodyContainersContainer, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyContainersContainer) 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 FCFCDFBodyContainersContainer) 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 FCFCDFBodyContainersContainer Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyContainersContainer) 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 FCFCDFBodyContainersContainer Return CType(SerializerXml.Deserialize(s),FCFCDFBodyContainersContainer) End Function #End Region ''' ''' Serializes current FCFCDFBodyContainersContainer 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyContainersContainer object ''' ''' File to load and deserialize ''' Output FCFCDFBodyContainersContainer 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyContainersContainer, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyContainersContainer) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyContainersContainer, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyContainersContainer) 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 FCFCDFBodyContainersContainer Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyContainersContainer 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, encoding) 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 FCFCDFBodyDeliveryTerms #Region "Private fields" Private _code As String Private _description As String Private _place As String Private _key 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 Description() As String Get Return Me._description End Get Set Me._description = value End Set End Property _ Public Property Place() As String Get Return Me._place End Get Set Me._place = value End Set End Property _ Public Property Key() As String Get Return Me._key End Get Set Me._key = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyDeliveryTerms)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyDeliveryTerms object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyDeliveryTerms object ''' ''' string to deserialize ''' Output FCFCDFBodyDeliveryTerms 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 FCFCDFBodyDeliveryTerms, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyDeliveryTerms) 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 FCFCDFBodyDeliveryTerms) 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 FCFCDFBodyDeliveryTerms Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyDeliveryTerms) 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 FCFCDFBodyDeliveryTerms Return CType(SerializerXml.Deserialize(s),FCFCDFBodyDeliveryTerms) End Function #End Region ''' ''' Serializes current FCFCDFBodyDeliveryTerms 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyDeliveryTerms object ''' ''' File to load and deserialize ''' Output FCFCDFBodyDeliveryTerms 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyDeliveryTerms, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyDeliveryTerms) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyDeliveryTerms, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyDeliveryTerms) 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 FCFCDFBodyDeliveryTerms Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyDeliveryTerms 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, encoding) 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 FCFCDFBodyPaymentTransaction #Region "Private fields" Private _amount As Decimal Private _currencyCode As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Amount() As Decimal Get Return Me._amount End Get Set Me._amount = value End Set End Property _ Public Property CurrencyCode() As String Get Return Me._currencyCode End Get Set Me._currencyCode = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyPaymentTransaction)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyPaymentTransaction object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyPaymentTransaction object ''' ''' string to deserialize ''' Output FCFCDFBodyPaymentTransaction 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 FCFCDFBodyPaymentTransaction, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyPaymentTransaction) 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 FCFCDFBodyPaymentTransaction) 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 FCFCDFBodyPaymentTransaction Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyPaymentTransaction) 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 FCFCDFBodyPaymentTransaction Return CType(SerializerXml.Deserialize(s),FCFCDFBodyPaymentTransaction) End Function #End Region ''' ''' Serializes current FCFCDFBodyPaymentTransaction 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyPaymentTransaction object ''' ''' File to load and deserialize ''' Output FCFCDFBodyPaymentTransaction 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyPaymentTransaction, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyPaymentTransaction) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyPaymentTransaction, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyPaymentTransaction) 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 FCFCDFBodyPaymentTransaction Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyPaymentTransaction 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, encoding) 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 FCFCDFBodyForeignTradeStatistics #Region "Private fields" Private _goodsStatus As String Private _transactionType As String Private _destinationCountry As String Private _destinationFederalState As String Private _inlandTransportMode As String Private _totalGrossMassMeasure As Decimal Private _entryCustomsOffice As FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._entryCustomsOffice = New FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice() End Sub _ Public Property GoodsStatus() As String Get Return Me._goodsStatus End Get Set Me._goodsStatus = value End Set End Property _ Public Property TransactionType() As String Get Return Me._transactionType End Get Set Me._transactionType = value End Set End Property _ Public Property DestinationCountry() As String Get Return Me._destinationCountry End Get Set Me._destinationCountry = value End Set End Property _ Public Property DestinationFederalState() As String Get Return Me._destinationFederalState End Get Set Me._destinationFederalState = value End Set End Property _ Public Property InlandTransportMode() As String Get Return Me._inlandTransportMode End Get Set Me._inlandTransportMode = value End Set End Property _ Public Property TotalGrossMassMeasure() As Decimal Get Return Me._totalGrossMassMeasure End Get Set Me._totalGrossMassMeasure = value End Set End Property _ Public Property EntryCustomsOffice() As FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice Get Return Me._entryCustomsOffice End Get Set Me._entryCustomsOffice = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyForeignTradeStatistics)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyForeignTradeStatistics object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyForeignTradeStatistics object ''' ''' string to deserialize ''' Output FCFCDFBodyForeignTradeStatistics 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 FCFCDFBodyForeignTradeStatistics, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyForeignTradeStatistics) 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 FCFCDFBodyForeignTradeStatistics) 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 FCFCDFBodyForeignTradeStatistics Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyForeignTradeStatistics) 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 FCFCDFBodyForeignTradeStatistics Return CType(SerializerXml.Deserialize(s),FCFCDFBodyForeignTradeStatistics) End Function #End Region ''' ''' Serializes current FCFCDFBodyForeignTradeStatistics 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyForeignTradeStatistics object ''' ''' File to load and deserialize ''' Output FCFCDFBodyForeignTradeStatistics 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyForeignTradeStatistics, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyForeignTradeStatistics) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyForeignTradeStatistics, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyForeignTradeStatistics) 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 FCFCDFBodyForeignTradeStatistics Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyForeignTradeStatistics 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, encoding) 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice object ''' ''' string to deserialize ''' Output FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice) 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice) 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice) 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice Return CType(SerializerXml.Deserialize(s),FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice) End Function #End Region ''' ''' Serializes current FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice object ''' ''' File to load and deserialize ''' Output FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice) 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 FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyForeignTradeStatisticsEntryCustomsOffice 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, encoding) 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 FCFCDFBodyCustomsValue #Region "Private fields" Private _formerDecisions As String Private _vendor As FCFCDFBodyCustomsValueVendor Private _vendee As FCFCDFBodyCustomsValueVendee Private _affiliation As FCFCDFBodyCustomsValueAffiliation Private _restrictionOrCondition As FCFCDFBodyCustomsValueRestrictionOrCondition Private _licenseFee As FCFCDFBodyCustomsValueLicenseFee Private _resale As FCFCDFBodyCustomsValueResale Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._resale = New FCFCDFBodyCustomsValueResale() Me._licenseFee = New FCFCDFBodyCustomsValueLicenseFee() Me._restrictionOrCondition = New FCFCDFBodyCustomsValueRestrictionOrCondition() Me._affiliation = New FCFCDFBodyCustomsValueAffiliation() Me._vendee = New FCFCDFBodyCustomsValueVendee() Me._vendor = New FCFCDFBodyCustomsValueVendor() End Sub _ Public Property FormerDecisions() As String Get Return Me._formerDecisions End Get Set Me._formerDecisions = value End Set End Property _ Public Property Vendor() As FCFCDFBodyCustomsValueVendor Get Return Me._vendor End Get Set Me._vendor = value End Set End Property _ Public Property Vendee() As FCFCDFBodyCustomsValueVendee Get Return Me._vendee End Get Set Me._vendee = value End Set End Property _ Public Property Affiliation() As FCFCDFBodyCustomsValueAffiliation Get Return Me._affiliation End Get Set Me._affiliation = value End Set End Property _ Public Property RestrictionOrCondition() As FCFCDFBodyCustomsValueRestrictionOrCondition Get Return Me._restrictionOrCondition End Get Set Me._restrictionOrCondition = value End Set End Property _ Public Property LicenseFee() As FCFCDFBodyCustomsValueLicenseFee Get Return Me._licenseFee End Get Set Me._licenseFee = value End Set End Property _ Public Property Resale() As FCFCDFBodyCustomsValueResale Get Return Me._resale End Get Set Me._resale = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyCustomsValue)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValue object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValue object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValue 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 FCFCDFBodyCustomsValue, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValue) 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 FCFCDFBodyCustomsValue) 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 FCFCDFBodyCustomsValue Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValue) 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 FCFCDFBodyCustomsValue Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValue) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValue 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValue object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValue 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValue, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValue) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValue, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValue) 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 FCFCDFBodyCustomsValue Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValue 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, encoding) 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 FCFCDFBodyCustomsValueVendor #Region "Private fields" Private _identification As FCFCDFBodyCustomsValueVendorIdentification Private _name As String Private _address As FCFCDFBodyCustomsValueVendorAddress Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New FCFCDFBodyCustomsValueVendorAddress() Me._identification = New FCFCDFBodyCustomsValueVendorIdentification() End Sub _ Public Property Identification() As FCFCDFBodyCustomsValueVendorIdentification Get Return Me._identification End Get Set Me._identification = 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 Address() As FCFCDFBodyCustomsValueVendorAddress Get Return Me._address End Get Set Me._address = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyCustomsValueVendor)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueVendor object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueVendor object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueVendor 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 FCFCDFBodyCustomsValueVendor, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendor) 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 FCFCDFBodyCustomsValueVendor) 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 FCFCDFBodyCustomsValueVendor Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueVendor) 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 FCFCDFBodyCustomsValueVendor Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueVendor) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueVendor 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueVendor object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueVendor 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueVendor, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendor) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueVendor, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueVendor) 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 FCFCDFBodyCustomsValueVendor Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueVendor 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, encoding) 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 FCFCDFBodyCustomsValueVendorIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyCustomsValueVendorIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueVendorIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueVendorIdentification object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueVendorIdentification 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 FCFCDFBodyCustomsValueVendorIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendorIdentification) 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 FCFCDFBodyCustomsValueVendorIdentification) 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 FCFCDFBodyCustomsValueVendorIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueVendorIdentification) 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 FCFCDFBodyCustomsValueVendorIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueVendorIdentification) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueVendorIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueVendorIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueVendorIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueVendorIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendorIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueVendorIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueVendorIdentification) 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 FCFCDFBodyCustomsValueVendorIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueVendorIdentification 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, encoding) 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 FCFCDFBodyCustomsValueVendorAddress #Region "Private fields" Private _line As String Private _country As String Private _postcode As String Private _city As String Private _district As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Line() As String Get Return Me._line End Get Set Me._line = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = value End Set End Property _ Public Property City() As String Get Return Me._city End Get Set Me._city = value End Set End Property _ Public Property District() As String Get Return Me._district End Get Set Me._district = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyCustomsValueVendorAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueVendorAddress object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueVendorAddress object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueVendorAddress 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 FCFCDFBodyCustomsValueVendorAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendorAddress) 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 FCFCDFBodyCustomsValueVendorAddress) 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 FCFCDFBodyCustomsValueVendorAddress Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueVendorAddress) 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 FCFCDFBodyCustomsValueVendorAddress Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueVendorAddress) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueVendorAddress 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueVendorAddress object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueVendorAddress 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueVendorAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendorAddress) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueVendorAddress, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueVendorAddress) 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 FCFCDFBodyCustomsValueVendorAddress Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueVendorAddress 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, encoding) 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 FCFCDFBodyCustomsValueVendee #Region "Private fields" Private _identification As FCFCDFBodyCustomsValueVendeeIdentification Private _name As String Private _address As FCFCDFBodyCustomsValueVendeeAddress Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New FCFCDFBodyCustomsValueVendeeAddress() Me._identification = New FCFCDFBodyCustomsValueVendeeIdentification() End Sub _ Public Property Identification() As FCFCDFBodyCustomsValueVendeeIdentification Get Return Me._identification End Get Set Me._identification = 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 Address() As FCFCDFBodyCustomsValueVendeeAddress Get Return Me._address End Get Set Me._address = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyCustomsValueVendee)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueVendee object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueVendee object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueVendee 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 FCFCDFBodyCustomsValueVendee, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendee) 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 FCFCDFBodyCustomsValueVendee) 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 FCFCDFBodyCustomsValueVendee Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueVendee) 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 FCFCDFBodyCustomsValueVendee Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueVendee) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueVendee 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueVendee object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueVendee 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueVendee, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendee) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueVendee, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueVendee) 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 FCFCDFBodyCustomsValueVendee Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueVendee 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, encoding) 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 FCFCDFBodyCustomsValueVendeeIdentification #Region "Private fields" Private _referenceNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyCustomsValueVendeeIdentification)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueVendeeIdentification object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueVendeeIdentification object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueVendeeIdentification 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 FCFCDFBodyCustomsValueVendeeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendeeIdentification) 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 FCFCDFBodyCustomsValueVendeeIdentification) 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 FCFCDFBodyCustomsValueVendeeIdentification Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueVendeeIdentification) 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 FCFCDFBodyCustomsValueVendeeIdentification Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueVendeeIdentification) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueVendeeIdentification 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueVendeeIdentification object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueVendeeIdentification 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueVendeeIdentification, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendeeIdentification) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueVendeeIdentification, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueVendeeIdentification) 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 FCFCDFBodyCustomsValueVendeeIdentification Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueVendeeIdentification 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, encoding) 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 FCFCDFBodyCustomsValueVendeeAddress #Region "Private fields" Private _line As String Private _country As String Private _postcode As String Private _city As String Private _district As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Line() As String Get Return Me._line End Get Set Me._line = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = value End Set End Property _ Public Property City() As String Get Return Me._city End Get Set Me._city = value End Set End Property _ Public Property District() As String Get Return Me._district End Get Set Me._district = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyCustomsValueVendeeAddress)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueVendeeAddress object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueVendeeAddress object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueVendeeAddress 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 FCFCDFBodyCustomsValueVendeeAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendeeAddress) 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 FCFCDFBodyCustomsValueVendeeAddress) 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 FCFCDFBodyCustomsValueVendeeAddress Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueVendeeAddress) 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 FCFCDFBodyCustomsValueVendeeAddress Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueVendeeAddress) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueVendeeAddress 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueVendeeAddress object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueVendeeAddress 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueVendeeAddress, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueVendeeAddress) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueVendeeAddress, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueVendeeAddress) 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 FCFCDFBodyCustomsValueVendeeAddress Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueVendeeAddress 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, encoding) 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 FCFCDFBodyCustomsValueAffiliation #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(FCFCDFBodyCustomsValueAffiliation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueAffiliation object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueAffiliation object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueAffiliation 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 FCFCDFBodyCustomsValueAffiliation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueAffiliation) 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 FCFCDFBodyCustomsValueAffiliation) 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 FCFCDFBodyCustomsValueAffiliation Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueAffiliation) 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 FCFCDFBodyCustomsValueAffiliation Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueAffiliation) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueAffiliation 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueAffiliation object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueAffiliation 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueAffiliation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueAffiliation) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueAffiliation, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueAffiliation) 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 FCFCDFBodyCustomsValueAffiliation Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueAffiliation 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, encoding) 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 FCFCDFBodyCustomsValueRestrictionOrCondition #Region "Private fields" Private _restrictionFlag As String Private _conditionFlag As String Private _description As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property RestrictionFlag() As String Get Return Me._restrictionFlag End Get Set Me._restrictionFlag = value End Set End Property _ Public Property ConditionFlag() As String Get Return Me._conditionFlag End Get Set Me._conditionFlag = 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(FCFCDFBodyCustomsValueRestrictionOrCondition)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueRestrictionOrCondition object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueRestrictionOrCondition object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueRestrictionOrCondition 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 FCFCDFBodyCustomsValueRestrictionOrCondition, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueRestrictionOrCondition) 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 FCFCDFBodyCustomsValueRestrictionOrCondition) 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 FCFCDFBodyCustomsValueRestrictionOrCondition Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueRestrictionOrCondition) 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 FCFCDFBodyCustomsValueRestrictionOrCondition Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueRestrictionOrCondition) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueRestrictionOrCondition 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueRestrictionOrCondition object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueRestrictionOrCondition 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueRestrictionOrCondition, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueRestrictionOrCondition) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueRestrictionOrCondition, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueRestrictionOrCondition) 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 FCFCDFBodyCustomsValueRestrictionOrCondition Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueRestrictionOrCondition 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, encoding) 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 FCFCDFBodyCustomsValueLicenseFee #Region "Private fields" Private _licenseFeeFlag As String Private _description As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property LicenseFeeFlag() As String Get Return Me._licenseFeeFlag End Get Set Me._licenseFeeFlag = 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(FCFCDFBodyCustomsValueLicenseFee)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueLicenseFee object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueLicenseFee object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueLicenseFee 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 FCFCDFBodyCustomsValueLicenseFee, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueLicenseFee) 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 FCFCDFBodyCustomsValueLicenseFee) 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 FCFCDFBodyCustomsValueLicenseFee Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueLicenseFee) 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 FCFCDFBodyCustomsValueLicenseFee Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueLicenseFee) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueLicenseFee 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueLicenseFee object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueLicenseFee 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueLicenseFee, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueLicenseFee) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueLicenseFee, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueLicenseFee) 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 FCFCDFBodyCustomsValueLicenseFee Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueLicenseFee 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, encoding) 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 FCFCDFBodyCustomsValueResale #Region "Private fields" Private _resaleFlag As String Private _description As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ResaleFlag() As String Get Return Me._resaleFlag End Get Set Me._resaleFlag = 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(FCFCDFBodyCustomsValueResale)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyCustomsValueResale object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyCustomsValueResale object ''' ''' string to deserialize ''' Output FCFCDFBodyCustomsValueResale 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 FCFCDFBodyCustomsValueResale, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueResale) 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 FCFCDFBodyCustomsValueResale) 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 FCFCDFBodyCustomsValueResale Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyCustomsValueResale) 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 FCFCDFBodyCustomsValueResale Return CType(SerializerXml.Deserialize(s),FCFCDFBodyCustomsValueResale) End Function #End Region ''' ''' Serializes current FCFCDFBodyCustomsValueResale 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyCustomsValueResale object ''' ''' File to load and deserialize ''' Output FCFCDFBodyCustomsValueResale 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyCustomsValueResale, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyCustomsValueResale) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyCustomsValueResale, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyCustomsValueResale) 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 FCFCDFBodyCustomsValueResale Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyCustomsValueResale 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, encoding) 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 FCFCDFBodyDocument #Region "Private fields" Private _division As FCFCDFBodyDocumentDivision Private _type As String Private _referenceNumber As String Private _issuingDate As Date Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Division() As FCFCDFBodyDocumentDivision Get Return Me._division End Get Set Me._division = 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 ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property IssuingDate() As Date Get Return Me._issuingDate End Get Set Me._issuingDate = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyDocument)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyDocument object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyDocument object ''' ''' string to deserialize ''' Output FCFCDFBodyDocument 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 FCFCDFBodyDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyDocument) 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 FCFCDFBodyDocument) 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 FCFCDFBodyDocument Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyDocument) 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 FCFCDFBodyDocument Return CType(SerializerXml.Deserialize(s),FCFCDFBodyDocument) End Function #End Region ''' ''' Serializes current FCFCDFBodyDocument 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyDocument object ''' ''' File to load and deserialize ''' Output FCFCDFBodyDocument 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyDocument) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyDocument, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyDocument) 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 FCFCDFBodyDocument Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyDocument 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, encoding) 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 FCFCDFBodyDocumentDivision ''' _ Item4 End Enum _ Partial Public Class FCFCDFBodyGoodsItem #Region "Private fields" Private _sequenceNumber As String Private _procedure As FCFCDFBodyGoodsItemProcedure Private _cessionManagementFlag As String Private _goodsDescription As String Private _invoiceAmount As Decimal Private _netMassMeasure As Decimal Private _tobaccoRevenueStampNumber As String Private _originCountry As String Private _preferentialOriginCountry As String Private _supplementaryInformation As String Private _condition As String Private _commodityCode As FCFCDFBodyGoodsItemCommodityCode Private _additionalProcedure As List(Of FCFCDFBodyGoodsItemAdditionalProcedure) Private _supplementaryCodes As List(Of FCFCDFBodyGoodsItemSupplementaryCodes) Private _package As FCFCDFBodyGoodsItemPackage Private _foreignTradeStatistics As FCFCDFBodyGoodsItemForeignTradeStatistics Private _customsValue As FCFCDFBodyGoodsItemCustomsValue Private _assessment As FCFCDFBodyGoodsItemAssessment Private _exciseDuty As List(Of FCFCDFBodyGoodsItemExciseDuty) Private _preferentialTreatment As FCFCDFBodyGoodsItemPreferentialTreatment Private _specialCase As List(Of FCFCDFBodyGoodsItemSpecialCase) Private _document As List(Of FCFCDFBodyGoodsItemDocument) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._document = New List(Of FCFCDFBodyGoodsItemDocument)() Me._specialCase = New List(Of FCFCDFBodyGoodsItemSpecialCase)() Me._preferentialTreatment = New FCFCDFBodyGoodsItemPreferentialTreatment() Me._exciseDuty = New List(Of FCFCDFBodyGoodsItemExciseDuty)() Me._assessment = New FCFCDFBodyGoodsItemAssessment() Me._customsValue = New FCFCDFBodyGoodsItemCustomsValue() Me._foreignTradeStatistics = New FCFCDFBodyGoodsItemForeignTradeStatistics() Me._package = New FCFCDFBodyGoodsItemPackage() Me._supplementaryCodes = New List(Of FCFCDFBodyGoodsItemSupplementaryCodes)() Me._additionalProcedure = New List(Of FCFCDFBodyGoodsItemAdditionalProcedure)() Me._commodityCode = New FCFCDFBodyGoodsItemCommodityCode() Me._procedure = New FCFCDFBodyGoodsItemProcedure() End Sub _ Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = value End Set End Property _ Public Property Procedure() As FCFCDFBodyGoodsItemProcedure Get Return Me._procedure End Get Set Me._procedure = value End Set End Property _ Public Property CessionManagementFlag() As String Get Return Me._cessionManagementFlag End Get Set Me._cessionManagementFlag = value End Set End Property _ Public Property GoodsDescription() As String Get Return Me._goodsDescription End Get Set Me._goodsDescription = value End Set End Property _ Public Property InvoiceAmount() As Decimal Get Return Me._invoiceAmount End Get Set Me._invoiceAmount = value End Set End Property _ Public Property NetMassMeasure() As Decimal Get Return Me._netMassMeasure End Get Set Me._netMassMeasure = value End Set End Property _ Public Property TobaccoRevenueStampNumber() As String Get Return Me._tobaccoRevenueStampNumber End Get Set Me._tobaccoRevenueStampNumber = value End Set End Property _ Public Property OriginCountry() As String Get Return Me._originCountry End Get Set Me._originCountry = value End Set End Property _ Public Property PreferentialOriginCountry() As String Get Return Me._preferentialOriginCountry End Get Set Me._preferentialOriginCountry = value End Set End Property _ Public Property SupplementaryInformation() As String Get Return Me._supplementaryInformation End Get Set Me._supplementaryInformation = value End Set End Property _ Public Property Condition() As String Get Return Me._condition End Get Set Me._condition = value End Set End Property _ Public Property CommodityCode() As FCFCDFBodyGoodsItemCommodityCode Get Return Me._commodityCode End Get Set Me._commodityCode = value End Set End Property _ Public Property AdditionalProcedure() As List(Of FCFCDFBodyGoodsItemAdditionalProcedure) Get Return Me._additionalProcedure End Get Set Me._additionalProcedure = value End Set End Property _ Public Property SupplementaryCodes() As List(Of FCFCDFBodyGoodsItemSupplementaryCodes) Get Return Me._supplementaryCodes End Get Set Me._supplementaryCodes = value End Set End Property _ Public Property Package() As FCFCDFBodyGoodsItemPackage Get Return Me._package End Get Set Me._package = value End Set End Property _ Public Property ForeignTradeStatistics() As FCFCDFBodyGoodsItemForeignTradeStatistics Get Return Me._foreignTradeStatistics End Get Set Me._foreignTradeStatistics = value End Set End Property _ Public Property CustomsValue() As FCFCDFBodyGoodsItemCustomsValue Get Return Me._customsValue End Get Set Me._customsValue = value End Set End Property _ Public Property Assessment() As FCFCDFBodyGoodsItemAssessment Get Return Me._assessment End Get Set Me._assessment = value End Set End Property _ Public Property ExciseDuty() As List(Of FCFCDFBodyGoodsItemExciseDuty) Get Return Me._exciseDuty End Get Set Me._exciseDuty = value End Set End Property _ Public Property PreferentialTreatment() As FCFCDFBodyGoodsItemPreferentialTreatment Get Return Me._preferentialTreatment End Get Set Me._preferentialTreatment = value End Set End Property _ Public Property SpecialCase() As List(Of FCFCDFBodyGoodsItemSpecialCase) Get Return Me._specialCase End Get Set Me._specialCase = value End Set End Property _ Public Property Document() As List(Of FCFCDFBodyGoodsItemDocument) Get Return Me._document End Get Set Me._document = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItem)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItem object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItem object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItem 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 FCFCDFBodyGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItem) 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 FCFCDFBodyGoodsItem) 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 FCFCDFBodyGoodsItem Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItem) 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 FCFCDFBodyGoodsItem Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItem) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItem 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItem object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItem 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItem, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItem) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItem, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItem) 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 FCFCDFBodyGoodsItem Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItem 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, encoding) 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 FCFCDFBodyGoodsItemProcedure #Region "Private fields" Private _requestedPreviousProcedure As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property RequestedPreviousProcedure() As String Get Return Me._requestedPreviousProcedure End Get Set Me._requestedPreviousProcedure = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemProcedure)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemProcedure object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemProcedure object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemProcedure 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 FCFCDFBodyGoodsItemProcedure, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemProcedure) 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 FCFCDFBodyGoodsItemProcedure) 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 FCFCDFBodyGoodsItemProcedure Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemProcedure) 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 FCFCDFBodyGoodsItemProcedure Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemProcedure) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemProcedure 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemProcedure object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemProcedure 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemProcedure, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemProcedure) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemProcedure, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemProcedure) 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 FCFCDFBodyGoodsItemProcedure Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemProcedure 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, encoding) 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 FCFCDFBodyGoodsItemCommodityCode #Region "Private fields" Private _commodityCode 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 Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemCommodityCode)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemCommodityCode object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemCommodityCode object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemCommodityCode 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 FCFCDFBodyGoodsItemCommodityCode, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCommodityCode) 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 FCFCDFBodyGoodsItemCommodityCode) 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 FCFCDFBodyGoodsItemCommodityCode Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemCommodityCode) 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 FCFCDFBodyGoodsItemCommodityCode Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemCommodityCode) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemCommodityCode 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemCommodityCode object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemCommodityCode 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemCommodityCode, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCommodityCode) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemCommodityCode, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemCommodityCode) 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 FCFCDFBodyGoodsItemCommodityCode Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemCommodityCode 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, encoding) 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 FCFCDFBodyGoodsItemAdditionalProcedure #Region "Private fields" Private _code 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 Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemAdditionalProcedure)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemAdditionalProcedure object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemAdditionalProcedure object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemAdditionalProcedure 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 FCFCDFBodyGoodsItemAdditionalProcedure, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAdditionalProcedure) 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 FCFCDFBodyGoodsItemAdditionalProcedure) 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 FCFCDFBodyGoodsItemAdditionalProcedure Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemAdditionalProcedure) 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 FCFCDFBodyGoodsItemAdditionalProcedure Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemAdditionalProcedure) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemAdditionalProcedure 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemAdditionalProcedure object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemAdditionalProcedure 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemAdditionalProcedure, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAdditionalProcedure) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemAdditionalProcedure, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemAdditionalProcedure) 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 FCFCDFBodyGoodsItemAdditionalProcedure Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemAdditionalProcedure 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, encoding) 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 FCFCDFBodyGoodsItemSupplementaryCodes #Region "Private fields" Private _code 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 Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemSupplementaryCodes)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemSupplementaryCodes object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemSupplementaryCodes object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemSupplementaryCodes 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 FCFCDFBodyGoodsItemSupplementaryCodes, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemSupplementaryCodes) 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 FCFCDFBodyGoodsItemSupplementaryCodes) 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 FCFCDFBodyGoodsItemSupplementaryCodes Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemSupplementaryCodes) 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 FCFCDFBodyGoodsItemSupplementaryCodes Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemSupplementaryCodes) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemSupplementaryCodes 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemSupplementaryCodes object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemSupplementaryCodes 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemSupplementaryCodes, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemSupplementaryCodes) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemSupplementaryCodes, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemSupplementaryCodes) 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 FCFCDFBodyGoodsItemSupplementaryCodes Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemSupplementaryCodes 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, encoding) 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 FCFCDFBodyGoodsItemPackage #Region "Private fields" Private _kind As String Private _quantity As String Private _marksNumbers As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Kind() As String Get Return Me._kind End Get Set Me._kind = value End Set End Property _ Public Property Quantity() As String Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MarksNumbers() As String Get Return Me._marksNumbers End Get Set Me._marksNumbers = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemPackage)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemPackage object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemPackage object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemPackage 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 FCFCDFBodyGoodsItemPackage, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPackage) 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 FCFCDFBodyGoodsItemPackage) 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 FCFCDFBodyGoodsItemPackage Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemPackage) 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 FCFCDFBodyGoodsItemPackage Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemPackage) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemPackage 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemPackage object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemPackage 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemPackage, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPackage) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemPackage, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemPackage) 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 FCFCDFBodyGoodsItemPackage Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemPackage 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, encoding) 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 FCFCDFBodyGoodsItemForeignTradeStatistics #Region "Private fields" Private _quantity As String Private _grossMassMeasure As Decimal Private _amount As FCFCDFBodyGoodsItemForeignTradeStatisticsAmount Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._amount = New FCFCDFBodyGoodsItemForeignTradeStatisticsAmount() End Sub _ Public Property Quantity() As String Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property GrossMassMeasure() As Decimal Get Return Me._grossMassMeasure End Get Set Me._grossMassMeasure = value End Set End Property _ Public Property Amount() As FCFCDFBodyGoodsItemForeignTradeStatisticsAmount Get Return Me._amount End Get Set Me._amount = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemForeignTradeStatistics)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemForeignTradeStatistics object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemForeignTradeStatistics object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemForeignTradeStatistics 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 FCFCDFBodyGoodsItemForeignTradeStatistics, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemForeignTradeStatistics) 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 FCFCDFBodyGoodsItemForeignTradeStatistics) 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 FCFCDFBodyGoodsItemForeignTradeStatistics Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemForeignTradeStatistics) 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 FCFCDFBodyGoodsItemForeignTradeStatistics Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemForeignTradeStatistics) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemForeignTradeStatistics 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemForeignTradeStatistics object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemForeignTradeStatistics 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemForeignTradeStatistics, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemForeignTradeStatistics) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemForeignTradeStatistics, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemForeignTradeStatistics) 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 FCFCDFBodyGoodsItemForeignTradeStatistics Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemForeignTradeStatistics 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, encoding) 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount #Region "Private fields" Private _quantity As Decimal Private _measurementUnit As String Private _qualifier As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = value End Set End Property _ Public Property Qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemForeignTradeStatisticsAmount)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemForeignTradeStatisticsAmount object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemForeignTradeStatisticsAmount object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemForeignTradeStatisticsAmount 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemForeignTradeStatisticsAmount) 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount) 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemForeignTradeStatisticsAmount) 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemForeignTradeStatisticsAmount) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemForeignTradeStatisticsAmount 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemForeignTradeStatisticsAmount 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemForeignTradeStatisticsAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemForeignTradeStatisticsAmount) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemForeignTradeStatisticsAmount) 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 FCFCDFBodyGoodsItemForeignTradeStatisticsAmount Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemForeignTradeStatisticsAmount 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, encoding) 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 FCFCDFBodyGoodsItemCustomsValue #Region "Private fields" Private _departureAirport As String Private _destinationPlace As String Private _additionDeductionDescription As String Private _netPrice As FCFCDFBodyGoodsItemCustomsValueNetPrice Private _indirectPayment As FCFCDFBodyGoodsItemCustomsValueIndirectPayment Private _airFreightCosts As FCFCDFBodyGoodsItemCustomsValueAirFreightCosts Private _additionDeduction As List(Of FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._additionDeduction = New List(Of FCFCDFBodyGoodsItemCustomsValueAdditionDeduction)() Me._airFreightCosts = New FCFCDFBodyGoodsItemCustomsValueAirFreightCosts() Me._indirectPayment = New FCFCDFBodyGoodsItemCustomsValueIndirectPayment() Me._netPrice = New FCFCDFBodyGoodsItemCustomsValueNetPrice() End Sub _ Public Property DepartureAirport() As String Get Return Me._departureAirport End Get Set Me._departureAirport = value End Set End Property _ Public Property DestinationPlace() As String Get Return Me._destinationPlace End Get Set Me._destinationPlace = value End Set End Property _ Public Property AdditionDeductionDescription() As String Get Return Me._additionDeductionDescription End Get Set Me._additionDeductionDescription = value End Set End Property _ Public Property NetPrice() As FCFCDFBodyGoodsItemCustomsValueNetPrice Get Return Me._netPrice End Get Set Me._netPrice = value End Set End Property _ Public Property IndirectPayment() As FCFCDFBodyGoodsItemCustomsValueIndirectPayment Get Return Me._indirectPayment End Get Set Me._indirectPayment = value End Set End Property _ Public Property AirFreightCosts() As FCFCDFBodyGoodsItemCustomsValueAirFreightCosts Get Return Me._airFreightCosts End Get Set Me._airFreightCosts = value End Set End Property _ Public Property AdditionDeduction() As List(Of FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) Get Return Me._additionDeduction End Get Set Me._additionDeduction = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemCustomsValue)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemCustomsValue object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemCustomsValue object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemCustomsValue 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 FCFCDFBodyGoodsItemCustomsValue, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValue) 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 FCFCDFBodyGoodsItemCustomsValue) 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 FCFCDFBodyGoodsItemCustomsValue Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemCustomsValue) 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 FCFCDFBodyGoodsItemCustomsValue Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemCustomsValue) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemCustomsValue 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemCustomsValue object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemCustomsValue 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemCustomsValue, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValue) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemCustomsValue, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemCustomsValue) 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 FCFCDFBodyGoodsItemCustomsValue Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemCustomsValue 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, encoding) 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 FCFCDFBodyGoodsItemCustomsValueNetPrice #Region "Private fields" Private _value As Decimal Private _currencyCode As String Private _currencyRateAgreedFlag As String Private _currencyRate As Decimal Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Value() As Decimal Get Return Me._value End Get Set Me._value = value End Set End Property _ Public Property CurrencyCode() As String Get Return Me._currencyCode End Get Set Me._currencyCode = value End Set End Property _ Public Property CurrencyRateAgreedFlag() As String Get Return Me._currencyRateAgreedFlag End Get Set Me._currencyRateAgreedFlag = value End Set End Property _ Public Property CurrencyRate() As Decimal Get Return Me._currencyRate End Get Set Me._currencyRate = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemCustomsValueNetPrice)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemCustomsValueNetPrice object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemCustomsValueNetPrice object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueNetPrice 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 FCFCDFBodyGoodsItemCustomsValueNetPrice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueNetPrice) 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 FCFCDFBodyGoodsItemCustomsValueNetPrice) 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 FCFCDFBodyGoodsItemCustomsValueNetPrice Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemCustomsValueNetPrice) 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 FCFCDFBodyGoodsItemCustomsValueNetPrice Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemCustomsValueNetPrice) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemCustomsValueNetPrice 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemCustomsValueNetPrice object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueNetPrice 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemCustomsValueNetPrice, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueNetPrice) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemCustomsValueNetPrice, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemCustomsValueNetPrice) 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 FCFCDFBodyGoodsItemCustomsValueNetPrice Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemCustomsValueNetPrice 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, encoding) 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment #Region "Private fields" Private _value As Decimal Private _currencyCode As String Private _currencyRateAgreedFlag As String Private _currencyRate As Decimal Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Value() As Decimal Get Return Me._value End Get Set Me._value = value End Set End Property _ Public Property CurrencyCode() As String Get Return Me._currencyCode End Get Set Me._currencyCode = value End Set End Property _ Public Property CurrencyRateAgreedFlag() As String Get Return Me._currencyRateAgreedFlag End Get Set Me._currencyRateAgreedFlag = value End Set End Property _ Public Property CurrencyRate() As Decimal Get Return Me._currencyRate End Get Set Me._currencyRate = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemCustomsValueIndirectPayment)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemCustomsValueIndirectPayment object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemCustomsValueIndirectPayment object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueIndirectPayment 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueIndirectPayment) 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment) 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemCustomsValueIndirectPayment) 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemCustomsValueIndirectPayment) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemCustomsValueIndirectPayment 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueIndirectPayment 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemCustomsValueIndirectPayment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueIndirectPayment) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemCustomsValueIndirectPayment) 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 FCFCDFBodyGoodsItemCustomsValueIndirectPayment Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemCustomsValueIndirectPayment 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, encoding) 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts #Region "Private fields" Private _value As Decimal Private _currencyCode As String Private _currencyRateIATA As String Private _currencyRateAgreedFlag As String Private _currencyRate As Decimal Private _currencyRateDate As Date Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Value() As Decimal Get Return Me._value End Get Set Me._value = value End Set End Property _ Public Property CurrencyCode() As String Get Return Me._currencyCode End Get Set Me._currencyCode = value End Set End Property _ Public Property CurrencyRateIATA() As String Get Return Me._currencyRateIATA End Get Set Me._currencyRateIATA = value End Set End Property _ Public Property CurrencyRateAgreedFlag() As String Get Return Me._currencyRateAgreedFlag End Get Set Me._currencyRateAgreedFlag = value End Set End Property _ Public Property CurrencyRate() As Decimal Get Return Me._currencyRate End Get Set Me._currencyRate = value End Set End Property _ Public Property CurrencyRateDate() As Date Get Return Me._currencyRateDate End Get Set Me._currencyRateDate = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemCustomsValueAirFreightCosts)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemCustomsValueAirFreightCosts object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemCustomsValueAirFreightCosts object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueAirFreightCosts 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueAirFreightCosts) 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts) 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemCustomsValueAirFreightCosts) 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemCustomsValueAirFreightCosts) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemCustomsValueAirFreightCosts 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueAirFreightCosts 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemCustomsValueAirFreightCosts, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueAirFreightCosts) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemCustomsValueAirFreightCosts) 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 FCFCDFBodyGoodsItemCustomsValueAirFreightCosts Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemCustomsValueAirFreightCosts 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, encoding) 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction #Region "Private fields" Private _type As String Private _value As Decimal Private _currencyCode As String Private _currencyRateIATA As String Private _currencyRateAgreedFlag As String Private _currencyRate As Decimal Private _currencyRateDate As Date Private _percentage As Decimal 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 Value() As Decimal Get Return Me._value End Get Set Me._value = value End Set End Property _ Public Property CurrencyCode() As String Get Return Me._currencyCode End Get Set Me._currencyCode = value End Set End Property _ Public Property CurrencyRateIATA() As String Get Return Me._currencyRateIATA End Get Set Me._currencyRateIATA = value End Set End Property _ Public Property CurrencyRateAgreedFlag() As String Get Return Me._currencyRateAgreedFlag End Get Set Me._currencyRateAgreedFlag = value End Set End Property _ Public Property CurrencyRate() As Decimal Get Return Me._currencyRate End Get Set Me._currencyRate = value End Set End Property _ Public Property CurrencyRateDate() As Date Get Return Me._currencyRateDate End Get Set Me._currencyRateDate = value End Set End Property _ Public Property Percentage() As Decimal Get Return Me._percentage End Get Set Me._percentage = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemCustomsValueAdditionDeduction)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemCustomsValueAdditionDeduction object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemCustomsValueAdditionDeduction object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueAdditionDeduction 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemCustomsValueAdditionDeduction 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemCustomsValueAdditionDeduction 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemCustomsValueAdditionDeduction, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemCustomsValueAdditionDeduction) 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 FCFCDFBodyGoodsItemCustomsValueAdditionDeduction Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemCustomsValueAdditionDeduction 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, encoding) 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 FCFCDFBodyGoodsItemAssessment #Region "Private fields" Private _customsValue As Decimal Private _outwardProcessingFee As Decimal Private _taxCosts As Decimal Private _amount As List(Of FCFCDFBodyGoodsItemAssessmentAmount) Private _specificRate As List(Of FCFCDFBodyGoodsItemAssessmentSpecificRate) Private _contentInformation As List(Of FCFCDFBodyGoodsItemAssessmentContentInformation) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._contentInformation = New List(Of FCFCDFBodyGoodsItemAssessmentContentInformation)() Me._specificRate = New List(Of FCFCDFBodyGoodsItemAssessmentSpecificRate)() Me._amount = New List(Of FCFCDFBodyGoodsItemAssessmentAmount)() End Sub _ Public Property CustomsValue() As Decimal Get Return Me._customsValue End Get Set Me._customsValue = value End Set End Property _ Public Property OutwardProcessingFee() As Decimal Get Return Me._outwardProcessingFee End Get Set Me._outwardProcessingFee = value End Set End Property _ Public Property TaxCosts() As Decimal Get Return Me._taxCosts End Get Set Me._taxCosts = value End Set End Property _ Public Property Amount() As List(Of FCFCDFBodyGoodsItemAssessmentAmount) Get Return Me._amount End Get Set Me._amount = value End Set End Property _ Public Property SpecificRate() As List(Of FCFCDFBodyGoodsItemAssessmentSpecificRate) Get Return Me._specificRate End Get Set Me._specificRate = value End Set End Property _ Public Property ContentInformation() As List(Of FCFCDFBodyGoodsItemAssessmentContentInformation) Get Return Me._contentInformation End Get Set Me._contentInformation = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemAssessment)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemAssessment object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemAssessment object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemAssessment 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 FCFCDFBodyGoodsItemAssessment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessment) 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 FCFCDFBodyGoodsItemAssessment) 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 FCFCDFBodyGoodsItemAssessment Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemAssessment) 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 FCFCDFBodyGoodsItemAssessment Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemAssessment) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemAssessment 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemAssessment object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemAssessment 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemAssessment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessment) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemAssessment, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemAssessment) 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 FCFCDFBodyGoodsItemAssessment Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemAssessment 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, encoding) 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 FCFCDFBodyGoodsItemAssessmentAmount #Region "Private fields" Private _quantity As Decimal Private _measurementUnit As String Private _qualifier As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = value End Set End Property _ Public Property Qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemAssessmentAmount)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemAssessmentAmount object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemAssessmentAmount object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemAssessmentAmount 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 FCFCDFBodyGoodsItemAssessmentAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessmentAmount) 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 FCFCDFBodyGoodsItemAssessmentAmount) 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 FCFCDFBodyGoodsItemAssessmentAmount Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemAssessmentAmount) 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 FCFCDFBodyGoodsItemAssessmentAmount Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemAssessmentAmount) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemAssessmentAmount 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemAssessmentAmount object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemAssessmentAmount 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemAssessmentAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessmentAmount) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemAssessmentAmount, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemAssessmentAmount) 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 FCFCDFBodyGoodsItemAssessmentAmount Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemAssessmentAmount 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, encoding) 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 FCFCDFBodyGoodsItemAssessmentSpecificRate #Region "Private fields" Private _type As String Private _value As Decimal 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 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(FCFCDFBodyGoodsItemAssessmentSpecificRate)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemAssessmentSpecificRate object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemAssessmentSpecificRate object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemAssessmentSpecificRate 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 FCFCDFBodyGoodsItemAssessmentSpecificRate, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessmentSpecificRate) 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 FCFCDFBodyGoodsItemAssessmentSpecificRate) 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 FCFCDFBodyGoodsItemAssessmentSpecificRate Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemAssessmentSpecificRate) 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 FCFCDFBodyGoodsItemAssessmentSpecificRate Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemAssessmentSpecificRate) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemAssessmentSpecificRate 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemAssessmentSpecificRate object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemAssessmentSpecificRate 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemAssessmentSpecificRate, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessmentSpecificRate) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemAssessmentSpecificRate, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemAssessmentSpecificRate) 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 FCFCDFBodyGoodsItemAssessmentSpecificRate Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemAssessmentSpecificRate 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, encoding) 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 FCFCDFBodyGoodsItemAssessmentContentInformation #Region "Private fields" Private _type As String Private _degreePercentage As Decimal 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 DegreePercentage() As Decimal Get Return Me._degreePercentage End Get Set Me._degreePercentage = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemAssessmentContentInformation)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemAssessmentContentInformation object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemAssessmentContentInformation object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemAssessmentContentInformation 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 FCFCDFBodyGoodsItemAssessmentContentInformation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessmentContentInformation) 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 FCFCDFBodyGoodsItemAssessmentContentInformation) 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 FCFCDFBodyGoodsItemAssessmentContentInformation Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemAssessmentContentInformation) 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 FCFCDFBodyGoodsItemAssessmentContentInformation Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemAssessmentContentInformation) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemAssessmentContentInformation 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemAssessmentContentInformation object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemAssessmentContentInformation 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemAssessmentContentInformation, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemAssessmentContentInformation) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemAssessmentContentInformation, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemAssessmentContentInformation) 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 FCFCDFBodyGoodsItemAssessmentContentInformation Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemAssessmentContentInformation 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, encoding) 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 FCFCDFBodyGoodsItemExciseDuty #Region "Private fields" Private _code As String Private _degreePercentage As Decimal Private _value As Decimal Private _amount As FCFCDFBodyGoodsItemExciseDutyAmount Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._amount = New FCFCDFBodyGoodsItemExciseDutyAmount() End Sub _ Public Property Code() As String Get Return Me._code End Get Set Me._code = value End Set End Property _ Public Property DegreePercentage() As Decimal Get Return Me._degreePercentage End Get Set Me._degreePercentage = value End Set End Property _ Public Property Value() As Decimal Get Return Me._value End Get Set Me._value = value End Set End Property _ Public Property Amount() As FCFCDFBodyGoodsItemExciseDutyAmount Get Return Me._amount End Get Set Me._amount = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemExciseDuty)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemExciseDuty object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemExciseDuty object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemExciseDuty 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 FCFCDFBodyGoodsItemExciseDuty, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemExciseDuty) 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 FCFCDFBodyGoodsItemExciseDuty) 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 FCFCDFBodyGoodsItemExciseDuty Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemExciseDuty) 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 FCFCDFBodyGoodsItemExciseDuty Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemExciseDuty) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemExciseDuty 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemExciseDuty object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemExciseDuty 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemExciseDuty, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemExciseDuty) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemExciseDuty, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemExciseDuty) 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 FCFCDFBodyGoodsItemExciseDuty Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemExciseDuty 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, encoding) 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 FCFCDFBodyGoodsItemExciseDutyAmount #Region "Private fields" Private _quantity As Decimal Private _measurementUnit As String Private _qualifier As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = value End Set End Property _ Public Property Qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemExciseDutyAmount)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemExciseDutyAmount object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemExciseDutyAmount object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemExciseDutyAmount 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 FCFCDFBodyGoodsItemExciseDutyAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemExciseDutyAmount) 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 FCFCDFBodyGoodsItemExciseDutyAmount) 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 FCFCDFBodyGoodsItemExciseDutyAmount Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemExciseDutyAmount) 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 FCFCDFBodyGoodsItemExciseDutyAmount Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemExciseDutyAmount) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemExciseDutyAmount 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemExciseDutyAmount object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemExciseDutyAmount 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemExciseDutyAmount, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemExciseDutyAmount) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemExciseDutyAmount, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemExciseDutyAmount) 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 FCFCDFBodyGoodsItemExciseDutyAmount Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemExciseDutyAmount 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, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatment #Region "Private fields" Private _requestedPreferentialTreatment As String Private _declaration As FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._declaration = New FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration() End Sub _ Public Property RequestedPreferentialTreatment() As String Get Return Me._requestedPreferentialTreatment End Get Set Me._requestedPreferentialTreatment = value End Set End Property _ Public Property Declaration() As FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration Get Return Me._declaration End Get Set Me._declaration = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemPreferentialTreatment)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemPreferentialTreatment object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemPreferentialTreatment object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatment 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 FCFCDFBodyGoodsItemPreferentialTreatment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatment) 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 FCFCDFBodyGoodsItemPreferentialTreatment) 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 FCFCDFBodyGoodsItemPreferentialTreatment Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemPreferentialTreatment) 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 FCFCDFBodyGoodsItemPreferentialTreatment Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemPreferentialTreatment) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemPreferentialTreatment 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatment object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatment 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatment, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatment) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatment, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatment) 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 FCFCDFBodyGoodsItemPreferentialTreatment Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemPreferentialTreatment 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, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration #Region "Private fields" Private _contingent As List(Of FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) Private _preferentialTreatmentQuantity As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._preferentialTreatmentQuantity = New FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity() Me._contingent = New List(Of FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent)() End Sub _ Public Property Contingent() As List(Of FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) Get Return Me._contingent End Get Set Me._contingent = value End Set End Property _ Public Property PreferentialTreatmentQuantity() As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity Get Return Me._preferentialTreatmentQuantity End Get Set Me._preferentialTreatmentQuantity = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemPreferentialTreatmentDeclaration 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, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent #Region "Private fields" Private _contingentNumber As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property ContingentNumber() As String Get Return Me._contingentNumber End Get Set Me._contingentNumber = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationContingent 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, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity #Region "Private fields" Private _quantity As String Private _measurementUnit As String Private _qualifier As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Quantity() As String Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = value End Set End Property _ Public Property Qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity) 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 FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemPreferentialTreatmentDeclarationPreferentialTreatmentQuantity 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, encoding) 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 FCFCDFBodyGoodsItemSpecialCase #Region "Private fields" Private _group As String Private _applicationType As String Private _rateOrAmountOrFactor As Decimal Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Group() As String Get Return Me._group End Get Set Me._group = value End Set End Property _ Public Property ApplicationType() As String Get Return Me._applicationType End Get Set Me._applicationType = value End Set End Property _ Public Property RateOrAmountOrFactor() As Decimal Get Return Me._rateOrAmountOrFactor End Get Set Me._rateOrAmountOrFactor = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemSpecialCase)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemSpecialCase object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemSpecialCase object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemSpecialCase 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 FCFCDFBodyGoodsItemSpecialCase, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemSpecialCase) 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 FCFCDFBodyGoodsItemSpecialCase) 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 FCFCDFBodyGoodsItemSpecialCase Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemSpecialCase) 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 FCFCDFBodyGoodsItemSpecialCase Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemSpecialCase) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemSpecialCase 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemSpecialCase object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemSpecialCase 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemSpecialCase, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemSpecialCase) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemSpecialCase, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemSpecialCase) 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 FCFCDFBodyGoodsItemSpecialCase Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemSpecialCase 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, encoding) 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 FCFCDFBodyGoodsItemDocument #Region "Private fields" Private _division As String Private _type As String Private _referenceNumber As String Private _issuingDate As Date Private _atHandFlag As String Private _writeOff As FCFCDFBodyGoodsItemDocumentWriteOff Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._writeOff = New FCFCDFBodyGoodsItemDocumentWriteOff() End Sub _ Public Property Division() As String Get Return Me._division End Get Set Me._division = 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 ReferenceNumber() As String Get Return Me._referenceNumber End Get Set Me._referenceNumber = value End Set End Property _ Public Property IssuingDate() As Date Get Return Me._issuingDate End Get Set Me._issuingDate = value End Set End Property _ Public Property AtHandFlag() As String Get Return Me._atHandFlag End Get Set Me._atHandFlag = value End Set End Property _ Public Property WriteOff() As FCFCDFBodyGoodsItemDocumentWriteOff Get Return Me._writeOff End Get Set Me._writeOff = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemDocument)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemDocument object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemDocument object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemDocument 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 FCFCDFBodyGoodsItemDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemDocument) 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 FCFCDFBodyGoodsItemDocument) 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 FCFCDFBodyGoodsItemDocument Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemDocument) 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 FCFCDFBodyGoodsItemDocument Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemDocument) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemDocument 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemDocument object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemDocument 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemDocument, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemDocument) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemDocument, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemDocument) 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 FCFCDFBodyGoodsItemDocument Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemDocument 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, encoding) 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 FCFCDFBodyGoodsItemDocumentWriteOff #Region "Private fields" Private _quantity As Decimal Private _measurementUnit As String Private _qualifier As String Private Shared _serializerXml As XmlSerializer #End Region _ Public Property Quantity() As Decimal Get Return Me._quantity End Get Set Me._quantity = value End Set End Property _ Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = value End Set End Property _ Public Property Qualifier() As String Get Return Me._qualifier End Get Set Me._qualifier = value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(FCFCDFBodyGoodsItemDocumentWriteOff)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize FCFCDFBodyGoodsItemDocumentWriteOff object ''' ''' XML value Public Overloads Overridable Function Serialize(ByVal encoding As System.Text.Encoding) 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.Encoding = encoding Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream, encoding) 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 Public Overloads Overridable Function Serialize() As String Return Serialize(System.Text.Encoding.UTF8) End Function ''' ''' Deserializes FCFCDFBodyGoodsItemDocumentWriteOff object ''' ''' string to deserialize ''' Output FCFCDFBodyGoodsItemDocumentWriteOff 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 FCFCDFBodyGoodsItemDocumentWriteOff, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemDocumentWriteOff) 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 FCFCDFBodyGoodsItemDocumentWriteOff) 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 FCFCDFBodyGoodsItemDocumentWriteOff Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)),FCFCDFBodyGoodsItemDocumentWriteOff) 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 FCFCDFBodyGoodsItemDocumentWriteOff Return CType(SerializerXml.Deserialize(s),FCFCDFBodyGoodsItemDocumentWriteOff) End Function #End Region ''' ''' Serializes current FCFCDFBodyGoodsItemDocumentWriteOff 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 Overloads Overridable Function SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName, encoding) Return true Catch e As System.Exception exception = e Return false End Try End Function Public Overloads Overridable Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean Return SaveToFile(fileName, System.Text.Encoding.UTF8, exception) End Function Public Overloads Overridable Sub SaveToFile(ByVal fileName As String) SaveToFile(fileName, System.Text.Encoding.UTF8) End Sub Public Overloads Overridable Sub SaveToFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim dataString As String = Serialize(encoding) streamWriter = New System.IO.StreamWriter(fileName, false, encoding) 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 FCFCDFBodyGoodsItemDocumentWriteOff object ''' ''' File to load and deserialize ''' Output FCFCDFBodyGoodsItemDocumentWriteOff 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, ByVal encoding As System.Text.Encoding, ByRef obj As FCFCDFBodyGoodsItemDocumentWriteOff, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, FCFCDFBodyGoodsItemDocumentWriteOff) Try obj = LoadFromFile(fileName, encoding) 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 FCFCDFBodyGoodsItemDocumentWriteOff, ByRef exception As System.Exception) As Boolean Return LoadFromFile(fileName, System.Text.Encoding.UTF8, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As FCFCDFBodyGoodsItemDocumentWriteOff) 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 FCFCDFBodyGoodsItemDocumentWriteOff Return LoadFromFile(fileName, System.Text.Encoding.UTF8) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByVal encoding As System.Text.Encoding) As FCFCDFBodyGoodsItemDocumentWriteOff 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, encoding) 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