9055 lines
338 KiB
VB.net
9055 lines
338 KiB
VB.net
'' ------------------------------------------------------------------------------
|
|
'' <auto-generated>
|
|
'' Generated by Xsd2Code. Version 3.4.1.33667 Microsoft Reciprocal License (Ms-RL)
|
|
'' <NameSpace>MicCustExportComponents</NameSpace><Collection>List</Collection><codeType>VisualBasic</codeType><EnableDataBinding>False</EnableDataBinding><EnableLazyLoading>False</EnableLazyLoading><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>False</EnableSummaryComment><VirtualProp>False</VirtualProp><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><GenerateCloneMethod>False</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net40</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>False</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableEncoding>False</EnableEncoding><AutomaticProperties>False</AutomaticProperties><GenerateShouldSerialize>False</GenerateShouldSerialize><DisableDebug>False</DisableDebug><PropNameSpecified>Default</PropNameSpecified><Encoder>UTF8</Encoder><CustomUsings></CustomUsings><ExcludeIncludedTypes>False</ExcludeIncludedTypes><EnableInitializeFields>True</EnableInitializeFields>
|
|
'' </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.Collections.Generic
|
|
|
|
Namespace MicCustExportComponents
|
|
|
|
Partial Public Class TItem
|
|
|
|
Private itemNoField As String
|
|
|
|
Private itemDescField As String
|
|
|
|
Private commCodeField As String
|
|
|
|
Private prodGrField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property itemNo() As String
|
|
Get
|
|
Return Me.itemNoField
|
|
End Get
|
|
Set
|
|
Me.itemNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property itemDesc() As String
|
|
Get
|
|
Return Me.itemDescField
|
|
End Get
|
|
Set
|
|
Me.itemDescField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property commCode() As String
|
|
Get
|
|
Return Me.commCodeField
|
|
End Get
|
|
Set
|
|
Me.commCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prodGr() As String
|
|
Get
|
|
Return Me.prodGrField
|
|
End Get
|
|
Set
|
|
Me.prodGrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TItem))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TItem object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TItem object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TItem object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TItem, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TItem)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TItem) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TItem
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TItem)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TItem 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 TItem object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TItem object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TItem, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TItem)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TItem) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TItem
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TAddress
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNameField As List(Of String)
|
|
|
|
Private addrStreetField As String
|
|
|
|
Private addrLocField As String
|
|
|
|
Private addrCtryField As String
|
|
|
|
Private addrStateField As String
|
|
|
|
Private addrZipField As String
|
|
|
|
Private addrTinField As String
|
|
|
|
Private addrVatIdField As String
|
|
|
|
Private addrEoriField As String
|
|
|
|
Private addrNatTField As String
|
|
|
|
Private branchNoField As String
|
|
|
|
Private addrKvbField As String
|
|
|
|
Private contactPersonField As TContactPerson
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.contactPersonField = New TContactPerson()
|
|
Me.addrNameField = New List(Of String)()
|
|
End Sub
|
|
|
|
Public Property addrNo() As String
|
|
Get
|
|
Return Me.addrNoField
|
|
End Get
|
|
Set
|
|
Me.addrNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrName() As List(Of String)
|
|
Get
|
|
Return Me.addrNameField
|
|
End Get
|
|
Set
|
|
Me.addrNameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrStreet() As String
|
|
Get
|
|
Return Me.addrStreetField
|
|
End Get
|
|
Set
|
|
Me.addrStreetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrLoc() As String
|
|
Get
|
|
Return Me.addrLocField
|
|
End Get
|
|
Set
|
|
Me.addrLocField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrCtry() As String
|
|
Get
|
|
Return Me.addrCtryField
|
|
End Get
|
|
Set
|
|
Me.addrCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrState() As String
|
|
Get
|
|
Return Me.addrStateField
|
|
End Get
|
|
Set
|
|
Me.addrStateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrZip() As String
|
|
Get
|
|
Return Me.addrZipField
|
|
End Get
|
|
Set
|
|
Me.addrZipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrTin() As String
|
|
Get
|
|
Return Me.addrTinField
|
|
End Get
|
|
Set
|
|
Me.addrTinField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrVatId() As String
|
|
Get
|
|
Return Me.addrVatIdField
|
|
End Get
|
|
Set
|
|
Me.addrVatIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrEori() As String
|
|
Get
|
|
Return Me.addrEoriField
|
|
End Get
|
|
Set
|
|
Me.addrEoriField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNatT() As String
|
|
Get
|
|
Return Me.addrNatTField
|
|
End Get
|
|
Set
|
|
Me.addrNatTField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrKvb() As String
|
|
Get
|
|
Return Me.addrKvbField
|
|
End Get
|
|
Set
|
|
Me.addrKvbField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contactPerson() As TContactPerson
|
|
Get
|
|
Return Me.contactPersonField
|
|
End Get
|
|
Set
|
|
Me.contactPersonField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAddress))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAddress object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TAddress object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddress)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAddress
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAddress)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAddress 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 TAddress object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddress)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAddress
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TContactPerson
|
|
|
|
Private jobField As String
|
|
|
|
Private nameField As String
|
|
|
|
Private emailField As String
|
|
|
|
Private phoneField As String
|
|
|
|
Private faxField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property job() As String
|
|
Get
|
|
Return Me.jobField
|
|
End Get
|
|
Set
|
|
Me.jobField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property name() As String
|
|
Get
|
|
Return Me.nameField
|
|
End Get
|
|
Set
|
|
Me.nameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property email() As String
|
|
Get
|
|
Return Me.emailField
|
|
End Get
|
|
Set
|
|
Me.emailField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property phone() As String
|
|
Get
|
|
Return Me.phoneField
|
|
End Get
|
|
Set
|
|
Me.phoneField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property fax() As String
|
|
Get
|
|
Return Me.faxField
|
|
End Get
|
|
Set
|
|
Me.faxField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TContactPerson))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TContactPerson object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TContactPerson object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TContactPerson object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TContactPerson, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TContactPerson)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TContactPerson) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TContactPerson
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TContactPerson)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TContactPerson 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 TContactPerson object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TContactPerson object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TContactPerson, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TContactPerson)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TContactPerson) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TContactPerson
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomsOffice
|
|
|
|
Private codeOffField As String
|
|
|
|
Private offCtryField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property codeOff() As String
|
|
Get
|
|
Return Me.codeOffField
|
|
End Get
|
|
Set
|
|
Me.codeOffField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property offCtry() As String
|
|
Get
|
|
Return Me.offCtryField
|
|
End Get
|
|
Set
|
|
Me.offCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomsOffice))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomsOffice object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomsOffice object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomsOffice object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomsOffice, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomsOffice)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomsOffice) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomsOffice
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomsOffice)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomsOffice 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 TCustomsOffice object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomsOffice object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomsOffice, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomsOffice)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomsOffice) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TCustomsOffice
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TMotInl
|
|
|
|
Private motField As String
|
|
|
|
Private natField As String
|
|
|
|
Private typeField As String
|
|
|
|
Private licNoField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property mot() As String
|
|
Get
|
|
Return Me.motField
|
|
End Get
|
|
Set
|
|
Me.motField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nat() As String
|
|
Get
|
|
Return Me.natField
|
|
End Get
|
|
Set
|
|
Me.natField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licNo() As String
|
|
Get
|
|
Return Me.licNoField
|
|
End Get
|
|
Set
|
|
Me.licNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TMotInl))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMotInl object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TMotInl object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMotInl object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMotInl, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMotInl)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMotInl) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TMotInl
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMotInl)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMotInl 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 TMotInl object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMotInl object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMotInl, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMotInl)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMotInl) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TMotInl
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TMot
|
|
|
|
Private motField As String
|
|
|
|
Private natField As String
|
|
|
|
Private typeField As String
|
|
|
|
Private licNoField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property mot() As String
|
|
Get
|
|
Return Me.motField
|
|
End Get
|
|
Set
|
|
Me.motField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nat() As String
|
|
Get
|
|
Return Me.natField
|
|
End Get
|
|
Set
|
|
Me.natField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licNo() As String
|
|
Get
|
|
Return Me.licNoField
|
|
End Get
|
|
Set
|
|
Me.licNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TMot))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMot object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TMot object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMot object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMot, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMot)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMot) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TMot
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMot)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMot 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 TMot object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMot object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMot, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMot)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMot) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TMot
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TFreight
|
|
|
|
Private flagField As String
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private currField As String
|
|
|
|
Private noneuField As Decimal
|
|
|
|
Private noneuFieldSpecified As Boolean
|
|
|
|
Private eunatField As Decimal
|
|
|
|
Private eunatFieldSpecified As Boolean
|
|
|
|
Private natField As Decimal
|
|
|
|
Private natFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property flag() As String
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property noneu() As Decimal
|
|
Get
|
|
Return Me.noneuField
|
|
End Get
|
|
Set
|
|
Me.noneuField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property noneuSpecified() As Boolean
|
|
Get
|
|
Return Me.noneuFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.noneuFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property eunat() As Decimal
|
|
Get
|
|
Return Me.eunatField
|
|
End Get
|
|
Set
|
|
Me.eunatField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property eunatSpecified() As Boolean
|
|
Get
|
|
Return Me.eunatFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.eunatFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nat() As Decimal
|
|
Get
|
|
Return Me.natField
|
|
End Get
|
|
Set
|
|
Me.natField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property natSpecified() As Boolean
|
|
Get
|
|
Return Me.natFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.natFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TFreight))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TFreight object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TFreight object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TFreight object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TFreight, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreight)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TFreight) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TFreight
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TFreight)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TFreight 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 TFreight object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TFreight object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TFreight, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreight)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TFreight) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TFreight
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TAssurance
|
|
|
|
Private flagField As String
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private currField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property flag() As String
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAssurance))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAssurance object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TAssurance object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAssurance object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAssurance, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAssurance)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAssurance) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAssurance
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAssurance)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAssurance 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 TAssurance object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAssurance object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAssurance, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAssurance)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAssurance) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAssurance
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TAddCosts
|
|
|
|
Private typeField As String
|
|
|
|
Private flagField As TAddCostsFlag
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private currField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property flag() As TAddCostsFlag
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAddCosts))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAddCosts object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TAddCosts object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAddCosts object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCosts)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddCosts) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAddCosts
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAddCosts)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAddCosts 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 TAddCosts object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAddCosts object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCosts)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddCosts) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAddCosts
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Public Enum TAddCostsFlag
|
|
|
|
'''<remarks/>
|
|
P
|
|
|
|
'''<remarks/>
|
|
V
|
|
End Enum
|
|
|
|
Partial Public Class TAddCostsShipment
|
|
|
|
Private currField As String
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private flagField As TAddCostsShipmentFlag
|
|
|
|
Private typeField As String
|
|
|
|
Private splitFlagField As AddCostsSplitType
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property flag() As TAddCostsShipmentFlag
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property splitFlag() As AddCostsSplitType
|
|
Get
|
|
Return Me.splitFlagField
|
|
End Get
|
|
Set
|
|
Me.splitFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAddCostsShipment))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAddCostsShipment object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TAddCostsShipment object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAddCostsShipment object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddCostsShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCostsShipment)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddCostsShipment) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAddCostsShipment
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAddCostsShipment)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAddCostsShipment 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 TAddCostsShipment object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAddCostsShipment object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddCostsShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCostsShipment)
|
|
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 TAddCostsShipment) 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 TAddCostsShipment
|
|
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 Region
|
|
End Class
|
|
|
|
Public Enum TAddCostsShipmentFlag
|
|
|
|
'''<remarks/>
|
|
P
|
|
|
|
'''<remarks/>
|
|
V
|
|
End Enum
|
|
|
|
Public Enum AddCostsSplitType
|
|
|
|
'''<remarks/>
|
|
V
|
|
|
|
'''<remarks/>
|
|
Q
|
|
End Enum
|
|
|
|
Partial Public Class TDelTerm
|
|
|
|
Private codeField As String
|
|
|
|
Private descField As String
|
|
|
|
Private code2Field As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property desc() As String
|
|
Get
|
|
Return Me.descField
|
|
End Get
|
|
Set
|
|
Me.descField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property code2() As String
|
|
Get
|
|
Return Me.code2Field
|
|
End Get
|
|
Set
|
|
Me.code2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDelTerm))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDelTerm object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TDelTerm object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDelTerm object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelTerm, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelTerm)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelTerm) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDelTerm
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDelTerm)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDelTerm 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 TDelTerm object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDelTerm object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelTerm, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelTerm)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelTerm) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDelTerm
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TDelNote
|
|
|
|
Private delNoField As String
|
|
|
|
Private positionField As Long
|
|
|
|
Private positionFieldSpecified As Boolean
|
|
|
|
Private delDateField As Date
|
|
|
|
Private delDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property delNo() As String
|
|
Get
|
|
Return Me.delNoField
|
|
End Get
|
|
Set
|
|
Me.delNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property position() As Long
|
|
Get
|
|
Return Me.positionField
|
|
End Get
|
|
Set
|
|
Me.positionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property positionSpecified() As Boolean
|
|
Get
|
|
Return Me.positionFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.positionFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property delDate() As Date
|
|
Get
|
|
Return Me.delDateField
|
|
End Get
|
|
Set
|
|
Me.delDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property delDateSpecified() As Boolean
|
|
Get
|
|
Return Me.delDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.delDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDelNote))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDelNote object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TDelNote object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDelNote object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelNote, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelNote)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelNote) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDelNote
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDelNote)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDelNote 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 TDelNote object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDelNote object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelNote, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelNote)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelNote) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDelNote
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TOrder
|
|
|
|
Private ordNoField As String
|
|
|
|
Private ordDateField As Date
|
|
|
|
Private ordDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property ordNo() As String
|
|
Get
|
|
Return Me.ordNoField
|
|
End Get
|
|
Set
|
|
Me.ordNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ordDate() As Date
|
|
Get
|
|
Return Me.ordDateField
|
|
End Get
|
|
Set
|
|
Me.ordDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property ordDateSpecified() As Boolean
|
|
Get
|
|
Return Me.ordDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.ordDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TOrder))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TOrder object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TOrder object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TOrder object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TOrder, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOrder)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TOrder) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TOrder
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TOrder)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TOrder 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 TOrder object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TOrder object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TOrder, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOrder)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TOrder) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TOrder
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TBomNo
|
|
|
|
Private noField As String
|
|
|
|
Private varField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property no() As String
|
|
Get
|
|
Return Me.noField
|
|
End Get
|
|
Set
|
|
Me.noField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property var() As String
|
|
Get
|
|
Return Me.varField
|
|
End Get
|
|
Set
|
|
Me.varField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TBomNo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TBomNo object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TBomNo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TBomNo object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TBomNo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TBomNo)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TBomNo) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TBomNo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TBomNo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TBomNo 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 TBomNo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TBomNo object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TBomNo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TBomNo)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TBomNo) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TBomNo
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TAttribute
|
|
|
|
Private attribTypeField As String
|
|
|
|
Private attribTextField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property attribType() As String
|
|
Get
|
|
Return Me.attribTypeField
|
|
End Get
|
|
Set
|
|
Me.attribTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property attribText() As String
|
|
Get
|
|
Return Me.attribTextField
|
|
End Get
|
|
Set
|
|
Me.attribTextField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAttribute))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAttribute object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TAttribute object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAttribute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAttribute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAttribute)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAttribute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAttribute
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAttribute)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAttribute 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 TAttribute object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAttribute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAttribute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAttribute)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAttribute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAttribute
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TPartner
|
|
|
|
Private partnerTypField As String
|
|
|
|
Private partnerAddressField As TPartnerPartnerAddress
|
|
|
|
Private partnerRelationField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.partnerAddressField = New TPartnerPartnerAddress()
|
|
End Sub
|
|
|
|
Public Property partnerTyp() As String
|
|
Get
|
|
Return Me.partnerTypField
|
|
End Get
|
|
Set
|
|
Me.partnerTypField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerAddress() As TPartnerPartnerAddress
|
|
Get
|
|
Return Me.partnerAddressField
|
|
End Get
|
|
Set
|
|
Me.partnerAddressField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerRelation() As String
|
|
Get
|
|
Return Me.partnerRelationField
|
|
End Get
|
|
Set
|
|
Me.partnerRelationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TPartner))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPartner object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TPartner object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPartner object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartner, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartner)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartner) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TPartner
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPartner)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPartner 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 TPartner object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPartner object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartner, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartner)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartner) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TPartner
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TPartnerPartnerAddress
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNoTypeField As String
|
|
|
|
Private addrNameField As List(Of String)
|
|
|
|
Private addrStreetField As String
|
|
|
|
Private addrStreet2Field As String
|
|
|
|
Private addrLocField As String
|
|
|
|
Private addrCtryField As String
|
|
|
|
Private addrStateField As String
|
|
|
|
Private addrZipField As String
|
|
|
|
Private addrTinField As String
|
|
|
|
Private addrEoriField As String
|
|
|
|
Private addrNatTField As String
|
|
|
|
Private branchNoField As String
|
|
|
|
Private addrKvbField As String
|
|
|
|
Private addrInfoField As String
|
|
|
|
Private contactPersonField As TContactPerson
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.contactPersonField = New TContactPerson()
|
|
Me.addrNameField = New List(Of String)()
|
|
End Sub
|
|
|
|
Public Property addrNo() As String
|
|
Get
|
|
Return Me.addrNoField
|
|
End Get
|
|
Set
|
|
Me.addrNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNoType() As String
|
|
Get
|
|
Return Me.addrNoTypeField
|
|
End Get
|
|
Set
|
|
Me.addrNoTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrName() As List(Of String)
|
|
Get
|
|
Return Me.addrNameField
|
|
End Get
|
|
Set
|
|
Me.addrNameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrStreet() As String
|
|
Get
|
|
Return Me.addrStreetField
|
|
End Get
|
|
Set
|
|
Me.addrStreetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrStreet2() As String
|
|
Get
|
|
Return Me.addrStreet2Field
|
|
End Get
|
|
Set
|
|
Me.addrStreet2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrLoc() As String
|
|
Get
|
|
Return Me.addrLocField
|
|
End Get
|
|
Set
|
|
Me.addrLocField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrCtry() As String
|
|
Get
|
|
Return Me.addrCtryField
|
|
End Get
|
|
Set
|
|
Me.addrCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrState() As String
|
|
Get
|
|
Return Me.addrStateField
|
|
End Get
|
|
Set
|
|
Me.addrStateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrZip() As String
|
|
Get
|
|
Return Me.addrZipField
|
|
End Get
|
|
Set
|
|
Me.addrZipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrTin() As String
|
|
Get
|
|
Return Me.addrTinField
|
|
End Get
|
|
Set
|
|
Me.addrTinField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrEori() As String
|
|
Get
|
|
Return Me.addrEoriField
|
|
End Get
|
|
Set
|
|
Me.addrEoriField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNatT() As String
|
|
Get
|
|
Return Me.addrNatTField
|
|
End Get
|
|
Set
|
|
Me.addrNatTField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrKvb() As String
|
|
Get
|
|
Return Me.addrKvbField
|
|
End Get
|
|
Set
|
|
Me.addrKvbField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrInfo() As String
|
|
Get
|
|
Return Me.addrInfoField
|
|
End Get
|
|
Set
|
|
Me.addrInfoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contactPerson() As TContactPerson
|
|
Get
|
|
Return Me.contactPersonField
|
|
End Get
|
|
Set
|
|
Me.contactPersonField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TPartnerPartnerAddress))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPartnerPartnerAddress object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TPartnerPartnerAddress object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPartnerPartnerAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartnerPartnerAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartnerPartnerAddress)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartnerPartnerAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TPartnerPartnerAddress
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPartnerPartnerAddress)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPartnerPartnerAddress 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 TPartnerPartnerAddress object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPartnerPartnerAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartnerPartnerAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartnerPartnerAddress)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartnerPartnerAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TPartnerPartnerAddress
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TDeclType
|
|
|
|
Private type1Field As String
|
|
|
|
Private type2Field As String
|
|
|
|
Private type3Field As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property type1() As String
|
|
Get
|
|
Return Me.type1Field
|
|
End Get
|
|
Set
|
|
Me.type1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type2() As String
|
|
Get
|
|
Return Me.type2Field
|
|
End Get
|
|
Set
|
|
Me.type2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type3() As String
|
|
Get
|
|
Return Me.type3Field
|
|
End Get
|
|
Set
|
|
Me.type3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDeclType))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDeclType object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TDeclType object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDeclType object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDeclType, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeclType)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDeclType) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDeclType
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDeclType)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDeclType 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 TDeclType object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDeclType object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeclType, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeclType)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeclType) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDeclType
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TLocationOfGoods
|
|
|
|
Private codeField As String
|
|
|
|
Private streetField As String
|
|
|
|
Private zipField As String
|
|
|
|
Private locField As String
|
|
|
|
Private additField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property street() As String
|
|
Get
|
|
Return Me.streetField
|
|
End Get
|
|
Set
|
|
Me.streetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property zip() As String
|
|
Get
|
|
Return Me.zipField
|
|
End Get
|
|
Set
|
|
Me.zipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property loc() As String
|
|
Get
|
|
Return Me.locField
|
|
End Get
|
|
Set
|
|
Me.locField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addit() As String
|
|
Get
|
|
Return Me.additField
|
|
End Get
|
|
Set
|
|
Me.additField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TLocationOfGoods))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TLocationOfGoods object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TLocationOfGoods object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TLocationOfGoods object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TLocationOfGoods, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TLocationOfGoods)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TLocationOfGoods) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TLocationOfGoods
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TLocationOfGoods)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TLocationOfGoods 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 TLocationOfGoods object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TLocationOfGoods object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TLocationOfGoods, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TLocationOfGoods)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TLocationOfGoods) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TLocationOfGoods
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TImportQuantity
|
|
|
|
Private qualifierField As String
|
|
|
|
Private unitField As String
|
|
|
|
Private valueField As Decimal
|
|
|
|
Private valueFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property qualifier() As String
|
|
Get
|
|
Return Me.qualifierField
|
|
End Get
|
|
Set
|
|
Me.qualifierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unit() As String
|
|
Get
|
|
Return Me.unitField
|
|
End Get
|
|
Set
|
|
Me.unitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property value() As Decimal
|
|
Get
|
|
Return Me.valueField
|
|
End Get
|
|
Set
|
|
Me.valueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property valueSpecified() As Boolean
|
|
Get
|
|
Return Me.valueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.valueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TImportQuantity))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TImportQuantity object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TImportQuantity object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TImportQuantity object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportQuantity, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportQuantity)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportQuantity) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TImportQuantity
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TImportQuantity)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TImportQuantity 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 TImportQuantity object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TImportQuantity object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportQuantity, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportQuantity)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportQuantity) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TImportQuantity
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TImportReference
|
|
|
|
Private typeField As String
|
|
|
|
Private authNrField As String
|
|
|
|
Private impShpNrField As String
|
|
|
|
Private lineNoField As String
|
|
|
|
Private authRegistryNoField As String
|
|
|
|
Private commCodeField As String
|
|
|
|
Private usualTreatmentField As String
|
|
|
|
Private importAtlasField As String
|
|
|
|
Private addInfoField As String
|
|
|
|
Private quantityField As TImportQuantity
|
|
|
|
Private tradeQuantityField As TImportQuantity
|
|
|
|
Private packageQuantityField As Decimal
|
|
|
|
Private packageQuantityFieldSpecified As Boolean
|
|
|
|
Private netMassField As Decimal
|
|
|
|
Private netMassFieldSpecified As Boolean
|
|
|
|
Private grossMassField As Decimal
|
|
|
|
Private grossMassFieldSpecified As Boolean
|
|
|
|
Private statisticalQuantityField As Decimal
|
|
|
|
Private statisticalQuantityFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.tradeQuantityField = New TImportQuantity()
|
|
Me.quantityField = New TImportQuantity()
|
|
End Sub
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authNr() As String
|
|
Get
|
|
Return Me.authNrField
|
|
End Get
|
|
Set
|
|
Me.authNrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property impShpNr() As String
|
|
Get
|
|
Return Me.impShpNrField
|
|
End Get
|
|
Set
|
|
Me.impShpNrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property lineNo() As String
|
|
Get
|
|
Return Me.lineNoField
|
|
End Get
|
|
Set
|
|
Me.lineNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authRegistryNo() As String
|
|
Get
|
|
Return Me.authRegistryNoField
|
|
End Get
|
|
Set
|
|
Me.authRegistryNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property commCode() As String
|
|
Get
|
|
Return Me.commCodeField
|
|
End Get
|
|
Set
|
|
Me.commCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property usualTreatment() As String
|
|
Get
|
|
Return Me.usualTreatmentField
|
|
End Get
|
|
Set
|
|
Me.usualTreatmentField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importAtlas() As String
|
|
Get
|
|
Return Me.importAtlasField
|
|
End Get
|
|
Set
|
|
Me.importAtlasField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addInfo() As String
|
|
Get
|
|
Return Me.addInfoField
|
|
End Get
|
|
Set
|
|
Me.addInfoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property quantity() As TImportQuantity
|
|
Get
|
|
Return Me.quantityField
|
|
End Get
|
|
Set
|
|
Me.quantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tradeQuantity() As TImportQuantity
|
|
Get
|
|
Return Me.tradeQuantityField
|
|
End Get
|
|
Set
|
|
Me.tradeQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property packageQuantity() As Decimal
|
|
Get
|
|
Return Me.packageQuantityField
|
|
End Get
|
|
Set
|
|
Me.packageQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property packageQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.packageQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.packageQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property netMass() As Decimal
|
|
Get
|
|
Return Me.netMassField
|
|
End Get
|
|
Set
|
|
Me.netMassField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property netMassSpecified() As Boolean
|
|
Get
|
|
Return Me.netMassFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.netMassFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property grossMass() As Decimal
|
|
Get
|
|
Return Me.grossMassField
|
|
End Get
|
|
Set
|
|
Me.grossMassField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property grossMassSpecified() As Boolean
|
|
Get
|
|
Return Me.grossMassFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.grossMassFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalQuantity() As Decimal
|
|
Get
|
|
Return Me.statisticalQuantityField
|
|
End Get
|
|
Set
|
|
Me.statisticalQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property statisticalQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.statisticalQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.statisticalQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TImportReference))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TImportReference object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TImportReference object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TImportReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportReference)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportReference) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TImportReference
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TImportReference)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TImportReference 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 TImportReference object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TImportReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportReference)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportReference) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TImportReference
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TRoute
|
|
|
|
Private countryField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property country() As String
|
|
Get
|
|
Return Me.countryField
|
|
End Get
|
|
Set
|
|
Me.countryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TRoute))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TRoute object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TRoute object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TRoute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TRoute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRoute)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TRoute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TRoute
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TRoute)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TRoute 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 TRoute object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TRoute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TRoute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRoute)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TRoute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TRoute
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TMotArrivalDispatch
|
|
|
|
Private motField As String
|
|
|
|
Private natField As String
|
|
|
|
Private licNoField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property mot() As String
|
|
Get
|
|
Return Me.motField
|
|
End Get
|
|
Set
|
|
Me.motField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nat() As String
|
|
Get
|
|
Return Me.natField
|
|
End Get
|
|
Set
|
|
Me.natField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licNo() As String
|
|
Get
|
|
Return Me.licNoField
|
|
End Get
|
|
Set
|
|
Me.licNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TMotArrivalDispatch))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMotArrivalDispatch object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TMotArrivalDispatch object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMotArrivalDispatch object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMotArrivalDispatch, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMotArrivalDispatch)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMotArrivalDispatch) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TMotArrivalDispatch
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMotArrivalDispatch)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMotArrivalDispatch 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 TMotArrivalDispatch object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMotArrivalDispatch object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMotArrivalDispatch, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMotArrivalDispatch)
|
|
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 TMotArrivalDispatch) 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 TMotArrivalDispatch
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TDelTermArrival
|
|
|
|
Private codeField As String
|
|
|
|
Private code2Field As String
|
|
|
|
Private descField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property code2() As String
|
|
Get
|
|
Return Me.code2Field
|
|
End Get
|
|
Set
|
|
Me.code2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property desc() As String
|
|
Get
|
|
Return Me.descField
|
|
End Get
|
|
Set
|
|
Me.descField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDelTermArrival))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDelTermArrival object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TDelTermArrival object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDelTermArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelTermArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelTermArrival)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelTermArrival) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDelTermArrival
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDelTermArrival)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDelTermArrival 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 TDelTermArrival object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDelTermArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelTermArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelTermArrival)
|
|
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 TDelTermArrival) 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 TDelTermArrival
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TItemNdp
|
|
|
|
Private partNumberField As String
|
|
|
|
Private partDescriptionField As String
|
|
|
|
Private prodGrField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property partNumber() As String
|
|
Get
|
|
Return Me.partNumberField
|
|
End Get
|
|
Set
|
|
Me.partNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partDescription() As String
|
|
Get
|
|
Return Me.partDescriptionField
|
|
End Get
|
|
Set
|
|
Me.partDescriptionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prodGr() As String
|
|
Get
|
|
Return Me.prodGrField
|
|
End Get
|
|
Set
|
|
Me.prodGrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TItemNdp))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TItemNdp object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TItemNdp object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TItemNdp object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TItemNdp, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TItemNdp)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TItemNdp) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TItemNdp
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TItemNdp)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TItemNdp 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 TItemNdp object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TItemNdp object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TItemNdp, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TItemNdp)
|
|
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 TItemNdp) 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 TItemNdp
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TLicenseArrival
|
|
|
|
Private licenseNoField As String
|
|
|
|
Private licenseDateField As Date
|
|
|
|
Private licenseDateFieldSpecified As Boolean
|
|
|
|
Private licenseNotRequiredField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property licenseNo() As String
|
|
Get
|
|
Return Me.licenseNoField
|
|
End Get
|
|
Set
|
|
Me.licenseNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licenseDate() As Date
|
|
Get
|
|
Return Me.licenseDateField
|
|
End Get
|
|
Set
|
|
Me.licenseDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property licenseDateSpecified() As Boolean
|
|
Get
|
|
Return Me.licenseDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.licenseDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licenseNotRequired() As String
|
|
Get
|
|
Return Me.licenseNotRequiredField
|
|
End Get
|
|
Set
|
|
Me.licenseNotRequiredField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TLicenseArrival))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TLicenseArrival object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TLicenseArrival object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TLicenseArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TLicenseArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TLicenseArrival)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TLicenseArrival) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TLicenseArrival
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TLicenseArrival)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TLicenseArrival 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 TLicenseArrival object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TLicenseArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TLicenseArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TLicenseArrival)
|
|
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 TLicenseArrival) 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 TLicenseArrival
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TTariffCode
|
|
|
|
Private hsCodeField As String
|
|
|
|
Private vatCodeField As String
|
|
|
|
Private exciseTaxCodeField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property hsCode() As String
|
|
Get
|
|
Return Me.hsCodeField
|
|
End Get
|
|
Set
|
|
Me.hsCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property vatCode() As String
|
|
Get
|
|
Return Me.vatCodeField
|
|
End Get
|
|
Set
|
|
Me.vatCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property exciseTaxCode() As String
|
|
Get
|
|
Return Me.exciseTaxCodeField
|
|
End Get
|
|
Set
|
|
Me.exciseTaxCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TTariffCode))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TTariffCode object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TTariffCode object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TTariffCode object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TTariffCode, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TTariffCode)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TTariffCode) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TTariffCode
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TTariffCode)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TTariffCode 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 TTariffCode object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TTariffCode object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TTariffCode, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TTariffCode)
|
|
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 TTariffCode) 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 TTariffCode
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TDocumentArrival
|
|
|
|
Private docTypeField As String
|
|
|
|
Private docNoField As String
|
|
|
|
Private docDateField As Date
|
|
|
|
Private docDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property docType() As String
|
|
Get
|
|
Return Me.docTypeField
|
|
End Get
|
|
Set
|
|
Me.docTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docNo() As String
|
|
Get
|
|
Return Me.docNoField
|
|
End Get
|
|
Set
|
|
Me.docNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docDate() As Date
|
|
Get
|
|
Return Me.docDateField
|
|
End Get
|
|
Set
|
|
Me.docDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property docDateSpecified() As Boolean
|
|
Get
|
|
Return Me.docDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.docDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDocumentArrival))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDocumentArrival object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TDocumentArrival object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDocumentArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDocumentArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDocumentArrival)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDocumentArrival) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDocumentArrival
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDocumentArrival)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDocumentArrival 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 TDocumentArrival object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDocumentArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDocumentArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDocumentArrival)
|
|
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 TDocumentArrival) 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 TDocumentArrival
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TPackageArrival
|
|
|
|
Private packageCountField As Integer
|
|
|
|
Private packageCountFieldSpecified As Boolean
|
|
|
|
Private packageTypeField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property packageCount() As Integer
|
|
Get
|
|
Return Me.packageCountField
|
|
End Get
|
|
Set
|
|
Me.packageCountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property packageCountSpecified() As Boolean
|
|
Get
|
|
Return Me.packageCountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.packageCountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property packageType() As String
|
|
Get
|
|
Return Me.packageTypeField
|
|
End Get
|
|
Set
|
|
Me.packageTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TPackageArrival))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPackageArrival object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TPackageArrival object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPackageArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPackageArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageArrival)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPackageArrival) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TPackageArrival
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPackageArrival)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPackageArrival 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 TPackageArrival object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPackageArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPackageArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageArrival)
|
|
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 TPackageArrival) 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 TPackageArrival
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TAdditionalCodes
|
|
|
|
Private addCode1Field As String
|
|
|
|
Private addCode2Field As String
|
|
|
|
Private addCode3Field As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property addCode1() As String
|
|
Get
|
|
Return Me.addCode1Field
|
|
End Get
|
|
Set
|
|
Me.addCode1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCode2() As String
|
|
Get
|
|
Return Me.addCode2Field
|
|
End Get
|
|
Set
|
|
Me.addCode2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCode3() As String
|
|
Get
|
|
Return Me.addCode3Field
|
|
End Get
|
|
Set
|
|
Me.addCode3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAdditionalCodes))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAdditionalCodes object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TAdditionalCodes object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAdditionalCodes object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAdditionalCodes, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAdditionalCodes)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAdditionalCodes) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAdditionalCodes
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAdditionalCodes)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAdditionalCodes 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 TAdditionalCodes object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAdditionalCodes object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAdditionalCodes, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAdditionalCodes)
|
|
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 TAdditionalCodes) 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 TAdditionalCodes
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TPrefDocumentArrival
|
|
|
|
Private prefTypeField As String
|
|
|
|
Private prefNoField As String
|
|
|
|
Private prefDateField As Date
|
|
|
|
Private prefDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property prefType() As String
|
|
Get
|
|
Return Me.prefTypeField
|
|
End Get
|
|
Set
|
|
Me.prefTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prefNo() As String
|
|
Get
|
|
Return Me.prefNoField
|
|
End Get
|
|
Set
|
|
Me.prefNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prefDate() As Date
|
|
Get
|
|
Return Me.prefDateField
|
|
End Get
|
|
Set
|
|
Me.prefDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property prefDateSpecified() As Boolean
|
|
Get
|
|
Return Me.prefDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.prefDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TPrefDocumentArrival))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPrefDocumentArrival object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TPrefDocumentArrival object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPrefDocumentArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPrefDocumentArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPrefDocumentArrival)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPrefDocumentArrival) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TPrefDocumentArrival
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPrefDocumentArrival)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPrefDocumentArrival 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 TPrefDocumentArrival object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPrefDocumentArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPrefDocumentArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPrefDocumentArrival)
|
|
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 TPrefDocumentArrival) 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 TPrefDocumentArrival
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TOrderArrival
|
|
|
|
Private ordNoField As String
|
|
|
|
Private ordLineNoField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property ordNo() As String
|
|
Get
|
|
Return Me.ordNoField
|
|
End Get
|
|
Set
|
|
Me.ordNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ordLineNo() As String
|
|
Get
|
|
Return Me.ordLineNoField
|
|
End Get
|
|
Set
|
|
Me.ordLineNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TOrderArrival))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TOrderArrival object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TOrderArrival object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TOrderArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TOrderArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOrderArrival)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TOrderArrival) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TOrderArrival
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TOrderArrival)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TOrderArrival 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 TOrderArrival object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TOrderArrival object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TOrderArrival, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOrderArrival)
|
|
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 TOrderArrival) 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 TOrderArrival
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TInf
|
|
|
|
Private infField As String
|
|
|
|
Private infDutyAmountField As Decimal
|
|
|
|
Private infDutyAmountFieldSpecified As Boolean
|
|
|
|
Private infDutyAmountCurrField As String
|
|
|
|
Private infDutyBasisField As Decimal
|
|
|
|
Private infDutyBasisFieldSpecified As Boolean
|
|
|
|
Private infDutyBet1Field As Decimal
|
|
|
|
Private infDutyBet1FieldSpecified As Boolean
|
|
|
|
Private infInterestAmountField As Decimal
|
|
|
|
Private infInterestAmountFieldSpecified As Boolean
|
|
|
|
Private infInterestAmountCurrField As String
|
|
|
|
Private infEndUseAmountField As Decimal
|
|
|
|
Private infEndUseAmountFieldSpecified As Boolean
|
|
|
|
Private infEndUseAmountCurrField As String
|
|
|
|
Private infDuty1TypeField As String
|
|
|
|
Private infDuty1BetField As Decimal
|
|
|
|
Private infDuty1BetFieldSpecified As Boolean
|
|
|
|
Private infDuty1CurrField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property inf() As String
|
|
Get
|
|
Return Me.infField
|
|
End Get
|
|
Set
|
|
Me.infField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDutyAmount() As Decimal
|
|
Get
|
|
Return Me.infDutyAmountField
|
|
End Get
|
|
Set
|
|
Me.infDutyAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infDutyAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.infDutyAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infDutyAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDutyAmountCurr() As String
|
|
Get
|
|
Return Me.infDutyAmountCurrField
|
|
End Get
|
|
Set
|
|
Me.infDutyAmountCurrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDutyBasis() As Decimal
|
|
Get
|
|
Return Me.infDutyBasisField
|
|
End Get
|
|
Set
|
|
Me.infDutyBasisField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infDutyBasisSpecified() As Boolean
|
|
Get
|
|
Return Me.infDutyBasisFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infDutyBasisFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDutyBet1() As Decimal
|
|
Get
|
|
Return Me.infDutyBet1Field
|
|
End Get
|
|
Set
|
|
Me.infDutyBet1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infDutyBet1Specified() As Boolean
|
|
Get
|
|
Return Me.infDutyBet1FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infDutyBet1FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infInterestAmount() As Decimal
|
|
Get
|
|
Return Me.infInterestAmountField
|
|
End Get
|
|
Set
|
|
Me.infInterestAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infInterestAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.infInterestAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infInterestAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infInterestAmountCurr() As String
|
|
Get
|
|
Return Me.infInterestAmountCurrField
|
|
End Get
|
|
Set
|
|
Me.infInterestAmountCurrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infEndUseAmount() As Decimal
|
|
Get
|
|
Return Me.infEndUseAmountField
|
|
End Get
|
|
Set
|
|
Me.infEndUseAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infEndUseAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.infEndUseAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infEndUseAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infEndUseAmountCurr() As String
|
|
Get
|
|
Return Me.infEndUseAmountCurrField
|
|
End Get
|
|
Set
|
|
Me.infEndUseAmountCurrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDuty1Type() As String
|
|
Get
|
|
Return Me.infDuty1TypeField
|
|
End Get
|
|
Set
|
|
Me.infDuty1TypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDuty1Bet() As Decimal
|
|
Get
|
|
Return Me.infDuty1BetField
|
|
End Get
|
|
Set
|
|
Me.infDuty1BetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infDuty1BetSpecified() As Boolean
|
|
Get
|
|
Return Me.infDuty1BetFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infDuty1BetFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDuty1Curr() As String
|
|
Get
|
|
Return Me.infDuty1CurrField
|
|
End Get
|
|
Set
|
|
Me.infDuty1CurrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TInf))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInf object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TInf object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInf object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TInf, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInf)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TInf) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TInf
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInf)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInf 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 TInf object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInf object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TInf, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInf)
|
|
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 TInf) 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 TInf
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerFields
|
|
|
|
Private textsField As List(Of TCustomerText)
|
|
|
|
Private datesField As List(Of TCustomerDate)
|
|
|
|
Private flagsField As List(Of TCustomerFlag)
|
|
|
|
Private numbersField As List(Of TCustomerNumber)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.numbersField = New List(Of TCustomerNumber)()
|
|
Me.flagsField = New List(Of TCustomerFlag)()
|
|
Me.datesField = New List(Of TCustomerDate)()
|
|
Me.textsField = New List(Of TCustomerText)()
|
|
End Sub
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("text", IsNullable:=False)>
|
|
Public Property texts() As List(Of TCustomerText)
|
|
Get
|
|
Return Me.textsField
|
|
End Get
|
|
Set
|
|
Me.textsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("date", IsNullable:=False)>
|
|
Public Property dates() As List(Of TCustomerDate)
|
|
Get
|
|
Return Me.datesField
|
|
End Get
|
|
Set
|
|
Me.datesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("flag", IsNullable:=False)>
|
|
Public Property flags() As List(Of TCustomerFlag)
|
|
Get
|
|
Return Me.flagsField
|
|
End Get
|
|
Set
|
|
Me.flagsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("number", IsNullable:=False)>
|
|
Public Property numbers() As List(Of TCustomerNumber)
|
|
Get
|
|
Return Me.numbersField
|
|
End Get
|
|
Set
|
|
Me.numbersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerFields))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerFields object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerFields object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerFields object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerFields, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerFields)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerFields) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerFields
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerFields)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerFields 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 TCustomerFields object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerFields object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerFields, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerFields)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerFields) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TCustomerFields
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerText
|
|
|
|
Private keyField As Integer
|
|
|
|
Private valueField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property key() As Integer
|
|
Get
|
|
Return Me.keyField
|
|
End Get
|
|
Set
|
|
Me.keyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property value() As String
|
|
Get
|
|
Return Me.valueField
|
|
End Get
|
|
Set
|
|
Me.valueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerText))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerText object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerText object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerText object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerText, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerText)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerText) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerText
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerText)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerText 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 TCustomerText object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerText object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerText, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerText)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerText) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TCustomerText
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerDate
|
|
|
|
Private keyField As Integer
|
|
|
|
Private valueField As Date
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property key() As Integer
|
|
Get
|
|
Return Me.keyField
|
|
End Get
|
|
Set
|
|
Me.keyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property value() As Date
|
|
Get
|
|
Return Me.valueField
|
|
End Get
|
|
Set
|
|
Me.valueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerDate))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerDate object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerDate object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerDate object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerDate, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerDate)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerDate) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerDate
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerDate)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerDate 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 TCustomerDate object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerDate object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerDate, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerDate)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerDate) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TCustomerDate
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerFlag
|
|
|
|
Private keyField As Integer
|
|
|
|
Private valueField As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property key() As Integer
|
|
Get
|
|
Return Me.keyField
|
|
End Get
|
|
Set
|
|
Me.keyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property value() As Boolean
|
|
Get
|
|
Return Me.valueField
|
|
End Get
|
|
Set
|
|
Me.valueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerFlag))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerFlag object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerFlag object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerFlag object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerFlag, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerFlag)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerFlag) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerFlag
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerFlag)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerFlag 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 TCustomerFlag object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerFlag object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerFlag, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerFlag)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerFlag) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TCustomerFlag
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerNumber
|
|
|
|
Private keyField As Integer
|
|
|
|
Private valueField As Decimal
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property key() As Integer
|
|
Get
|
|
Return Me.keyField
|
|
End Get
|
|
Set
|
|
Me.keyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property value() As Decimal
|
|
Get
|
|
Return Me.valueField
|
|
End Get
|
|
Set
|
|
Me.valueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerNumber))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerNumber object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerNumber object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerNumber object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerNumber, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerNumber)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerNumber) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerNumber
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerNumber)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerNumber 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 TCustomerNumber object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerNumber object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerNumber, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerNumber)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerNumber) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TCustomerNumber
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerTexts
|
|
|
|
Private textField As List(Of TCustomerText)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.textField = New List(Of TCustomerText)()
|
|
End Sub
|
|
|
|
Public Property text() As List(Of TCustomerText)
|
|
Get
|
|
Return Me.textField
|
|
End Get
|
|
Set
|
|
Me.textField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerTexts))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerTexts object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerTexts object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerTexts object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerTexts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerTexts)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerTexts) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerTexts
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerTexts)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerTexts 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 TCustomerTexts object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerTexts object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerTexts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerTexts)
|
|
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 TCustomerTexts) 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 TCustomerTexts
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerDates
|
|
|
|
Private dateField As List(Of TCustomerDate)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.dateField = New List(Of TCustomerDate)()
|
|
End Sub
|
|
|
|
Public Property [date]() As List(Of TCustomerDate)
|
|
Get
|
|
Return Me.dateField
|
|
End Get
|
|
Set
|
|
Me.dateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerDates))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerDates object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerDates object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerDates object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerDates, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerDates)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerDates) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerDates
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerDates)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerDates 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 TCustomerDates object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerDates object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerDates, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerDates)
|
|
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 TCustomerDates) 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 TCustomerDates
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerFlags
|
|
|
|
Private flagField As List(Of TCustomerFlag)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.flagField = New List(Of TCustomerFlag)()
|
|
End Sub
|
|
|
|
Public Property flag() As List(Of TCustomerFlag)
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerFlags))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerFlags object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerFlags object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerFlags object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerFlags, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerFlags)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerFlags) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerFlags
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerFlags)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerFlags 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 TCustomerFlags object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerFlags object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerFlags, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerFlags)
|
|
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 TCustomerFlags) 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 TCustomerFlags
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomerNumbers
|
|
|
|
Private numberField As List(Of TCustomerNumber)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.numberField = New List(Of TCustomerNumber)()
|
|
End Sub
|
|
|
|
Public Property number() As List(Of TCustomerNumber)
|
|
Get
|
|
Return Me.numberField
|
|
End Get
|
|
Set
|
|
Me.numberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomerNumbers))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomerNumbers object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TCustomerNumbers object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomerNumbers object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerNumbers, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerNumbers)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomerNumbers) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomerNumbers
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomerNumbers)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomerNumbers 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 TCustomerNumbers object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomerNumbers object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomerNumbers, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomerNumbers)
|
|
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 TCustomerNumbers) 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 TCustomerNumbers
|
|
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 Region
|
|
End Class
|
|
|
|
Partial Public Class TErpShipmentData
|
|
|
|
Private erpSystemIdField As String
|
|
|
|
Private clientField As String
|
|
|
|
Private companyCodeField As String
|
|
|
|
Private customerIdField As String
|
|
|
|
Private consolidationCompanyIdField As String
|
|
|
|
Private accountGroupField As String
|
|
|
|
Private shippingPointField As String
|
|
|
|
Private loadingPointField As String
|
|
|
|
Private offshoreField As Boolean
|
|
|
|
Private offshoreFieldSpecified As Boolean
|
|
|
|
Private routeField As String
|
|
|
|
Private salesOrganizationField As String
|
|
|
|
Private distributionChannelField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property erpSystemId() As String
|
|
Get
|
|
Return Me.erpSystemIdField
|
|
End Get
|
|
Set
|
|
Me.erpSystemIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property client() As String
|
|
Get
|
|
Return Me.clientField
|
|
End Get
|
|
Set
|
|
Me.clientField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property companyCode() As String
|
|
Get
|
|
Return Me.companyCodeField
|
|
End Get
|
|
Set
|
|
Me.companyCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customerId() As String
|
|
Get
|
|
Return Me.customerIdField
|
|
End Get
|
|
Set
|
|
Me.customerIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property consolidationCompanyId() As String
|
|
Get
|
|
Return Me.consolidationCompanyIdField
|
|
End Get
|
|
Set
|
|
Me.consolidationCompanyIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property accountGroup() As String
|
|
Get
|
|
Return Me.accountGroupField
|
|
End Get
|
|
Set
|
|
Me.accountGroupField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shippingPoint() As String
|
|
Get
|
|
Return Me.shippingPointField
|
|
End Get
|
|
Set
|
|
Me.shippingPointField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property loadingPoint() As String
|
|
Get
|
|
Return Me.loadingPointField
|
|
End Get
|
|
Set
|
|
Me.loadingPointField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property offshore() As Boolean
|
|
Get
|
|
Return Me.offshoreField
|
|
End Get
|
|
Set
|
|
Me.offshoreField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property offshoreSpecified() As Boolean
|
|
Get
|
|
Return Me.offshoreFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.offshoreFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property route() As String
|
|
Get
|
|
Return Me.routeField
|
|
End Get
|
|
Set
|
|
Me.routeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property salesOrganization() As String
|
|
Get
|
|
Return Me.salesOrganizationField
|
|
End Get
|
|
Set
|
|
Me.salesOrganizationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property distributionChannel() As String
|
|
Get
|
|
Return Me.distributionChannelField
|
|
End Get
|
|
Set
|
|
Me.distributionChannelField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TErpShipmentData))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TErpShipmentData object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TErpShipmentData object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErpShipmentData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpShipmentData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpShipmentData)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpShipmentData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TErpShipmentData
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErpShipmentData)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TErpShipmentData 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 TErpShipmentData object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErpShipmentData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpShipmentData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpShipmentData)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpShipmentData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TErpShipmentData
|
|
Dim file As 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 Region
|
|
End Class
|
|
|
|
Partial Public Class TErpLineData
|
|
|
|
Private legalRegulationField As String
|
|
|
|
Private exportControlClassField As String
|
|
|
|
Private embargoField As String
|
|
|
|
Private licenseTypeField As String
|
|
|
|
Private licenseNumberField As String
|
|
|
|
Private profitCenterField As String
|
|
|
|
Private vZTAField As String
|
|
|
|
Private erpInvoicelinenumberField As String
|
|
|
|
Private erpPartnumberField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property legalRegulation() As String
|
|
Get
|
|
Return Me.legalRegulationField
|
|
End Get
|
|
Set
|
|
Me.legalRegulationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property exportControlClass() As String
|
|
Get
|
|
Return Me.exportControlClassField
|
|
End Get
|
|
Set
|
|
Me.exportControlClassField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property embargo() As String
|
|
Get
|
|
Return Me.embargoField
|
|
End Get
|
|
Set
|
|
Me.embargoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licenseType() As String
|
|
Get
|
|
Return Me.licenseTypeField
|
|
End Get
|
|
Set
|
|
Me.licenseTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licenseNumber() As String
|
|
Get
|
|
Return Me.licenseNumberField
|
|
End Get
|
|
Set
|
|
Me.licenseNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property profitCenter() As String
|
|
Get
|
|
Return Me.profitCenterField
|
|
End Get
|
|
Set
|
|
Me.profitCenterField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property vZTA() As String
|
|
Get
|
|
Return Me.vZTAField
|
|
End Get
|
|
Set
|
|
Me.vZTAField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property erpInvoicelinenumber() As String
|
|
Get
|
|
Return Me.erpInvoicelinenumberField
|
|
End Get
|
|
Set
|
|
Me.erpInvoicelinenumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property erpPartnumber() As String
|
|
Get
|
|
Return Me.erpPartnumberField
|
|
End Get
|
|
Set
|
|
Me.erpPartnumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TErpLineData))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TErpLineData object into an XML document
|
|
'''</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()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.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 TErpLineData object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErpLineData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpLineData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpLineData)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpLineData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TErpLineData
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErpLineData)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TErpLineData 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 TErpLineData object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErpLineData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpLineData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpLineData)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpLineData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TErpLineData
|
|
Dim file As 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 Region
|
|
End Class
|
|
End Namespace
|