'' ------------------------------------------------------------------------------ '' '' Generated by Xsd2Code++. Version 6.0.0.0. www.xsd2code.com '' {"TargetFramework":"Net47","NameSpace":"CBAM_QReport_17","Language":"VisualBasic","Properties":{},"XmlAttribute":{"Enabled":true},"ClassParams":{},"Serialization":{"ShouldSerialize":{},"AdditionalSerializers":{},"XmlSerializerEvent":{},"XmlOutput":{},"JsonOutput":{},"Enabled":true},"Miscellaneous":{}} '' '' ------------------------------------------------------------------------------ #Disable Warning Imports System Imports System.Diagnostics Imports System.Xml.Serialization Imports System.Runtime.Serialization Imports System.Collections Imports System.Xml.Schema Imports System.ComponentModel Imports System.Xml Imports System.IO Imports System.Text Imports System.Collections.Generic Namespace CBAM_QReport_17 Partial Public Class QReportType #Region "Private fields" Private _submissionDate As Date Private _draftReportId As String Private _reportId As String Private _reportingPeriod As String Private _year As Integer Private _totalImported As String Private _totalEmissions As Decimal Private _declarant As DeclarantType Private _representative As RepresentativeType Private _importer As ImporterType Private _nationalCompetentAuth As NationalCompetentAuthType Private _signatures As SignaturesType Private _remarks As RemarksType Private _importedGood As List(Of ImportedGoodType) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._importedGood = New List(Of ImportedGoodType)() Me._remarks = New RemarksType() Me._signatures = New SignaturesType() Me._nationalCompetentAuth = New NationalCompetentAuthType() Me._importer = New ImporterType() Me._representative = New RepresentativeType() Me._declarant = New DeclarantType() End Sub Public Property SubmissionDate() As Date Get Return Me._submissionDate End Get Set Me._submissionDate = Value End Set End Property Public Property DraftReportId() As String Get Return Me._draftReportId End Get Set Me._draftReportId = Value End Set End Property Public Property ReportId() As String Get Return Me._reportId End Get Set Me._reportId = Value End Set End Property Public Property ReportingPeriod() As String Get Return Me._reportingPeriod End Get Set Me._reportingPeriod = Value End Set End Property Public Property Year() As Integer Get Return Me._year End Get Set Me._year = Value End Set End Property Public Property TotalImported() As String Get Return Me._totalImported End Get Set Me._totalImported = Value End Set End Property Public Property TotalEmissions() As Decimal Get Return Me._totalEmissions End Get Set Me._totalEmissions = Value End Set End Property Public Property Declarant() As DeclarantType Get Return Me._declarant End Get Set Me._declarant = Value End Set End Property Public Property Representative() As RepresentativeType Get Return Me._representative End Get Set Me._representative = Value End Set End Property Public Property Importer() As ImporterType Get Return Me._importer End Get Set Me._importer = Value End Set End Property Public Property NationalCompetentAuth() As NationalCompetentAuthType Get Return Me._nationalCompetentAuth End Get Set Me._nationalCompetentAuth = Value End Set End Property Public Property Signatures() As SignaturesType Get Return Me._signatures End Get Set Me._signatures = Value End Set End Property Public Property Remarks() As RemarksType Get Return Me._remarks End Get Set Me._remarks = Value End Set End Property Public Property ImportedGood() As List(Of ImportedGoodType) Get Return Me._importedGood End Get Set Me._importedGood = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(QReportType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize QReportType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes QReportType object ''' ''' string to deserialize ''' Output QReportType 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 QReportType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, QReportType) 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 QReportType) 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 QReportType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), QReportType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As QReportType Return CType(SerializerXml.Deserialize(s), QReportType) End Function #End Region ''' ''' Serializes current QReportType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an QReportType object ''' ''' File to load and deserialize ''' Output QReportType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As QReportType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, QReportType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As QReportType) 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 QReportType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class DeclarantType #Region "Private fields" Private _identificationNumber As String Private _name As String Private _role As String Private _actorAddress As AddressType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._actorAddress = New AddressType() End Sub Public Property IdentificationNumber() As String Get Return Me._identificationNumber End Get Set Me._identificationNumber = 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 Role() As String Get Return Me._role End Get Set Me._role = Value End Set End Property Public Property ActorAddress() As AddressType Get Return Me._actorAddress End Get Set Me._actorAddress = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(DeclarantType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize DeclarantType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes DeclarantType object ''' ''' string to deserialize ''' Output DeclarantType 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 DeclarantType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, DeclarantType) 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 DeclarantType) 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 DeclarantType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), DeclarantType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As DeclarantType Return CType(SerializerXml.Deserialize(s), DeclarantType) End Function #End Region ''' ''' Serializes current DeclarantType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an DeclarantType object ''' ''' File to load and deserialize ''' Output DeclarantType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DeclarantType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, DeclarantType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DeclarantType) 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 DeclarantType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class AddressType #Region "Private fields" Private _country As String Private _subDivision As String Private _city As String Private _street As String Private _streetAdditionalLine As String Private _number As String Private _postcode As String Private _pOBox As String Private Shared _serializerXml As XmlSerializer #End Region Public Property Country() As String Get Return Me._country End Get Set Me._country = Value End Set End Property Public Property SubDivision() As String Get Return Me._subDivision End Get Set Me._subDivision = 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 Street() As String Get Return Me._street End Get Set Me._street = Value End Set End Property Public Property StreetAdditionalLine() As String Get Return Me._streetAdditionalLine End Get Set Me._streetAdditionalLine = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = Value End Set End Property Public Property POBox() As String Get Return Me._pOBox End Get Set Me._pOBox = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(AddressType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize AddressType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes AddressType object ''' ''' string to deserialize ''' Output AddressType 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 AddressType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, AddressType) 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 AddressType) 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 AddressType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), AddressType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As AddressType Return CType(SerializerXml.Deserialize(s), AddressType) End Function #End Region ''' ''' Serializes current AddressType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an AddressType object ''' ''' File to load and deserialize ''' Output AddressType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As AddressType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, AddressType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As AddressType) 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 AddressType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class RemarksEmissionsType #Region "Private fields" Private _sequenceNumber As String Private _additionalInformation 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 AdditionalInformation() As String Get Return Me._additionalInformation End Get Set Me._additionalInformation = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(RemarksEmissionsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize RemarksEmissionsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes RemarksEmissionsType object ''' ''' string to deserialize ''' Output RemarksEmissionsType 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 RemarksEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, RemarksEmissionsType) 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 RemarksEmissionsType) 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 RemarksEmissionsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), RemarksEmissionsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As RemarksEmissionsType Return CType(SerializerXml.Deserialize(s), RemarksEmissionsType) End Function #End Region ''' ''' Serializes current RemarksEmissionsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an RemarksEmissionsType object ''' ''' File to load and deserialize ''' Output RemarksEmissionsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As RemarksEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, RemarksEmissionsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As RemarksEmissionsType) 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 RemarksEmissionsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ProductsCoveredType #Region "Private fields" Private _sequenceNumber As String Private _type As String Private _cn As String Private _quantityCovered As Decimal Private _quantityCoveredFreeAloc As Decimal Private _supplementaryInformation As String Private _additionalInformation As String Private _measure As MeasureType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._measure = New MeasureType() End Sub Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = 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 CN() As String Get Return Me._cn End Get Set Me._cn = Value End Set End Property Public Property QuantityCovered() As Decimal Get Return Me._quantityCovered End Get Set Me._quantityCovered = Value End Set End Property Public Property QuantityCoveredFreeAloc() As Decimal Get Return Me._quantityCoveredFreeAloc End Get Set Me._quantityCoveredFreeAloc = 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 AdditionalInformation() As String Get Return Me._additionalInformation End Get Set Me._additionalInformation = Value End Set End Property Public Property Measure() As MeasureType Get Return Me._measure End Get Set Me._measure = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ProductsCoveredType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ProductsCoveredType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ProductsCoveredType object ''' ''' string to deserialize ''' Output ProductsCoveredType 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 ProductsCoveredType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ProductsCoveredType) 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 ProductsCoveredType) 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 ProductsCoveredType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ProductsCoveredType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ProductsCoveredType Return CType(SerializerXml.Deserialize(s), ProductsCoveredType) End Function #End Region ''' ''' Serializes current ProductsCoveredType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ProductsCoveredType object ''' ''' File to load and deserialize ''' Output ProductsCoveredType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ProductsCoveredType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ProductsCoveredType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ProductsCoveredType) 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 ProductsCoveredType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class MeasureType #Region "Private fields" Private _netMass As Decimal Private _supplementaryUnits As Decimal Private _measurementUnit As String Private Shared _serializerXml As XmlSerializer #End Region Public Property NetMass() As Decimal Get Return Me._netMass End Get Set Me._netMass = Value End Set End Property Public Property SupplementaryUnits() As Decimal Get Return Me._supplementaryUnits End Get Set Me._supplementaryUnits = Value End Set End Property Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(MeasureType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize MeasureType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes MeasureType object ''' ''' string to deserialize ''' Output MeasureType 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 MeasureType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, MeasureType) 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 MeasureType) 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 MeasureType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), MeasureType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As MeasureType Return CType(SerializerXml.Deserialize(s), MeasureType) End Function #End Region ''' ''' Serializes current MeasureType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an MeasureType object ''' ''' File to load and deserialize ''' Output MeasureType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As MeasureType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, MeasureType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As MeasureType) 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 MeasureType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class CarbonPriceDueType #Region "Private fields" Private _sequenceNumber As String Private _instrumentType As String Private _legalActDescription As String Private _amount As Decimal Private _currency As String Private _exchangeRate As String Private _eURO As Decimal Private _country As String Private _productsCovered As List(Of ProductsCoveredType) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._productsCovered = New List(Of ProductsCoveredType)() End Sub Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = Value End Set End Property Public Property InstrumentType() As String Get Return Me._instrumentType End Get Set Me._instrumentType = Value End Set End Property Public Property LegalActDescription() As String Get Return Me._legalActDescription End Get Set Me._legalActDescription = Value End Set End Property Public Property Amount() As Decimal Get Return Me._amount End Get Set Me._amount = Value End Set End Property Public Property Currency() As String Get Return Me._currency End Get Set Me._currency = Value End Set End Property Public Property ExchangeRate() As String Get Return Me._exchangeRate End Get Set Me._exchangeRate = Value End Set End Property Public Property EURO() As Decimal Get Return Me._eURO End Get Set Me._eURO = 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 ProductsCovered() As List(Of ProductsCoveredType) Get Return Me._productsCovered End Get Set Me._productsCovered = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(CarbonPriceDueType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize CarbonPriceDueType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes CarbonPriceDueType object ''' ''' string to deserialize ''' Output CarbonPriceDueType 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 CarbonPriceDueType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, CarbonPriceDueType) 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 CarbonPriceDueType) 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 CarbonPriceDueType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), CarbonPriceDueType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As CarbonPriceDueType Return CType(SerializerXml.Deserialize(s), CarbonPriceDueType) End Function #End Region ''' ''' Serializes current CarbonPriceDueType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an CarbonPriceDueType object ''' ''' File to load and deserialize ''' Output CarbonPriceDueType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As CarbonPriceDueType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, CarbonPriceDueType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As CarbonPriceDueType) 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 CarbonPriceDueType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class QualifyingParametersType #Region "Private fields" Private _sequenceNumber As String Private _determinationType As String Private _parameterId As String Private _parameterName As String Private _description As String Private _parameterValueType As String Private _parameterValue As String Private _additionalInformation 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 DeterminationType() As String Get Return Me._determinationType End Get Set Me._determinationType = Value End Set End Property Public Property ParameterId() As String Get Return Me._parameterId End Get Set Me._parameterId = Value End Set End Property Public Property ParameterName() As String Get Return Me._parameterName End Get Set Me._parameterName = 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 ParameterValueType() As String Get Return Me._parameterValueType End Get Set Me._parameterValueType = Value End Set End Property Public Property ParameterValue() As String Get Return Me._parameterValue End Get Set Me._parameterValue = Value End Set End Property Public Property AdditionalInformation() As String Get Return Me._additionalInformation End Get Set Me._additionalInformation = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(QualifyingParametersType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize QualifyingParametersType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes QualifyingParametersType object ''' ''' string to deserialize ''' Output QualifyingParametersType 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 QualifyingParametersType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, QualifyingParametersType) 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 QualifyingParametersType) 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 QualifyingParametersType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), QualifyingParametersType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As QualifyingParametersType Return CType(SerializerXml.Deserialize(s), QualifyingParametersType) End Function #End Region ''' ''' Serializes current QualifyingParametersType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an QualifyingParametersType object ''' ''' File to load and deserialize ''' Output QualifyingParametersType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As QualifyingParametersType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, QualifyingParametersType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As QualifyingParametersType) 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 QualifyingParametersType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ProdMethodQualifyingParamsType #Region "Private fields" Private _sequenceNumber As String Private _methodId As String Private _methodName As String Private _steelMillNumber As String Private _additionalInformation As String Private _directQualifyingParameters As List(Of QualifyingParametersType) Private _indirectQualifyingParameters As List(Of QualifyingParametersType) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._indirectQualifyingParameters = New List(Of QualifyingParametersType)() Me._directQualifyingParameters = New List(Of QualifyingParametersType)() End Sub Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = Value End Set End Property Public Property MethodId() As String Get Return Me._methodId End Get Set Me._methodId = Value End Set End Property Public Property MethodName() As String Get Return Me._methodName End Get Set Me._methodName = Value End Set End Property Public Property SteelMillNumber() As String Get Return Me._steelMillNumber End Get Set Me._steelMillNumber = 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 DirectQualifyingParameters() As List(Of QualifyingParametersType) Get Return Me._directQualifyingParameters End Get Set Me._directQualifyingParameters = Value End Set End Property Public Property IndirectQualifyingParameters() As List(Of QualifyingParametersType) Get Return Me._indirectQualifyingParameters End Get Set Me._indirectQualifyingParameters = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ProdMethodQualifyingParamsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ProdMethodQualifyingParamsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ProdMethodQualifyingParamsType object ''' ''' string to deserialize ''' Output ProdMethodQualifyingParamsType 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 ProdMethodQualifyingParamsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ProdMethodQualifyingParamsType) 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 ProdMethodQualifyingParamsType) 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 ProdMethodQualifyingParamsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ProdMethodQualifyingParamsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ProdMethodQualifyingParamsType Return CType(SerializerXml.Deserialize(s), ProdMethodQualifyingParamsType) End Function #End Region ''' ''' Serializes current ProdMethodQualifyingParamsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ProdMethodQualifyingParamsType object ''' ''' File to load and deserialize ''' Output ProdMethodQualifyingParamsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ProdMethodQualifyingParamsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ProdMethodQualifyingParamsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ProdMethodQualifyingParamsType) 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 ProdMethodQualifyingParamsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class IndirectEmissionsType #Region "Private fields" Private _determinationType As String Private _emissionFactorSource As String Private _emissionFactor As Decimal Private _specificEmbeddedEmissions As Decimal Private _measurementUnit As String Private _electricityConsumed As Decimal Private _electricitySource As String Private _otherSourceIndication As String Private _emissionFactorSourceValue As String Private Shared _serializerXml As XmlSerializer #End Region Public Property DeterminationType() As String Get Return Me._determinationType End Get Set Me._determinationType = Value End Set End Property Public Property EmissionFactorSource() As String Get Return Me._emissionFactorSource End Get Set Me._emissionFactorSource = Value End Set End Property Public Property EmissionFactor() As Decimal Get Return Me._emissionFactor End Get Set Me._emissionFactor = Value End Set End Property Public Property SpecificEmbeddedEmissions() As Decimal Get Return Me._specificEmbeddedEmissions End Get Set Me._specificEmbeddedEmissions = 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 ElectricityConsumed() As Decimal Get Return Me._electricityConsumed End Get Set Me._electricityConsumed = Value End Set End Property Public Property ElectricitySource() As String Get Return Me._electricitySource End Get Set Me._electricitySource = Value End Set End Property Public Property OtherSourceIndication() As String Get Return Me._otherSourceIndication End Get Set Me._otherSourceIndication = Value End Set End Property Public Property EmissionFactorSourceValue() As String Get Return Me._emissionFactorSourceValue End Get Set Me._emissionFactorSourceValue = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(IndirectEmissionsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize IndirectEmissionsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes IndirectEmissionsType object ''' ''' string to deserialize ''' Output IndirectEmissionsType 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 IndirectEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, IndirectEmissionsType) 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 IndirectEmissionsType) 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 IndirectEmissionsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), IndirectEmissionsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As IndirectEmissionsType Return CType(SerializerXml.Deserialize(s), IndirectEmissionsType) End Function #End Region ''' ''' Serializes current IndirectEmissionsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an IndirectEmissionsType object ''' ''' File to load and deserialize ''' Output IndirectEmissionsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As IndirectEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, IndirectEmissionsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As IndirectEmissionsType) 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 IndirectEmissionsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class DirectEmissionsType #Region "Private fields" Private _determinationType As String Private _determinationTypeElectricity As String Private _applicableReportingTypeMethodology As String Private _applicableReportingMethodology As String Private _specificEmbeddedEmissions As Decimal Private _otherSourceIndication As String Private _emissionFactorSourceElectricity As String Private _emissionFactor As Decimal Private _electricityImported As Decimal Private _totalEmbeddedElectricityImported As Decimal Private _measurementUnit As String Private _emissionFactorSourceValue As String Private _justification As String Private _conditionalityFulfillment As String Private Shared _serializerXml As XmlSerializer #End Region Public Property DeterminationType() As String Get Return Me._determinationType End Get Set Me._determinationType = Value End Set End Property Public Property DeterminationTypeElectricity() As String Get Return Me._determinationTypeElectricity End Get Set Me._determinationTypeElectricity = Value End Set End Property Public Property ApplicableReportingTypeMethodology() As String Get Return Me._applicableReportingTypeMethodology End Get Set Me._applicableReportingTypeMethodology = Value End Set End Property Public Property ApplicableReportingMethodology() As String Get Return Me._applicableReportingMethodology End Get Set Me._applicableReportingMethodology = Value End Set End Property Public Property SpecificEmbeddedEmissions() As Decimal Get Return Me._specificEmbeddedEmissions End Get Set Me._specificEmbeddedEmissions = Value End Set End Property Public Property OtherSourceIndication() As String Get Return Me._otherSourceIndication End Get Set Me._otherSourceIndication = Value End Set End Property Public Property EmissionFactorSourceElectricity() As String Get Return Me._emissionFactorSourceElectricity End Get Set Me._emissionFactorSourceElectricity = Value End Set End Property Public Property EmissionFactor() As Decimal Get Return Me._emissionFactor End Get Set Me._emissionFactor = Value End Set End Property Public Property ElectricityImported() As Decimal Get Return Me._electricityImported End Get Set Me._electricityImported = Value End Set End Property Public Property TotalEmbeddedElectricityImported() As Decimal Get Return Me._totalEmbeddedElectricityImported End Get Set Me._totalEmbeddedElectricityImported = 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 EmissionFactorSourceValue() As String Get Return Me._emissionFactorSourceValue End Get Set Me._emissionFactorSourceValue = Value End Set End Property Public Property Justification() As String Get Return Me._justification End Get Set Me._justification = Value End Set End Property Public Property ConditionalityFulfillment() As String Get Return Me._conditionalityFulfillment End Get Set Me._conditionalityFulfillment = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(DirectEmissionsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize DirectEmissionsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes DirectEmissionsType object ''' ''' string to deserialize ''' Output DirectEmissionsType 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 DirectEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, DirectEmissionsType) 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 DirectEmissionsType) 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 DirectEmissionsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), DirectEmissionsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As DirectEmissionsType Return CType(SerializerXml.Deserialize(s), DirectEmissionsType) End Function #End Region ''' ''' Serializes current DirectEmissionsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an DirectEmissionsType object ''' ''' File to load and deserialize ''' Output DirectEmissionsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DirectEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, DirectEmissionsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DirectEmissionsType) 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 DirectEmissionsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class InstallationEmissionsType #Region "Private fields" Private _overallEmissions As Decimal Private _totalDirect As Decimal Private _totalIndirect As Decimal Private _measurementUnit As String Private Shared _serializerXml As XmlSerializer #End Region Public Property OverallEmissions() As Decimal Get Return Me._overallEmissions End Get Set Me._overallEmissions = Value End Set End Property Public Property TotalDirect() As Decimal Get Return Me._totalDirect End Get Set Me._totalDirect = Value End Set End Property Public Property TotalIndirect() As Decimal Get Return Me._totalIndirect End Get Set Me._totalIndirect = Value End Set End Property Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(InstallationEmissionsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize InstallationEmissionsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes InstallationEmissionsType object ''' ''' string to deserialize ''' Output InstallationEmissionsType 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 InstallationEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationEmissionsType) 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 InstallationEmissionsType) 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 InstallationEmissionsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), InstallationEmissionsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As InstallationEmissionsType Return CType(SerializerXml.Deserialize(s), InstallationEmissionsType) End Function #End Region ''' ''' Serializes current InstallationEmissionsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an InstallationEmissionsType object ''' ''' File to load and deserialize ''' Output InstallationEmissionsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationEmissionsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationEmissionsType) 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 InstallationEmissionsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class InstallationAddressType #Region "Private fields" Private _establishmentCountry As String Private _subDivision As String Private _city As String Private _street As String Private _streetAdditionalLine As String Private _number As String Private _postcode As String Private _pOBox As String Private _plotParcelNumber As String Private _uNLOCODE As String Private _latitude As String Private _longitude As String Private _coordinatesType As String Private Shared _serializerXml As XmlSerializer #End Region Public Property EstablishmentCountry() As String Get Return Me._establishmentCountry End Get Set Me._establishmentCountry = Value End Set End Property Public Property SubDivision() As String Get Return Me._subDivision End Get Set Me._subDivision = 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 Street() As String Get Return Me._street End Get Set Me._street = Value End Set End Property Public Property StreetAdditionalLine() As String Get Return Me._streetAdditionalLine End Get Set Me._streetAdditionalLine = 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 Postcode() As String Get Return Me._postcode End Get Set Me._postcode = Value End Set End Property Public Property POBox() As String Get Return Me._pOBox End Get Set Me._pOBox = Value End Set End Property Public Property PlotParcelNumber() As String Get Return Me._plotParcelNumber End Get Set Me._plotParcelNumber = Value End Set End Property Public Property UNLOCODE() As String Get Return Me._uNLOCODE End Get Set Me._uNLOCODE = Value End Set End Property Public Property Latitude() As String Get Return Me._latitude End Get Set Me._latitude = Value End Set End Property Public Property Longitude() As String Get Return Me._longitude End Get Set Me._longitude = Value End Set End Property Public Property CoordinatesType() As String Get Return Me._coordinatesType End Get Set Me._coordinatesType = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(InstallationAddressType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize InstallationAddressType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes InstallationAddressType object ''' ''' string to deserialize ''' Output InstallationAddressType 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 InstallationAddressType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationAddressType) 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 InstallationAddressType) 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 InstallationAddressType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), InstallationAddressType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As InstallationAddressType Return CType(SerializerXml.Deserialize(s), InstallationAddressType) End Function #End Region ''' ''' Serializes current InstallationAddressType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an InstallationAddressType object ''' ''' File to load and deserialize ''' Output InstallationAddressType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationAddressType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationAddressType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationAddressType) 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 InstallationAddressType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class InstallationType #Region "Private fields" Private _installationId As String Private _installationName As String Private _economicActivity As String Private _address As InstallationAddressType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._address = New InstallationAddressType() End Sub Public Property InstallationId() As String Get Return Me._installationId End Get Set Me._installationId = Value End Set End Property Public Property InstallationName() As String Get Return Me._installationName End Get Set Me._installationName = Value End Set End Property Public Property EconomicActivity() As String Get Return Me._economicActivity End Get Set Me._economicActivity = Value End Set End Property Public Property Address() As InstallationAddressType 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(InstallationType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize InstallationType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes InstallationType object ''' ''' string to deserialize ''' Output InstallationType 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 InstallationType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationType) 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 InstallationType) 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 InstallationType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), InstallationType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As InstallationType Return CType(SerializerXml.Deserialize(s), InstallationType) End Function #End Region ''' ''' Serializes current InstallationType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an InstallationType object ''' ''' File to load and deserialize ''' Output InstallationType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationType) 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 InstallationType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ContactDetailsType #Region "Private fields" Private _name As String Private _phone As String Private _email 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 Phone() As String Get Return Me._phone End Get Set Me._phone = Value End Set End Property Public Property Email() As String Get Return Me._email End Get Set Me._email = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ContactDetailsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ContactDetailsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ContactDetailsType object ''' ''' string to deserialize ''' Output ContactDetailsType 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 ContactDetailsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ContactDetailsType) 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 ContactDetailsType) 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 ContactDetailsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ContactDetailsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ContactDetailsType Return CType(SerializerXml.Deserialize(s), ContactDetailsType) End Function #End Region ''' ''' Serializes current ContactDetailsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ContactDetailsType object ''' ''' File to load and deserialize ''' Output ContactDetailsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ContactDetailsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ContactDetailsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ContactDetailsType) 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 ContactDetailsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class InstallationOperatorType #Region "Private fields" Private _operatorId As String Private _operatorName As String Private _operatorAddress As AddressType Private _contactDetails As List(Of ContactDetailsType) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._contactDetails = New List(Of ContactDetailsType)() Me._operatorAddress = New AddressType() End Sub Public Property OperatorId() As String Get Return Me._operatorId End Get Set Me._operatorId = Value End Set End Property Public Property OperatorName() As String Get Return Me._operatorName End Get Set Me._operatorName = Value End Set End Property Public Property OperatorAddress() As AddressType Get Return Me._operatorAddress End Get Set Me._operatorAddress = Value End Set End Property Public Property ContactDetails() As List(Of ContactDetailsType) Get Return Me._contactDetails End Get Set Me._contactDetails = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(InstallationOperatorType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize InstallationOperatorType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes InstallationOperatorType object ''' ''' string to deserialize ''' Output InstallationOperatorType 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 InstallationOperatorType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationOperatorType) 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 InstallationOperatorType) 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 InstallationOperatorType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), InstallationOperatorType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As InstallationOperatorType Return CType(SerializerXml.Deserialize(s), InstallationOperatorType) End Function #End Region ''' ''' Serializes current InstallationOperatorType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an InstallationOperatorType object ''' ''' File to load and deserialize ''' Output InstallationOperatorType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationOperatorType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InstallationOperatorType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InstallationOperatorType) 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 InstallationOperatorType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class GoodsEmissionsType #Region "Private fields" Private _sequenceNumber As String Private _productionCountry As String Private _installationOperator As InstallationOperatorType Private _installation As InstallationType Private _producedMeasure As MeasureType Private _installationEmissions As InstallationEmissionsType Private _directEmissions As DirectEmissionsType Private _indirectEmissions As IndirectEmissionsType Private _prodMethodQualifyingParams As List(Of ProdMethodQualifyingParamsType) Private _supportingDocuments As List(Of SupportingDocumentsType) Private _carbonPriceDue As List(Of CarbonPriceDueType) Private _remarksEmissions As List(Of RemarksEmissionsType) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._remarksEmissions = New List(Of RemarksEmissionsType)() Me._carbonPriceDue = New List(Of CarbonPriceDueType)() Me._supportingDocuments = New List(Of SupportingDocumentsType)() Me._prodMethodQualifyingParams = New List(Of ProdMethodQualifyingParamsType)() Me._indirectEmissions = New IndirectEmissionsType() Me._directEmissions = New DirectEmissionsType() Me._installationEmissions = New InstallationEmissionsType() Me._producedMeasure = New MeasureType() Me._installation = New InstallationType() Me._installationOperator = New InstallationOperatorType() End Sub Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = Value End Set End Property Public Property ProductionCountry() As String Get Return Me._productionCountry End Get Set Me._productionCountry = Value End Set End Property Public Property InstallationOperator() As InstallationOperatorType Get Return Me._installationOperator End Get Set Me._installationOperator = Value End Set End Property Public Property Installation() As InstallationType Get Return Me._installation End Get Set Me._installation = Value End Set End Property Public Property ProducedMeasure() As MeasureType Get Return Me._producedMeasure End Get Set Me._producedMeasure = Value End Set End Property Public Property InstallationEmissions() As InstallationEmissionsType Get Return Me._installationEmissions End Get Set Me._installationEmissions = Value End Set End Property Public Property DirectEmissions() As DirectEmissionsType Get Return Me._directEmissions End Get Set Me._directEmissions = Value End Set End Property Public Property IndirectEmissions() As IndirectEmissionsType Get Return Me._indirectEmissions End Get Set Me._indirectEmissions = Value End Set End Property Public Property ProdMethodQualifyingParams() As List(Of ProdMethodQualifyingParamsType) Get Return Me._prodMethodQualifyingParams End Get Set Me._prodMethodQualifyingParams = Value End Set End Property Public Property SupportingDocuments() As List(Of SupportingDocumentsType) Get Return Me._supportingDocuments End Get Set Me._supportingDocuments = Value End Set End Property Public Property CarbonPriceDue() As List(Of CarbonPriceDueType) Get Return Me._carbonPriceDue End Get Set Me._carbonPriceDue = Value End Set End Property Public Property RemarksEmissions() As List(Of RemarksEmissionsType) Get Return Me._remarksEmissions End Get Set Me._remarksEmissions = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(GoodsEmissionsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize GoodsEmissionsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes GoodsEmissionsType object ''' ''' string to deserialize ''' Output GoodsEmissionsType 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 GoodsEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, GoodsEmissionsType) 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 GoodsEmissionsType) 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 GoodsEmissionsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), GoodsEmissionsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As GoodsEmissionsType Return CType(SerializerXml.Deserialize(s), GoodsEmissionsType) End Function #End Region ''' ''' Serializes current GoodsEmissionsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an GoodsEmissionsType object ''' ''' File to load and deserialize ''' Output GoodsEmissionsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As GoodsEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, GoodsEmissionsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As GoodsEmissionsType) 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 GoodsEmissionsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class SupportingDocumentsType #Region "Private fields" Private _sequenceNumber As String Private _type As String Private _country As String Private _referenceNumber As String Private _lineItemNumber As String Private _issuingAuthName As String Private _validityStartDate As Date Private _validityEndDate As Date Private _description As String Private _attachment As AttachmentType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._attachment = New AttachmentType() End Sub Public Property SequenceNumber() As String Get Return Me._sequenceNumber End Get Set Me._sequenceNumber = 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 Country() As String Get Return Me._country End Get Set Me._country = 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 LineItemNumber() As String Get Return Me._lineItemNumber End Get Set Me._lineItemNumber = Value End Set End Property Public Property IssuingAuthName() As String Get Return Me._issuingAuthName End Get Set Me._issuingAuthName = Value End Set End Property Public Property ValidityStartDate() As Date Get Return Me._validityStartDate End Get Set Me._validityStartDate = Value End Set End Property Public Property ValidityEndDate() As Date Get Return Me._validityEndDate End Get Set Me._validityEndDate = 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 Attachment() As AttachmentType Get Return Me._attachment End Get Set Me._attachment = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(SupportingDocumentsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize SupportingDocumentsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes SupportingDocumentsType object ''' ''' string to deserialize ''' Output SupportingDocumentsType 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 SupportingDocumentsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, SupportingDocumentsType) 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 SupportingDocumentsType) 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 SupportingDocumentsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), SupportingDocumentsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As SupportingDocumentsType Return CType(SerializerXml.Deserialize(s), SupportingDocumentsType) End Function #End Region ''' ''' Serializes current SupportingDocumentsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an SupportingDocumentsType object ''' ''' File to load and deserialize ''' Output SupportingDocumentsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As SupportingDocumentsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, SupportingDocumentsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As SupportingDocumentsType) 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 SupportingDocumentsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class AttachmentType #Region "Private fields" Private _filename As String Private _uRI As String Private _mIME As String Private _binary() As Byte Private Shared _serializerXml As XmlSerializer #End Region Public Property Filename() As String Get Return Me._filename End Get Set Me._filename = Value End Set End Property Public Property URI() As String Get Return Me._uRI End Get Set Me._uRI = Value End Set End Property Public Property MIME() As String Get Return Me._mIME End Get Set Me._mIME = Value End Set End Property Public Property Binary() As Byte() Get Return Me._binary End Get Set Me._binary = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(AttachmentType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize AttachmentType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes AttachmentType object ''' ''' string to deserialize ''' Output AttachmentType 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 AttachmentType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, AttachmentType) 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 AttachmentType) 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 AttachmentType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), AttachmentType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As AttachmentType Return CType(SerializerXml.Deserialize(s), AttachmentType) End Function #End Region ''' ''' Serializes current AttachmentType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an AttachmentType object ''' ''' File to load and deserialize ''' Output AttachmentType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As AttachmentType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, AttachmentType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As AttachmentType) 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 AttachmentType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class TotalEmissionsType #Region "Private fields" Private _emissionsPerUnit As Decimal Private _overallEmissions As Decimal Private _totalDirect As Decimal Private _totalIndirect As Decimal Private _measurementUnit As String Private Shared _serializerXml As XmlSerializer #End Region Public Property EmissionsPerUnit() As Decimal Get Return Me._emissionsPerUnit End Get Set Me._emissionsPerUnit = Value End Set End Property Public Property OverallEmissions() As Decimal Get Return Me._overallEmissions End Get Set Me._overallEmissions = Value End Set End Property Public Property TotalDirect() As Decimal Get Return Me._totalDirect End Get Set Me._totalDirect = Value End Set End Property Public Property TotalIndirect() As Decimal Get Return Me._totalIndirect End Get Set Me._totalIndirect = Value End Set End Property Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(TotalEmissionsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize TotalEmissionsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes TotalEmissionsType object ''' ''' string to deserialize ''' Output TotalEmissionsType 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 TotalEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TotalEmissionsType) 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 TotalEmissionsType) 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 TotalEmissionsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), TotalEmissionsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As TotalEmissionsType Return CType(SerializerXml.Deserialize(s), TotalEmissionsType) End Function #End Region ''' ''' Serializes current TotalEmissionsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an TotalEmissionsType object ''' ''' File to load and deserialize ''' Output TotalEmissionsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TotalEmissionsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TotalEmissionsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TotalEmissionsType) 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 TotalEmissionsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class SpecialReferencesType #Region "Private fields" Private _additionalInformation As String Private Shared _serializerXml As XmlSerializer #End Region Public Property AdditionalInformation() As String Get Return Me._additionalInformation End Get Set Me._additionalInformation = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(SpecialReferencesType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize SpecialReferencesType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes SpecialReferencesType object ''' ''' string to deserialize ''' Output SpecialReferencesType 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 SpecialReferencesType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, SpecialReferencesType) 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 SpecialReferencesType) 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 SpecialReferencesType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), SpecialReferencesType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As SpecialReferencesType Return CType(SerializerXml.Deserialize(s), SpecialReferencesType) End Function #End Region ''' ''' Serializes current SpecialReferencesType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an SpecialReferencesType object ''' ''' File to load and deserialize ''' Output SpecialReferencesType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As SpecialReferencesType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, SpecialReferencesType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As SpecialReferencesType) 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 SpecialReferencesType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class MeasureProcedureType #Region "Private fields" Private _indicator As Integer Private _netMass As Decimal Private _supplementaryUnits As Decimal Private _measurementUnit As String Private Shared _serializerXml As XmlSerializer #End Region Public Property Indicator() As Integer Get Return Me._indicator End Get Set Me._indicator = Value End Set End Property Public Property NetMass() As Decimal Get Return Me._netMass End Get Set Me._netMass = Value End Set End Property Public Property SupplementaryUnits() As Decimal Get Return Me._supplementaryUnits End Get Set Me._supplementaryUnits = Value End Set End Property Public Property MeasurementUnit() As String Get Return Me._measurementUnit End Get Set Me._measurementUnit = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(MeasureProcedureType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize MeasureProcedureType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes MeasureProcedureType object ''' ''' string to deserialize ''' Output MeasureProcedureType 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 MeasureProcedureType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, MeasureProcedureType) 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 MeasureProcedureType) 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 MeasureProcedureType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), MeasureProcedureType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As MeasureProcedureType Return CType(SerializerXml.Deserialize(s), MeasureProcedureType) End Function #End Region ''' ''' Serializes current MeasureProcedureType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an MeasureProcedureType object ''' ''' File to load and deserialize ''' Output MeasureProcedureType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As MeasureProcedureType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, MeasureProcedureType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As MeasureProcedureType) 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 MeasureProcedureType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ImportAreaType #Region "Private fields" Private _importArea As String Private Shared _serializerXml As XmlSerializer #End Region Public Property ImportArea() As String Get Return Me._importArea End Get Set Me._importArea = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ImportAreaType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ImportAreaType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ImportAreaType object ''' ''' string to deserialize ''' Output ImportAreaType 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 ImportAreaType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImportAreaType) 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 ImportAreaType) 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 ImportAreaType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ImportAreaType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ImportAreaType Return CType(SerializerXml.Deserialize(s), ImportAreaType) End Function #End Region ''' ''' Serializes current ImportAreaType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ImportAreaType object ''' ''' File to load and deserialize ''' Output ImportAreaType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportAreaType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImportAreaType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportAreaType) 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 ImportAreaType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class InwardProcessingInfoType #Region "Private fields" Private _memberStateAuth As String Private _dischargeBillWaiver As Integer Private _authorisation As String Private _startTime As Integer Private _endTime As Integer Private _deadline As Integer Private Shared _serializerXml As XmlSerializer #End Region Public Property MemberStateAuth() As String Get Return Me._memberStateAuth End Get Set Me._memberStateAuth = Value End Set End Property Public Property DischargeBillWaiver() As Integer Get Return Me._dischargeBillWaiver End Get Set Me._dischargeBillWaiver = Value End Set End Property Public Property Authorisation() As String Get Return Me._authorisation End Get Set Me._authorisation = Value End Set End Property Public Property StartTime() As Integer Get Return Me._startTime End Get Set Me._startTime = Value End Set End Property Public Property EndTime() As Integer Get Return Me._endTime End Get Set Me._endTime = Value End Set End Property Public Property Deadline() As Integer Get Return Me._deadline End Get Set Me._deadline = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(InwardProcessingInfoType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize InwardProcessingInfoType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes InwardProcessingInfoType object ''' ''' string to deserialize ''' Output InwardProcessingInfoType 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 InwardProcessingInfoType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InwardProcessingInfoType) 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 InwardProcessingInfoType) 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 InwardProcessingInfoType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), InwardProcessingInfoType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As InwardProcessingInfoType Return CType(SerializerXml.Deserialize(s), InwardProcessingInfoType) End Function #End Region ''' ''' Serializes current InwardProcessingInfoType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an InwardProcessingInfoType object ''' ''' File to load and deserialize ''' Output InwardProcessingInfoType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InwardProcessingInfoType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, InwardProcessingInfoType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As InwardProcessingInfoType) 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 InwardProcessingInfoType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ProcedureType #Region "Private fields" Private _requestedProc As String Private _previousProc As String Private _inwardProcessingInfo As List(Of InwardProcessingInfoType) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._inwardProcessingInfo = New List(Of InwardProcessingInfoType)() End Sub Public Property RequestedProc() As String Get Return Me._requestedProc End Get Set Me._requestedProc = Value End Set End Property Public Property PreviousProc() As String Get Return Me._previousProc End Get Set Me._previousProc = Value End Set End Property Public Property InwardProcessingInfo() As List(Of InwardProcessingInfoType) Get Return Me._inwardProcessingInfo End Get Set Me._inwardProcessingInfo = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ProcedureType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ProcedureType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ProcedureType object ''' ''' string to deserialize ''' Output ProcedureType 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 ProcedureType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ProcedureType) 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 ProcedureType) 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 ProcedureType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ProcedureType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ProcedureType Return CType(SerializerXml.Deserialize(s), ProcedureType) End Function #End Region ''' ''' Serializes current ProcedureType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ProcedureType object ''' ''' File to load and deserialize ''' Output ProcedureType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ProcedureType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ProcedureType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ProcedureType) 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 ProcedureType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ImportedQuantityType #Region "Private fields" Private _sequenceNumber As String Private _procedure As ProcedureType Private _importArea As ImportAreaType Private _measureProcedureImported As List(Of MeasureProcedureType) Private _specialReferences As SpecialReferencesType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._specialReferences = New SpecialReferencesType() Me._measureProcedureImported = New List(Of MeasureProcedureType)() Me._importArea = New ImportAreaType() Me._procedure = New ProcedureType() 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 ProcedureType Get Return Me._procedure End Get Set Me._procedure = Value End Set End Property Public Property ImportArea() As ImportAreaType Get Return Me._importArea End Get Set Me._importArea = Value End Set End Property Public Property MeasureProcedureImported() As List(Of MeasureProcedureType) Get Return Me._measureProcedureImported End Get Set Me._measureProcedureImported = Value End Set End Property Public Property SpecialReferences() As SpecialReferencesType Get Return Me._specialReferences End Get Set Me._specialReferences = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ImportedQuantityType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ImportedQuantityType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ImportedQuantityType object ''' ''' string to deserialize ''' Output ImportedQuantityType 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 ImportedQuantityType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImportedQuantityType) 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 ImportedQuantityType) 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 ImportedQuantityType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ImportedQuantityType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ImportedQuantityType Return CType(SerializerXml.Deserialize(s), ImportedQuantityType) End Function #End Region ''' ''' Serializes current ImportedQuantityType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ImportedQuantityType object ''' ''' File to load and deserialize ''' Output ImportedQuantityType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportedQuantityType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImportedQuantityType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportedQuantityType) 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 ImportedQuantityType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class OriginCountryType #Region "Private fields" Private _country As String Private Shared _serializerXml As XmlSerializer #End Region Public Property Country() As String Get Return Me._country End Get Set Me._country = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(OriginCountryType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize OriginCountryType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes OriginCountryType object ''' ''' string to deserialize ''' Output OriginCountryType 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 OriginCountryType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, OriginCountryType) 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 OriginCountryType) 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 OriginCountryType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), OriginCountryType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As OriginCountryType Return CType(SerializerXml.Deserialize(s), OriginCountryType) End Function #End Region ''' ''' Serializes current OriginCountryType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an OriginCountryType object ''' ''' File to load and deserialize ''' Output OriginCountryType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As OriginCountryType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, OriginCountryType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As OriginCountryType) 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 OriginCountryType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class CommodityDetailsType #Region "Private fields" Private _description As String Private Shared _serializerXml As XmlSerializer #End Region 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(CommodityDetailsType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize CommodityDetailsType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes CommodityDetailsType object ''' ''' string to deserialize ''' Output CommodityDetailsType 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 CommodityDetailsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, CommodityDetailsType) 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 CommodityDetailsType) 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 CommodityDetailsType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), CommodityDetailsType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As CommodityDetailsType Return CType(SerializerXml.Deserialize(s), CommodityDetailsType) End Function #End Region ''' ''' Serializes current CommodityDetailsType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an CommodityDetailsType object ''' ''' File to load and deserialize ''' Output CommodityDetailsType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As CommodityDetailsType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, CommodityDetailsType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As CommodityDetailsType) 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 CommodityDetailsType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class CommodityCodeType #Region "Private fields" Private _hsCode As String Private _cnCode As String Private _commodityDetails As CommodityDetailsType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._commodityDetails = New CommodityDetailsType() End Sub Public Property HsCode() As String Get Return Me._hsCode End Get Set Me._hsCode = Value End Set End Property Public Property CnCode() As String Get Return Me._cnCode End Get Set Me._cnCode = Value End Set End Property Public Property CommodityDetails() As CommodityDetailsType Get Return Me._commodityDetails End Get Set Me._commodityDetails = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(CommodityCodeType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize CommodityCodeType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes CommodityCodeType object ''' ''' string to deserialize ''' Output CommodityCodeType 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 CommodityCodeType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, CommodityCodeType) 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 CommodityCodeType) 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 CommodityCodeType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), CommodityCodeType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As CommodityCodeType Return CType(SerializerXml.Deserialize(s), CommodityCodeType) End Function #End Region ''' ''' Serializes current CommodityCodeType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an CommodityCodeType object ''' ''' File to load and deserialize ''' Output CommodityCodeType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As CommodityCodeType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, CommodityCodeType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As CommodityCodeType) 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 CommodityCodeType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ImportedGoodType #Region "Private fields" Private _itemNumber As String Private _representative As RepresentativeType Private _importer As ImporterType Private _commodityCode As CommodityCodeType Private _originCountry As OriginCountryType Private _importedQuantity As List(Of ImportedQuantityType) Private _measureImported As MeasureType Private _totalEmissions As TotalEmissionsType Private _supportingDocuments As List(Of SupportingDocumentsType) Private _remarks As RemarksType Private _goodsEmissions As List(Of GoodsEmissionsType) Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._goodsEmissions = New List(Of GoodsEmissionsType)() Me._remarks = New RemarksType() Me._supportingDocuments = New List(Of SupportingDocumentsType)() Me._totalEmissions = New TotalEmissionsType() Me._measureImported = New MeasureType() Me._importedQuantity = New List(Of ImportedQuantityType)() Me._originCountry = New OriginCountryType() Me._commodityCode = New CommodityCodeType() Me._importer = New ImporterType() Me._representative = New RepresentativeType() End Sub Public Property ItemNumber() As String Get Return Me._itemNumber End Get Set Me._itemNumber = Value End Set End Property Public Property Representative() As RepresentativeType Get Return Me._representative End Get Set Me._representative = Value End Set End Property Public Property Importer() As ImporterType Get Return Me._importer End Get Set Me._importer = Value End Set End Property Public Property CommodityCode() As CommodityCodeType Get Return Me._commodityCode End Get Set Me._commodityCode = Value End Set End Property Public Property OriginCountry() As OriginCountryType Get Return Me._originCountry End Get Set Me._originCountry = Value End Set End Property Public Property ImportedQuantity() As List(Of ImportedQuantityType) Get Return Me._importedQuantity End Get Set Me._importedQuantity = Value End Set End Property Public Property MeasureImported() As MeasureType Get Return Me._measureImported End Get Set Me._measureImported = Value End Set End Property Public Property TotalEmissions() As TotalEmissionsType Get Return Me._totalEmissions End Get Set Me._totalEmissions = Value End Set End Property Public Property SupportingDocuments() As List(Of SupportingDocumentsType) Get Return Me._supportingDocuments End Get Set Me._supportingDocuments = Value End Set End Property Public Property Remarks() As RemarksType Get Return Me._remarks End Get Set Me._remarks = Value End Set End Property Public Property GoodsEmissions() As List(Of GoodsEmissionsType) Get Return Me._goodsEmissions End Get Set Me._goodsEmissions = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ImportedGoodType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ImportedGoodType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ImportedGoodType object ''' ''' string to deserialize ''' Output ImportedGoodType 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 ImportedGoodType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImportedGoodType) 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 ImportedGoodType) 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 ImportedGoodType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ImportedGoodType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ImportedGoodType Return CType(SerializerXml.Deserialize(s), ImportedGoodType) End Function #End Region ''' ''' Serializes current ImportedGoodType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ImportedGoodType object ''' ''' File to load and deserialize ''' Output ImportedGoodType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportedGoodType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImportedGoodType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImportedGoodType) 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 ImportedGoodType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class RepresentativeType #Region "Private fields" Private _identificationNumber As String Private _name As String Private _representativeAddress As AddressType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._representativeAddress = New AddressType() End Sub Public Property IdentificationNumber() As String Get Return Me._identificationNumber End Get Set Me._identificationNumber = 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 RepresentativeAddress() As AddressType Get Return Me._representativeAddress End Get Set Me._representativeAddress = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(RepresentativeType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize RepresentativeType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes RepresentativeType object ''' ''' string to deserialize ''' Output RepresentativeType 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 RepresentativeType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, RepresentativeType) 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 RepresentativeType) 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 RepresentativeType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), RepresentativeType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As RepresentativeType Return CType(SerializerXml.Deserialize(s), RepresentativeType) End Function #End Region ''' ''' Serializes current RepresentativeType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an RepresentativeType object ''' ''' File to load and deserialize ''' Output RepresentativeType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As RepresentativeType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, RepresentativeType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As RepresentativeType) 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 RepresentativeType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ImporterType #Region "Private fields" Private _identificationNumber As String Private _name As String Private _importerAddress As AddressType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._importerAddress = New AddressType() End Sub Public Property IdentificationNumber() As String Get Return Me._identificationNumber End Get Set Me._identificationNumber = 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 ImporterAddress() As AddressType Get Return Me._importerAddress End Get Set Me._importerAddress = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ImporterType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ImporterType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ImporterType object ''' ''' string to deserialize ''' Output ImporterType 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 ImporterType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImporterType) 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 ImporterType) 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 ImporterType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ImporterType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ImporterType Return CType(SerializerXml.Deserialize(s), ImporterType) End Function #End Region ''' ''' Serializes current ImporterType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ImporterType object ''' ''' File to load and deserialize ''' Output ImporterType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImporterType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ImporterType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ImporterType) 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 ImporterType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class RemarksType #Region "Private fields" Private _additionalInformation As String Private Shared _serializerXml As XmlSerializer #End Region Public Property AdditionalInformation() As String Get Return Me._additionalInformation End Get Set Me._additionalInformation = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(RemarksType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize RemarksType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes RemarksType object ''' ''' string to deserialize ''' Output RemarksType 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 RemarksType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, RemarksType) 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 RemarksType) 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 RemarksType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), RemarksType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As RemarksType Return CType(SerializerXml.Deserialize(s), RemarksType) End Function #End Region ''' ''' Serializes current RemarksType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an RemarksType object ''' ''' File to load and deserialize ''' Output RemarksType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As RemarksType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, RemarksType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As RemarksType) 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 RemarksType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ApplicableMethodologyConfirmationType #Region "Private fields" Private _otherApplicableReportingMethodology As Boolean Private Shared _serializerXml As XmlSerializer #End Region Public Property OtherApplicableReportingMethodology() As Boolean Get Return Me._otherApplicableReportingMethodology End Get Set Me._otherApplicableReportingMethodology = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ApplicableMethodologyConfirmationType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ApplicableMethodologyConfirmationType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ApplicableMethodologyConfirmationType object ''' ''' string to deserialize ''' Output ApplicableMethodologyConfirmationType 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 ApplicableMethodologyConfirmationType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ApplicableMethodologyConfirmationType) 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 ApplicableMethodologyConfirmationType) 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 ApplicableMethodologyConfirmationType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ApplicableMethodologyConfirmationType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ApplicableMethodologyConfirmationType Return CType(SerializerXml.Deserialize(s), ApplicableMethodologyConfirmationType) End Function #End Region ''' ''' Serializes current ApplicableMethodologyConfirmationType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ApplicableMethodologyConfirmationType object ''' ''' File to load and deserialize ''' Output ApplicableMethodologyConfirmationType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ApplicableMethodologyConfirmationType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ApplicableMethodologyConfirmationType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ApplicableMethodologyConfirmationType) 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 ApplicableMethodologyConfirmationType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class ReportConfirmationType #Region "Private fields" Private _globalDataConfirmation As Boolean Private _useOfDataConfirmation As Boolean Private _signatureDate As Integer Private _signaturePlace As String Private _signature As String Private _positionOfPersonSending As String Private Shared _serializerXml As XmlSerializer #End Region Public Property GlobalDataConfirmation() As Boolean Get Return Me._globalDataConfirmation End Get Set Me._globalDataConfirmation = Value End Set End Property Public Property UseOfDataConfirmation() As Boolean Get Return Me._useOfDataConfirmation End Get Set Me._useOfDataConfirmation = Value End Set End Property Public Property SignatureDate() As Integer Get Return Me._signatureDate End Get Set Me._signatureDate = Value End Set End Property Public Property SignaturePlace() As String Get Return Me._signaturePlace End Get Set Me._signaturePlace = Value End Set End Property Public Property Signature() As String Get Return Me._signature End Get Set Me._signature = Value End Set End Property Public Property PositionOfPersonSending() As String Get Return Me._positionOfPersonSending End Get Set Me._positionOfPersonSending = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(ReportConfirmationType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize ReportConfirmationType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes ReportConfirmationType object ''' ''' string to deserialize ''' Output ReportConfirmationType 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 ReportConfirmationType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ReportConfirmationType) 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 ReportConfirmationType) 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 ReportConfirmationType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), ReportConfirmationType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As ReportConfirmationType Return CType(SerializerXml.Deserialize(s), ReportConfirmationType) End Function #End Region ''' ''' Serializes current ReportConfirmationType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an ReportConfirmationType object ''' ''' File to load and deserialize ''' Output ReportConfirmationType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ReportConfirmationType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ReportConfirmationType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ReportConfirmationType) 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 ReportConfirmationType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class SignaturesType #Region "Private fields" Private _reportConfirmation As ReportConfirmationType Private _applicableMethdologyConfirmation As ApplicableMethodologyConfirmationType Private Shared _serializerXml As XmlSerializer #End Region Public Sub New() MyBase.New Me._applicableMethdologyConfirmation = New ApplicableMethodologyConfirmationType() Me._reportConfirmation = New ReportConfirmationType() End Sub Public Property ReportConfirmation() As ReportConfirmationType Get Return Me._reportConfirmation End Get Set Me._reportConfirmation = Value End Set End Property Public Property ApplicableMethdologyConfirmation() As ApplicableMethodologyConfirmationType Get Return Me._applicableMethdologyConfirmation End Get Set Me._applicableMethdologyConfirmation = Value End Set End Property Private Shared ReadOnly Property SerializerXml() As XmlSerializer Get If (_serializerXml Is Nothing) Then _serializerXml = New XmlSerializerFactory().CreateSerializer(GetType(SignaturesType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize SignaturesType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes SignaturesType object ''' ''' string to deserialize ''' Output SignaturesType 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 SignaturesType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, SignaturesType) 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 SignaturesType) 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 SignaturesType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), SignaturesType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As SignaturesType Return CType(SerializerXml.Deserialize(s), SignaturesType) End Function #End Region ''' ''' Serializes current SignaturesType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an SignaturesType object ''' ''' File to load and deserialize ''' Output SignaturesType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As SignaturesType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, SignaturesType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As SignaturesType) 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 SignaturesType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class Partial Public Class NationalCompetentAuthType #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(NationalCompetentAuthType)) End If Return _serializerXml End Get End Property #Region "Serialize/Deserialize" ''' ''' Serialize NationalCompetentAuthType object ''' ''' XML value Public Overridable Function Serialize() As String Dim streamReader As StreamReader = Nothing Dim memoryStream As MemoryStream = Nothing Try memoryStream = New MemoryStream() Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings() Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings) SerializerXml.Serialize(xmlWriter, Me) memoryStream.Seek(0, SeekOrigin.Begin) streamReader = New StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' ''' Deserializes NationalCompetentAuthType object ''' ''' string to deserialize ''' Output NationalCompetentAuthType 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 NationalCompetentAuthType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, NationalCompetentAuthType) 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 NationalCompetentAuthType) 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 NationalCompetentAuthType Dim stringReader As StringReader = Nothing Try stringReader = New StringReader(input) Return CType(SerializerXml.Deserialize(XmlReader.Create(stringReader)), NationalCompetentAuthType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function Public Overloads Shared Function Deserialize(ByVal s As Stream) As NationalCompetentAuthType Return CType(SerializerXml.Deserialize(s), NationalCompetentAuthType) End Function #End Region ''' ''' Serializes current NationalCompetentAuthType object into file ''' ''' full path of outupt xml file ''' output Exception value if failed ''' true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As StreamWriter = Nothing Try Dim dataString As String = Serialize() Dim outputFile As FileInfo = New FileInfo(fileName) streamWriter = outputFile.CreateText streamWriter.WriteLine(dataString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' ''' Deserializes xml markup from file into an NationalCompetentAuthType object ''' ''' File to load and deserialize ''' Output NationalCompetentAuthType object ''' output Exception value if deserialize failed ''' true if this Serializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As NationalCompetentAuthType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, NationalCompetentAuthType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As NationalCompetentAuthType) 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 NationalCompetentAuthType Dim file As FileStream = Nothing Dim sr As StreamReader = Nothing Try file = New FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New StreamReader(file) Dim dataString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(dataString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function End Class End Namespace #Enable Warning