3137 lines
120 KiB
VB.net
3137 lines
120 KiB
VB.net
'' ------------------------------------------------------------------------------
|
|
'' <auto-generated>
|
|
'' Generated by Xsd2Code++. Version 5.0.0.47. www.xsd2code.com
|
|
'' <NameSpace>IDEV_Intrastat</NameSpace><Collection>List</Collection><codeType>VisualBasic</codeType><EnableDataBinding>False</EnableDataBinding><GenerateCloneMethod>False</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><DataMemberNameArg>OnlyIfDifferent</DataMemberNameArg><DataMemberOnXmlIgnore>False</DataMemberOnXmlIgnore><CodeBaseTag>Net45</CodeBaseTag><InitializeFields>All</InitializeFields><GenerateUnusedComplexTypes>True</GenerateUnusedComplexTypes><GenerateUnusedSimpleTypes>True</GenerateUnusedSimpleTypes><GenerateXMLAttributes>True</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableLazyLoading>False</EnableLazyLoading><VirtualProp>False</VirtualProp><PascalCase>False</PascalCase><AutomaticProperties>False</AutomaticProperties><PropNameSpecified>None</PropNameSpecified><PrivateFieldName>StartWithUnderscore</PrivateFieldName><PrivateFieldNamePrefix></PrivateFieldNamePrefix><EnableRestriction>False</EnableRestriction><RestrictionMaxLenght>False</RestrictionMaxLenght><RestrictionRegEx>False</RestrictionRegEx><RestrictionRange>False</RestrictionRange><ValidateProperty>False</ValidateProperty><ClassNamePrefix></ClassNamePrefix><ClassLevel>Public</ClassLevel><PartialClass>True</PartialClass><ClassesInSeparateFiles>False</ClassesInSeparateFiles><ClassesInSeparateFilesDir></ClassesInSeparateFilesDir><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>False</EnableSummaryComment><EnableAppInfoSettings>False</EnableAppInfoSettings><EnableExternalSchemasCache>False</EnableExternalSchemasCache><EnableDebug>False</EnableDebug><EnableWarn>True</EnableWarn><ExcludeImportedTypes>True</ExcludeImportedTypes><ExpandNesteadAttributeGroup>True</ExpandNesteadAttributeGroup><CleanupCode>False</CleanupCode><EnableXmlSerialization>True</EnableXmlSerialization><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><EnableEncoding>False</EnableEncoding><EnableXMLIndent>True</EnableXMLIndent><IndentChar>Indent2Space</IndentChar><NewLineAttr>False</NewLineAttr><OmitXML>False</OmitXML><Encoder>UTF8</Encoder><Serializer>XmlSerializer</Serializer><sspNullable>False</sspNullable><sspString>False</sspString><sspCollection>False</sspCollection><sspComplexType>False</sspComplexType><sspSimpleType>False</sspSimpleType><sspEnumType>False</sspEnumType><XmlSerializerEvent>False</XmlSerializerEvent><BaseClassName>EntityBase</BaseClassName><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><CustomUsings></CustomUsings><AttributesToExlude></AttributesToExlude>
|
|
'' </auto-generated>
|
|
'' ------------------------------------------------------------------------------
|
|
Imports System
|
|
Imports System.Diagnostics
|
|
Imports System.Xml.Serialization
|
|
Imports System.Collections
|
|
Imports System.Xml.Schema
|
|
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports System.Text
|
|
Imports System.Xml
|
|
Imports System.Collections.Generic
|
|
|
|
Namespace IDEV_Intrastat
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class INSTAT
|
|
|
|
#Region "Private fields"
|
|
Private _envelope As Envelope
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me._envelope = New Envelope()
|
|
End Sub
|
|
|
|
Public Property Envelope() As Envelope
|
|
Get
|
|
Return Me._envelope
|
|
End Get
|
|
Set
|
|
Me._envelope = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(INSTAT))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current INSTAT object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an INSTAT object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output INSTAT object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As INSTAT, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, INSTAT)
|
|
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 INSTAT) 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 INSTAT
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), INSTAT)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As INSTAT
|
|
Return CType(Serializer.Deserialize(s), INSTAT)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current INSTAT object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an INSTAT object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output INSTAT object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As INSTAT, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, INSTAT)
|
|
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 INSTAT) 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 INSTAT
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class Envelope
|
|
|
|
#Region "Private fields"
|
|
Private _envelopeId As String
|
|
|
|
Private _dateTime As DateTime
|
|
|
|
Private _party As List(Of Party)
|
|
|
|
Private _acknowlegementRequest As Boolean
|
|
|
|
Private _authentication As String
|
|
|
|
Private _testIndicator As Boolean
|
|
|
|
Private _applicationReference As String
|
|
|
|
Private _softwareUsed As String
|
|
|
|
Private _declaration As List(Of Declaration)
|
|
|
|
Private _numberOfDeclarations As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me._declaration = New List(Of Declaration)()
|
|
Me._party = New List(Of Party)()
|
|
Me._dateTime = New DateTime()
|
|
End Sub
|
|
|
|
Public Property envelopeId() As String
|
|
Get
|
|
Return Me._envelopeId
|
|
End Get
|
|
Set
|
|
Me._envelopeId = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property DateTime() As DateTime
|
|
Get
|
|
Return Me._dateTime
|
|
End Get
|
|
Set
|
|
Me._dateTime = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute("Party")>
|
|
Public Property Party() As List(Of Party)
|
|
Get
|
|
Return Me._party
|
|
End Get
|
|
Set
|
|
Me._party = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property acknowlegementRequest() As Boolean
|
|
Get
|
|
Return Me._acknowlegementRequest
|
|
End Get
|
|
Set
|
|
Me._acknowlegementRequest = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authentication() As String
|
|
Get
|
|
Return Me._authentication
|
|
End Get
|
|
Set
|
|
Me._authentication = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property testIndicator() As Boolean
|
|
Get
|
|
Return Me._testIndicator
|
|
End Get
|
|
Set
|
|
Me._testIndicator = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property applicationReference() As String
|
|
Get
|
|
Return Me._applicationReference
|
|
End Get
|
|
Set
|
|
Me._applicationReference = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property softwareUsed() As String
|
|
Get
|
|
Return Me._softwareUsed
|
|
End Get
|
|
Set
|
|
Me._softwareUsed = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute("Declaration")>
|
|
Public Property Declaration() As List(Of Declaration)
|
|
Get
|
|
Return Me._declaration
|
|
End Get
|
|
Set
|
|
Me._declaration = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property numberOfDeclarations() As String
|
|
Get
|
|
Return Me._numberOfDeclarations
|
|
End Get
|
|
Set
|
|
Me._numberOfDeclarations = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(Envelope))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current Envelope object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an Envelope object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output Envelope object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As Envelope, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Envelope)
|
|
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 Envelope) 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 Envelope
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), Envelope)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As Envelope
|
|
Return CType(Serializer.Deserialize(s), Envelope)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current Envelope object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an Envelope object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output Envelope object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As Envelope, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Envelope)
|
|
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 Envelope) 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 Envelope
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class DateTime
|
|
|
|
#Region "Private fields"
|
|
Private _date As Date
|
|
|
|
Private _time As Date
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="date")>
|
|
Public Property [date]() As Date
|
|
Get
|
|
Return Me._date
|
|
End Get
|
|
Set
|
|
Me._date = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="time")>
|
|
Public Property time() As Date
|
|
Get
|
|
Return Me._time
|
|
End Get
|
|
Set
|
|
Me._time = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(DateTime))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current DateTime object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an DateTime object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output DateTime object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As DateTime, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, DateTime)
|
|
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 DateTime) 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 DateTime
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), DateTime)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As DateTime
|
|
Return CType(Serializer.Deserialize(s), DateTime)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current DateTime object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an DateTime object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output DateTime object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DateTime, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, DateTime)
|
|
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 DateTime) 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 DateTime
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class Party
|
|
|
|
#Region "Private fields"
|
|
Private _partyId As String
|
|
|
|
Private _partyName As String
|
|
|
|
Private _interchangeAgreementId As String
|
|
|
|
Private _password As String
|
|
|
|
Private _address As Address
|
|
|
|
Private _contactPerson As ContactPerson
|
|
|
|
Private _partyType As PartyPartyType
|
|
|
|
Private _partyRole As PartyPartyRole
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me._contactPerson = New ContactPerson()
|
|
Me._address = New Address()
|
|
End Sub
|
|
|
|
Public Property partyId() As String
|
|
Get
|
|
Return Me._partyId
|
|
End Get
|
|
Set
|
|
Me._partyId = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partyName() As String
|
|
Get
|
|
Return Me._partyName
|
|
End Get
|
|
Set
|
|
Me._partyName = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property interchangeAgreementId() As String
|
|
Get
|
|
Return Me._interchangeAgreementId
|
|
End Get
|
|
Set
|
|
Me._interchangeAgreementId = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property password() As String
|
|
Get
|
|
Return Me._password
|
|
End Get
|
|
Set
|
|
Me._password = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Address() As Address
|
|
Get
|
|
Return Me._address
|
|
End Get
|
|
Set
|
|
Me._address = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ContactPerson() As ContactPerson
|
|
Get
|
|
Return Me._contactPerson
|
|
End Get
|
|
Set
|
|
Me._contactPerson = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlAttributeAttribute()>
|
|
Public Property partyType() As PartyPartyType
|
|
Get
|
|
Return Me._partyType
|
|
End Get
|
|
Set
|
|
Me._partyType = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlAttributeAttribute()>
|
|
Public Property partyRole() As PartyPartyRole
|
|
Get
|
|
Return Me._partyRole
|
|
End Get
|
|
Set
|
|
Me._partyRole = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(Party))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current Party object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an Party object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output Party object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As Party, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Party)
|
|
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 Party) 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 Party
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), Party)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As Party
|
|
Return CType(Serializer.Deserialize(s), Party)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current Party object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an Party object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output Party object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As Party, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Party)
|
|
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 Party) 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 Party
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class Address
|
|
|
|
#Region "Private fields"
|
|
Private _streetName As String
|
|
|
|
Private _streetNumber As String
|
|
|
|
Private _postalCode As String
|
|
|
|
Private _cityName As String
|
|
|
|
Private _countryName As String
|
|
|
|
Private _phoneNumber As String
|
|
|
|
Private _faxNumber As String
|
|
|
|
Private _email As String
|
|
|
|
Private _uRL As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Property streetName() As String
|
|
Get
|
|
Return Me._streetName
|
|
End Get
|
|
Set
|
|
Me._streetName = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property streetNumber() As String
|
|
Get
|
|
Return Me._streetNumber
|
|
End Get
|
|
Set
|
|
Me._streetNumber = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property postalCode() As String
|
|
Get
|
|
Return Me._postalCode
|
|
End Get
|
|
Set
|
|
Me._postalCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property cityName() As String
|
|
Get
|
|
Return Me._cityName
|
|
End Get
|
|
Set
|
|
Me._cityName = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property countryName() As String
|
|
Get
|
|
Return Me._countryName
|
|
End Get
|
|
Set
|
|
Me._countryName = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property phoneNumber() As String
|
|
Get
|
|
Return Me._phoneNumber
|
|
End Get
|
|
Set
|
|
Me._phoneNumber = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property faxNumber() As String
|
|
Get
|
|
Return Me._faxNumber
|
|
End Get
|
|
Set
|
|
Me._faxNumber = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute("e-mail")>
|
|
Public Property email() As String
|
|
Get
|
|
Return Me._email
|
|
End Get
|
|
Set
|
|
Me._email = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="anyURI")>
|
|
Public Property URL() As String
|
|
Get
|
|
Return Me._uRL
|
|
End Get
|
|
Set
|
|
Me._uRL = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(Address))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current Address object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an Address object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output Address object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As Address, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Address)
|
|
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 Address) 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 Address
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), Address)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As Address
|
|
Return CType(Serializer.Deserialize(s), Address)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current Address object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an Address object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output Address object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As Address, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Address)
|
|
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 Address) 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 Address
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class ContactPerson
|
|
|
|
#Region "Private fields"
|
|
Private _contactPersonName As String
|
|
|
|
Private _address As Address
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me._address = New Address()
|
|
End Sub
|
|
|
|
Public Property contactPersonName() As String
|
|
Get
|
|
Return Me._contactPersonName
|
|
End Get
|
|
Set
|
|
Me._contactPersonName = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Address() As Address
|
|
Get
|
|
Return Me._address
|
|
End Get
|
|
Set
|
|
Me._address = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(ContactPerson))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current ContactPerson object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an ContactPerson object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output ContactPerson object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As ContactPerson, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ContactPerson)
|
|
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 ContactPerson) 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 ContactPerson
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), ContactPerson)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As ContactPerson
|
|
Return CType(Serializer.Deserialize(s), ContactPerson)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current ContactPerson object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an ContactPerson object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output ContactPerson object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ContactPerson, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ContactPerson)
|
|
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 ContactPerson) 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 ContactPerson
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)>
|
|
Public Enum PartyPartyType
|
|
|
|
'''<remarks/>
|
|
PSI
|
|
|
|
'''<remarks/>
|
|
TDP
|
|
|
|
'''<remarks/>
|
|
CC
|
|
End Enum
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)>
|
|
Public Enum PartyPartyRole
|
|
|
|
'''<remarks/>
|
|
sender
|
|
|
|
'''<remarks/>
|
|
receiver
|
|
|
|
'''<remarks/>
|
|
PSI
|
|
End Enum
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class Declaration
|
|
|
|
#Region "Private fields"
|
|
Private _declarationId As String
|
|
|
|
Private _dateTime As DateTime
|
|
|
|
Private _referencePeriod As String
|
|
|
|
Private _pSIId As String
|
|
|
|
Private _function As [Function]
|
|
|
|
Private _declarationTypeCode As String
|
|
|
|
Private _flowCode As String
|
|
|
|
Private _currencyCode As String
|
|
|
|
Private _firstLast As String
|
|
|
|
Private _totalNetMass As String
|
|
|
|
Private _totalInvoicedAmount As Decimal
|
|
|
|
Private _totalStatisticalValue As Decimal
|
|
|
|
Private _item As List(Of Item)
|
|
|
|
Private _totalNumberLines As String
|
|
|
|
Private _totalNumberDetailedLines As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me._item = New List(Of Item)()
|
|
Me._function = New [Function]()
|
|
Me._dateTime = New DateTime()
|
|
End Sub
|
|
|
|
Public Property declarationId() As String
|
|
Get
|
|
Return Me._declarationId
|
|
End Get
|
|
Set
|
|
Me._declarationId = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property DateTime() As DateTime
|
|
Get
|
|
Return Me._dateTime
|
|
End Get
|
|
Set
|
|
Me._dateTime = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referencePeriod() As String
|
|
Get
|
|
Return Me._referencePeriod
|
|
End Get
|
|
Set
|
|
Me._referencePeriod = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property PSIId() As String
|
|
Get
|
|
Return Me._pSIId
|
|
End Get
|
|
Set
|
|
Me._pSIId = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property [Function]() As [Function]
|
|
Get
|
|
Return Me._function
|
|
End Get
|
|
Set
|
|
Me._function = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property declarationTypeCode() As String
|
|
Get
|
|
Return Me._declarationTypeCode
|
|
End Get
|
|
Set
|
|
Me._declarationTypeCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property flowCode() As String
|
|
Get
|
|
Return Me._flowCode
|
|
End Get
|
|
Set
|
|
Me._flowCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property currencyCode() As String
|
|
Get
|
|
Return Me._currencyCode
|
|
End Get
|
|
Set
|
|
Me._currencyCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property firstLast() As String
|
|
Get
|
|
Return Me._firstLast
|
|
End Get
|
|
Set
|
|
Me._firstLast = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property totalNetMass() As String
|
|
Get
|
|
Return Me._totalNetMass
|
|
End Get
|
|
Set
|
|
Me._totalNetMass = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property totalInvoicedAmount() As Decimal
|
|
Get
|
|
Return Me._totalInvoicedAmount
|
|
End Get
|
|
Set
|
|
Me._totalInvoicedAmount = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property totalStatisticalValue() As Decimal
|
|
Get
|
|
Return Me._totalStatisticalValue
|
|
End Get
|
|
Set
|
|
Me._totalStatisticalValue = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute("Item")>
|
|
Public Property Item() As List(Of Item)
|
|
Get
|
|
Return Me._item
|
|
End Get
|
|
Set
|
|
Me._item = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property totalNumberLines() As String
|
|
Get
|
|
Return Me._totalNumberLines
|
|
End Get
|
|
Set
|
|
Me._totalNumberLines = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property totalNumberDetailedLines() As String
|
|
Get
|
|
Return Me._totalNumberDetailedLines
|
|
End Get
|
|
Set
|
|
Me._totalNumberDetailedLines = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(Declaration))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current Declaration object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an Declaration object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output Declaration object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As Declaration, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Declaration)
|
|
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 Declaration) 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 Declaration
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), Declaration)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As Declaration
|
|
Return CType(Serializer.Deserialize(s), Declaration)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current Declaration object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an Declaration object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output Declaration object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As Declaration, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Declaration)
|
|
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 Declaration) 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 Declaration
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class [Function]
|
|
|
|
#Region "Private fields"
|
|
Private _functionCode As String
|
|
|
|
Private _previousDeclarationId As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Property functionCode() As String
|
|
Get
|
|
Return Me._functionCode
|
|
End Get
|
|
Set
|
|
Me._functionCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property previousDeclarationId() As String
|
|
Get
|
|
Return Me._previousDeclarationId
|
|
End Get
|
|
Set
|
|
Me._previousDeclarationId = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType([Function]))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current Function object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an Function object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output Function object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As [Function], ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, [Function])
|
|
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 [Function]) 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 [Function]
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), [Function])
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As [Function]
|
|
Return CType(Serializer.Deserialize(s), [Function])
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current Function object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an Function object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output Function object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As [Function], ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, [Function])
|
|
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 [Function]) 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 [Function]
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class Item
|
|
|
|
#Region "Private fields"
|
|
Private _itemNumber As String
|
|
|
|
Private _cN8 As CN8
|
|
|
|
Private _goodsDescription As String
|
|
|
|
Private _mSConsDestCode As String
|
|
|
|
Private _countryOfOriginCode As String
|
|
|
|
Private _netMass As String
|
|
|
|
Private _quantityInSU As String
|
|
|
|
Private _invoicedAmount As List(Of invoicedAmount)
|
|
|
|
Private _statisticalValue As Decimal
|
|
|
|
Private _invoiceNumber As String
|
|
|
|
Private _partnerId As String
|
|
|
|
Private _statisticalProcedureCode As String
|
|
|
|
Private _natureOfTransaction As NatureOfTransaction
|
|
|
|
Private _modeOfTransportCode As String
|
|
|
|
Private _regionCode As String
|
|
|
|
Private _portAirportInlandportCode As String
|
|
|
|
Private _deliveryTerms As DeliveryTerms
|
|
|
|
Private _numberOfConsignments As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me._deliveryTerms = New DeliveryTerms()
|
|
Me._natureOfTransaction = New NatureOfTransaction()
|
|
Me._invoicedAmount = New List(Of invoicedAmount)()
|
|
Me._cN8 = New CN8()
|
|
End Sub
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property itemNumber() As String
|
|
Get
|
|
Return Me._itemNumber
|
|
End Get
|
|
Set
|
|
Me._itemNumber = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property CN8() As CN8
|
|
Get
|
|
Return Me._cN8
|
|
End Get
|
|
Set
|
|
Me._cN8 = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property goodsDescription() As String
|
|
Get
|
|
Return Me._goodsDescription
|
|
End Get
|
|
Set
|
|
Me._goodsDescription = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MSConsDestCode() As String
|
|
Get
|
|
Return Me._mSConsDestCode
|
|
End Get
|
|
Set
|
|
Me._mSConsDestCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property countryOfOriginCode() As String
|
|
Get
|
|
Return Me._countryOfOriginCode
|
|
End Get
|
|
Set
|
|
Me._countryOfOriginCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property netMass() As String
|
|
Get
|
|
Return Me._netMass
|
|
End Get
|
|
Set
|
|
Me._netMass = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property quantityInSU() As String
|
|
Get
|
|
Return Me._quantityInSU
|
|
End Get
|
|
Set
|
|
Me._quantityInSU = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute("invoicedAmount")>
|
|
Public Property invoicedAmount() As List(Of invoicedAmount)
|
|
Get
|
|
Return Me._invoicedAmount
|
|
End Get
|
|
Set
|
|
Me._invoicedAmount = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalValue() As Decimal
|
|
Get
|
|
Return Me._statisticalValue
|
|
End Get
|
|
Set
|
|
Me._statisticalValue = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invoiceNumber() As String
|
|
Get
|
|
Return Me._invoiceNumber
|
|
End Get
|
|
Set
|
|
Me._invoiceNumber = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerId() As String
|
|
Get
|
|
Return Me._partnerId
|
|
End Get
|
|
Set
|
|
Me._partnerId = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalProcedureCode() As String
|
|
Get
|
|
Return Me._statisticalProcedureCode
|
|
End Get
|
|
Set
|
|
Me._statisticalProcedureCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property NatureOfTransaction() As NatureOfTransaction
|
|
Get
|
|
Return Me._natureOfTransaction
|
|
End Get
|
|
Set
|
|
Me._natureOfTransaction = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modeOfTransportCode() As String
|
|
Get
|
|
Return Me._modeOfTransportCode
|
|
End Get
|
|
Set
|
|
Me._modeOfTransportCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property regionCode() As String
|
|
Get
|
|
Return Me._regionCode
|
|
End Get
|
|
Set
|
|
Me._regionCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property portAirportInlandportCode() As String
|
|
Get
|
|
Return Me._portAirportInlandportCode
|
|
End Get
|
|
Set
|
|
Me._portAirportInlandportCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property DeliveryTerms() As DeliveryTerms
|
|
Get
|
|
Return Me._deliveryTerms
|
|
End Get
|
|
Set
|
|
Me._deliveryTerms = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlElementAttribute(DataType:="integer")>
|
|
Public Property numberOfConsignments() As String
|
|
Get
|
|
Return Me._numberOfConsignments
|
|
End Get
|
|
Set
|
|
Me._numberOfConsignments = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(Item))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current Item object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an Item object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output Item object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As Item, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Item)
|
|
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 Item) 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 Item
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), Item)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As Item
|
|
Return CType(Serializer.Deserialize(s), Item)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current Item object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an Item object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output Item object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As Item, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, Item)
|
|
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 Item) 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 Item
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class CN8
|
|
|
|
#Region "Private fields"
|
|
Private _cN8Code As String
|
|
|
|
Private _sUCode As String
|
|
|
|
Private _additionalGoodsCode As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Property CN8Code() As String
|
|
Get
|
|
Return Me._cN8Code
|
|
End Get
|
|
Set
|
|
Me._cN8Code = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property SUCode() As String
|
|
Get
|
|
Return Me._sUCode
|
|
End Get
|
|
Set
|
|
Me._sUCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalGoodsCode() As String
|
|
Get
|
|
Return Me._additionalGoodsCode
|
|
End Get
|
|
Set
|
|
Me._additionalGoodsCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(CN8))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current CN8 object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an CN8 object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output CN8 object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As CN8, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, CN8)
|
|
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 CN8) 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 CN8
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), CN8)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As CN8
|
|
Return CType(Serializer.Deserialize(s), CN8)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current CN8 object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an CN8 object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output CN8 object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As CN8, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, CN8)
|
|
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 CN8) 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 CN8
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class invoicedAmount
|
|
|
|
#Region "Private fields"
|
|
Private _currencyCode As String
|
|
|
|
Private _value As Decimal
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
<System.Xml.Serialization.XmlAttributeAttribute()>
|
|
Public Property currencyCode() As String
|
|
Get
|
|
Return Me._currencyCode
|
|
End Get
|
|
Set
|
|
Me._currencyCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlTextAttribute()>
|
|
Public Property Value() As Decimal
|
|
Get
|
|
Return Me._value
|
|
End Get
|
|
Set
|
|
Me._value = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(invoicedAmount))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current invoicedAmount object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an invoicedAmount object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output invoicedAmount object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As invoicedAmount, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, invoicedAmount)
|
|
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 invoicedAmount) 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 invoicedAmount
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), invoicedAmount)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As invoicedAmount
|
|
Return CType(Serializer.Deserialize(s), invoicedAmount)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current invoicedAmount object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an invoicedAmount object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output invoicedAmount object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As invoicedAmount, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, invoicedAmount)
|
|
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 invoicedAmount) 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 invoicedAmount
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class NatureOfTransaction
|
|
|
|
#Region "Private fields"
|
|
Private _natureOfTransactionACode As String
|
|
|
|
Private _natureOfTransactionBCode As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Property natureOfTransactionACode() As String
|
|
Get
|
|
Return Me._natureOfTransactionACode
|
|
End Get
|
|
Set
|
|
Me._natureOfTransactionACode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property natureOfTransactionBCode() As String
|
|
Get
|
|
Return Me._natureOfTransactionBCode
|
|
End Get
|
|
Set
|
|
Me._natureOfTransactionBCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(NatureOfTransaction))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current NatureOfTransaction object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an NatureOfTransaction object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output NatureOfTransaction object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As NatureOfTransaction, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, NatureOfTransaction)
|
|
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 NatureOfTransaction) 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 NatureOfTransaction
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), NatureOfTransaction)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As NatureOfTransaction
|
|
Return CType(Serializer.Deserialize(s), NatureOfTransaction)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current NatureOfTransaction object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an NatureOfTransaction object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output NatureOfTransaction object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As NatureOfTransaction, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, NatureOfTransaction)
|
|
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 NatureOfTransaction) 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 NatureOfTransaction
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0"),
|
|
System.SerializableAttribute(),
|
|
System.Diagnostics.DebuggerStepThroughAttribute(),
|
|
System.ComponentModel.DesignerCategoryAttribute("code"),
|
|
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
|
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
|
Partial Public Class DeliveryTerms
|
|
|
|
#Region "Private fields"
|
|
Private _tODCode As String
|
|
|
|
Private _locationCode As String
|
|
|
|
Private _tODPlace As String
|
|
|
|
Private _tODDetails As String
|
|
|
|
Private Shared sSerializer As XmlSerializer
|
|
#End Region
|
|
|
|
Public Property TODCode() As String
|
|
Get
|
|
Return Me._tODCode
|
|
End Get
|
|
Set
|
|
Me._tODCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property locationCode() As String
|
|
Get
|
|
Return Me._locationCode
|
|
End Get
|
|
Set
|
|
Me._locationCode = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property TODPlace() As String
|
|
Get
|
|
Return Me._tODPlace
|
|
End Get
|
|
Set
|
|
Me._tODPlace = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property TODDetails() As String
|
|
Get
|
|
Return Me._tODDetails
|
|
End Get
|
|
Set
|
|
Me._tODDetails = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New XmlSerializerFactory().CreateSerializer(GetType(DeliveryTerms))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
''' <summary>
|
|
''' Serializes current DeliveryTerms object into an XML string
|
|
''' </summary>
|
|
''' <returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Dim xmlWriterSettings As System.Xml.XmlWriterSettings = New System.Xml.XmlWriterSettings()
|
|
xmlWriterSettings.Indent = True
|
|
xmlWriterSettings.IndentChars = " "
|
|
Dim xmlWriter As System.Xml.XmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings)
|
|
Serializer.Serialize(xmlWriter, Me)
|
|
memoryStream.Seek(0, SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' Deserializes workflow markup into an DeliveryTerms object
|
|
''' </summary>
|
|
''' <param name="input">string workflow markup to deserialize</param>
|
|
''' <param name="obj">Output DeliveryTerms object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal input As String, ByRef obj As DeliveryTerms, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, DeliveryTerms)
|
|
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 DeliveryTerms) 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 DeliveryTerms
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(input)
|
|
Return CType(Serializer.Deserialize(XmlReader.Create(stringReader)), DeliveryTerms)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal s As System.IO.Stream) As DeliveryTerms
|
|
Return CType(Serializer.Deserialize(s), DeliveryTerms)
|
|
End Function
|
|
#End Region
|
|
|
|
''' <summary>
|
|
''' Serializes current DeliveryTerms object into file
|
|
''' </summary>
|
|
''' <param name="fileName">full path of outupt xml file</param>
|
|
''' <param name="exception">output Exception value if failed</param>
|
|
''' <returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Deserializes xml markup from file into an DeliveryTerms object
|
|
''' </summary>
|
|
''' <param name="fileName">string xml file to load and deserialize</param>
|
|
''' <param name="obj">Output DeliveryTerms object</param>
|
|
''' <param name="exception">output Exception value if deserialize failed</param>
|
|
''' <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As DeliveryTerms, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, DeliveryTerms)
|
|
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 DeliveryTerms) 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 DeliveryTerms
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
End Class
|
|
End Namespace
|