17260 lines
599 KiB
VB.net
17260 lines
599 KiB
VB.net
'' ------------------------------------------------------------------------------
|
|
'' <auto-generated>
|
|
'' Generated by Xsd2Code. Version 3.4.1.33667 Microsoft Reciprocal License (Ms-RL)
|
|
'' <NameSpace>MicCustImportShipment</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 MicCustImportShipment
|
|
|
|
Partial Public Class ImportShipment
|
|
|
|
Private shipmentField As TShipment
|
|
|
|
Private invoiceField As List(Of TInvoice)
|
|
|
|
Private schemaVersionField As Decimal
|
|
|
|
Private schemaVersionFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.invoiceField = New List(Of TInvoice)()
|
|
Me.shipmentField = New TShipment()
|
|
End Sub
|
|
|
|
Public Property Shipment() As TShipment
|
|
Get
|
|
Return Me.shipmentField
|
|
End Get
|
|
Set
|
|
Me.shipmentField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Invoice() As List(Of TInvoice)
|
|
Get
|
|
Return Me.invoiceField
|
|
End Get
|
|
Set
|
|
Me.invoiceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property schemaVersion() As Decimal
|
|
Get
|
|
Return Me.schemaVersionField
|
|
End Get
|
|
Set
|
|
Me.schemaVersionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property schemaVersionSpecified() As Boolean
|
|
Get
|
|
Return Me.schemaVersionFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.schemaVersionFieldSpecified = 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(ImportShipment))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current ImportShipment 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 ImportShipment object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output ImportShipment 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 ImportShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ImportShipment)
|
|
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 ImportShipment) 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 ImportShipment
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), ImportShipment)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current ImportShipment 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 ImportShipment object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output ImportShipment 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 ImportShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ImportShipment)
|
|
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 ImportShipment) 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 ImportShipment
|
|
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 TShipment
|
|
|
|
Private companyField As String
|
|
|
|
Private plantField As String
|
|
|
|
Private shipmentIdField As String
|
|
|
|
Private shipmentPartialField As String
|
|
|
|
Private shipmentVersionField As String
|
|
|
|
Private documentNumberField As Decimal
|
|
|
|
Private shipmentHeadField As TShipmentHead
|
|
|
|
Private containersField As List(Of TDetailContainerInfo)
|
|
|
|
Private documentsField As List(Of TDocument)
|
|
|
|
Private attributesField As List(Of TAttribute)
|
|
|
|
Private partnersField As List(Of TPartner)
|
|
|
|
Private previousDocumentsField As List(Of TPrevDoc)
|
|
|
|
Private atlasCompletionSumDsField As List(Of TAtlasCompSumDEntry)
|
|
|
|
Private additionalInformationField As List(Of TAttribute)
|
|
|
|
Private authorisationHoldersField As TAuthHolders
|
|
|
|
Private defermentAccountsField As TDeferAccs
|
|
|
|
Private guaranteesField As TGuarantees
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.guaranteesField = New TGuarantees()
|
|
Me.defermentAccountsField = New TDeferAccs()
|
|
Me.authorisationHoldersField = New TAuthHolders()
|
|
Me.additionalInformationField = New List(Of TAttribute)()
|
|
Me.atlasCompletionSumDsField = New List(Of TAtlasCompSumDEntry)()
|
|
Me.previousDocumentsField = New List(Of TPrevDoc)()
|
|
Me.partnersField = New List(Of TPartner)()
|
|
Me.attributesField = New List(Of TAttribute)()
|
|
Me.documentsField = New List(Of TDocument)()
|
|
Me.containersField = New List(Of TDetailContainerInfo)()
|
|
Me.shipmentHeadField = New TShipmentHead()
|
|
Me.shipmentVersionField = "1"
|
|
Me.documentNumberField = CType(1D, Decimal)
|
|
End Sub
|
|
|
|
Public Property company() As String
|
|
Get
|
|
Return Me.companyField
|
|
End Get
|
|
Set
|
|
Me.companyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property plant() As String
|
|
Get
|
|
Return Me.plantField
|
|
End Get
|
|
Set
|
|
Me.plantField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipmentId() As String
|
|
Get
|
|
Return Me.shipmentIdField
|
|
End Get
|
|
Set
|
|
Me.shipmentIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipmentPartial() As String
|
|
Get
|
|
Return Me.shipmentPartialField
|
|
End Get
|
|
Set
|
|
Me.shipmentPartialField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.DefaultValueAttribute("1")>
|
|
Public Property shipmentVersion() As String
|
|
Get
|
|
Return Me.shipmentVersionField
|
|
End Get
|
|
Set
|
|
Me.shipmentVersionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.DefaultValueAttribute(GetType(Decimal), "1")>
|
|
Public Property documentNumber() As Decimal
|
|
Get
|
|
Return Me.documentNumberField
|
|
End Get
|
|
Set
|
|
Me.documentNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ShipmentHead() As TShipmentHead
|
|
Get
|
|
Return Me.shipmentHeadField
|
|
End Get
|
|
Set
|
|
Me.shipmentHeadField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("DetailContainerInfo", IsNullable:=False)>
|
|
Public Property Containers() As List(Of TDetailContainerInfo)
|
|
Get
|
|
Return Me.containersField
|
|
End Get
|
|
Set
|
|
Me.containersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Document", IsNullable:=False)>
|
|
Public Property Documents() As List(Of TDocument)
|
|
Get
|
|
Return Me.documentsField
|
|
End Get
|
|
Set
|
|
Me.documentsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Attribute", IsNullable:=False)>
|
|
Public Property Attributes() As List(Of TAttribute)
|
|
Get
|
|
Return Me.attributesField
|
|
End Get
|
|
Set
|
|
Me.attributesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Partner", IsNullable:=False)>
|
|
Public Property Partners() As List(Of TPartner)
|
|
Get
|
|
Return Me.partnersField
|
|
End Get
|
|
Set
|
|
Me.partnersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("PreviousDocument", IsNullable:=False)>
|
|
Public Property PreviousDocuments() As List(Of TPrevDoc)
|
|
Get
|
|
Return Me.previousDocumentsField
|
|
End Get
|
|
Set
|
|
Me.previousDocumentsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("AtlasCompletionSumD", IsNullable:=False)>
|
|
Public Property AtlasCompletionSumDs() As List(Of TAtlasCompSumDEntry)
|
|
Get
|
|
Return Me.atlasCompletionSumDsField
|
|
End Get
|
|
Set
|
|
Me.atlasCompletionSumDsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Attribute", IsNullable:=False)>
|
|
Public Property AdditionalInformation() As List(Of TAttribute)
|
|
Get
|
|
Return Me.additionalInformationField
|
|
End Get
|
|
Set
|
|
Me.additionalInformationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property AuthorisationHolders() As TAuthHolders
|
|
Get
|
|
Return Me.authorisationHoldersField
|
|
End Get
|
|
Set
|
|
Me.authorisationHoldersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property DefermentAccounts() As TDeferAccs
|
|
Get
|
|
Return Me.defermentAccountsField
|
|
End Get
|
|
Set
|
|
Me.defermentAccountsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Guarantees() As TGuarantees
|
|
Get
|
|
Return Me.guaranteesField
|
|
End Get
|
|
Set
|
|
Me.guaranteesField = 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(TShipment))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipment 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 TShipment object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipment 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 TShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipment)
|
|
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 TShipment) 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 TShipment
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipment)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipment 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 TShipment object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipment 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 TShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipment)
|
|
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 TShipment) 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 TShipment
|
|
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 TShipmentHead
|
|
|
|
Private shipmentTypeField As TShipmentHeadShipmentType
|
|
|
|
Private customsDateField As Date
|
|
|
|
Private customsDateFieldSpecified As Boolean
|
|
|
|
Private declTypeField As TDeclType
|
|
|
|
Private mrnField As String
|
|
|
|
Private grossWeightField As Decimal
|
|
|
|
Private grossWeightFieldSpecified As Boolean
|
|
|
|
Private departurePlaceField As String
|
|
|
|
Private dispatchCountryField As String
|
|
|
|
Private lastDispatchCountryField As String
|
|
|
|
Private destinationPlaceField As String
|
|
|
|
Private destinationRegionField As String
|
|
|
|
Private officeEntryField As String
|
|
|
|
Private importStateField As String
|
|
|
|
Private substituteFlagField As String
|
|
|
|
Private typeOfImportField As String
|
|
|
|
Private authorizationNumberField As String
|
|
|
|
Private placeOfDispatchDescriptionField As String
|
|
|
|
Private typeOfAirTransportationField As String
|
|
|
|
Private motBorderField As TMot
|
|
|
|
Private motBorderCrossingField As TMot
|
|
|
|
Private motInlandField As TMot
|
|
|
|
Private containerIndicatorField As String
|
|
|
|
Private containerField As TContainer
|
|
|
|
Private freightField As TFreightCosts
|
|
|
|
Private insuranceField As TInsuranceCosts
|
|
|
|
Private additionalCostsField As List(Of TAddCosts)
|
|
|
|
Private additionalCostVATField As Decimal
|
|
|
|
Private additionalCostVATFieldSpecified As Boolean
|
|
|
|
Private textField As String
|
|
|
|
Private exportDateField As Date
|
|
|
|
Private exportDateFieldSpecified As Boolean
|
|
|
|
Private importDateField As Date
|
|
|
|
Private importDateFieldSpecified As Boolean
|
|
|
|
Private estArrivalDateField As Date
|
|
|
|
Private estArrivalDateFieldSpecified As Boolean
|
|
|
|
Private partyConstField As String
|
|
|
|
Private periodField As String
|
|
|
|
Private customerFieldsField As TCustomerFields
|
|
|
|
Private countryDestinationField As String
|
|
|
|
Private clearenceTypeField As String
|
|
|
|
Private previousDocTypeField As String
|
|
|
|
Private previousDocNumberField As String
|
|
|
|
Private customsOfficeOfDestinationField As String
|
|
|
|
Private carrierNumberField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private supervisingOfficeField As String
|
|
|
|
Private typeIdentificationOfTransportArrivalField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.customerFieldsField = New TCustomerFields()
|
|
Me.additionalCostsField = New List(Of TAddCosts)()
|
|
Me.insuranceField = New TInsuranceCosts()
|
|
Me.freightField = New TFreightCosts()
|
|
Me.containerField = New TContainer()
|
|
Me.motInlandField = New TMot()
|
|
Me.motBorderCrossingField = New TMot()
|
|
Me.motBorderField = New TMot()
|
|
Me.declTypeField = New TDeclType()
|
|
Me.shipmentTypeField = TShipmentHeadShipmentType.E
|
|
Me.containerIndicatorField = "0"
|
|
End Sub
|
|
|
|
<System.ComponentModel.DefaultValueAttribute(TShipmentHeadShipmentType.E)>
|
|
Public Property shipmentType() As TShipmentHeadShipmentType
|
|
Get
|
|
Return Me.shipmentTypeField
|
|
End Get
|
|
Set
|
|
Me.shipmentTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customsDate() As Date
|
|
Get
|
|
Return Me.customsDateField
|
|
End Get
|
|
Set
|
|
Me.customsDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property customsDateSpecified() As Boolean
|
|
Get
|
|
Return Me.customsDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.customsDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property declType() As TDeclType
|
|
Get
|
|
Return Me.declTypeField
|
|
End Get
|
|
Set
|
|
Me.declTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property mrn() As String
|
|
Get
|
|
Return Me.mrnField
|
|
End Get
|
|
Set
|
|
Me.mrnField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property grossWeight() As Decimal
|
|
Get
|
|
Return Me.grossWeightField
|
|
End Get
|
|
Set
|
|
Me.grossWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property grossWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.grossWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.grossWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property departurePlace() As String
|
|
Get
|
|
Return Me.departurePlaceField
|
|
End Get
|
|
Set
|
|
Me.departurePlaceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dispatchCountry() As String
|
|
Get
|
|
Return Me.dispatchCountryField
|
|
End Get
|
|
Set
|
|
Me.dispatchCountryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property lastDispatchCountry() As String
|
|
Get
|
|
Return Me.lastDispatchCountryField
|
|
End Get
|
|
Set
|
|
Me.lastDispatchCountryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property destinationPlace() As String
|
|
Get
|
|
Return Me.destinationPlaceField
|
|
End Get
|
|
Set
|
|
Me.destinationPlaceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property destinationRegion() As String
|
|
Get
|
|
Return Me.destinationRegionField
|
|
End Get
|
|
Set
|
|
Me.destinationRegionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property officeEntry() As String
|
|
Get
|
|
Return Me.officeEntryField
|
|
End Get
|
|
Set
|
|
Me.officeEntryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importState() As String
|
|
Get
|
|
Return Me.importStateField
|
|
End Get
|
|
Set
|
|
Me.importStateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property substituteFlag() As String
|
|
Get
|
|
Return Me.substituteFlagField
|
|
End Get
|
|
Set
|
|
Me.substituteFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property typeOfImport() As String
|
|
Get
|
|
Return Me.typeOfImportField
|
|
End Get
|
|
Set
|
|
Me.typeOfImportField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authorizationNumber() As String
|
|
Get
|
|
Return Me.authorizationNumberField
|
|
End Get
|
|
Set
|
|
Me.authorizationNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property placeOfDispatchDescription() As String
|
|
Get
|
|
Return Me.placeOfDispatchDescriptionField
|
|
End Get
|
|
Set
|
|
Me.placeOfDispatchDescriptionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property typeOfAirTransportation() As String
|
|
Get
|
|
Return Me.typeOfAirTransportationField
|
|
End Get
|
|
Set
|
|
Me.typeOfAirTransportationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MotBorder() As TMot
|
|
Get
|
|
Return Me.motBorderField
|
|
End Get
|
|
Set
|
|
Me.motBorderField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MotBorderCrossing() As TMot
|
|
Get
|
|
Return Me.motBorderCrossingField
|
|
End Get
|
|
Set
|
|
Me.motBorderCrossingField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MotInland() As TMot
|
|
Get
|
|
Return Me.motInlandField
|
|
End Get
|
|
Set
|
|
Me.motInlandField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.DefaultValueAttribute("0")>
|
|
Public Property containerIndicator() As String
|
|
Get
|
|
Return Me.containerIndicatorField
|
|
End Get
|
|
Set
|
|
Me.containerIndicatorField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Container() As TContainer
|
|
Get
|
|
Return Me.containerField
|
|
End Get
|
|
Set
|
|
Me.containerField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Freight() As TFreightCosts
|
|
Get
|
|
Return Me.freightField
|
|
End Get
|
|
Set
|
|
Me.freightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Insurance() As TInsuranceCosts
|
|
Get
|
|
Return Me.insuranceField
|
|
End Get
|
|
Set
|
|
Me.insuranceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property AdditionalCosts() As List(Of TAddCosts)
|
|
Get
|
|
Return Me.additionalCostsField
|
|
End Get
|
|
Set
|
|
Me.additionalCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCostVAT() As Decimal
|
|
Get
|
|
Return Me.additionalCostVATField
|
|
End Get
|
|
Set
|
|
Me.additionalCostVATField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCostVATSpecified() As Boolean
|
|
Get
|
|
Return Me.additionalCostVATFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCostVATFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property text() As String
|
|
Get
|
|
Return Me.textField
|
|
End Get
|
|
Set
|
|
Me.textField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property exportDate() As Date
|
|
Get
|
|
Return Me.exportDateField
|
|
End Get
|
|
Set
|
|
Me.exportDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property exportDateSpecified() As Boolean
|
|
Get
|
|
Return Me.exportDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.exportDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importDate() As Date
|
|
Get
|
|
Return Me.importDateField
|
|
End Get
|
|
Set
|
|
Me.importDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property importDateSpecified() As Boolean
|
|
Get
|
|
Return Me.importDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.importDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property estArrivalDate() As Date
|
|
Get
|
|
Return Me.estArrivalDateField
|
|
End Get
|
|
Set
|
|
Me.estArrivalDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property estArrivalDateSpecified() As Boolean
|
|
Get
|
|
Return Me.estArrivalDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.estArrivalDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partyConst() As String
|
|
Get
|
|
Return Me.partyConstField
|
|
End Get
|
|
Set
|
|
Me.partyConstField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property period() As String
|
|
Get
|
|
Return Me.periodField
|
|
End Get
|
|
Set
|
|
Me.periodField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property CustomerFields() As TCustomerFields
|
|
Get
|
|
Return Me.customerFieldsField
|
|
End Get
|
|
Set
|
|
Me.customerFieldsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property countryDestination() As String
|
|
Get
|
|
Return Me.countryDestinationField
|
|
End Get
|
|
Set
|
|
Me.countryDestinationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property clearenceType() As String
|
|
Get
|
|
Return Me.clearenceTypeField
|
|
End Get
|
|
Set
|
|
Me.clearenceTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property previousDocType() As String
|
|
Get
|
|
Return Me.previousDocTypeField
|
|
End Get
|
|
Set
|
|
Me.previousDocTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property previousDocNumber() As String
|
|
Get
|
|
Return Me.previousDocNumberField
|
|
End Get
|
|
Set
|
|
Me.previousDocNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customsOfficeOfDestination() As String
|
|
Get
|
|
Return Me.customsOfficeOfDestinationField
|
|
End Get
|
|
Set
|
|
Me.customsOfficeOfDestinationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property carrierNumber() As String
|
|
Get
|
|
Return Me.carrierNumberField
|
|
End Get
|
|
Set
|
|
Me.carrierNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property supervisingOffice() As String
|
|
Get
|
|
Return Me.supervisingOfficeField
|
|
End Get
|
|
Set
|
|
Me.supervisingOfficeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property typeIdentificationOfTransportArrival() As String
|
|
Get
|
|
Return Me.typeIdentificationOfTransportArrivalField
|
|
End Get
|
|
Set
|
|
Me.typeIdentificationOfTransportArrivalField = 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(TShipmentHead))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipmentHead 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 TShipmentHead object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipmentHead 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 TShipmentHead, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHead)
|
|
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 TShipmentHead) 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 TShipmentHead
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipmentHead)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipmentHead 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 TShipmentHead object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipmentHead 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 TShipmentHead, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHead)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TShipmentHead) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TShipmentHead
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Public Enum TShipmentHeadShipmentType
|
|
|
|
'''<remarks/>
|
|
E
|
|
|
|
'''<remarks/>
|
|
B
|
|
|
|
'''<remarks/>
|
|
U
|
|
|
|
'''<remarks/>
|
|
X
|
|
|
|
'''<remarks/>
|
|
I
|
|
End Enum
|
|
|
|
Partial Public Class TDeclType
|
|
|
|
Private type1Field As String
|
|
|
|
Private type2Field 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
|
|
|
|
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 TPackageData
|
|
|
|
Private signoField As String
|
|
|
|
Private numberOfPackagesField As Long
|
|
|
|
Private numberOfPackagesFieldSpecified As Boolean
|
|
|
|
Private packageTypeField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property signo() As String
|
|
Get
|
|
Return Me.signoField
|
|
End Get
|
|
Set
|
|
Me.signoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property numberOfPackages() As Long
|
|
Get
|
|
Return Me.numberOfPackagesField
|
|
End Get
|
|
Set
|
|
Me.numberOfPackagesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property numberOfPackagesSpecified() As Boolean
|
|
Get
|
|
Return Me.numberOfPackagesFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.numberOfPackagesFieldSpecified = 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(TPackageData))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPackageData 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 TPackageData object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPackageData 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 TPackageData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageData)
|
|
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 TPackageData) 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 TPackageData
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPackageData)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPackageData 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 TPackageData object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPackageData 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 TPackageData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageData)
|
|
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 TPackageData) 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 TPackageData
|
|
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 TPackagesData
|
|
|
|
Private packageDataField As List(Of TPackageData)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.packageDataField = New List(Of TPackageData)()
|
|
End Sub
|
|
|
|
Public Property PackageData() As List(Of TPackageData)
|
|
Get
|
|
Return Me.packageDataField
|
|
End Get
|
|
Set
|
|
Me.packageDataField = 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(TPackagesData))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPackagesData 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 TPackagesData object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPackagesData 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 TPackagesData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackagesData)
|
|
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 TPackagesData) 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 TPackagesData
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPackagesData)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPackagesData 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 TPackagesData object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPackagesData 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 TPackagesData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackagesData)
|
|
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 TPackagesData) 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 TPackagesData
|
|
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 TRefPrevProcedure
|
|
|
|
Private referenceTypeField As String
|
|
|
|
Private referenceNumberField As String
|
|
|
|
Private authorisationNumberField As String
|
|
|
|
Private registrationNumberField As String
|
|
|
|
Private positionNumberField As Long
|
|
|
|
Private positionNumberFieldSpecified As Boolean
|
|
|
|
Private partNumberField As String
|
|
|
|
Private tariffNumberField As String
|
|
|
|
Private tradeQuantityField As Decimal
|
|
|
|
Private tradeQuantityFieldSpecified As Boolean
|
|
|
|
Private tradeUnitOfMeasurementField As String
|
|
|
|
Private tradeQualifierField As String
|
|
|
|
Private deductionQuantityField As Decimal
|
|
|
|
Private deductionQuantityFieldSpecified As Boolean
|
|
|
|
Private deductionUnitOfMeasurementField As String
|
|
|
|
Private deductionQualifierField As String
|
|
|
|
Private additionalInformationField As String
|
|
|
|
Private normalTreatmentFlagField As Boolean
|
|
|
|
Private normalTreatmentFlagFieldSpecified As Boolean
|
|
|
|
Private atlasFlagField As Boolean
|
|
|
|
Private atlasFlagFieldSpecified As Boolean
|
|
|
|
Private customsNumberField As String
|
|
|
|
Private statisticalQuantityField As Decimal
|
|
|
|
Private statisticalQuantityFieldSpecified As Boolean
|
|
|
|
Private netMassField As Decimal
|
|
|
|
Private netMassFieldSpecified As Boolean
|
|
|
|
Private grossMassField As Decimal
|
|
|
|
Private grossMassFieldSpecified As Boolean
|
|
|
|
Private packageQuantityField As Decimal
|
|
|
|
Private packageQuantityFieldSpecified As Boolean
|
|
|
|
Private simpleIprApplicationField As Boolean
|
|
|
|
Private simpleIprApplicationFieldSpecified As Boolean
|
|
|
|
Private supervisingOfficeField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property referenceType() As String
|
|
Get
|
|
Return Me.referenceTypeField
|
|
End Get
|
|
Set
|
|
Me.referenceTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceNumber() As String
|
|
Get
|
|
Return Me.referenceNumberField
|
|
End Get
|
|
Set
|
|
Me.referenceNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authorisationNumber() As String
|
|
Get
|
|
Return Me.authorisationNumberField
|
|
End Get
|
|
Set
|
|
Me.authorisationNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationNumber() As String
|
|
Get
|
|
Return Me.registrationNumberField
|
|
End Get
|
|
Set
|
|
Me.registrationNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property positionNumber() As Long
|
|
Get
|
|
Return Me.positionNumberField
|
|
End Get
|
|
Set
|
|
Me.positionNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property positionNumberSpecified() As Boolean
|
|
Get
|
|
Return Me.positionNumberFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.positionNumberFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partNumber() As String
|
|
Get
|
|
Return Me.partNumberField
|
|
End Get
|
|
Set
|
|
Me.partNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tariffNumber() As String
|
|
Get
|
|
Return Me.tariffNumberField
|
|
End Get
|
|
Set
|
|
Me.tariffNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tradeQuantity() As Decimal
|
|
Get
|
|
Return Me.tradeQuantityField
|
|
End Get
|
|
Set
|
|
Me.tradeQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property tradeQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.tradeQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.tradeQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tradeUnitOfMeasurement() As String
|
|
Get
|
|
Return Me.tradeUnitOfMeasurementField
|
|
End Get
|
|
Set
|
|
Me.tradeUnitOfMeasurementField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tradeQualifier() As String
|
|
Get
|
|
Return Me.tradeQualifierField
|
|
End Get
|
|
Set
|
|
Me.tradeQualifierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property deductionQuantity() As Decimal
|
|
Get
|
|
Return Me.deductionQuantityField
|
|
End Get
|
|
Set
|
|
Me.deductionQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property deductionQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.deductionQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.deductionQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property deductionUnitOfMeasurement() As String
|
|
Get
|
|
Return Me.deductionUnitOfMeasurementField
|
|
End Get
|
|
Set
|
|
Me.deductionUnitOfMeasurementField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property deductionQualifier() As String
|
|
Get
|
|
Return Me.deductionQualifierField
|
|
End Get
|
|
Set
|
|
Me.deductionQualifierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalInformation() As String
|
|
Get
|
|
Return Me.additionalInformationField
|
|
End Get
|
|
Set
|
|
Me.additionalInformationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property normalTreatmentFlag() As Boolean
|
|
Get
|
|
Return Me.normalTreatmentFlagField
|
|
End Get
|
|
Set
|
|
Me.normalTreatmentFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property normalTreatmentFlagSpecified() As Boolean
|
|
Get
|
|
Return Me.normalTreatmentFlagFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.normalTreatmentFlagFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property atlasFlag() As Boolean
|
|
Get
|
|
Return Me.atlasFlagField
|
|
End Get
|
|
Set
|
|
Me.atlasFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property atlasFlagSpecified() As Boolean
|
|
Get
|
|
Return Me.atlasFlagFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.atlasFlagFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customsNumber() As String
|
|
Get
|
|
Return Me.customsNumberField
|
|
End Get
|
|
Set
|
|
Me.customsNumberField = 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
|
|
|
|
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 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 simpleIprApplication() As Boolean
|
|
Get
|
|
Return Me.simpleIprApplicationField
|
|
End Get
|
|
Set
|
|
Me.simpleIprApplicationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property simpleIprApplicationSpecified() As Boolean
|
|
Get
|
|
Return Me.simpleIprApplicationFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.simpleIprApplicationFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property supervisingOffice() As String
|
|
Get
|
|
Return Me.supervisingOfficeField
|
|
End Get
|
|
Set
|
|
Me.supervisingOfficeField = 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(TRefPrevProcedure))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TRefPrevProcedure 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 TRefPrevProcedure object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TRefPrevProcedure 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 TRefPrevProcedure, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRefPrevProcedure)
|
|
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 TRefPrevProcedure) 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 TRefPrevProcedure
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TRefPrevProcedure)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TRefPrevProcedure 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 TRefPrevProcedure object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TRefPrevProcedure 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 TRefPrevProcedure, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRefPrevProcedure)
|
|
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 TRefPrevProcedure) 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 TRefPrevProcedure
|
|
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 TPreSupplier
|
|
|
|
Private infDutyValueField As Decimal
|
|
|
|
Private infDutyValueFieldSpecified As Boolean
|
|
|
|
Private infDutyRateField As Decimal
|
|
|
|
Private infDutyRateFieldSpecified As Boolean
|
|
|
|
Private infDutyField As Decimal
|
|
|
|
Private infDutyFieldSpecified As Boolean
|
|
|
|
Private infDutyCurrencyField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property infDutyValue() As Decimal
|
|
Get
|
|
Return Me.infDutyValueField
|
|
End Get
|
|
Set
|
|
Me.infDutyValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infDutyValueSpecified() As Boolean
|
|
Get
|
|
Return Me.infDutyValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infDutyValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDutyRate() As Decimal
|
|
Get
|
|
Return Me.infDutyRateField
|
|
End Get
|
|
Set
|
|
Me.infDutyRateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infDutyRateSpecified() As Boolean
|
|
Get
|
|
Return Me.infDutyRateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infDutyRateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDuty() As Decimal
|
|
Get
|
|
Return Me.infDutyField
|
|
End Get
|
|
Set
|
|
Me.infDutyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property infDutySpecified() As Boolean
|
|
Get
|
|
Return Me.infDutyFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.infDutyFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infDutyCurrency() As String
|
|
Get
|
|
Return Me.infDutyCurrencyField
|
|
End Get
|
|
Set
|
|
Me.infDutyCurrencyField = 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(TPreSupplier))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPreSupplier 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 TPreSupplier object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPreSupplier 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 TPreSupplier, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPreSupplier)
|
|
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 TPreSupplier) 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 TPreSupplier
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPreSupplier)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPreSupplier 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 TPreSupplier object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPreSupplier 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 TPreSupplier, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPreSupplier)
|
|
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 TPreSupplier) 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 TPreSupplier
|
|
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 TCustIntraLine
|
|
|
|
Private statusField As String
|
|
|
|
Private invoiceDateField As Date
|
|
|
|
Private invoiceDateFieldSpecified As Boolean
|
|
|
|
Private periodField As Long
|
|
|
|
Private periodFieldSpecified As Boolean
|
|
|
|
Private regionField As String
|
|
|
|
Private statisticalProcedureField As String
|
|
|
|
Private statisticalValueField As Decimal
|
|
|
|
Private statisticalValueFieldSpecified As Boolean
|
|
|
|
Private additionalCostsCurrency1Field As String
|
|
|
|
Private additionalCostsType1Field As String
|
|
|
|
Private additionalCostsCurrency2Field As String
|
|
|
|
Private additionalCostsType2Field As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property status() As String
|
|
Get
|
|
Return Me.statusField
|
|
End Get
|
|
Set
|
|
Me.statusField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invoiceDate() As Date
|
|
Get
|
|
Return Me.invoiceDateField
|
|
End Get
|
|
Set
|
|
Me.invoiceDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property invoiceDateSpecified() As Boolean
|
|
Get
|
|
Return Me.invoiceDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.invoiceDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property period() As Long
|
|
Get
|
|
Return Me.periodField
|
|
End Get
|
|
Set
|
|
Me.periodField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property periodSpecified() As Boolean
|
|
Get
|
|
Return Me.periodFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.periodFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property region() As String
|
|
Get
|
|
Return Me.regionField
|
|
End Get
|
|
Set
|
|
Me.regionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalProcedure() As String
|
|
Get
|
|
Return Me.statisticalProcedureField
|
|
End Get
|
|
Set
|
|
Me.statisticalProcedureField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalValue() As Decimal
|
|
Get
|
|
Return Me.statisticalValueField
|
|
End Get
|
|
Set
|
|
Me.statisticalValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property statisticalValueSpecified() As Boolean
|
|
Get
|
|
Return Me.statisticalValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.statisticalValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCostsCurrency1() As String
|
|
Get
|
|
Return Me.additionalCostsCurrency1Field
|
|
End Get
|
|
Set
|
|
Me.additionalCostsCurrency1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCostsType1() As String
|
|
Get
|
|
Return Me.additionalCostsType1Field
|
|
End Get
|
|
Set
|
|
Me.additionalCostsType1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCostsCurrency2() As String
|
|
Get
|
|
Return Me.additionalCostsCurrency2Field
|
|
End Get
|
|
Set
|
|
Me.additionalCostsCurrency2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCostsType2() As String
|
|
Get
|
|
Return Me.additionalCostsType2Field
|
|
End Get
|
|
Set
|
|
Me.additionalCostsType2Field = 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(TCustIntraLine))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustIntraLine 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 TCustIntraLine object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustIntraLine 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 TCustIntraLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustIntraLine)
|
|
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 TCustIntraLine) 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 TCustIntraLine
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustIntraLine)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustIntraLine 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 TCustIntraLine object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustIntraLine 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 TCustIntraLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustIntraLine)
|
|
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 TCustIntraLine) 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 TCustIntraLine
|
|
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 TOprInfo
|
|
|
|
Private dutyGroup1Field As String
|
|
|
|
Private reductionAmount1Field As Decimal
|
|
|
|
Private reductionAmount1FieldSpecified As Boolean
|
|
|
|
Private dutyGroup2Field As String
|
|
|
|
Private reductionAmount2Field As Decimal
|
|
|
|
Private reductionAmount2FieldSpecified As Boolean
|
|
|
|
Private dutyGroup3Field As String
|
|
|
|
Private reductionAmount3Field As Decimal
|
|
|
|
Private reductionAmount3FieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property dutyGroup1() As String
|
|
Get
|
|
Return Me.dutyGroup1Field
|
|
End Get
|
|
Set
|
|
Me.dutyGroup1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property reductionAmount1() As Decimal
|
|
Get
|
|
Return Me.reductionAmount1Field
|
|
End Get
|
|
Set
|
|
Me.reductionAmount1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property reductionAmount1Specified() As Boolean
|
|
Get
|
|
Return Me.reductionAmount1FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.reductionAmount1FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dutyGroup2() As String
|
|
Get
|
|
Return Me.dutyGroup2Field
|
|
End Get
|
|
Set
|
|
Me.dutyGroup2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property reductionAmount2() As Decimal
|
|
Get
|
|
Return Me.reductionAmount2Field
|
|
End Get
|
|
Set
|
|
Me.reductionAmount2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property reductionAmount2Specified() As Boolean
|
|
Get
|
|
Return Me.reductionAmount2FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.reductionAmount2FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dutyGroup3() As String
|
|
Get
|
|
Return Me.dutyGroup3Field
|
|
End Get
|
|
Set
|
|
Me.dutyGroup3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property reductionAmount3() As Decimal
|
|
Get
|
|
Return Me.reductionAmount3Field
|
|
End Get
|
|
Set
|
|
Me.reductionAmount3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property reductionAmount3Specified() As Boolean
|
|
Get
|
|
Return Me.reductionAmount3FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.reductionAmount3FieldSpecified = 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(TOprInfo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TOprInfo 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 TOprInfo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TOprInfo 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 TOprInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOprInfo)
|
|
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 TOprInfo) 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 TOprInfo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TOprInfo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TOprInfo 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 TOprInfo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TOprInfo 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 TOprInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOprInfo)
|
|
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 TOprInfo) 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 TOprInfo
|
|
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 TDutySaving
|
|
|
|
Private additionalCostsTypeField As String
|
|
|
|
Private codeField As String
|
|
|
|
Private calculatedCustDutiesField As Decimal
|
|
|
|
Private calculatedCustDutiesFieldSpecified As Boolean
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private amountFieldSpecified As Boolean
|
|
|
|
Private creationFlagField As String
|
|
|
|
Private unitOfMeasurmentField As String
|
|
|
|
Private calculationBaseField As Decimal
|
|
|
|
Private calculationBaseFieldSpecified As Boolean
|
|
|
|
Private countryOfDutiesField As String
|
|
|
|
Private calculatedDutiesField As Decimal
|
|
|
|
Private calculatedDutiesFieldSpecified As Boolean
|
|
|
|
Private calculatedAssessmentBasisField As Decimal
|
|
|
|
Private calculatedAssessmentBasisFieldSpecified As Boolean
|
|
|
|
Private measuresTypeField As String
|
|
|
|
Private dutyRateField As Decimal
|
|
|
|
Private dutyRateFieldSpecified As Boolean
|
|
|
|
Private additionField As Decimal
|
|
|
|
Private additionFieldSpecified As Boolean
|
|
|
|
Private preferentialFlagField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property additionalCostsType() As String
|
|
Get
|
|
Return Me.additionalCostsTypeField
|
|
End Get
|
|
Set
|
|
Me.additionalCostsTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculatedCustDuties() As Decimal
|
|
Get
|
|
Return Me.calculatedCustDutiesField
|
|
End Get
|
|
Set
|
|
Me.calculatedCustDutiesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculatedCustDutiesSpecified() As Boolean
|
|
Get
|
|
Return Me.calculatedCustDutiesFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculatedCustDutiesFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property amountSpecified() As Boolean
|
|
Get
|
|
Return Me.amountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.amountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationFlag() As String
|
|
Get
|
|
Return Me.creationFlagField
|
|
End Get
|
|
Set
|
|
Me.creationFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unitOfMeasurment() As String
|
|
Get
|
|
Return Me.unitOfMeasurmentField
|
|
End Get
|
|
Set
|
|
Me.unitOfMeasurmentField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculationBase() As Decimal
|
|
Get
|
|
Return Me.calculationBaseField
|
|
End Get
|
|
Set
|
|
Me.calculationBaseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculationBaseSpecified() As Boolean
|
|
Get
|
|
Return Me.calculationBaseFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculationBaseFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property countryOfDuties() As String
|
|
Get
|
|
Return Me.countryOfDutiesField
|
|
End Get
|
|
Set
|
|
Me.countryOfDutiesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculatedDuties() As Decimal
|
|
Get
|
|
Return Me.calculatedDutiesField
|
|
End Get
|
|
Set
|
|
Me.calculatedDutiesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculatedDutiesSpecified() As Boolean
|
|
Get
|
|
Return Me.calculatedDutiesFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculatedDutiesFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculatedAssessmentBasis() As Decimal
|
|
Get
|
|
Return Me.calculatedAssessmentBasisField
|
|
End Get
|
|
Set
|
|
Me.calculatedAssessmentBasisField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculatedAssessmentBasisSpecified() As Boolean
|
|
Get
|
|
Return Me.calculatedAssessmentBasisFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculatedAssessmentBasisFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property measuresType() As String
|
|
Get
|
|
Return Me.measuresTypeField
|
|
End Get
|
|
Set
|
|
Me.measuresTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dutyRate() As Decimal
|
|
Get
|
|
Return Me.dutyRateField
|
|
End Get
|
|
Set
|
|
Me.dutyRateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dutyRateSpecified() As Boolean
|
|
Get
|
|
Return Me.dutyRateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dutyRateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addition() As Decimal
|
|
Get
|
|
Return Me.additionField
|
|
End Get
|
|
Set
|
|
Me.additionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionSpecified() As Boolean
|
|
Get
|
|
Return Me.additionFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property preferentialFlag() As String
|
|
Get
|
|
Return Me.preferentialFlagField
|
|
End Get
|
|
Set
|
|
Me.preferentialFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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(TDutySaving))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDutySaving 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 TDutySaving object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDutySaving 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 TDutySaving, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDutySaving)
|
|
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 TDutySaving) 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 TDutySaving
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDutySaving)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDutySaving 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 TDutySaving object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDutySaving 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 TDutySaving, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDutySaving)
|
|
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 TDutySaving) 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 TDutySaving
|
|
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 TDutyTax
|
|
|
|
Private additionalCostsTypeField As String
|
|
|
|
Private codeField As String
|
|
|
|
Private calculatedCustDutiesField As Decimal
|
|
|
|
Private calculatedCustDutiesFieldSpecified As Boolean
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private amountFieldSpecified As Boolean
|
|
|
|
Private creationFlagField As String
|
|
|
|
Private unitOfMeasurmentField As String
|
|
|
|
Private calculationBaseField As Decimal
|
|
|
|
Private calculationBaseFieldSpecified As Boolean
|
|
|
|
Private countryOfDutiesField As String
|
|
|
|
Private calculatedDutiesField As Decimal
|
|
|
|
Private calculatedDutiesFieldSpecified As Boolean
|
|
|
|
Private calculatedAssessmentBasisField As Decimal
|
|
|
|
Private calculatedAssessmentBasisFieldSpecified As Boolean
|
|
|
|
Private areaCodeField As String
|
|
|
|
Private measuresTypeField As String
|
|
|
|
Private dutyCodeCustomsOfficeField As String
|
|
|
|
Private indentureNumberField As String
|
|
|
|
Private dutyRateField As Decimal
|
|
|
|
Private dutyRateFieldSpecified As Boolean
|
|
|
|
Private stornoFlagField As String
|
|
|
|
Private dutyAmountIncreaseOrDecreaseField As Decimal
|
|
|
|
Private dutyAmountIncreaseOrDecreaseFieldSpecified As Boolean
|
|
|
|
Private typeOfAdditionalCodeField As String
|
|
|
|
Private noOfAdditionalCodeField As String
|
|
|
|
Private calculatedDutyRateField As Decimal
|
|
|
|
Private calculatedDutyRateFieldSpecified As Boolean
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property additionalCostsType() As String
|
|
Get
|
|
Return Me.additionalCostsTypeField
|
|
End Get
|
|
Set
|
|
Me.additionalCostsTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculatedCustDuties() As Decimal
|
|
Get
|
|
Return Me.calculatedCustDutiesField
|
|
End Get
|
|
Set
|
|
Me.calculatedCustDutiesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculatedCustDutiesSpecified() As Boolean
|
|
Get
|
|
Return Me.calculatedCustDutiesFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculatedCustDutiesFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property amountSpecified() As Boolean
|
|
Get
|
|
Return Me.amountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.amountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationFlag() As String
|
|
Get
|
|
Return Me.creationFlagField
|
|
End Get
|
|
Set
|
|
Me.creationFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unitOfMeasurment() As String
|
|
Get
|
|
Return Me.unitOfMeasurmentField
|
|
End Get
|
|
Set
|
|
Me.unitOfMeasurmentField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculationBase() As Decimal
|
|
Get
|
|
Return Me.calculationBaseField
|
|
End Get
|
|
Set
|
|
Me.calculationBaseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculationBaseSpecified() As Boolean
|
|
Get
|
|
Return Me.calculationBaseFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculationBaseFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property countryOfDuties() As String
|
|
Get
|
|
Return Me.countryOfDutiesField
|
|
End Get
|
|
Set
|
|
Me.countryOfDutiesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculatedDuties() As Decimal
|
|
Get
|
|
Return Me.calculatedDutiesField
|
|
End Get
|
|
Set
|
|
Me.calculatedDutiesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculatedDutiesSpecified() As Boolean
|
|
Get
|
|
Return Me.calculatedDutiesFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculatedDutiesFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculatedAssessmentBasis() As Decimal
|
|
Get
|
|
Return Me.calculatedAssessmentBasisField
|
|
End Get
|
|
Set
|
|
Me.calculatedAssessmentBasisField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculatedAssessmentBasisSpecified() As Boolean
|
|
Get
|
|
Return Me.calculatedAssessmentBasisFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculatedAssessmentBasisFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property areaCode() As String
|
|
Get
|
|
Return Me.areaCodeField
|
|
End Get
|
|
Set
|
|
Me.areaCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property measuresType() As String
|
|
Get
|
|
Return Me.measuresTypeField
|
|
End Get
|
|
Set
|
|
Me.measuresTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dutyCodeCustomsOffice() As String
|
|
Get
|
|
Return Me.dutyCodeCustomsOfficeField
|
|
End Get
|
|
Set
|
|
Me.dutyCodeCustomsOfficeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property indentureNumber() As String
|
|
Get
|
|
Return Me.indentureNumberField
|
|
End Get
|
|
Set
|
|
Me.indentureNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dutyRate() As Decimal
|
|
Get
|
|
Return Me.dutyRateField
|
|
End Get
|
|
Set
|
|
Me.dutyRateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dutyRateSpecified() As Boolean
|
|
Get
|
|
Return Me.dutyRateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dutyRateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property stornoFlag() As String
|
|
Get
|
|
Return Me.stornoFlagField
|
|
End Get
|
|
Set
|
|
Me.stornoFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dutyAmountIncreaseOrDecrease() As Decimal
|
|
Get
|
|
Return Me.dutyAmountIncreaseOrDecreaseField
|
|
End Get
|
|
Set
|
|
Me.dutyAmountIncreaseOrDecreaseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dutyAmountIncreaseOrDecreaseSpecified() As Boolean
|
|
Get
|
|
Return Me.dutyAmountIncreaseOrDecreaseFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dutyAmountIncreaseOrDecreaseFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property typeOfAdditionalCode() As String
|
|
Get
|
|
Return Me.typeOfAdditionalCodeField
|
|
End Get
|
|
Set
|
|
Me.typeOfAdditionalCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property noOfAdditionalCode() As String
|
|
Get
|
|
Return Me.noOfAdditionalCodeField
|
|
End Get
|
|
Set
|
|
Me.noOfAdditionalCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calculatedDutyRate() As Decimal
|
|
Get
|
|
Return Me.calculatedDutyRateField
|
|
End Get
|
|
Set
|
|
Me.calculatedDutyRateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calculatedDutyRateSpecified() As Boolean
|
|
Get
|
|
Return Me.calculatedDutyRateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calculatedDutyRateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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(TDutyTax))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDutyTax 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 TDutyTax object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDutyTax 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 TDutyTax, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDutyTax)
|
|
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 TDutyTax) 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 TDutyTax
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDutyTax)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDutyTax 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 TDutyTax object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDutyTax 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 TDutyTax, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDutyTax)
|
|
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 TDutyTax) 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 TDutyTax
|
|
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 TDuty
|
|
|
|
Private typeField As String
|
|
|
|
Private calcDutyBaseField As Decimal
|
|
|
|
Private calcDutyBaseFieldSpecified As Boolean
|
|
|
|
Private currencyField As String
|
|
|
|
Private codeField As String
|
|
|
|
Private rateField As Decimal
|
|
|
|
Private rateFieldSpecified As Boolean
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private amountFieldSpecified As Boolean
|
|
|
|
Private addDeductField As Decimal
|
|
|
|
Private addDeductFieldSpecified As Boolean
|
|
|
|
Private calcDutyField As Decimal
|
|
|
|
Private calcDutyFieldSpecified As Boolean
|
|
|
|
Private dutyField As Decimal
|
|
|
|
Private dutyFieldSpecified As Boolean
|
|
|
|
Private dutyBaseField As Decimal
|
|
|
|
Private dutyBaseFieldSpecified As Boolean
|
|
|
|
Private measureCodeField As String
|
|
|
|
Private measureField As String
|
|
|
|
Private authorityDutyCodeField As String
|
|
|
|
Private territoryField As String
|
|
|
|
Private typeAddCodeField As String
|
|
|
|
Private numberAddCodeField As String
|
|
|
|
Private tariffRateQuotaField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
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 calcDutyBase() As Decimal
|
|
Get
|
|
Return Me.calcDutyBaseField
|
|
End Get
|
|
Set
|
|
Me.calcDutyBaseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calcDutyBaseSpecified() As Boolean
|
|
Get
|
|
Return Me.calcDutyBaseFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calcDutyBaseFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property currency() As String
|
|
Get
|
|
Return Me.currencyField
|
|
End Get
|
|
Set
|
|
Me.currencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property rate() As Decimal
|
|
Get
|
|
Return Me.rateField
|
|
End Get
|
|
Set
|
|
Me.rateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property rateSpecified() As Boolean
|
|
Get
|
|
Return Me.rateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.rateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property amountSpecified() As Boolean
|
|
Get
|
|
Return Me.amountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.amountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addDeduct() As Decimal
|
|
Get
|
|
Return Me.addDeductField
|
|
End Get
|
|
Set
|
|
Me.addDeductField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property addDeductSpecified() As Boolean
|
|
Get
|
|
Return Me.addDeductFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.addDeductFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property calcDuty() As Decimal
|
|
Get
|
|
Return Me.calcDutyField
|
|
End Get
|
|
Set
|
|
Me.calcDutyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property calcDutySpecified() As Boolean
|
|
Get
|
|
Return Me.calcDutyFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.calcDutyFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property duty() As Decimal
|
|
Get
|
|
Return Me.dutyField
|
|
End Get
|
|
Set
|
|
Me.dutyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dutySpecified() As Boolean
|
|
Get
|
|
Return Me.dutyFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dutyFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dutyBase() As Decimal
|
|
Get
|
|
Return Me.dutyBaseField
|
|
End Get
|
|
Set
|
|
Me.dutyBaseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dutyBaseSpecified() As Boolean
|
|
Get
|
|
Return Me.dutyBaseFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dutyBaseFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property measureCode() As String
|
|
Get
|
|
Return Me.measureCodeField
|
|
End Get
|
|
Set
|
|
Me.measureCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property measure() As String
|
|
Get
|
|
Return Me.measureField
|
|
End Get
|
|
Set
|
|
Me.measureField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authorityDutyCode() As String
|
|
Get
|
|
Return Me.authorityDutyCodeField
|
|
End Get
|
|
Set
|
|
Me.authorityDutyCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property territory() As String
|
|
Get
|
|
Return Me.territoryField
|
|
End Get
|
|
Set
|
|
Me.territoryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property typeAddCode() As String
|
|
Get
|
|
Return Me.typeAddCodeField
|
|
End Get
|
|
Set
|
|
Me.typeAddCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property numberAddCode() As String
|
|
Get
|
|
Return Me.numberAddCodeField
|
|
End Get
|
|
Set
|
|
Me.numberAddCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tariffRateQuota() As String
|
|
Get
|
|
Return Me.tariffRateQuotaField
|
|
End Get
|
|
Set
|
|
Me.tariffRateQuotaField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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(TDuty))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDuty 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 TDuty object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDuty 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 TDuty, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDuty)
|
|
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 TDuty) 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 TDuty
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDuty)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDuty 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 TDuty object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDuty 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 TDuty, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDuty)
|
|
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 TDuty) 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 TDuty
|
|
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 TCalcValuesCust
|
|
|
|
Private customsValueField As Decimal
|
|
|
|
Private customsValueFieldSpecified As Boolean
|
|
|
|
Private netValueField As Decimal
|
|
|
|
Private netValueFieldSpecified As Boolean
|
|
|
|
Private additionalStatisticalValueField As Decimal
|
|
|
|
Private additionalStatisticalValueFieldSpecified As Boolean
|
|
|
|
Private additionalCostsVatField As Decimal
|
|
|
|
Private additionalCostsVatFieldSpecified As Boolean
|
|
|
|
Private addStatisticValueField As Decimal
|
|
|
|
Private addStatisticValueFieldSpecified As Boolean
|
|
|
|
Private oprIngredientsValueField As Decimal
|
|
|
|
Private oprIngredientsValueFieldSpecified As Boolean
|
|
|
|
Private additionalCosts1Field As Decimal
|
|
|
|
Private additionalCosts1FieldSpecified As Boolean
|
|
|
|
Private additionalCosts2Field As Decimal
|
|
|
|
Private additionalCosts2FieldSpecified As Boolean
|
|
|
|
Private additionalCosts3Field As Decimal
|
|
|
|
Private additionalCosts3FieldSpecified As Boolean
|
|
|
|
Private additionalCosts4Field As Decimal
|
|
|
|
Private additionalCosts4FieldSpecified As Boolean
|
|
|
|
Private additionalCosts5Field As Decimal
|
|
|
|
Private additionalCosts5FieldSpecified As Boolean
|
|
|
|
Private additionalCosts6Field As Decimal
|
|
|
|
Private additionalCosts6FieldSpecified As Boolean
|
|
|
|
Private additionalCosts7Field As Decimal
|
|
|
|
Private additionalCosts7FieldSpecified As Boolean
|
|
|
|
Private additionalCosts8Field As Decimal
|
|
|
|
Private additionalCosts8FieldSpecified As Boolean
|
|
|
|
Private additionalCosts9Field As Decimal
|
|
|
|
Private additionalCosts9FieldSpecified As Boolean
|
|
|
|
Private additionalCosts10Field As Decimal
|
|
|
|
Private additionalCosts10FieldSpecified As Boolean
|
|
|
|
Private additionalCosts11Field As Decimal
|
|
|
|
Private additionalCosts11FieldSpecified As Boolean
|
|
|
|
Private additionalCosts12Field As Decimal
|
|
|
|
Private additionalCosts12FieldSpecified As Boolean
|
|
|
|
Private additionalCosts13Field As Decimal
|
|
|
|
Private additionalCosts13FieldSpecified As Boolean
|
|
|
|
Private additionalCosts14Field As Decimal
|
|
|
|
Private additionalCosts14FieldSpecified As Boolean
|
|
|
|
Private additionalCosts15Field As Decimal
|
|
|
|
Private additionalCosts15FieldSpecified As Boolean
|
|
|
|
Private additionalCosts16Field As Decimal
|
|
|
|
Private additionalCosts16FieldSpecified As Boolean
|
|
|
|
Private additionalCosts17Field As Decimal
|
|
|
|
Private additionalCosts17FieldSpecified As Boolean
|
|
|
|
Private additionalCosts18Field As Decimal
|
|
|
|
Private additionalCosts18FieldSpecified As Boolean
|
|
|
|
Private additionalCosts19Field As Decimal
|
|
|
|
Private additionalCosts19FieldSpecified As Boolean
|
|
|
|
Private additionalCosts20Field As Decimal
|
|
|
|
Private additionalCosts20FieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property customsValue() As Decimal
|
|
Get
|
|
Return Me.customsValueField
|
|
End Get
|
|
Set
|
|
Me.customsValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property customsValueSpecified() As Boolean
|
|
Get
|
|
Return Me.customsValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.customsValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property netValue() As Decimal
|
|
Get
|
|
Return Me.netValueField
|
|
End Get
|
|
Set
|
|
Me.netValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property netValueSpecified() As Boolean
|
|
Get
|
|
Return Me.netValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.netValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalStatisticalValue() As Decimal
|
|
Get
|
|
Return Me.additionalStatisticalValueField
|
|
End Get
|
|
Set
|
|
Me.additionalStatisticalValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalStatisticalValueSpecified() As Boolean
|
|
Get
|
|
Return Me.additionalStatisticalValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalStatisticalValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCostsVat() As Decimal
|
|
Get
|
|
Return Me.additionalCostsVatField
|
|
End Get
|
|
Set
|
|
Me.additionalCostsVatField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCostsVatSpecified() As Boolean
|
|
Get
|
|
Return Me.additionalCostsVatFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCostsVatFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addStatisticValue() As Decimal
|
|
Get
|
|
Return Me.addStatisticValueField
|
|
End Get
|
|
Set
|
|
Me.addStatisticValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property addStatisticValueSpecified() As Boolean
|
|
Get
|
|
Return Me.addStatisticValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.addStatisticValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property oprIngredientsValue() As Decimal
|
|
Get
|
|
Return Me.oprIngredientsValueField
|
|
End Get
|
|
Set
|
|
Me.oprIngredientsValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property oprIngredientsValueSpecified() As Boolean
|
|
Get
|
|
Return Me.oprIngredientsValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.oprIngredientsValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts1() As Decimal
|
|
Get
|
|
Return Me.additionalCosts1Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts1Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts1FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts1FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts2() As Decimal
|
|
Get
|
|
Return Me.additionalCosts2Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts2Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts2FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts2FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts3() As Decimal
|
|
Get
|
|
Return Me.additionalCosts3Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts3Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts3FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts3FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts4() As Decimal
|
|
Get
|
|
Return Me.additionalCosts4Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts4Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts4Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts4FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts4FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts5() As Decimal
|
|
Get
|
|
Return Me.additionalCosts5Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts5Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts5Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts5FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts5FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts6() As Decimal
|
|
Get
|
|
Return Me.additionalCosts6Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts6Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts6Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts6FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts6FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts7() As Decimal
|
|
Get
|
|
Return Me.additionalCosts7Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts7Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts7Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts7FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts7FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts8() As Decimal
|
|
Get
|
|
Return Me.additionalCosts8Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts8Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts8Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts8FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts8FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts9() As Decimal
|
|
Get
|
|
Return Me.additionalCosts9Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts9Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts9Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts9FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts9FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts10() As Decimal
|
|
Get
|
|
Return Me.additionalCosts10Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts10Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts10Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts10FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts10FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts11() As Decimal
|
|
Get
|
|
Return Me.additionalCosts11Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts11Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts11Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts11FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts11FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts12() As Decimal
|
|
Get
|
|
Return Me.additionalCosts12Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts12Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts12Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts12FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts12FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts13() As Decimal
|
|
Get
|
|
Return Me.additionalCosts13Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts13Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts13Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts13FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts13FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts14() As Decimal
|
|
Get
|
|
Return Me.additionalCosts14Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts14Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts14Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts14FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts14FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts15() As Decimal
|
|
Get
|
|
Return Me.additionalCosts15Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts15Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts15Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts15FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts15FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts16() As Decimal
|
|
Get
|
|
Return Me.additionalCosts16Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts16Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts16Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts16FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts16FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts17() As Decimal
|
|
Get
|
|
Return Me.additionalCosts17Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts17Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts17Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts17FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts17FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts18() As Decimal
|
|
Get
|
|
Return Me.additionalCosts18Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts18Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts18Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts18FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts18FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts19() As Decimal
|
|
Get
|
|
Return Me.additionalCosts19Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts19Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts19Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts19FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts19FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalCosts20() As Decimal
|
|
Get
|
|
Return Me.additionalCosts20Field
|
|
End Get
|
|
Set
|
|
Me.additionalCosts20Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property additionalCosts20Specified() As Boolean
|
|
Get
|
|
Return Me.additionalCosts20FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.additionalCosts20FieldSpecified = 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(TCalcValuesCust))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCalcValuesCust 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 TCalcValuesCust object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCalcValuesCust 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 TCalcValuesCust, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCalcValuesCust)
|
|
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 TCalcValuesCust) 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 TCalcValuesCust
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCalcValuesCust)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCalcValuesCust 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 TCalcValuesCust object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCalcValuesCust 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 TCalcValuesCust, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCalcValuesCust)
|
|
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 TCalcValuesCust) 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 TCalcValuesCust
|
|
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 TCalcValues
|
|
|
|
Private customsValueField As Decimal
|
|
|
|
Private customsValueFieldSpecified As Boolean
|
|
|
|
Private netValueField As Decimal
|
|
|
|
Private netValueFieldSpecified As Boolean
|
|
|
|
Private statValueField As Decimal
|
|
|
|
Private statValueFieldSpecified As Boolean
|
|
|
|
Private freightStatValField As Decimal
|
|
|
|
Private freightStatValFieldSpecified As Boolean
|
|
|
|
Private freightInternationalField As Decimal
|
|
|
|
Private freightInternationalFieldSpecified As Boolean
|
|
|
|
Private freightEUField As Decimal
|
|
|
|
Private freightEUFieldSpecified As Boolean
|
|
|
|
Private freightNationalField As Decimal
|
|
|
|
Private freightNationalFieldSpecified As Boolean
|
|
|
|
Private insuranceField As Decimal
|
|
|
|
Private insuranceFieldSpecified As Boolean
|
|
|
|
Private shipAddCostsField As List(Of Decimal)
|
|
|
|
Private invAddCostsField As List(Of Decimal)
|
|
|
|
Private lineAddCostsField As List(Of Decimal)
|
|
|
|
Private custValueField As Decimal
|
|
|
|
Private custValueFieldSpecified As Boolean
|
|
|
|
Private assistValueField As Decimal
|
|
|
|
Private assistValueFieldSpecified As Boolean
|
|
|
|
Private vatAddCostsField As Decimal
|
|
|
|
Private vatAddCostsFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.lineAddCostsField = New List(Of Decimal)()
|
|
Me.invAddCostsField = New List(Of Decimal)()
|
|
Me.shipAddCostsField = New List(Of Decimal)()
|
|
End Sub
|
|
|
|
Public Property customsValue() As Decimal
|
|
Get
|
|
Return Me.customsValueField
|
|
End Get
|
|
Set
|
|
Me.customsValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property customsValueSpecified() As Boolean
|
|
Get
|
|
Return Me.customsValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.customsValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property netValue() As Decimal
|
|
Get
|
|
Return Me.netValueField
|
|
End Get
|
|
Set
|
|
Me.netValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property netValueSpecified() As Boolean
|
|
Get
|
|
Return Me.netValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.netValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statValue() As Decimal
|
|
Get
|
|
Return Me.statValueField
|
|
End Get
|
|
Set
|
|
Me.statValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property statValueSpecified() As Boolean
|
|
Get
|
|
Return Me.statValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.statValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property freightStatVal() As Decimal
|
|
Get
|
|
Return Me.freightStatValField
|
|
End Get
|
|
Set
|
|
Me.freightStatValField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property freightStatValSpecified() As Boolean
|
|
Get
|
|
Return Me.freightStatValFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.freightStatValFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property freightInternational() As Decimal
|
|
Get
|
|
Return Me.freightInternationalField
|
|
End Get
|
|
Set
|
|
Me.freightInternationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property freightInternationalSpecified() As Boolean
|
|
Get
|
|
Return Me.freightInternationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.freightInternationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property freightEU() As Decimal
|
|
Get
|
|
Return Me.freightEUField
|
|
End Get
|
|
Set
|
|
Me.freightEUField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property freightEUSpecified() As Boolean
|
|
Get
|
|
Return Me.freightEUFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.freightEUFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property freightNational() As Decimal
|
|
Get
|
|
Return Me.freightNationalField
|
|
End Get
|
|
Set
|
|
Me.freightNationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property freightNationalSpecified() As Boolean
|
|
Get
|
|
Return Me.freightNationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.freightNationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property insurance() As Decimal
|
|
Get
|
|
Return Me.insuranceField
|
|
End Get
|
|
Set
|
|
Me.insuranceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property insuranceSpecified() As Boolean
|
|
Get
|
|
Return Me.insuranceFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.insuranceFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipAddCosts() As List(Of Decimal)
|
|
Get
|
|
Return Me.shipAddCostsField
|
|
End Get
|
|
Set
|
|
Me.shipAddCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invAddCosts() As List(Of Decimal)
|
|
Get
|
|
Return Me.invAddCostsField
|
|
End Get
|
|
Set
|
|
Me.invAddCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property lineAddCosts() As List(Of Decimal)
|
|
Get
|
|
Return Me.lineAddCostsField
|
|
End Get
|
|
Set
|
|
Me.lineAddCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property custValue() As Decimal
|
|
Get
|
|
Return Me.custValueField
|
|
End Get
|
|
Set
|
|
Me.custValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property custValueSpecified() As Boolean
|
|
Get
|
|
Return Me.custValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.custValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property assistValue() As Decimal
|
|
Get
|
|
Return Me.assistValueField
|
|
End Get
|
|
Set
|
|
Me.assistValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property assistValueSpecified() As Boolean
|
|
Get
|
|
Return Me.assistValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.assistValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property vatAddCosts() As Decimal
|
|
Get
|
|
Return Me.vatAddCostsField
|
|
End Get
|
|
Set
|
|
Me.vatAddCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property vatAddCostsSpecified() As Boolean
|
|
Get
|
|
Return Me.vatAddCostsFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.vatAddCostsFieldSpecified = 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(TCalcValues))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCalcValues 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 TCalcValues object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCalcValues 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 TCalcValues, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCalcValues)
|
|
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 TCalcValues) 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 TCalcValues
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCalcValues)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCalcValues 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 TCalcValues object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCalcValues 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 TCalcValues, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCalcValues)
|
|
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 TCalcValues) 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 TCalcValues
|
|
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 TImportRegistrationNo
|
|
|
|
Private registrationNumber1Field As String
|
|
|
|
Private registrationNumber2Field As String
|
|
|
|
Private registrationNumber3Field As String
|
|
|
|
Private registrationNumber4Field As String
|
|
|
|
Private messageRefNumber1Field As String
|
|
|
|
Private messageRefNumber2Field As String
|
|
|
|
Private messageRefNumber3Field As String
|
|
|
|
Private positionNumber1Field As Decimal
|
|
|
|
Private positionNumber1FieldSpecified As Boolean
|
|
|
|
Private positionNumber2Field As Decimal
|
|
|
|
Private positionNumber2FieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property registrationNumber1() As String
|
|
Get
|
|
Return Me.registrationNumber1Field
|
|
End Get
|
|
Set
|
|
Me.registrationNumber1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationNumber2() As String
|
|
Get
|
|
Return Me.registrationNumber2Field
|
|
End Get
|
|
Set
|
|
Me.registrationNumber2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationNumber3() As String
|
|
Get
|
|
Return Me.registrationNumber3Field
|
|
End Get
|
|
Set
|
|
Me.registrationNumber3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationNumber4() As String
|
|
Get
|
|
Return Me.registrationNumber4Field
|
|
End Get
|
|
Set
|
|
Me.registrationNumber4Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property messageRefNumber1() As String
|
|
Get
|
|
Return Me.messageRefNumber1Field
|
|
End Get
|
|
Set
|
|
Me.messageRefNumber1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property messageRefNumber2() As String
|
|
Get
|
|
Return Me.messageRefNumber2Field
|
|
End Get
|
|
Set
|
|
Me.messageRefNumber2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property messageRefNumber3() As String
|
|
Get
|
|
Return Me.messageRefNumber3Field
|
|
End Get
|
|
Set
|
|
Me.messageRefNumber3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property positionNumber1() As Decimal
|
|
Get
|
|
Return Me.positionNumber1Field
|
|
End Get
|
|
Set
|
|
Me.positionNumber1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property positionNumber1Specified() As Boolean
|
|
Get
|
|
Return Me.positionNumber1FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.positionNumber1FieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property positionNumber2() As Decimal
|
|
Get
|
|
Return Me.positionNumber2Field
|
|
End Get
|
|
Set
|
|
Me.positionNumber2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property positionNumber2Specified() As Boolean
|
|
Get
|
|
Return Me.positionNumber2FieldSpecified
|
|
End Get
|
|
Set
|
|
Me.positionNumber2FieldSpecified = 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(TImportRegistrationNo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TImportRegistrationNo 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 TImportRegistrationNo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TImportRegistrationNo 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 TImportRegistrationNo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportRegistrationNo)
|
|
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 TImportRegistrationNo) 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 TImportRegistrationNo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TImportRegistrationNo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TImportRegistrationNo 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 TImportRegistrationNo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TImportRegistrationNo 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 TImportRegistrationNo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportRegistrationNo)
|
|
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 TImportRegistrationNo) 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 TImportRegistrationNo
|
|
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 TReceipt
|
|
|
|
Private receiptNumberField As String
|
|
|
|
Private receiptDateField As Date
|
|
|
|
Private receiptDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property receiptNumber() As String
|
|
Get
|
|
Return Me.receiptNumberField
|
|
End Get
|
|
Set
|
|
Me.receiptNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property receiptDate() As Date
|
|
Get
|
|
Return Me.receiptDateField
|
|
End Get
|
|
Set
|
|
Me.receiptDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property receiptDateSpecified() As Boolean
|
|
Get
|
|
Return Me.receiptDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.receiptDateFieldSpecified = 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(TReceipt))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TReceipt 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 TReceipt object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TReceipt 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 TReceipt, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TReceipt)
|
|
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 TReceipt) 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 TReceipt
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TReceipt)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TReceipt 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 TReceipt object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TReceipt 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 TReceipt, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TReceipt)
|
|
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 TReceipt) 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 TReceipt
|
|
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 TPackage
|
|
|
|
Private packageCountField As Decimal
|
|
|
|
Private packageCountFieldSpecified As Boolean
|
|
|
|
Private packageTypeField As String
|
|
|
|
Private packageDescriptionField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property packageCount() As Decimal
|
|
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
|
|
|
|
Public Property packageDescription() As String
|
|
Get
|
|
Return Me.packageDescriptionField
|
|
End Get
|
|
Set
|
|
Me.packageDescriptionField = 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(TPackage))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPackage 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 TPackage object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPackage 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 TPackage, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackage)
|
|
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 TPackage) 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 TPackage
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPackage)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPackage 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 TPackage object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPackage 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 TPackage, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackage)
|
|
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 TPackage) 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 TPackage
|
|
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 TBom
|
|
|
|
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(TBom))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TBom 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 TBom object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TBom 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 TBom, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TBom)
|
|
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 TBom) 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 TBom
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TBom)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TBom 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 TBom object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TBom 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 TBom, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TBom)
|
|
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 TBom) 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 TBom
|
|
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 TAddCostsVAT
|
|
|
|
Private addAmountVATField As Decimal
|
|
|
|
Private addAmountVATFieldSpecified As Boolean
|
|
|
|
Private addCurrencyVATField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property addAmountVAT() As Decimal
|
|
Get
|
|
Return Me.addAmountVATField
|
|
End Get
|
|
Set
|
|
Me.addAmountVATField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property addAmountVATSpecified() As Boolean
|
|
Get
|
|
Return Me.addAmountVATFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.addAmountVATFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCurrencyVAT() As String
|
|
Get
|
|
Return Me.addCurrencyVATField
|
|
End Get
|
|
Set
|
|
Me.addCurrencyVATField = 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(TAddCostsVAT))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAddCostsVAT 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 TAddCostsVAT object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAddCostsVAT 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 TAddCostsVAT, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCostsVAT)
|
|
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 TAddCostsVAT) 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 TAddCostsVAT
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAddCostsVAT)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAddCostsVAT 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 TAddCostsVAT object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAddCostsVAT 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 TAddCostsVAT, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCostsVAT)
|
|
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 TAddCostsVAT) 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 TAddCostsVAT
|
|
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 TRebateLine
|
|
|
|
Private rebAmountField As Decimal
|
|
|
|
Private rebAmountFieldSpecified As Boolean
|
|
|
|
Private rebCurrencyField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property rebAmount() As Decimal
|
|
Get
|
|
Return Me.rebAmountField
|
|
End Get
|
|
Set
|
|
Me.rebAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property rebAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.rebAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.rebAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property rebCurrency() As String
|
|
Get
|
|
Return Me.rebCurrencyField
|
|
End Get
|
|
Set
|
|
Me.rebCurrencyField = 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(TRebateLine))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TRebateLine 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 TRebateLine object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TRebateLine 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 TRebateLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRebateLine)
|
|
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 TRebateLine) 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 TRebateLine
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TRebateLine)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TRebateLine 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 TRebateLine object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TRebateLine 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 TRebateLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRebateLine)
|
|
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 TRebateLine) 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 TRebateLine
|
|
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 TInsuranceCostsLine
|
|
|
|
Private insAmountField As Decimal
|
|
|
|
Private insAmountFieldSpecified As Boolean
|
|
|
|
Private insCurrencyField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property insAmount() As Decimal
|
|
Get
|
|
Return Me.insAmountField
|
|
End Get
|
|
Set
|
|
Me.insAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property insAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.insAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.insAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property insCurrency() As String
|
|
Get
|
|
Return Me.insCurrencyField
|
|
End Get
|
|
Set
|
|
Me.insCurrencyField = 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(TInsuranceCostsLine))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInsuranceCostsLine 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 TInsuranceCostsLine object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInsuranceCostsLine 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 TInsuranceCostsLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInsuranceCostsLine)
|
|
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 TInsuranceCostsLine) 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 TInsuranceCostsLine
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInsuranceCostsLine)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInsuranceCostsLine 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 TInsuranceCostsLine object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInsuranceCostsLine 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 TInsuranceCostsLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInsuranceCostsLine)
|
|
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 TInsuranceCostsLine) 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 TInsuranceCostsLine
|
|
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 TFreightCostsLine
|
|
|
|
Private frtAmountField As Decimal
|
|
|
|
Private frtAmountFieldSpecified As Boolean
|
|
|
|
Private frtCurrencyField As String
|
|
|
|
Private frtInternationalField As Decimal
|
|
|
|
Private frtInternationalFieldSpecified As Boolean
|
|
|
|
Private frtEuNationalField As Decimal
|
|
|
|
Private frtEuNationalFieldSpecified As Boolean
|
|
|
|
Private frtInlandField As Decimal
|
|
|
|
Private frtInlandFieldSpecified As Boolean
|
|
|
|
Private frtFlagPercentOrValueField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.frtFlagPercentOrValueField = "P"
|
|
End Sub
|
|
|
|
Public Property frtAmount() As Decimal
|
|
Get
|
|
Return Me.frtAmountField
|
|
End Get
|
|
Set
|
|
Me.frtAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.frtAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtCurrency() As String
|
|
Get
|
|
Return Me.frtCurrencyField
|
|
End Get
|
|
Set
|
|
Me.frtCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtInternational() As Decimal
|
|
Get
|
|
Return Me.frtInternationalField
|
|
End Get
|
|
Set
|
|
Me.frtInternationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtInternationalSpecified() As Boolean
|
|
Get
|
|
Return Me.frtInternationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtInternationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtEuNational() As Decimal
|
|
Get
|
|
Return Me.frtEuNationalField
|
|
End Get
|
|
Set
|
|
Me.frtEuNationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtEuNationalSpecified() As Boolean
|
|
Get
|
|
Return Me.frtEuNationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtEuNationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtInland() As Decimal
|
|
Get
|
|
Return Me.frtInlandField
|
|
End Get
|
|
Set
|
|
Me.frtInlandField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtInlandSpecified() As Boolean
|
|
Get
|
|
Return Me.frtInlandFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtInlandFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.ComponentModel.DefaultValueAttribute("P")>
|
|
Public Property frtFlagPercentOrValue() As String
|
|
Get
|
|
Return Me.frtFlagPercentOrValueField
|
|
End Get
|
|
Set
|
|
Me.frtFlagPercentOrValueField = 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(TFreightCostsLine))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TFreightCostsLine 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 TFreightCostsLine object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TFreightCostsLine 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 TFreightCostsLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreightCostsLine)
|
|
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 TFreightCostsLine) 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 TFreightCostsLine
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TFreightCostsLine)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TFreightCostsLine 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 TFreightCostsLine object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TFreightCostsLine 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 TFreightCostsLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreightCostsLine)
|
|
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 TFreightCostsLine) 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 TFreightCostsLine
|
|
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 TPricing
|
|
|
|
Private prcTypeField As String
|
|
|
|
Private prcReferenceField As String
|
|
|
|
Private prcDateField As Date
|
|
|
|
Private prcDateFieldSpecified As Boolean
|
|
|
|
Private prcSystemField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property prcType() As String
|
|
Get
|
|
Return Me.prcTypeField
|
|
End Get
|
|
Set
|
|
Me.prcTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prcReference() As String
|
|
Get
|
|
Return Me.prcReferenceField
|
|
End Get
|
|
Set
|
|
Me.prcReferenceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prcDate() As Date
|
|
Get
|
|
Return Me.prcDateField
|
|
End Get
|
|
Set
|
|
Me.prcDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property prcDateSpecified() As Boolean
|
|
Get
|
|
Return Me.prcDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.prcDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prcSystem() As String
|
|
Get
|
|
Return Me.prcSystemField
|
|
End Get
|
|
Set
|
|
Me.prcSystemField = 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(TPricing))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPricing 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 TPricing object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPricing 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 TPricing, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPricing)
|
|
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 TPricing) 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 TPricing
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPricing)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPricing 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 TPricing object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPricing 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 TPricing, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPricing)
|
|
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 TPricing) 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 TPricing
|
|
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 TImportLineLicense
|
|
|
|
Private typeField As String
|
|
|
|
Private codeField As String
|
|
|
|
Private numberField As String
|
|
|
|
Private dateField As Date
|
|
|
|
Private dateFieldSpecified As Boolean
|
|
|
|
Private notRequiredField As Boolean
|
|
|
|
Private notRequiredFieldSpecified As Boolean
|
|
|
|
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 code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property number() As String
|
|
Get
|
|
Return Me.numberField
|
|
End Get
|
|
Set
|
|
Me.numberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property [date]() As Date
|
|
Get
|
|
Return Me.dateField
|
|
End Get
|
|
Set
|
|
Me.dateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dateSpecified() As Boolean
|
|
Get
|
|
Return Me.dateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property notRequired() As Boolean
|
|
Get
|
|
Return Me.notRequiredField
|
|
End Get
|
|
Set
|
|
Me.notRequiredField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property notRequiredSpecified() As Boolean
|
|
Get
|
|
Return Me.notRequiredFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.notRequiredFieldSpecified = 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(TImportLineLicense))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TImportLineLicense 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 TImportLineLicense object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TImportLineLicense 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 TImportLineLicense, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportLineLicense)
|
|
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 TImportLineLicense) 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 TImportLineLicense
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TImportLineLicense)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TImportLineLicense 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 TImportLineLicense object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TImportLineLicense 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 TImportLineLicense, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportLineLicense)
|
|
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 TImportLineLicense) 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 TImportLineLicense
|
|
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 TItem
|
|
|
|
Private partNumberField As String
|
|
|
|
Private partDescriptionField As String
|
|
|
|
Private serialNumberField As String
|
|
|
|
Private productGroupField As String
|
|
|
|
Private modelField As String
|
|
|
|
Private brandField As String
|
|
|
|
Private manufacturerNumberField As String
|
|
|
|
Private ctoNumberField As String
|
|
|
|
Private confidenceLevelField As Long
|
|
|
|
Private confidenceLevelFieldSpecified As Boolean
|
|
|
|
Private productCategoryField As String
|
|
|
|
Private tariffCodeField As TTariffCode
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.tariffCodeField = New TTariffCode()
|
|
End Sub
|
|
|
|
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 serialNumber() As String
|
|
Get
|
|
Return Me.serialNumberField
|
|
End Get
|
|
Set
|
|
Me.serialNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property productGroup() As String
|
|
Get
|
|
Return Me.productGroupField
|
|
End Get
|
|
Set
|
|
Me.productGroupField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property model() As String
|
|
Get
|
|
Return Me.modelField
|
|
End Get
|
|
Set
|
|
Me.modelField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property brand() As String
|
|
Get
|
|
Return Me.brandField
|
|
End Get
|
|
Set
|
|
Me.brandField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property manufacturerNumber() As String
|
|
Get
|
|
Return Me.manufacturerNumberField
|
|
End Get
|
|
Set
|
|
Me.manufacturerNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ctoNumber() As String
|
|
Get
|
|
Return Me.ctoNumberField
|
|
End Get
|
|
Set
|
|
Me.ctoNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property confidenceLevel() As Long
|
|
Get
|
|
Return Me.confidenceLevelField
|
|
End Get
|
|
Set
|
|
Me.confidenceLevelField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property confidenceLevelSpecified() As Boolean
|
|
Get
|
|
Return Me.confidenceLevelFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.confidenceLevelFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property productCategory() As String
|
|
Get
|
|
Return Me.productCategoryField
|
|
End Get
|
|
Set
|
|
Me.productCategoryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property TariffCode() As TTariffCode
|
|
Get
|
|
Return Me.tariffCodeField
|
|
End Get
|
|
Set
|
|
Me.tariffCodeField = 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 TInvoiceLine
|
|
|
|
Private lineNumberField As Decimal
|
|
|
|
Private itemField As TItem
|
|
|
|
Private quantityField As Decimal
|
|
|
|
Private quantityFieldSpecified As Boolean
|
|
|
|
Private quantityUomField As String
|
|
|
|
Private netWeightField As Decimal
|
|
|
|
Private netWeightFieldSpecified As Boolean
|
|
|
|
Private grossWeightField As Decimal
|
|
|
|
Private grossWeightFieldSpecified As Boolean
|
|
|
|
Private reportingQuantityField As Decimal
|
|
|
|
Private reportingQuantityFieldSpecified As Boolean
|
|
|
|
Private reportingQuantityUomField As String
|
|
|
|
Private priceField As Decimal
|
|
|
|
Private priceFieldSpecified As Boolean
|
|
|
|
Private lineValueField As Decimal
|
|
|
|
Private lineValueFieldSpecified As Boolean
|
|
|
|
Private licenseField As TImportLineLicense
|
|
|
|
Private pricingField As TPricing
|
|
|
|
Private freightCostsField As TFreightCostsLine
|
|
|
|
Private insuranceCostsField As TInsuranceCostsLine
|
|
|
|
Private additionalCostField As List(Of TAddCosts)
|
|
|
|
Private rebateField As TRebateLine
|
|
|
|
Private additionalCostsVATField As TAddCostsVAT
|
|
|
|
Private countryOfOriginField As String
|
|
|
|
Private prefCountryOfOriginField As String
|
|
|
|
Private locationOfGoodsField As String
|
|
|
|
Private importQuotaField As String
|
|
|
|
Private importQuotaKeyField As String
|
|
|
|
Private importQuotaQuantityField As Decimal
|
|
|
|
Private importQuotaQuantityFieldSpecified As Boolean
|
|
|
|
Private importQuotaUnitOfMeasurementField As String
|
|
|
|
Private importQuotaQualifierField As String
|
|
|
|
Private customsProcedureField As String
|
|
|
|
Private statisticalCodeField As String
|
|
|
|
Private endUseIndicatorField As String
|
|
|
|
Private transactionTypeField As String
|
|
|
|
Private addCodeField As List(Of String)
|
|
|
|
Private prefRequestCodeField As String
|
|
|
|
Private documentsField As List(Of TDocument)
|
|
|
|
Private previousDocumentField As List(Of TPrevDoc)
|
|
|
|
Private bOMField As TBom
|
|
|
|
Private stockTypeField As String
|
|
|
|
Private stockType2Field As String
|
|
|
|
Private stockExpiryDateField As Date
|
|
|
|
Private stockExpiryDateFieldSpecified As Boolean
|
|
|
|
Private packageField As TPackage
|
|
|
|
Private accountNumberField As String
|
|
|
|
Private deliveryNoteField As String
|
|
|
|
Private orderNumberField As String
|
|
|
|
Private receiptField As TReceipt
|
|
|
|
Private asnNumberField As String
|
|
|
|
Private referenceValueField As Decimal
|
|
|
|
Private referenceValueFieldSpecified As Boolean
|
|
|
|
Private referenceCurrencyField As String
|
|
|
|
Private textField As String
|
|
|
|
Private text2Field As String
|
|
|
|
Private registrationNumbersField As TImportRegistrationNo
|
|
|
|
Private customerFieldsField As TCustomerFields
|
|
|
|
Private attributesField As List(Of TAttribute)
|
|
|
|
Private containerInfoField As List(Of TDetailContainerInfo)
|
|
|
|
Private partnersField As List(Of TPartner)
|
|
|
|
Private calculatedValuesField As TCalcValues
|
|
|
|
Private calculatedValuesCustField As TCalcValuesCust
|
|
|
|
Private dutiesField As List(Of TDuty)
|
|
|
|
Private dutyTaxesField As List(Of TDutyTax)
|
|
|
|
Private dutySavingsField As List(Of TDutySaving)
|
|
|
|
Private oprDetailsField As TOprInfo
|
|
|
|
Private uniqueIdField As Decimal
|
|
|
|
Private uniqueIdFieldSpecified As Boolean
|
|
|
|
Private externalProcessingField As String
|
|
|
|
Private additionalInformationField As List(Of TAttribute)
|
|
|
|
Private intraField As TCustIntraLine
|
|
|
|
Private preSupplierField As TPreSupplier
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private valuationIndicatorField As String
|
|
|
|
Private referencePreviousProceduresField As List(Of TRefPrevProcedure)
|
|
|
|
Private packagesDataField As TPackagesData
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.packagesDataField = New TPackagesData()
|
|
Me.referencePreviousProceduresField = New List(Of TRefPrevProcedure)()
|
|
Me.preSupplierField = New TPreSupplier()
|
|
Me.intraField = New TCustIntraLine()
|
|
Me.additionalInformationField = New List(Of TAttribute)()
|
|
Me.oprDetailsField = New TOprInfo()
|
|
Me.dutySavingsField = New List(Of TDutySaving)()
|
|
Me.dutyTaxesField = New List(Of TDutyTax)()
|
|
Me.dutiesField = New List(Of TDuty)()
|
|
Me.calculatedValuesCustField = New TCalcValuesCust()
|
|
Me.calculatedValuesField = New TCalcValues()
|
|
Me.partnersField = New List(Of TPartner)()
|
|
Me.containerInfoField = New List(Of TDetailContainerInfo)()
|
|
Me.attributesField = New List(Of TAttribute)()
|
|
Me.customerFieldsField = New TCustomerFields()
|
|
Me.registrationNumbersField = New TImportRegistrationNo()
|
|
Me.receiptField = New TReceipt()
|
|
Me.packageField = New TPackage()
|
|
Me.bOMField = New TBom()
|
|
Me.previousDocumentField = New List(Of TPrevDoc)()
|
|
Me.documentsField = New List(Of TDocument)()
|
|
Me.addCodeField = New List(Of String)()
|
|
Me.additionalCostsVATField = New TAddCostsVAT()
|
|
Me.rebateField = New TRebateLine()
|
|
Me.additionalCostField = New List(Of TAddCosts)()
|
|
Me.insuranceCostsField = New TInsuranceCostsLine()
|
|
Me.freightCostsField = New TFreightCostsLine()
|
|
Me.pricingField = New TPricing()
|
|
Me.licenseField = New TImportLineLicense()
|
|
Me.itemField = New TItem()
|
|
End Sub
|
|
|
|
Public Property lineNumber() As Decimal
|
|
Get
|
|
Return Me.lineNumberField
|
|
End Get
|
|
Set
|
|
Me.lineNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Item() As TItem
|
|
Get
|
|
Return Me.itemField
|
|
End Get
|
|
Set
|
|
Me.itemField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property quantity() As Decimal
|
|
Get
|
|
Return Me.quantityField
|
|
End Get
|
|
Set
|
|
Me.quantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property quantitySpecified() As Boolean
|
|
Get
|
|
Return Me.quantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.quantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property quantityUom() As String
|
|
Get
|
|
Return Me.quantityUomField
|
|
End Get
|
|
Set
|
|
Me.quantityUomField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property netWeight() As Decimal
|
|
Get
|
|
Return Me.netWeightField
|
|
End Get
|
|
Set
|
|
Me.netWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property netWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.netWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.netWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property grossWeight() As Decimal
|
|
Get
|
|
Return Me.grossWeightField
|
|
End Get
|
|
Set
|
|
Me.grossWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property grossWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.grossWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.grossWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property reportingQuantity() As Decimal
|
|
Get
|
|
Return Me.reportingQuantityField
|
|
End Get
|
|
Set
|
|
Me.reportingQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property reportingQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.reportingQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.reportingQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property reportingQuantityUom() As String
|
|
Get
|
|
Return Me.reportingQuantityUomField
|
|
End Get
|
|
Set
|
|
Me.reportingQuantityUomField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property price() As Decimal
|
|
Get
|
|
Return Me.priceField
|
|
End Get
|
|
Set
|
|
Me.priceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property priceSpecified() As Boolean
|
|
Get
|
|
Return Me.priceFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.priceFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property lineValue() As Decimal
|
|
Get
|
|
Return Me.lineValueField
|
|
End Get
|
|
Set
|
|
Me.lineValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property lineValueSpecified() As Boolean
|
|
Get
|
|
Return Me.lineValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.lineValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property License() As TImportLineLicense
|
|
Get
|
|
Return Me.licenseField
|
|
End Get
|
|
Set
|
|
Me.licenseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Pricing() As TPricing
|
|
Get
|
|
Return Me.pricingField
|
|
End Get
|
|
Set
|
|
Me.pricingField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property FreightCosts() As TFreightCostsLine
|
|
Get
|
|
Return Me.freightCostsField
|
|
End Get
|
|
Set
|
|
Me.freightCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property InsuranceCosts() As TInsuranceCostsLine
|
|
Get
|
|
Return Me.insuranceCostsField
|
|
End Get
|
|
Set
|
|
Me.insuranceCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property AdditionalCost() As List(Of TAddCosts)
|
|
Get
|
|
Return Me.additionalCostField
|
|
End Get
|
|
Set
|
|
Me.additionalCostField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Rebate() As TRebateLine
|
|
Get
|
|
Return Me.rebateField
|
|
End Get
|
|
Set
|
|
Me.rebateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property AdditionalCostsVAT() As TAddCostsVAT
|
|
Get
|
|
Return Me.additionalCostsVATField
|
|
End Get
|
|
Set
|
|
Me.additionalCostsVATField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property countryOfOrigin() As String
|
|
Get
|
|
Return Me.countryOfOriginField
|
|
End Get
|
|
Set
|
|
Me.countryOfOriginField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prefCountryOfOrigin() As String
|
|
Get
|
|
Return Me.prefCountryOfOriginField
|
|
End Get
|
|
Set
|
|
Me.prefCountryOfOriginField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property locationOfGoods() As String
|
|
Get
|
|
Return Me.locationOfGoodsField
|
|
End Get
|
|
Set
|
|
Me.locationOfGoodsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importQuota() As String
|
|
Get
|
|
Return Me.importQuotaField
|
|
End Get
|
|
Set
|
|
Me.importQuotaField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importQuotaKey() As String
|
|
Get
|
|
Return Me.importQuotaKeyField
|
|
End Get
|
|
Set
|
|
Me.importQuotaKeyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importQuotaQuantity() As Decimal
|
|
Get
|
|
Return Me.importQuotaQuantityField
|
|
End Get
|
|
Set
|
|
Me.importQuotaQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property importQuotaQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.importQuotaQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.importQuotaQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importQuotaUnitOfMeasurement() As String
|
|
Get
|
|
Return Me.importQuotaUnitOfMeasurementField
|
|
End Get
|
|
Set
|
|
Me.importQuotaUnitOfMeasurementField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importQuotaQualifier() As String
|
|
Get
|
|
Return Me.importQuotaQualifierField
|
|
End Get
|
|
Set
|
|
Me.importQuotaQualifierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customsProcedure() As String
|
|
Get
|
|
Return Me.customsProcedureField
|
|
End Get
|
|
Set
|
|
Me.customsProcedureField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalCode() As String
|
|
Get
|
|
Return Me.statisticalCodeField
|
|
End Get
|
|
Set
|
|
Me.statisticalCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property endUseIndicator() As String
|
|
Get
|
|
Return Me.endUseIndicatorField
|
|
End Get
|
|
Set
|
|
Me.endUseIndicatorField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property transactionType() As String
|
|
Get
|
|
Return Me.transactionTypeField
|
|
End Get
|
|
Set
|
|
Me.transactionTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCode() As List(Of String)
|
|
Get
|
|
Return Me.addCodeField
|
|
End Get
|
|
Set
|
|
Me.addCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prefRequestCode() As String
|
|
Get
|
|
Return Me.prefRequestCodeField
|
|
End Get
|
|
Set
|
|
Me.prefRequestCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Document", IsNullable:=False)>
|
|
Public Property Documents() As List(Of TDocument)
|
|
Get
|
|
Return Me.documentsField
|
|
End Get
|
|
Set
|
|
Me.documentsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("PreviousDocument", IsNullable:=False)>
|
|
Public Property PreviousDocument() As List(Of TPrevDoc)
|
|
Get
|
|
Return Me.previousDocumentField
|
|
End Get
|
|
Set
|
|
Me.previousDocumentField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property BOM() As TBom
|
|
Get
|
|
Return Me.bOMField
|
|
End Get
|
|
Set
|
|
Me.bOMField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property stockType() As String
|
|
Get
|
|
Return Me.stockTypeField
|
|
End Get
|
|
Set
|
|
Me.stockTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property stockType2() As String
|
|
Get
|
|
Return Me.stockType2Field
|
|
End Get
|
|
Set
|
|
Me.stockType2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property stockExpiryDate() As Date
|
|
Get
|
|
Return Me.stockExpiryDateField
|
|
End Get
|
|
Set
|
|
Me.stockExpiryDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property stockExpiryDateSpecified() As Boolean
|
|
Get
|
|
Return Me.stockExpiryDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.stockExpiryDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Package() As TPackage
|
|
Get
|
|
Return Me.packageField
|
|
End Get
|
|
Set
|
|
Me.packageField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property accountNumber() As String
|
|
Get
|
|
Return Me.accountNumberField
|
|
End Get
|
|
Set
|
|
Me.accountNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property deliveryNote() As String
|
|
Get
|
|
Return Me.deliveryNoteField
|
|
End Get
|
|
Set
|
|
Me.deliveryNoteField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property orderNumber() As String
|
|
Get
|
|
Return Me.orderNumberField
|
|
End Get
|
|
Set
|
|
Me.orderNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Receipt() As TReceipt
|
|
Get
|
|
Return Me.receiptField
|
|
End Get
|
|
Set
|
|
Me.receiptField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property asnNumber() As String
|
|
Get
|
|
Return Me.asnNumberField
|
|
End Get
|
|
Set
|
|
Me.asnNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceValue() As Decimal
|
|
Get
|
|
Return Me.referenceValueField
|
|
End Get
|
|
Set
|
|
Me.referenceValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property referenceValueSpecified() As Boolean
|
|
Get
|
|
Return Me.referenceValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.referenceValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceCurrency() As String
|
|
Get
|
|
Return Me.referenceCurrencyField
|
|
End Get
|
|
Set
|
|
Me.referenceCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property text() As String
|
|
Get
|
|
Return Me.textField
|
|
End Get
|
|
Set
|
|
Me.textField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property text2() As String
|
|
Get
|
|
Return Me.text2Field
|
|
End Get
|
|
Set
|
|
Me.text2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property RegistrationNumbers() As TImportRegistrationNo
|
|
Get
|
|
Return Me.registrationNumbersField
|
|
End Get
|
|
Set
|
|
Me.registrationNumbersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property CustomerFields() As TCustomerFields
|
|
Get
|
|
Return Me.customerFieldsField
|
|
End Get
|
|
Set
|
|
Me.customerFieldsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Attribute", IsNullable:=False)>
|
|
Public Property Attributes() As List(Of TAttribute)
|
|
Get
|
|
Return Me.attributesField
|
|
End Get
|
|
Set
|
|
Me.attributesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("DetailContainerInfo", IsNullable:=False)>
|
|
Public Property ContainerInfo() As List(Of TDetailContainerInfo)
|
|
Get
|
|
Return Me.containerInfoField
|
|
End Get
|
|
Set
|
|
Me.containerInfoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Partner", IsNullable:=False)>
|
|
Public Property Partners() As List(Of TPartner)
|
|
Get
|
|
Return Me.partnersField
|
|
End Get
|
|
Set
|
|
Me.partnersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property CalculatedValues() As TCalcValues
|
|
Get
|
|
Return Me.calculatedValuesField
|
|
End Get
|
|
Set
|
|
Me.calculatedValuesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property CalculatedValuesCust() As TCalcValuesCust
|
|
Get
|
|
Return Me.calculatedValuesCustField
|
|
End Get
|
|
Set
|
|
Me.calculatedValuesCustField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Duty", IsNullable:=False)>
|
|
Public Property Duties() As List(Of TDuty)
|
|
Get
|
|
Return Me.dutiesField
|
|
End Get
|
|
Set
|
|
Me.dutiesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("DutyTax", IsNullable:=False)>
|
|
Public Property DutyTaxes() As List(Of TDutyTax)
|
|
Get
|
|
Return Me.dutyTaxesField
|
|
End Get
|
|
Set
|
|
Me.dutyTaxesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("DutySaving", IsNullable:=False)>
|
|
Public Property DutySavings() As List(Of TDutySaving)
|
|
Get
|
|
Return Me.dutySavingsField
|
|
End Get
|
|
Set
|
|
Me.dutySavingsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property OprDetails() As TOprInfo
|
|
Get
|
|
Return Me.oprDetailsField
|
|
End Get
|
|
Set
|
|
Me.oprDetailsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property uniqueId() As Decimal
|
|
Get
|
|
Return Me.uniqueIdField
|
|
End Get
|
|
Set
|
|
Me.uniqueIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property uniqueIdSpecified() As Boolean
|
|
Get
|
|
Return Me.uniqueIdFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.uniqueIdFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property externalProcessing() As String
|
|
Get
|
|
Return Me.externalProcessingField
|
|
End Get
|
|
Set
|
|
Me.externalProcessingField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Attribute", IsNullable:=False)>
|
|
Public Property AdditionalInformation() As List(Of TAttribute)
|
|
Get
|
|
Return Me.additionalInformationField
|
|
End Get
|
|
Set
|
|
Me.additionalInformationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Intra() As TCustIntraLine
|
|
Get
|
|
Return Me.intraField
|
|
End Get
|
|
Set
|
|
Me.intraField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property PreSupplier() As TPreSupplier
|
|
Get
|
|
Return Me.preSupplierField
|
|
End Get
|
|
Set
|
|
Me.preSupplierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property valuationIndicator() As String
|
|
Get
|
|
Return Me.valuationIndicatorField
|
|
End Get
|
|
Set
|
|
Me.valuationIndicatorField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("ReferencePreviousProcedure", IsNullable:=False)>
|
|
Public Property ReferencePreviousProcedures() As List(Of TRefPrevProcedure)
|
|
Get
|
|
Return Me.referencePreviousProceduresField
|
|
End Get
|
|
Set
|
|
Me.referencePreviousProceduresField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property PackagesData() As TPackagesData
|
|
Get
|
|
Return Me.packagesDataField
|
|
End Get
|
|
Set
|
|
Me.packagesDataField = 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(TInvoiceLine))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLine 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 TInvoiceLine object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLine 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 TInvoiceLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLine)
|
|
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 TInvoiceLine) 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 TInvoiceLine
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInvoiceLine)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLine 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 TInvoiceLine object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLine 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 TInvoiceLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLine)
|
|
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 TInvoiceLine) 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 TInvoiceLine
|
|
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 addTypeField As String
|
|
|
|
Private addAmountField As Decimal
|
|
|
|
Private addAmountFieldSpecified As Boolean
|
|
|
|
Private addCurrencyField As String
|
|
|
|
Private addProRatingField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property addType() As String
|
|
Get
|
|
Return Me.addTypeField
|
|
End Get
|
|
Set
|
|
Me.addTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addAmount() As Decimal
|
|
Get
|
|
Return Me.addAmountField
|
|
End Get
|
|
Set
|
|
Me.addAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property addAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.addAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.addAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCurrency() As String
|
|
Get
|
|
Return Me.addCurrencyField
|
|
End Get
|
|
Set
|
|
Me.addCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addProRating() As String
|
|
Get
|
|
Return Me.addProRatingField
|
|
End Get
|
|
Set
|
|
Me.addProRatingField = 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
|
|
|
|
Partial Public Class TDocument
|
|
|
|
Private docNoField As String
|
|
|
|
Private docDateField As Date
|
|
|
|
Private docDateFieldSpecified As Boolean
|
|
|
|
Private docTypeField As String
|
|
|
|
Private docQualField As String
|
|
|
|
Private docValidFromField As Date
|
|
|
|
Private docValidFromFieldSpecified As Boolean
|
|
|
|
Private docValidToField As Date
|
|
|
|
Private docValidToFieldSpecified As Boolean
|
|
|
|
Private docAddTextField As String
|
|
|
|
Private docQuantityField As Decimal
|
|
|
|
Private docQuantityFieldSpecified As Boolean
|
|
|
|
Private docUnitField As String
|
|
|
|
Private docValueField As Decimal
|
|
|
|
Private docValueFieldSpecified As Boolean
|
|
|
|
Private docCategoryField As String
|
|
|
|
Private docWriteOffQuantityField As Decimal
|
|
|
|
Private docWriteOffQuantityFieldSpecified As Boolean
|
|
|
|
Private docIssuerCountryField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
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
|
|
|
|
Public Property docType() As String
|
|
Get
|
|
Return Me.docTypeField
|
|
End Get
|
|
Set
|
|
Me.docTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docQual() As String
|
|
Get
|
|
Return Me.docQualField
|
|
End Get
|
|
Set
|
|
Me.docQualField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docValidFrom() As Date
|
|
Get
|
|
Return Me.docValidFromField
|
|
End Get
|
|
Set
|
|
Me.docValidFromField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property docValidFromSpecified() As Boolean
|
|
Get
|
|
Return Me.docValidFromFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.docValidFromFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docValidTo() As Date
|
|
Get
|
|
Return Me.docValidToField
|
|
End Get
|
|
Set
|
|
Me.docValidToField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property docValidToSpecified() As Boolean
|
|
Get
|
|
Return Me.docValidToFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.docValidToFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docAddText() As String
|
|
Get
|
|
Return Me.docAddTextField
|
|
End Get
|
|
Set
|
|
Me.docAddTextField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docQuantity() As Decimal
|
|
Get
|
|
Return Me.docQuantityField
|
|
End Get
|
|
Set
|
|
Me.docQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property docQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.docQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.docQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docUnit() As String
|
|
Get
|
|
Return Me.docUnitField
|
|
End Get
|
|
Set
|
|
Me.docUnitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docValue() As Decimal
|
|
Get
|
|
Return Me.docValueField
|
|
End Get
|
|
Set
|
|
Me.docValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property docValueSpecified() As Boolean
|
|
Get
|
|
Return Me.docValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.docValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docCategory() As String
|
|
Get
|
|
Return Me.docCategoryField
|
|
End Get
|
|
Set
|
|
Me.docCategoryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docWriteOffQuantity() As Decimal
|
|
Get
|
|
Return Me.docWriteOffQuantityField
|
|
End Get
|
|
Set
|
|
Me.docWriteOffQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property docWriteOffQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.docWriteOffQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.docWriteOffQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docIssuerCountry() As String
|
|
Get
|
|
Return Me.docIssuerCountryField
|
|
End Get
|
|
Set
|
|
Me.docIssuerCountryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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(TDocument))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDocument 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 TDocument object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDocument 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 TDocument, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDocument)
|
|
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 TDocument) 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 TDocument
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDocument)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDocument 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 TDocument object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDocument 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 TDocument, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDocument)
|
|
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 TDocument) 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 TDocument
|
|
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 TPrevDoc
|
|
|
|
Private previousDocTypeField As String
|
|
|
|
Private previousDocNumberField As String
|
|
|
|
Private previousDocDateField As Date
|
|
|
|
Private previousDocDateFieldSpecified As Boolean
|
|
|
|
Private departureCustomsOfficeField As String
|
|
|
|
Private destinationCustomsOfficeField As String
|
|
|
|
Private typeField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property previousDocType() As String
|
|
Get
|
|
Return Me.previousDocTypeField
|
|
End Get
|
|
Set
|
|
Me.previousDocTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property previousDocNumber() As String
|
|
Get
|
|
Return Me.previousDocNumberField
|
|
End Get
|
|
Set
|
|
Me.previousDocNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property previousDocDate() As Date
|
|
Get
|
|
Return Me.previousDocDateField
|
|
End Get
|
|
Set
|
|
Me.previousDocDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property previousDocDateSpecified() As Boolean
|
|
Get
|
|
Return Me.previousDocDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.previousDocDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property departureCustomsOffice() As String
|
|
Get
|
|
Return Me.departureCustomsOfficeField
|
|
End Get
|
|
Set
|
|
Me.departureCustomsOfficeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property destinationCustomsOffice() As String
|
|
Get
|
|
Return Me.destinationCustomsOfficeField
|
|
End Get
|
|
Set
|
|
Me.destinationCustomsOfficeField = 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 creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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(TPrevDoc))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPrevDoc 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 TPrevDoc object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPrevDoc 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 TPrevDoc, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPrevDoc)
|
|
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 TPrevDoc) 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 TPrevDoc
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPrevDoc)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPrevDoc 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 TPrevDoc object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPrevDoc 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 TPrevDoc, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPrevDoc)
|
|
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 TPrevDoc) 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 TPrevDoc
|
|
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 TAttribute
|
|
|
|
Private attrTypeField As String
|
|
|
|
Private attrTextField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property attrType() As String
|
|
Get
|
|
Return Me.attrTypeField
|
|
End Get
|
|
Set
|
|
Me.attrTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property attrText() As String
|
|
Get
|
|
Return Me.attrTextField
|
|
End Get
|
|
Set
|
|
Me.attrTextField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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 TDetailContainerInfo
|
|
|
|
Private containerNumberField As String
|
|
|
|
Private containerSealNumberField As String
|
|
|
|
Private containerPackagesField As Decimal
|
|
|
|
Private containerPackagesFieldSpecified As Boolean
|
|
|
|
Private containerGrossWeightField As Decimal
|
|
|
|
Private containerGrossWeightFieldSpecified As Boolean
|
|
|
|
Private containerNetWeightField As Decimal
|
|
|
|
Private containerNetWeightFieldSpecified As Boolean
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property containerNumber() As String
|
|
Get
|
|
Return Me.containerNumberField
|
|
End Get
|
|
Set
|
|
Me.containerNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containerSealNumber() As String
|
|
Get
|
|
Return Me.containerSealNumberField
|
|
End Get
|
|
Set
|
|
Me.containerSealNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containerPackages() As Decimal
|
|
Get
|
|
Return Me.containerPackagesField
|
|
End Get
|
|
Set
|
|
Me.containerPackagesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property containerPackagesSpecified() As Boolean
|
|
Get
|
|
Return Me.containerPackagesFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.containerPackagesFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containerGrossWeight() As Decimal
|
|
Get
|
|
Return Me.containerGrossWeightField
|
|
End Get
|
|
Set
|
|
Me.containerGrossWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property containerGrossWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.containerGrossWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.containerGrossWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containerNetWeight() As Decimal
|
|
Get
|
|
Return Me.containerNetWeightField
|
|
End Get
|
|
Set
|
|
Me.containerNetWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property containerNetWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.containerNetWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.containerNetWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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(TDetailContainerInfo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDetailContainerInfo 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 TDetailContainerInfo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDetailContainerInfo 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 TDetailContainerInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDetailContainerInfo)
|
|
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 TDetailContainerInfo) 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 TDetailContainerInfo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDetailContainerInfo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDetailContainerInfo 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 TDetailContainerInfo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDetailContainerInfo 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 TDetailContainerInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDetailContainerInfo)
|
|
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 TDetailContainerInfo) 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 TDetailContainerInfo
|
|
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 partnerTypeField As String
|
|
|
|
Private partnerAddressField As TAddress
|
|
|
|
Private partnerRelationField As String
|
|
|
|
Private partnerInfoField As String
|
|
|
|
Private partnerTelephoneField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.partnerAddressField = New TAddress()
|
|
End Sub
|
|
|
|
Public Property partnerType() As String
|
|
Get
|
|
Return Me.partnerTypeField
|
|
End Get
|
|
Set
|
|
Me.partnerTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property PartnerAddress() As TAddress
|
|
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
|
|
|
|
Public Property partnerInfo() As String
|
|
Get
|
|
Return Me.partnerInfoField
|
|
End Get
|
|
Set
|
|
Me.partnerInfoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerTelephone() As String
|
|
Get
|
|
Return Me.partnerTelephoneField
|
|
End Get
|
|
Set
|
|
Me.partnerTelephoneField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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 TAddress
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNoTypeField 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 addrEoriField As String
|
|
|
|
Private partnerRelationField As String
|
|
|
|
Private addrDistrictField As String
|
|
|
|
Private addrBranchNoField As String
|
|
|
|
Private emailField As String
|
|
|
|
Private addrVatNumberField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
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 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 partnerRelation() As String
|
|
Get
|
|
Return Me.partnerRelationField
|
|
End Get
|
|
Set
|
|
Me.partnerRelationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrDistrict() As String
|
|
Get
|
|
Return Me.addrDistrictField
|
|
End Get
|
|
Set
|
|
Me.addrDistrictField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrBranchNo() As String
|
|
Get
|
|
Return Me.addrBranchNoField
|
|
End Get
|
|
Set
|
|
Me.addrBranchNoField = 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 addrVatNumber() As String
|
|
Get
|
|
Return Me.addrVatNumberField
|
|
End Get
|
|
Set
|
|
Me.addrVatNumberField = 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 TCustIntra
|
|
|
|
Private vendorVatIdField As String
|
|
|
|
Private statisticalProcedureField As String
|
|
|
|
Private internalReferenceField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property vendorVatId() As String
|
|
Get
|
|
Return Me.vendorVatIdField
|
|
End Get
|
|
Set
|
|
Me.vendorVatIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalProcedure() As String
|
|
Get
|
|
Return Me.statisticalProcedureField
|
|
End Get
|
|
Set
|
|
Me.statisticalProcedureField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property internalReference() As String
|
|
Get
|
|
Return Me.internalReferenceField
|
|
End Get
|
|
Set
|
|
Me.internalReferenceField = 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(TCustIntra))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustIntra 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 TCustIntra object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustIntra 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 TCustIntra, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustIntra)
|
|
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 TCustIntra) 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 TCustIntra
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustIntra)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustIntra 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 TCustIntra object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustIntra 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 TCustIntra, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustIntra)
|
|
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 TCustIntra) 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 TCustIntra
|
|
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 TImportPaymentInfo
|
|
|
|
Private paymentTypeField As String
|
|
|
|
Private paymentDateField As Date
|
|
|
|
Private paymentDateFieldSpecified As Boolean
|
|
|
|
Private paymentBankCodeField As String
|
|
|
|
Private paymentBankBranchCodeField As String
|
|
|
|
Private paymentCurrencyField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property paymentType() As String
|
|
Get
|
|
Return Me.paymentTypeField
|
|
End Get
|
|
Set
|
|
Me.paymentTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property paymentDate() As Date
|
|
Get
|
|
Return Me.paymentDateField
|
|
End Get
|
|
Set
|
|
Me.paymentDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property paymentDateSpecified() As Boolean
|
|
Get
|
|
Return Me.paymentDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.paymentDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property paymentBankCode() As String
|
|
Get
|
|
Return Me.paymentBankCodeField
|
|
End Get
|
|
Set
|
|
Me.paymentBankCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property paymentBankBranchCode() As String
|
|
Get
|
|
Return Me.paymentBankBranchCodeField
|
|
End Get
|
|
Set
|
|
Me.paymentBankBranchCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property paymentCurrency() As String
|
|
Get
|
|
Return Me.paymentCurrencyField
|
|
End Get
|
|
Set
|
|
Me.paymentCurrencyField = 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(TImportPaymentInfo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TImportPaymentInfo 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 TImportPaymentInfo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TImportPaymentInfo 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 TImportPaymentInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportPaymentInfo)
|
|
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 TImportPaymentInfo) 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 TImportPaymentInfo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TImportPaymentInfo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TImportPaymentInfo 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 TImportPaymentInfo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TImportPaymentInfo 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 TImportPaymentInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportPaymentInfo)
|
|
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 TImportPaymentInfo) 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 TImportPaymentInfo
|
|
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 TInsuranceCostsInv
|
|
|
|
Private insAmountField As Decimal
|
|
|
|
Private insAmountFieldSpecified As Boolean
|
|
|
|
Private insCurrencyField As String
|
|
|
|
Private insProRatingField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property insAmount() As Decimal
|
|
Get
|
|
Return Me.insAmountField
|
|
End Get
|
|
Set
|
|
Me.insAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property insAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.insAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.insAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property insCurrency() As String
|
|
Get
|
|
Return Me.insCurrencyField
|
|
End Get
|
|
Set
|
|
Me.insCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property insProRating() As String
|
|
Get
|
|
Return Me.insProRatingField
|
|
End Get
|
|
Set
|
|
Me.insProRatingField = 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(TInsuranceCostsInv))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInsuranceCostsInv 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 TInsuranceCostsInv object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInsuranceCostsInv 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 TInsuranceCostsInv, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInsuranceCostsInv)
|
|
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 TInsuranceCostsInv) 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 TInsuranceCostsInv
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInsuranceCostsInv)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInsuranceCostsInv 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 TInsuranceCostsInv object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInsuranceCostsInv 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 TInsuranceCostsInv, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInsuranceCostsInv)
|
|
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 TInsuranceCostsInv) 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 TInsuranceCostsInv
|
|
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 TFreightCostsInv
|
|
|
|
Private frtAmountField As Decimal
|
|
|
|
Private frtAmountFieldSpecified As Boolean
|
|
|
|
Private frtCurrencyField As String
|
|
|
|
Private frtInternationalField As Decimal
|
|
|
|
Private frtInternationalFieldSpecified As Boolean
|
|
|
|
Private frtEuNationalField As Decimal
|
|
|
|
Private frtEuNationalFieldSpecified As Boolean
|
|
|
|
Private frtInlandField As Decimal
|
|
|
|
Private frtInlandFieldSpecified As Boolean
|
|
|
|
Private frtProRatingField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property frtAmount() As Decimal
|
|
Get
|
|
Return Me.frtAmountField
|
|
End Get
|
|
Set
|
|
Me.frtAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.frtAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtCurrency() As String
|
|
Get
|
|
Return Me.frtCurrencyField
|
|
End Get
|
|
Set
|
|
Me.frtCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtInternational() As Decimal
|
|
Get
|
|
Return Me.frtInternationalField
|
|
End Get
|
|
Set
|
|
Me.frtInternationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtInternationalSpecified() As Boolean
|
|
Get
|
|
Return Me.frtInternationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtInternationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtEuNational() As Decimal
|
|
Get
|
|
Return Me.frtEuNationalField
|
|
End Get
|
|
Set
|
|
Me.frtEuNationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtEuNationalSpecified() As Boolean
|
|
Get
|
|
Return Me.frtEuNationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtEuNationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtInland() As Decimal
|
|
Get
|
|
Return Me.frtInlandField
|
|
End Get
|
|
Set
|
|
Me.frtInlandField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtInlandSpecified() As Boolean
|
|
Get
|
|
Return Me.frtInlandFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtInlandFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtProRating() As String
|
|
Get
|
|
Return Me.frtProRatingField
|
|
End Get
|
|
Set
|
|
Me.frtProRatingField = 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(TFreightCostsInv))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TFreightCostsInv 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 TFreightCostsInv object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TFreightCostsInv 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 TFreightCostsInv, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreightCostsInv)
|
|
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 TFreightCostsInv) 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 TFreightCostsInv
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TFreightCostsInv)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TFreightCostsInv 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 TFreightCostsInv object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TFreightCostsInv 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 TFreightCostsInv, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreightCostsInv)
|
|
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 TFreightCostsInv) 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 TFreightCostsInv
|
|
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 TRebate
|
|
|
|
Private rebAmountField As Decimal
|
|
|
|
Private rebAmountFieldSpecified As Boolean
|
|
|
|
Private rebCurrencyField As String
|
|
|
|
Private rebProRatingField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property rebAmount() As Decimal
|
|
Get
|
|
Return Me.rebAmountField
|
|
End Get
|
|
Set
|
|
Me.rebAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property rebAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.rebAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.rebAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property rebCurrency() As String
|
|
Get
|
|
Return Me.rebCurrencyField
|
|
End Get
|
|
Set
|
|
Me.rebCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property rebProRating() As String
|
|
Get
|
|
Return Me.rebProRatingField
|
|
End Get
|
|
Set
|
|
Me.rebProRatingField = 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(TRebate))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TRebate 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 TRebate object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TRebate 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 TRebate, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRebate)
|
|
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 TRebate) 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 TRebate
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TRebate)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TRebate 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 TRebate object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TRebate 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 TRebate, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRebate)
|
|
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 TRebate) 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 TRebate
|
|
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 TDelTerm
|
|
|
|
Private codeField As String
|
|
|
|
Private descField As String
|
|
|
|
Private calculationOfFreightCostsField 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 calculationOfFreightCosts() As String
|
|
Get
|
|
Return Me.calculationOfFreightCostsField
|
|
End Get
|
|
Set
|
|
Me.calculationOfFreightCostsField = 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 TInvoiceHead
|
|
|
|
Private invoiceTypeField As String
|
|
|
|
Private contractDateField As Date
|
|
|
|
Private contractDateFieldSpecified As Boolean
|
|
|
|
Private countryOfTradeField As String
|
|
|
|
Private supplierField As TAddress
|
|
|
|
Private grossWeightField As Decimal
|
|
|
|
Private grossWeightFieldSpecified As Boolean
|
|
|
|
Private netWeightField As Decimal
|
|
|
|
Private netWeightFieldSpecified As Boolean
|
|
|
|
Private invoiceValueField As Decimal
|
|
|
|
Private invoiceValueFieldSpecified As Boolean
|
|
|
|
Private invoiceCurrencyField As String
|
|
|
|
Private deliveryTermsField As TDelTerm
|
|
|
|
Private rebateField As TRebate
|
|
|
|
Private discountField As Decimal
|
|
|
|
Private discountFieldSpecified As Boolean
|
|
|
|
Private additionalCostField As List(Of TAddCosts)
|
|
|
|
Private textField As String
|
|
|
|
Private text2Field As String
|
|
|
|
Private freightField As TFreightCostsInv
|
|
|
|
Private insuranceField As TInsuranceCostsInv
|
|
|
|
Private referenceNumberField As String
|
|
|
|
Private transportNumberField As String
|
|
|
|
Private transportTypeField As String
|
|
|
|
Private acceptanceDateField As Date
|
|
|
|
Private acceptanceDateFieldSpecified As Boolean
|
|
|
|
Private disposalDateField As Date
|
|
|
|
Private disposalDateFieldSpecified As Boolean
|
|
|
|
Private timeLimitField As Date
|
|
|
|
Private timeLimitFieldSpecified As Boolean
|
|
|
|
Private registrationNumberField As String
|
|
|
|
Private sealNumberField As String
|
|
|
|
Private billOfLadingField As String
|
|
|
|
Private packageCountField As Decimal
|
|
|
|
Private packageCountFieldSpecified As Boolean
|
|
|
|
Private packageTypeField As String
|
|
|
|
Private buyerField As String
|
|
|
|
Private consigneeField As String
|
|
|
|
Private paymentInformationField As TImportPaymentInfo
|
|
|
|
Private customerFieldsField As TCustomerFields
|
|
|
|
Private sellerField As TAddress
|
|
|
|
Private exchangeRateField As Decimal
|
|
|
|
Private exchangeRateFieldSpecified As Boolean
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private containerInfoField As TContainer
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.containerInfoField = New TContainer()
|
|
Me.sellerField = New TAddress()
|
|
Me.customerFieldsField = New TCustomerFields()
|
|
Me.paymentInformationField = New TImportPaymentInfo()
|
|
Me.insuranceField = New TInsuranceCostsInv()
|
|
Me.freightField = New TFreightCostsInv()
|
|
Me.additionalCostField = New List(Of TAddCosts)()
|
|
Me.rebateField = New TRebate()
|
|
Me.deliveryTermsField = New TDelTerm()
|
|
Me.supplierField = New TAddress()
|
|
End Sub
|
|
|
|
Public Property invoiceType() As String
|
|
Get
|
|
Return Me.invoiceTypeField
|
|
End Get
|
|
Set
|
|
Me.invoiceTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contractDate() As Date
|
|
Get
|
|
Return Me.contractDateField
|
|
End Get
|
|
Set
|
|
Me.contractDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property contractDateSpecified() As Boolean
|
|
Get
|
|
Return Me.contractDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.contractDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property countryOfTrade() As String
|
|
Get
|
|
Return Me.countryOfTradeField
|
|
End Get
|
|
Set
|
|
Me.countryOfTradeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Supplier() As TAddress
|
|
Get
|
|
Return Me.supplierField
|
|
End Get
|
|
Set
|
|
Me.supplierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property grossWeight() As Decimal
|
|
Get
|
|
Return Me.grossWeightField
|
|
End Get
|
|
Set
|
|
Me.grossWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property grossWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.grossWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.grossWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property netWeight() As Decimal
|
|
Get
|
|
Return Me.netWeightField
|
|
End Get
|
|
Set
|
|
Me.netWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property netWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.netWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.netWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invoiceValue() As Decimal
|
|
Get
|
|
Return Me.invoiceValueField
|
|
End Get
|
|
Set
|
|
Me.invoiceValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property invoiceValueSpecified() As Boolean
|
|
Get
|
|
Return Me.invoiceValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.invoiceValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invoiceCurrency() As String
|
|
Get
|
|
Return Me.invoiceCurrencyField
|
|
End Get
|
|
Set
|
|
Me.invoiceCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property deliveryTerms() As TDelTerm
|
|
Get
|
|
Return Me.deliveryTermsField
|
|
End Get
|
|
Set
|
|
Me.deliveryTermsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Rebate() As TRebate
|
|
Get
|
|
Return Me.rebateField
|
|
End Get
|
|
Set
|
|
Me.rebateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property discount() As Decimal
|
|
Get
|
|
Return Me.discountField
|
|
End Get
|
|
Set
|
|
Me.discountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property discountSpecified() As Boolean
|
|
Get
|
|
Return Me.discountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.discountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property AdditionalCost() As List(Of TAddCosts)
|
|
Get
|
|
Return Me.additionalCostField
|
|
End Get
|
|
Set
|
|
Me.additionalCostField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property text() As String
|
|
Get
|
|
Return Me.textField
|
|
End Get
|
|
Set
|
|
Me.textField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property text2() As String
|
|
Get
|
|
Return Me.text2Field
|
|
End Get
|
|
Set
|
|
Me.text2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Freight() As TFreightCostsInv
|
|
Get
|
|
Return Me.freightField
|
|
End Get
|
|
Set
|
|
Me.freightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Insurance() As TInsuranceCostsInv
|
|
Get
|
|
Return Me.insuranceField
|
|
End Get
|
|
Set
|
|
Me.insuranceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceNumber() As String
|
|
Get
|
|
Return Me.referenceNumberField
|
|
End Get
|
|
Set
|
|
Me.referenceNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property transportNumber() As String
|
|
Get
|
|
Return Me.transportNumberField
|
|
End Get
|
|
Set
|
|
Me.transportNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property transportType() As String
|
|
Get
|
|
Return Me.transportTypeField
|
|
End Get
|
|
Set
|
|
Me.transportTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property acceptanceDate() As Date
|
|
Get
|
|
Return Me.acceptanceDateField
|
|
End Get
|
|
Set
|
|
Me.acceptanceDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property acceptanceDateSpecified() As Boolean
|
|
Get
|
|
Return Me.acceptanceDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.acceptanceDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property disposalDate() As Date
|
|
Get
|
|
Return Me.disposalDateField
|
|
End Get
|
|
Set
|
|
Me.disposalDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property disposalDateSpecified() As Boolean
|
|
Get
|
|
Return Me.disposalDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.disposalDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property timeLimit() As Date
|
|
Get
|
|
Return Me.timeLimitField
|
|
End Get
|
|
Set
|
|
Me.timeLimitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property timeLimitSpecified() As Boolean
|
|
Get
|
|
Return Me.timeLimitFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.timeLimitFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationNumber() As String
|
|
Get
|
|
Return Me.registrationNumberField
|
|
End Get
|
|
Set
|
|
Me.registrationNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sealNumber() As String
|
|
Get
|
|
Return Me.sealNumberField
|
|
End Get
|
|
Set
|
|
Me.sealNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property billOfLading() As String
|
|
Get
|
|
Return Me.billOfLadingField
|
|
End Get
|
|
Set
|
|
Me.billOfLadingField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property packageCount() As Decimal
|
|
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
|
|
|
|
Public Property buyer() As String
|
|
Get
|
|
Return Me.buyerField
|
|
End Get
|
|
Set
|
|
Me.buyerField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property consignee() As String
|
|
Get
|
|
Return Me.consigneeField
|
|
End Get
|
|
Set
|
|
Me.consigneeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property PaymentInformation() As TImportPaymentInfo
|
|
Get
|
|
Return Me.paymentInformationField
|
|
End Get
|
|
Set
|
|
Me.paymentInformationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property CustomerFields() As TCustomerFields
|
|
Get
|
|
Return Me.customerFieldsField
|
|
End Get
|
|
Set
|
|
Me.customerFieldsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property seller() As TAddress
|
|
Get
|
|
Return Me.sellerField
|
|
End Get
|
|
Set
|
|
Me.sellerField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property exchangeRate() As Decimal
|
|
Get
|
|
Return Me.exchangeRateField
|
|
End Get
|
|
Set
|
|
Me.exchangeRateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property exchangeRateSpecified() As Boolean
|
|
Get
|
|
Return Me.exchangeRateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.exchangeRateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ContainerInfo() As TContainer
|
|
Get
|
|
Return Me.containerInfoField
|
|
End Get
|
|
Set
|
|
Me.containerInfoField = 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(TInvoiceHead))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInvoiceHead 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 TInvoiceHead object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInvoiceHead 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 TInvoiceHead, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceHead)
|
|
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 TInvoiceHead) 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 TInvoiceHead
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInvoiceHead)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInvoiceHead 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 TInvoiceHead object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInvoiceHead 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 TInvoiceHead, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceHead)
|
|
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 TInvoiceHead) 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 TInvoiceHead
|
|
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 TContainer
|
|
|
|
Private containerIndicatorField As String
|
|
|
|
Private containerNumberField As String
|
|
|
|
Private containerTypeField As String
|
|
|
|
Private containerLCLIndicatorField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property containerIndicator() As String
|
|
Get
|
|
Return Me.containerIndicatorField
|
|
End Get
|
|
Set
|
|
Me.containerIndicatorField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containerNumber() As String
|
|
Get
|
|
Return Me.containerNumberField
|
|
End Get
|
|
Set
|
|
Me.containerNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containerType() As String
|
|
Get
|
|
Return Me.containerTypeField
|
|
End Get
|
|
Set
|
|
Me.containerTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containerLCLIndicator() As String
|
|
Get
|
|
Return Me.containerLCLIndicatorField
|
|
End Get
|
|
Set
|
|
Me.containerLCLIndicatorField = 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(TContainer))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TContainer 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 TContainer object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TContainer 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 TContainer, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TContainer)
|
|
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 TContainer) 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 TContainer
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TContainer)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TContainer 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 TContainer object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TContainer 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 TContainer, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TContainer)
|
|
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 TContainer) 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 TContainer
|
|
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 TInvoice
|
|
|
|
Private invoiceNumberField As String
|
|
|
|
Private invoiceVersionField As String
|
|
|
|
Private invoiceDateField As Date
|
|
|
|
Private invoiceDateFieldSpecified As Boolean
|
|
|
|
Private invoiceHeadField As TInvoiceHead
|
|
|
|
Private attributesField As List(Of TAttribute)
|
|
|
|
Private documentsField As List(Of TDocument)
|
|
|
|
Private partnersField As List(Of TPartner)
|
|
|
|
Private atlasCompletionSumDsField As List(Of TAtlasCompSumDEntry)
|
|
|
|
Private intraField As TCustIntra
|
|
|
|
Private invoiceLinesField As List(Of TInvoiceLine)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.invoiceLinesField = New List(Of TInvoiceLine)()
|
|
Me.intraField = New TCustIntra()
|
|
Me.atlasCompletionSumDsField = New List(Of TAtlasCompSumDEntry)()
|
|
Me.partnersField = New List(Of TPartner)()
|
|
Me.documentsField = New List(Of TDocument)()
|
|
Me.attributesField = New List(Of TAttribute)()
|
|
Me.invoiceHeadField = New TInvoiceHead()
|
|
End Sub
|
|
|
|
Public Property invoiceNumber() As String
|
|
Get
|
|
Return Me.invoiceNumberField
|
|
End Get
|
|
Set
|
|
Me.invoiceNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invoiceVersion() As String
|
|
Get
|
|
Return Me.invoiceVersionField
|
|
End Get
|
|
Set
|
|
Me.invoiceVersionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invoiceDate() As Date
|
|
Get
|
|
Return Me.invoiceDateField
|
|
End Get
|
|
Set
|
|
Me.invoiceDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property invoiceDateSpecified() As Boolean
|
|
Get
|
|
Return Me.invoiceDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.invoiceDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property InvoiceHead() As TInvoiceHead
|
|
Get
|
|
Return Me.invoiceHeadField
|
|
End Get
|
|
Set
|
|
Me.invoiceHeadField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Attribute", IsNullable:=False)>
|
|
Public Property Attributes() As List(Of TAttribute)
|
|
Get
|
|
Return Me.attributesField
|
|
End Get
|
|
Set
|
|
Me.attributesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Document", IsNullable:=False)>
|
|
Public Property Documents() As List(Of TDocument)
|
|
Get
|
|
Return Me.documentsField
|
|
End Get
|
|
Set
|
|
Me.documentsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Partner", IsNullable:=False)>
|
|
Public Property Partners() As List(Of TPartner)
|
|
Get
|
|
Return Me.partnersField
|
|
End Get
|
|
Set
|
|
Me.partnersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("AtlasCompletionSumD", IsNullable:=False)>
|
|
Public Property AtlasCompletionSumDs() As List(Of TAtlasCompSumDEntry)
|
|
Get
|
|
Return Me.atlasCompletionSumDsField
|
|
End Get
|
|
Set
|
|
Me.atlasCompletionSumDsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Intra() As TCustIntra
|
|
Get
|
|
Return Me.intraField
|
|
End Get
|
|
Set
|
|
Me.intraField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("Line", IsNullable:=False)>
|
|
Public Property InvoiceLines() As List(Of TInvoiceLine)
|
|
Get
|
|
Return Me.invoiceLinesField
|
|
End Get
|
|
Set
|
|
Me.invoiceLinesField = 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(TInvoice))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInvoice 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 TInvoice object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInvoice 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 TInvoice, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoice)
|
|
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 TInvoice) 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 TInvoice
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInvoice)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInvoice 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 TInvoice object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInvoice 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 TInvoice, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoice)
|
|
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 TInvoice) 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 TInvoice
|
|
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 TAtlasCompSumDEntry
|
|
|
|
Private idTypeField As String
|
|
|
|
Private quantityField As Long
|
|
|
|
Private quantityFieldSpecified As Boolean
|
|
|
|
Private packageTypeField As String
|
|
|
|
Private registrationNumberField As String
|
|
|
|
Private lineNumberField As Long
|
|
|
|
Private lineNumberFieldSpecified As Boolean
|
|
|
|
Private depositorField As String
|
|
|
|
Private spoTypeField As String
|
|
|
|
Private spoField As String
|
|
|
|
Private creationUserField As String
|
|
|
|
Private creationDateField As Date
|
|
|
|
Private creationDateFieldSpecified As Boolean
|
|
|
|
Private modificationUserField As String
|
|
|
|
Private modificationDateField As Date
|
|
|
|
Private modificationDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property idType() As String
|
|
Get
|
|
Return Me.idTypeField
|
|
End Get
|
|
Set
|
|
Me.idTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property quantity() As Long
|
|
Get
|
|
Return Me.quantityField
|
|
End Get
|
|
Set
|
|
Me.quantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property quantitySpecified() As Boolean
|
|
Get
|
|
Return Me.quantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.quantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property packageType() As String
|
|
Get
|
|
Return Me.packageTypeField
|
|
End Get
|
|
Set
|
|
Me.packageTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationNumber() As String
|
|
Get
|
|
Return Me.registrationNumberField
|
|
End Get
|
|
Set
|
|
Me.registrationNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property lineNumber() As Long
|
|
Get
|
|
Return Me.lineNumberField
|
|
End Get
|
|
Set
|
|
Me.lineNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property lineNumberSpecified() As Boolean
|
|
Get
|
|
Return Me.lineNumberFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.lineNumberFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property depositor() As String
|
|
Get
|
|
Return Me.depositorField
|
|
End Get
|
|
Set
|
|
Me.depositorField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property spoType() As String
|
|
Get
|
|
Return Me.spoTypeField
|
|
End Get
|
|
Set
|
|
Me.spoTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property spo() As String
|
|
Get
|
|
Return Me.spoField
|
|
End Get
|
|
Set
|
|
Me.spoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationUser() As String
|
|
Get
|
|
Return Me.creationUserField
|
|
End Get
|
|
Set
|
|
Me.creationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property creationDate() As Date
|
|
Get
|
|
Return Me.creationDateField
|
|
End Get
|
|
Set
|
|
Me.creationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property creationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.creationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.creationDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationUser() As String
|
|
Get
|
|
Return Me.modificationUserField
|
|
End Get
|
|
Set
|
|
Me.modificationUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property modificationDate() As Date
|
|
Get
|
|
Return Me.modificationDateField
|
|
End Get
|
|
Set
|
|
Me.modificationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property modificationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.modificationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.modificationDateFieldSpecified = 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(TAtlasCompSumDEntry))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAtlasCompSumDEntry 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 TAtlasCompSumDEntry object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAtlasCompSumDEntry 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 TAtlasCompSumDEntry, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAtlasCompSumDEntry)
|
|
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 TAtlasCompSumDEntry) 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 TAtlasCompSumDEntry
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAtlasCompSumDEntry)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAtlasCompSumDEntry 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 TAtlasCompSumDEntry object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAtlasCompSumDEntry 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 TAtlasCompSumDEntry, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAtlasCompSumDEntry)
|
|
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 TAtlasCompSumDEntry) 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 TAtlasCompSumDEntry
|
|
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 TGuarantee
|
|
|
|
Private guaranteeNumberField As Long
|
|
|
|
Private guaranteeNumberFieldSpecified As Boolean
|
|
|
|
Private guaranteeCodeField As String
|
|
|
|
Private guaranteeTypeField As String
|
|
|
|
Private guaranteeAmountField As Decimal
|
|
|
|
Private guaranteeAmountFieldSpecified As Boolean
|
|
|
|
Private guaranteeCurrencyField As String
|
|
|
|
Private guaranteeReferenceField As String
|
|
|
|
Private guaranteeCustomsOfficeField As String
|
|
|
|
Private localBaseField As Decimal
|
|
|
|
Private localBaseFieldSpecified As Boolean
|
|
|
|
Private factoringBaseField As String
|
|
|
|
Private customsRateField As Decimal
|
|
|
|
Private customsRateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property guaranteeNumber() As Long
|
|
Get
|
|
Return Me.guaranteeNumberField
|
|
End Get
|
|
Set
|
|
Me.guaranteeNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property guaranteeNumberSpecified() As Boolean
|
|
Get
|
|
Return Me.guaranteeNumberFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.guaranteeNumberFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property guaranteeCode() As String
|
|
Get
|
|
Return Me.guaranteeCodeField
|
|
End Get
|
|
Set
|
|
Me.guaranteeCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property guaranteeType() As String
|
|
Get
|
|
Return Me.guaranteeTypeField
|
|
End Get
|
|
Set
|
|
Me.guaranteeTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property guaranteeAmount() As Decimal
|
|
Get
|
|
Return Me.guaranteeAmountField
|
|
End Get
|
|
Set
|
|
Me.guaranteeAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property guaranteeAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.guaranteeAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.guaranteeAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property guaranteeCurrency() As String
|
|
Get
|
|
Return Me.guaranteeCurrencyField
|
|
End Get
|
|
Set
|
|
Me.guaranteeCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property guaranteeReference() As String
|
|
Get
|
|
Return Me.guaranteeReferenceField
|
|
End Get
|
|
Set
|
|
Me.guaranteeReferenceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property guaranteeCustomsOffice() As String
|
|
Get
|
|
Return Me.guaranteeCustomsOfficeField
|
|
End Get
|
|
Set
|
|
Me.guaranteeCustomsOfficeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property localBase() As Decimal
|
|
Get
|
|
Return Me.localBaseField
|
|
End Get
|
|
Set
|
|
Me.localBaseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property localBaseSpecified() As Boolean
|
|
Get
|
|
Return Me.localBaseFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.localBaseFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property factoringBase() As String
|
|
Get
|
|
Return Me.factoringBaseField
|
|
End Get
|
|
Set
|
|
Me.factoringBaseField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customsRate() As Decimal
|
|
Get
|
|
Return Me.customsRateField
|
|
End Get
|
|
Set
|
|
Me.customsRateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property customsRateSpecified() As Boolean
|
|
Get
|
|
Return Me.customsRateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.customsRateFieldSpecified = 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(TGuarantee))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TGuarantee 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 TGuarantee object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TGuarantee 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 TGuarantee, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TGuarantee)
|
|
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 TGuarantee) 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 TGuarantee
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TGuarantee)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TGuarantee 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 TGuarantee object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TGuarantee 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 TGuarantee, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TGuarantee)
|
|
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 TGuarantee) 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 TGuarantee
|
|
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 TGuarantees
|
|
|
|
Private guaranteeField As List(Of TGuarantee)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.guaranteeField = New List(Of TGuarantee)()
|
|
End Sub
|
|
|
|
Public Property Guarantee() As List(Of TGuarantee)
|
|
Get
|
|
Return Me.guaranteeField
|
|
End Get
|
|
Set
|
|
Me.guaranteeField = 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(TGuarantees))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TGuarantees 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 TGuarantees object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TGuarantees 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 TGuarantees, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TGuarantees)
|
|
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 TGuarantees) 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 TGuarantees
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TGuarantees)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TGuarantees 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 TGuarantees object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TGuarantees 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 TGuarantees, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TGuarantees)
|
|
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 TGuarantees) 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 TGuarantees
|
|
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 TDeferAcc
|
|
|
|
Private accountNumber1Field As String
|
|
|
|
Private accountNumber2Field As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property accountNumber1() As String
|
|
Get
|
|
Return Me.accountNumber1Field
|
|
End Get
|
|
Set
|
|
Me.accountNumber1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property accountNumber2() As String
|
|
Get
|
|
Return Me.accountNumber2Field
|
|
End Get
|
|
Set
|
|
Me.accountNumber2Field = 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(TDeferAcc))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDeferAcc 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 TDeferAcc object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDeferAcc 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 TDeferAcc, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeferAcc)
|
|
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 TDeferAcc) 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 TDeferAcc
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDeferAcc)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDeferAcc 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 TDeferAcc object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDeferAcc 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 TDeferAcc, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeferAcc)
|
|
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 TDeferAcc) 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 TDeferAcc
|
|
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 TDeferAccs
|
|
|
|
Private defermentAccountField As TDeferAcc
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.defermentAccountField = New TDeferAcc()
|
|
End Sub
|
|
|
|
Public Property DefermentAccount() As TDeferAcc
|
|
Get
|
|
Return Me.defermentAccountField
|
|
End Get
|
|
Set
|
|
Me.defermentAccountField = 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(TDeferAccs))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDeferAccs 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 TDeferAccs object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDeferAccs 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 TDeferAccs, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeferAccs)
|
|
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 TDeferAccs) 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 TDeferAccs
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDeferAccs)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDeferAccs 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 TDeferAccs object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDeferAccs 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 TDeferAccs, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeferAccs)
|
|
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 TDeferAccs) 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 TDeferAccs
|
|
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 TAuthHolder
|
|
|
|
Private typeCodeField As String
|
|
|
|
Private identifierField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property typeCode() As String
|
|
Get
|
|
Return Me.typeCodeField
|
|
End Get
|
|
Set
|
|
Me.typeCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property identifier() As String
|
|
Get
|
|
Return Me.identifierField
|
|
End Get
|
|
Set
|
|
Me.identifierField = 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(TAuthHolder))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAuthHolder 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 TAuthHolder object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAuthHolder 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 TAuthHolder, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAuthHolder)
|
|
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 TAuthHolder) 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 TAuthHolder
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAuthHolder)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAuthHolder 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 TAuthHolder object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAuthHolder 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 TAuthHolder, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAuthHolder)
|
|
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 TAuthHolder) 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 TAuthHolder
|
|
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 TAuthHolders
|
|
|
|
Private authorisationHolderField As List(Of TAuthHolder)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.authorisationHolderField = New List(Of TAuthHolder)()
|
|
End Sub
|
|
|
|
Public Property AuthorisationHolder() As List(Of TAuthHolder)
|
|
Get
|
|
Return Me.authorisationHolderField
|
|
End Get
|
|
Set
|
|
Me.authorisationHolderField = 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(TAuthHolders))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAuthHolders 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 TAuthHolders object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAuthHolders 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 TAuthHolders, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAuthHolders)
|
|
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 TAuthHolders) 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 TAuthHolders
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAuthHolders)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAuthHolders 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 TAuthHolders object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAuthHolders 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 TAuthHolders, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAuthHolders)
|
|
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 TAuthHolders) 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 TAuthHolders
|
|
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 TInsuranceCosts
|
|
|
|
Private insAmountField As Decimal
|
|
|
|
Private insAmountFieldSpecified As Boolean
|
|
|
|
Private insCurrencyField As String
|
|
|
|
Private insProRatingField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property insAmount() As Decimal
|
|
Get
|
|
Return Me.insAmountField
|
|
End Get
|
|
Set
|
|
Me.insAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property insAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.insAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.insAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property insCurrency() As String
|
|
Get
|
|
Return Me.insCurrencyField
|
|
End Get
|
|
Set
|
|
Me.insCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property insProRating() As String
|
|
Get
|
|
Return Me.insProRatingField
|
|
End Get
|
|
Set
|
|
Me.insProRatingField = 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(TInsuranceCosts))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInsuranceCosts 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 TInsuranceCosts object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInsuranceCosts 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 TInsuranceCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInsuranceCosts)
|
|
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 TInsuranceCosts) 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 TInsuranceCosts
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInsuranceCosts)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInsuranceCosts 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 TInsuranceCosts object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInsuranceCosts 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 TInsuranceCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInsuranceCosts)
|
|
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 TInsuranceCosts) 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 TInsuranceCosts
|
|
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 TFreightCosts
|
|
|
|
Private frtAmountField As Decimal
|
|
|
|
Private frtAmountFieldSpecified As Boolean
|
|
|
|
Private frtCurrencyField As String
|
|
|
|
Private frtInternationalField As Decimal
|
|
|
|
Private frtInternationalFieldSpecified As Boolean
|
|
|
|
Private frtEuNationalField As Decimal
|
|
|
|
Private frtEuNationalFieldSpecified As Boolean
|
|
|
|
Private frtInlandField As Decimal
|
|
|
|
Private frtInlandFieldSpecified As Boolean
|
|
|
|
Private frtProRatingField As String
|
|
|
|
Private frtInternationalAbsField As Decimal
|
|
|
|
Private frtInternationalAbsFieldSpecified As Boolean
|
|
|
|
Private frtIntCurrencyField As String
|
|
|
|
Private frtCommunityAbsField As Decimal
|
|
|
|
Private frtCommunityAbsFieldSpecified As Boolean
|
|
|
|
Private frtCommunityCurrencyField As String
|
|
|
|
Private frtNatAbsField As Decimal
|
|
|
|
Private frtNatAbsFieldSpecified As Boolean
|
|
|
|
Private frtNatCurrencyField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property frtAmount() As Decimal
|
|
Get
|
|
Return Me.frtAmountField
|
|
End Get
|
|
Set
|
|
Me.frtAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.frtAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtCurrency() As String
|
|
Get
|
|
Return Me.frtCurrencyField
|
|
End Get
|
|
Set
|
|
Me.frtCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtInternational() As Decimal
|
|
Get
|
|
Return Me.frtInternationalField
|
|
End Get
|
|
Set
|
|
Me.frtInternationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtInternationalSpecified() As Boolean
|
|
Get
|
|
Return Me.frtInternationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtInternationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtEuNational() As Decimal
|
|
Get
|
|
Return Me.frtEuNationalField
|
|
End Get
|
|
Set
|
|
Me.frtEuNationalField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtEuNationalSpecified() As Boolean
|
|
Get
|
|
Return Me.frtEuNationalFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtEuNationalFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtInland() As Decimal
|
|
Get
|
|
Return Me.frtInlandField
|
|
End Get
|
|
Set
|
|
Me.frtInlandField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtInlandSpecified() As Boolean
|
|
Get
|
|
Return Me.frtInlandFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtInlandFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtProRating() As String
|
|
Get
|
|
Return Me.frtProRatingField
|
|
End Get
|
|
Set
|
|
Me.frtProRatingField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtInternationalAbs() As Decimal
|
|
Get
|
|
Return Me.frtInternationalAbsField
|
|
End Get
|
|
Set
|
|
Me.frtInternationalAbsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtInternationalAbsSpecified() As Boolean
|
|
Get
|
|
Return Me.frtInternationalAbsFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtInternationalAbsFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtIntCurrency() As String
|
|
Get
|
|
Return Me.frtIntCurrencyField
|
|
End Get
|
|
Set
|
|
Me.frtIntCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtCommunityAbs() As Decimal
|
|
Get
|
|
Return Me.frtCommunityAbsField
|
|
End Get
|
|
Set
|
|
Me.frtCommunityAbsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtCommunityAbsSpecified() As Boolean
|
|
Get
|
|
Return Me.frtCommunityAbsFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtCommunityAbsFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtCommunityCurrency() As String
|
|
Get
|
|
Return Me.frtCommunityCurrencyField
|
|
End Get
|
|
Set
|
|
Me.frtCommunityCurrencyField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtNatAbs() As Decimal
|
|
Get
|
|
Return Me.frtNatAbsField
|
|
End Get
|
|
Set
|
|
Me.frtNatAbsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property frtNatAbsSpecified() As Boolean
|
|
Get
|
|
Return Me.frtNatAbsFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.frtNatAbsFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property frtNatCurrency() As String
|
|
Get
|
|
Return Me.frtNatCurrencyField
|
|
End Get
|
|
Set
|
|
Me.frtNatCurrencyField = 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(TFreightCosts))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TFreightCosts 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 TFreightCosts object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TFreightCosts 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 TFreightCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreightCosts)
|
|
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 TFreightCosts) 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 TFreightCosts
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TFreightCosts)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TFreightCosts 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 TFreightCosts object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TFreightCosts 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 TFreightCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreightCosts)
|
|
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 TFreightCosts) 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 TFreightCosts
|
|
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 motModeField As String
|
|
|
|
Private meansOfTransportField As String
|
|
|
|
Private motCountryField As String
|
|
|
|
Private motVehicleField As String
|
|
|
|
Private meansOfTransportDescriptionField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property motMode() As String
|
|
Get
|
|
Return Me.motModeField
|
|
End Get
|
|
Set
|
|
Me.motModeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property meansOfTransport() As String
|
|
Get
|
|
Return Me.meansOfTransportField
|
|
End Get
|
|
Set
|
|
Me.meansOfTransportField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property motCountry() As String
|
|
Get
|
|
Return Me.motCountryField
|
|
End Get
|
|
Set
|
|
Me.motCountryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property motVehicle() As String
|
|
Get
|
|
Return Me.motVehicleField
|
|
End Get
|
|
Set
|
|
Me.motVehicleField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property meansOfTransportDescription() As String
|
|
Get
|
|
Return Me.meansOfTransportDescriptionField
|
|
End Get
|
|
Set
|
|
Me.meansOfTransportDescriptionField = 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
|
|
End Namespace
|