15842 lines
567 KiB
VB.net
15842 lines
567 KiB
VB.net
'' ------------------------------------------------------------------------------
|
|
'' <auto-generated>
|
|
'' Generated by Xsd2Code. Version 3.4.1.33667 Microsoft Reciprocal License (Ms-RL)
|
|
'' <NameSpace>MIC_EXPORT</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 MIC_EXPORT
|
|
|
|
Partial Public Class ExportShipment
|
|
|
|
Private shipmentHeadField As TShipmentHead
|
|
|
|
Private invoicesField As List(Of TInvoice)
|
|
|
|
Private packagesField As List(Of TPackage)
|
|
|
|
Private schemaVersionField As Decimal
|
|
|
|
Private schemaVersionFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.packagesField = New List(Of TPackage)()
|
|
Me.invoicesField = New List(Of TInvoice)()
|
|
Me.shipmentHeadField = New TShipmentHead()
|
|
End Sub
|
|
|
|
Public Property ShipmentHead() As TShipmentHead
|
|
Get
|
|
Return Me.shipmentHeadField
|
|
End Get
|
|
Set
|
|
Me.shipmentHeadField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Invoices() As List(Of TInvoice)
|
|
Get
|
|
Return Me.invoicesField
|
|
End Get
|
|
Set
|
|
Me.invoicesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Packages() As List(Of TPackage)
|
|
Get
|
|
Return Me.packagesField
|
|
End Get
|
|
Set
|
|
Me.packagesField = 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(ExportShipment))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current ExportShipment 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 ExportShipment object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output ExportShipment 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 ExportShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ExportShipment)
|
|
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 ExportShipment) 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 ExportShipment
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), ExportShipment)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current ExportShipment 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 ExportShipment object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output ExportShipment 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 ExportShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ExportShipment)
|
|
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 ExportShipment) 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 ExportShipment
|
|
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 companyField As String
|
|
|
|
Private plantField As String
|
|
|
|
Private shipmentIdField As String
|
|
|
|
Private shipmentIdPartField As String
|
|
|
|
Private shipmentTypeField As String
|
|
|
|
Private mrnField As String
|
|
|
|
Private deliveryDateField As Date
|
|
|
|
Private deliveryDateFieldSpecified As Boolean
|
|
|
|
Private codField As String
|
|
|
|
Private exportCountryField As String
|
|
|
|
Private contCodeField As ContainerCode
|
|
|
|
Private contCodeFieldSpecified As Boolean
|
|
|
|
Private gWeightField As Decimal
|
|
|
|
Private gWeightFieldSpecified As Boolean
|
|
|
|
Private dateStartPackField As Date
|
|
|
|
Private dateStartPackFieldSpecified As Boolean
|
|
|
|
Private dateEndPackField As Date
|
|
|
|
Private dateEndPackFieldSpecified As Boolean
|
|
|
|
Private partyConstField As String
|
|
|
|
Private consigneeEndUserFlagField As String
|
|
|
|
Private endUserInEamField As TShipmentHeadEndUserInEam
|
|
|
|
Private endUserInEamFieldSpecified As Boolean
|
|
|
|
Private estimatedArrivalDateField As Date
|
|
|
|
Private estimatedArrivalDateFieldSpecified As Boolean
|
|
|
|
Private nctsIndicatorField As Boolean
|
|
|
|
Private nctsIndicatorFieldSpecified As Boolean
|
|
|
|
Private motInlField As TMotInl
|
|
|
|
Private textField As List(Of String)
|
|
|
|
Private partnersField As List(Of TPartner)
|
|
|
|
Private locGoodsField As TLocationOfGoods
|
|
|
|
Private officeDepartField As TCustomsOffice
|
|
|
|
Private officeBorderField As TCustomsOffice
|
|
|
|
Private motBorderField As TMot
|
|
|
|
Private sealsField As List(Of TSeal)
|
|
|
|
Private declTypeField As TDeclType
|
|
|
|
Private placeDestField As String
|
|
|
|
Private authLocationField As String
|
|
|
|
Private declPlaceField As String
|
|
|
|
Private agreedLocationOfGoodsCdField As String
|
|
|
|
Private agreedLocationOfGoodsField As String
|
|
|
|
Private custSubPlaceField As String
|
|
|
|
Private codFirstField As String
|
|
|
|
Private officeDestField As TCustomsOffice
|
|
|
|
Private carrierField As String
|
|
|
|
Private containersField As List(Of TContainer)
|
|
|
|
Private freightCostField As TFreight
|
|
|
|
Private addCostsField As List(Of TAddCosts)
|
|
|
|
Private assurCostField As TAssurance
|
|
|
|
Private groupIDField As String
|
|
|
|
Private documentsField As List(Of TDocuments)
|
|
|
|
Private regNoExtField As String
|
|
|
|
Private customerFieldsField As TCustomerFields
|
|
|
|
Private attributesField As List(Of TAttribute)
|
|
|
|
Private coeField As String
|
|
|
|
Private specCircumField As String
|
|
|
|
Private carriageCostsField As String
|
|
|
|
Private shipmentIdentificationField As String
|
|
|
|
Private conveyRefNrField As String
|
|
|
|
Private unloadingPlaceField As String
|
|
|
|
Private routeField As List(Of TRoute)
|
|
|
|
Private expressField As String
|
|
|
|
Private routeNameField As String
|
|
|
|
Private authorisationNoField As String
|
|
|
|
Private authorisationField As TShipmentHeadAuthorisation
|
|
|
|
Private postExportDeclarationField As TShipmentHeadPostExportDeclaration
|
|
|
|
Private oprDataField As TShipmentHeadOprData
|
|
|
|
Private additionalInformationField As List(Of TAttribute)
|
|
|
|
Private stateOfAffairsField As List(Of String)
|
|
|
|
Private erpDataField As TErpShipmentData
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.erpDataField = New TErpShipmentData()
|
|
Me.stateOfAffairsField = New List(Of String)()
|
|
Me.additionalInformationField = New List(Of TAttribute)()
|
|
Me.oprDataField = New TShipmentHeadOprData()
|
|
Me.postExportDeclarationField = New TShipmentHeadPostExportDeclaration()
|
|
Me.authorisationField = New TShipmentHeadAuthorisation()
|
|
Me.routeField = New List(Of TRoute)()
|
|
Me.attributesField = New List(Of TAttribute)()
|
|
Me.customerFieldsField = New TCustomerFields()
|
|
Me.documentsField = New List(Of TDocuments)()
|
|
Me.assurCostField = New TAssurance()
|
|
Me.addCostsField = New List(Of TAddCosts)()
|
|
Me.freightCostField = New TFreight()
|
|
Me.containersField = New List(Of TContainer)()
|
|
Me.officeDestField = New TCustomsOffice()
|
|
Me.declTypeField = New TDeclType()
|
|
Me.sealsField = New List(Of TSeal)()
|
|
Me.motBorderField = New TMot()
|
|
Me.officeBorderField = New TCustomsOffice()
|
|
Me.officeDepartField = New TCustomsOffice()
|
|
Me.locGoodsField = New TLocationOfGoods()
|
|
Me.partnersField = New List(Of TPartner)()
|
|
Me.textField = New List(Of String)()
|
|
Me.motInlField = New TMotInl()
|
|
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 shipmentIdPart() As String
|
|
Get
|
|
Return Me.shipmentIdPartField
|
|
End Get
|
|
Set
|
|
Me.shipmentIdPartField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipmentType() As String
|
|
Get
|
|
Return Me.shipmentTypeField
|
|
End Get
|
|
Set
|
|
Me.shipmentTypeField = 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 deliveryDate() As Date
|
|
Get
|
|
Return Me.deliveryDateField
|
|
End Get
|
|
Set
|
|
Me.deliveryDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property deliveryDateSpecified() As Boolean
|
|
Get
|
|
Return Me.deliveryDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.deliveryDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property cod() As String
|
|
Get
|
|
Return Me.codField
|
|
End Get
|
|
Set
|
|
Me.codField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property exportCountry() As String
|
|
Get
|
|
Return Me.exportCountryField
|
|
End Get
|
|
Set
|
|
Me.exportCountryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contCode() As ContainerCode
|
|
Get
|
|
Return Me.contCodeField
|
|
End Get
|
|
Set
|
|
Me.contCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property contCodeSpecified() As Boolean
|
|
Get
|
|
Return Me.contCodeFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.contCodeFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property gWeight() As Decimal
|
|
Get
|
|
Return Me.gWeightField
|
|
End Get
|
|
Set
|
|
Me.gWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property gWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.gWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.gWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dateStartPack() As Date
|
|
Get
|
|
Return Me.dateStartPackField
|
|
End Get
|
|
Set
|
|
Me.dateStartPackField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dateStartPackSpecified() As Boolean
|
|
Get
|
|
Return Me.dateStartPackFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dateStartPackFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dateEndPack() As Date
|
|
Get
|
|
Return Me.dateEndPackField
|
|
End Get
|
|
Set
|
|
Me.dateEndPackField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dateEndPackSpecified() As Boolean
|
|
Get
|
|
Return Me.dateEndPackFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dateEndPackFieldSpecified = 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 consigneeEndUserFlag() As String
|
|
Get
|
|
Return Me.consigneeEndUserFlagField
|
|
End Get
|
|
Set
|
|
Me.consigneeEndUserFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property endUserInEam() As TShipmentHeadEndUserInEam
|
|
Get
|
|
Return Me.endUserInEamField
|
|
End Get
|
|
Set
|
|
Me.endUserInEamField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property endUserInEamSpecified() As Boolean
|
|
Get
|
|
Return Me.endUserInEamFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.endUserInEamFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property estimatedArrivalDate() As Date
|
|
Get
|
|
Return Me.estimatedArrivalDateField
|
|
End Get
|
|
Set
|
|
Me.estimatedArrivalDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property estimatedArrivalDateSpecified() As Boolean
|
|
Get
|
|
Return Me.estimatedArrivalDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.estimatedArrivalDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nctsIndicator() As Boolean
|
|
Get
|
|
Return Me.nctsIndicatorField
|
|
End Get
|
|
Set
|
|
Me.nctsIndicatorField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property nctsIndicatorSpecified() As Boolean
|
|
Get
|
|
Return Me.nctsIndicatorFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.nctsIndicatorFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property motInl() As TMotInl
|
|
Get
|
|
Return Me.motInlField
|
|
End Get
|
|
Set
|
|
Me.motInlField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property text() As List(Of String)
|
|
Get
|
|
Return Me.textField
|
|
End Get
|
|
Set
|
|
Me.textField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partners() As List(Of TPartner)
|
|
Get
|
|
Return Me.partnersField
|
|
End Get
|
|
Set
|
|
Me.partnersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property locGoods() As TLocationOfGoods
|
|
Get
|
|
Return Me.locGoodsField
|
|
End Get
|
|
Set
|
|
Me.locGoodsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property officeDepart() As TCustomsOffice
|
|
Get
|
|
Return Me.officeDepartField
|
|
End Get
|
|
Set
|
|
Me.officeDepartField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property officeBorder() As TCustomsOffice
|
|
Get
|
|
Return Me.officeBorderField
|
|
End Get
|
|
Set
|
|
Me.officeBorderField = 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 seals() As List(Of TSeal)
|
|
Get
|
|
Return Me.sealsField
|
|
End Get
|
|
Set
|
|
Me.sealsField = 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 placeDest() As String
|
|
Get
|
|
Return Me.placeDestField
|
|
End Get
|
|
Set
|
|
Me.placeDestField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authLocation() As String
|
|
Get
|
|
Return Me.authLocationField
|
|
End Get
|
|
Set
|
|
Me.authLocationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property declPlace() As String
|
|
Get
|
|
Return Me.declPlaceField
|
|
End Get
|
|
Set
|
|
Me.declPlaceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property agreedLocationOfGoodsCd() As String
|
|
Get
|
|
Return Me.agreedLocationOfGoodsCdField
|
|
End Get
|
|
Set
|
|
Me.agreedLocationOfGoodsCdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property agreedLocationOfGoods() As String
|
|
Get
|
|
Return Me.agreedLocationOfGoodsField
|
|
End Get
|
|
Set
|
|
Me.agreedLocationOfGoodsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property custSubPlace() As String
|
|
Get
|
|
Return Me.custSubPlaceField
|
|
End Get
|
|
Set
|
|
Me.custSubPlaceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property codFirst() As String
|
|
Get
|
|
Return Me.codFirstField
|
|
End Get
|
|
Set
|
|
Me.codFirstField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property officeDest() As TCustomsOffice
|
|
Get
|
|
Return Me.officeDestField
|
|
End Get
|
|
Set
|
|
Me.officeDestField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property carrier() As String
|
|
Get
|
|
Return Me.carrierField
|
|
End Get
|
|
Set
|
|
Me.carrierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containers() As List(Of TContainer)
|
|
Get
|
|
Return Me.containersField
|
|
End Get
|
|
Set
|
|
Me.containersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property freightCost() As TFreight
|
|
Get
|
|
Return Me.freightCostField
|
|
End Get
|
|
Set
|
|
Me.freightCostField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCosts() As List(Of TAddCosts)
|
|
Get
|
|
Return Me.addCostsField
|
|
End Get
|
|
Set
|
|
Me.addCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property assurCost() As TAssurance
|
|
Get
|
|
Return Me.assurCostField
|
|
End Get
|
|
Set
|
|
Me.assurCostField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property groupID() As String
|
|
Get
|
|
Return Me.groupIDField
|
|
End Get
|
|
Set
|
|
Me.groupIDField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property documents() As List(Of TDocuments)
|
|
Get
|
|
Return Me.documentsField
|
|
End Get
|
|
Set
|
|
Me.documentsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property regNoExt() As String
|
|
Get
|
|
Return Me.regNoExtField
|
|
End Get
|
|
Set
|
|
Me.regNoExtField = 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 attributes() As List(Of TAttribute)
|
|
Get
|
|
Return Me.attributesField
|
|
End Get
|
|
Set
|
|
Me.attributesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property coe() As String
|
|
Get
|
|
Return Me.coeField
|
|
End Get
|
|
Set
|
|
Me.coeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property specCircum() As String
|
|
Get
|
|
Return Me.specCircumField
|
|
End Get
|
|
Set
|
|
Me.specCircumField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property carriageCosts() As String
|
|
Get
|
|
Return Me.carriageCostsField
|
|
End Get
|
|
Set
|
|
Me.carriageCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipmentIdentification() As String
|
|
Get
|
|
Return Me.shipmentIdentificationField
|
|
End Get
|
|
Set
|
|
Me.shipmentIdentificationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property conveyRefNr() As String
|
|
Get
|
|
Return Me.conveyRefNrField
|
|
End Get
|
|
Set
|
|
Me.conveyRefNrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unloadingPlace() As String
|
|
Get
|
|
Return Me.unloadingPlaceField
|
|
End Get
|
|
Set
|
|
Me.unloadingPlaceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property route() As List(Of TRoute)
|
|
Get
|
|
Return Me.routeField
|
|
End Get
|
|
Set
|
|
Me.routeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property express() As String
|
|
Get
|
|
Return Me.expressField
|
|
End Get
|
|
Set
|
|
Me.expressField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property routeName() As String
|
|
Get
|
|
Return Me.routeNameField
|
|
End Get
|
|
Set
|
|
Me.routeNameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authorisationNo() As String
|
|
Get
|
|
Return Me.authorisationNoField
|
|
End Get
|
|
Set
|
|
Me.authorisationNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authorisation() As TShipmentHeadAuthorisation
|
|
Get
|
|
Return Me.authorisationField
|
|
End Get
|
|
Set
|
|
Me.authorisationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property postExportDeclaration() As TShipmentHeadPostExportDeclaration
|
|
Get
|
|
Return Me.postExportDeclarationField
|
|
End Get
|
|
Set
|
|
Me.postExportDeclarationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property oprData() As TShipmentHeadOprData
|
|
Get
|
|
Return Me.oprDataField
|
|
End Get
|
|
Set
|
|
Me.oprDataField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalInformation() As List(Of TAttribute)
|
|
Get
|
|
Return Me.additionalInformationField
|
|
End Get
|
|
Set
|
|
Me.additionalInformationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlArrayItemAttribute("stateOfAffairsCode", IsNullable:=False)>
|
|
Public Property stateOfAffairs() As List(Of String)
|
|
Get
|
|
Return Me.stateOfAffairsField
|
|
End Get
|
|
Set
|
|
Me.stateOfAffairsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property erpData() As TErpShipmentData
|
|
Get
|
|
Return Me.erpDataField
|
|
End Get
|
|
Set
|
|
Me.erpDataField = 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 ContainerCode
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("1")>
|
|
Item1
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("0")>
|
|
Item0
|
|
End Enum
|
|
|
|
Public Enum TShipmentHeadEndUserInEam
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("")>
|
|
Item
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("0")>
|
|
Item0
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("1")>
|
|
Item1
|
|
End Enum
|
|
|
|
Partial Public Class TMotInl
|
|
|
|
Private motField As String
|
|
|
|
Private natField As String
|
|
|
|
Private typeField As String
|
|
|
|
Private licNoField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property mot() As String
|
|
Get
|
|
Return Me.motField
|
|
End Get
|
|
Set
|
|
Me.motField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nat() As String
|
|
Get
|
|
Return Me.natField
|
|
End Get
|
|
Set
|
|
Me.natField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licNo() As String
|
|
Get
|
|
Return Me.licNoField
|
|
End Get
|
|
Set
|
|
Me.licNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TMotInl))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMotInl object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TMotInl object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMotInl object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMotInl, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMotInl)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMotInl) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TMotInl
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMotInl)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMotInl object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TMotInl object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMotInl object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMotInl, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMotInl)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMotInl) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TMotInl
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TPackageLine
|
|
|
|
Private invNoField As String
|
|
|
|
Private invPosField As String
|
|
|
|
Private quantityField As Decimal
|
|
|
|
Private quantityFieldSpecified As Boolean
|
|
|
|
Private unitField As String
|
|
|
|
Private nWeightField As Decimal
|
|
|
|
Private nWeightFieldSpecified As Boolean
|
|
|
|
Private numberOfPackagesField As Long
|
|
|
|
Private numberOfPackagesFieldSpecified As Boolean
|
|
|
|
Private itemQuantityField As Long
|
|
|
|
Private itemQuantityFieldSpecified As Boolean
|
|
|
|
Private itemUnitField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property invNo() As String
|
|
Get
|
|
Return Me.invNoField
|
|
End Get
|
|
Set
|
|
Me.invNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invPos() As String
|
|
Get
|
|
Return Me.invPosField
|
|
End Get
|
|
Set
|
|
Me.invPosField = 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 unit() As String
|
|
Get
|
|
Return Me.unitField
|
|
End Get
|
|
Set
|
|
Me.unitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nWeight() As Decimal
|
|
Get
|
|
Return Me.nWeightField
|
|
End Get
|
|
Set
|
|
Me.nWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property nWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.nWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.nWeightFieldSpecified = 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 itemQuantity() As Long
|
|
Get
|
|
Return Me.itemQuantityField
|
|
End Get
|
|
Set
|
|
Me.itemQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property itemQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.itemQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.itemQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property itemUnit() As String
|
|
Get
|
|
Return Me.itemUnitField
|
|
End Get
|
|
Set
|
|
Me.itemUnitField = 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(TPackageLine))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPackageLine 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 TPackageLine object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPackageLine 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 TPackageLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageLine)
|
|
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 TPackageLine) 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 TPackageLine
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPackageLine)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPackageLine 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 TPackageLine object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPackageLine 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 TPackageLine, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageLine)
|
|
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 TPackageLine) 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 TPackageLine
|
|
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 TPackageHead
|
|
|
|
Private packageNoField As String
|
|
|
|
Private pTypeField As String
|
|
|
|
Private unitField As String
|
|
|
|
Private packageNoExtField As String
|
|
|
|
Private gWeightField As Decimal
|
|
|
|
Private gWeightFieldSpecified As Boolean
|
|
|
|
Private nWeightField As Decimal
|
|
|
|
Private nWeightFieldSpecified As Boolean
|
|
|
|
Private taraField As Decimal
|
|
|
|
Private taraFieldSpecified As Boolean
|
|
|
|
Private unitWeightField As String
|
|
|
|
Private volumeField As Decimal
|
|
|
|
Private volumeFieldSpecified As Boolean
|
|
|
|
Private grossVolumeField As Decimal
|
|
|
|
Private grossVolumeFieldSpecified As Boolean
|
|
|
|
Private netVolumeField As Decimal
|
|
|
|
Private netVolumeFieldSpecified As Boolean
|
|
|
|
Private unitVolumeField As String
|
|
|
|
Private lengthField As Decimal
|
|
|
|
Private lengthFieldSpecified As Boolean
|
|
|
|
Private widthField As Decimal
|
|
|
|
Private widthFieldSpecified As Boolean
|
|
|
|
Private heightField As Decimal
|
|
|
|
Private heightFieldSpecified As Boolean
|
|
|
|
Private unitlwhField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property packageNo() As String
|
|
Get
|
|
Return Me.packageNoField
|
|
End Get
|
|
Set
|
|
Me.packageNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property pType() As String
|
|
Get
|
|
Return Me.pTypeField
|
|
End Get
|
|
Set
|
|
Me.pTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unit() As String
|
|
Get
|
|
Return Me.unitField
|
|
End Get
|
|
Set
|
|
Me.unitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property packageNoExt() As String
|
|
Get
|
|
Return Me.packageNoExtField
|
|
End Get
|
|
Set
|
|
Me.packageNoExtField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property gWeight() As Decimal
|
|
Get
|
|
Return Me.gWeightField
|
|
End Get
|
|
Set
|
|
Me.gWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property gWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.gWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.gWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nWeight() As Decimal
|
|
Get
|
|
Return Me.nWeightField
|
|
End Get
|
|
Set
|
|
Me.nWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property nWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.nWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.nWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tara() As Decimal
|
|
Get
|
|
Return Me.taraField
|
|
End Get
|
|
Set
|
|
Me.taraField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property taraSpecified() As Boolean
|
|
Get
|
|
Return Me.taraFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.taraFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unitWeight() As String
|
|
Get
|
|
Return Me.unitWeightField
|
|
End Get
|
|
Set
|
|
Me.unitWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property volume() As Decimal
|
|
Get
|
|
Return Me.volumeField
|
|
End Get
|
|
Set
|
|
Me.volumeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property volumeSpecified() As Boolean
|
|
Get
|
|
Return Me.volumeFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.volumeFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property grossVolume() As Decimal
|
|
Get
|
|
Return Me.grossVolumeField
|
|
End Get
|
|
Set
|
|
Me.grossVolumeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property grossVolumeSpecified() As Boolean
|
|
Get
|
|
Return Me.grossVolumeFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.grossVolumeFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property netVolume() As Decimal
|
|
Get
|
|
Return Me.netVolumeField
|
|
End Get
|
|
Set
|
|
Me.netVolumeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property netVolumeSpecified() As Boolean
|
|
Get
|
|
Return Me.netVolumeFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.netVolumeFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unitVolume() As String
|
|
Get
|
|
Return Me.unitVolumeField
|
|
End Get
|
|
Set
|
|
Me.unitVolumeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property length() As Decimal
|
|
Get
|
|
Return Me.lengthField
|
|
End Get
|
|
Set
|
|
Me.lengthField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property lengthSpecified() As Boolean
|
|
Get
|
|
Return Me.lengthFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.lengthFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property width() As Decimal
|
|
Get
|
|
Return Me.widthField
|
|
End Get
|
|
Set
|
|
Me.widthField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property widthSpecified() As Boolean
|
|
Get
|
|
Return Me.widthFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.widthFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property height() As Decimal
|
|
Get
|
|
Return Me.heightField
|
|
End Get
|
|
Set
|
|
Me.heightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property heightSpecified() As Boolean
|
|
Get
|
|
Return Me.heightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.heightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unitlwh() As String
|
|
Get
|
|
Return Me.unitlwhField
|
|
End Get
|
|
Set
|
|
Me.unitlwhField = 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(TPackageHead))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPackageHead 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 TPackageHead object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPackageHead 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 TPackageHead, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageHead)
|
|
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 TPackageHead) 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 TPackageHead
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPackageHead)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPackageHead 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 TPackageHead object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPackageHead 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 TPackageHead, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPackageHead)
|
|
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 TPackageHead) 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 TPackageHead
|
|
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 packageHeadField As TPackageHead
|
|
|
|
Private packageLineField As List(Of TPackageLine)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.packageLineField = New List(Of TPackageLine)()
|
|
Me.packageHeadField = New TPackageHead()
|
|
End Sub
|
|
|
|
Public Property packageHead() As TPackageHead
|
|
Get
|
|
Return Me.packageHeadField
|
|
End Get
|
|
Set
|
|
Me.packageHeadField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property packageLine() As List(Of TPackageLine)
|
|
Get
|
|
Return Me.packageLineField
|
|
End Get
|
|
Set
|
|
Me.packageLineField = 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 TErpLineData
|
|
|
|
Private legalRegulationField As String
|
|
|
|
Private exportControlClassField As String
|
|
|
|
Private embargoField As String
|
|
|
|
Private licenseTypeField As String
|
|
|
|
Private licenseNumberField As String
|
|
|
|
Private profitCenterField As String
|
|
|
|
Private vZTAField As String
|
|
|
|
Private erpInvoicelinenumberField As String
|
|
|
|
Private erpPartnumberField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property legalRegulation() As String
|
|
Get
|
|
Return Me.legalRegulationField
|
|
End Get
|
|
Set
|
|
Me.legalRegulationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property exportControlClass() As String
|
|
Get
|
|
Return Me.exportControlClassField
|
|
End Get
|
|
Set
|
|
Me.exportControlClassField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property embargo() As String
|
|
Get
|
|
Return Me.embargoField
|
|
End Get
|
|
Set
|
|
Me.embargoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licenseType() As String
|
|
Get
|
|
Return Me.licenseTypeField
|
|
End Get
|
|
Set
|
|
Me.licenseTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licenseNumber() As String
|
|
Get
|
|
Return Me.licenseNumberField
|
|
End Get
|
|
Set
|
|
Me.licenseNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property profitCenter() As String
|
|
Get
|
|
Return Me.profitCenterField
|
|
End Get
|
|
Set
|
|
Me.profitCenterField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property vZTA() As String
|
|
Get
|
|
Return Me.vZTAField
|
|
End Get
|
|
Set
|
|
Me.vZTAField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property erpInvoicelinenumber() As String
|
|
Get
|
|
Return Me.erpInvoicelinenumberField
|
|
End Get
|
|
Set
|
|
Me.erpInvoicelinenumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property erpPartnumber() As String
|
|
Get
|
|
Return Me.erpPartnumberField
|
|
End Get
|
|
Set
|
|
Me.erpPartnumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TErpLineData))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TErpLineData object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TErpLineData object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErpLineData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpLineData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpLineData)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpLineData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TErpLineData
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErpLineData)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TErpLineData object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TErpLineData object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErpLineData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpLineData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpLineData)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpLineData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TErpLineData
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TRegInfo
|
|
|
|
Private registrationNumber1Field As String
|
|
|
|
Private registrationNumber2Field As String
|
|
|
|
Private registrationNumber3Field As String
|
|
|
|
Private referenceNumber1Field As String
|
|
|
|
Private referenceNumber2Field As String
|
|
|
|
Private referenceNumber3Field As String
|
|
|
|
Private registrationDateField As Date
|
|
|
|
Private registrationDateFieldSpecified As Boolean
|
|
|
|
Private acceptanceDateField As Date
|
|
|
|
Private acceptanceDateFieldSpecified As Boolean
|
|
|
|
Private releaseDateField As Date
|
|
|
|
Private releaseDateFieldSpecified 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 referenceNumber1() As String
|
|
Get
|
|
Return Me.referenceNumber1Field
|
|
End Get
|
|
Set
|
|
Me.referenceNumber1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceNumber2() As String
|
|
Get
|
|
Return Me.referenceNumber2Field
|
|
End Get
|
|
Set
|
|
Me.referenceNumber2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceNumber3() As String
|
|
Get
|
|
Return Me.referenceNumber3Field
|
|
End Get
|
|
Set
|
|
Me.referenceNumber3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationDate() As Date
|
|
Get
|
|
Return Me.registrationDateField
|
|
End Get
|
|
Set
|
|
Me.registrationDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property registrationDateSpecified() As Boolean
|
|
Get
|
|
Return Me.registrationDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.registrationDateFieldSpecified = 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 releaseDate() As Date
|
|
Get
|
|
Return Me.releaseDateField
|
|
End Get
|
|
Set
|
|
Me.releaseDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property releaseDateSpecified() As Boolean
|
|
Get
|
|
Return Me.releaseDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.releaseDateFieldSpecified = 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(TRegInfo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TRegInfo 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 TRegInfo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TRegInfo 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 TRegInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRegInfo)
|
|
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 TRegInfo) 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 TRegInfo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TRegInfo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TRegInfo 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 TRegInfo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TRegInfo 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 TRegInfo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRegInfo)
|
|
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 TRegInfo) 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 TRegInfo
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TImportQuantity
|
|
|
|
Private qualifierField As String
|
|
|
|
Private unitField As String
|
|
|
|
Private valueField As Decimal
|
|
|
|
Private valueFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property qualifier() As String
|
|
Get
|
|
Return Me.qualifierField
|
|
End Get
|
|
Set
|
|
Me.qualifierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unit() As String
|
|
Get
|
|
Return Me.unitField
|
|
End Get
|
|
Set
|
|
Me.unitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property value() As Decimal
|
|
Get
|
|
Return Me.valueField
|
|
End Get
|
|
Set
|
|
Me.valueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property valueSpecified() As Boolean
|
|
Get
|
|
Return Me.valueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.valueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TImportQuantity))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TImportQuantity object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TImportQuantity object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TImportQuantity object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportQuantity, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportQuantity)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportQuantity) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TImportQuantity
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TImportQuantity)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TImportQuantity object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TImportQuantity object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TImportQuantity object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportQuantity, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportQuantity)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportQuantity) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TImportQuantity
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TImportReference
|
|
|
|
Private typeField As String
|
|
|
|
Private authNrField As String
|
|
|
|
Private impShpNrField As String
|
|
|
|
Private lineNoField As String
|
|
|
|
Private authRegistryNoField As String
|
|
|
|
Private commCodeField As String
|
|
|
|
Private usualTreatmentField As String
|
|
|
|
Private importAtlasField As String
|
|
|
|
Private addInfoField As String
|
|
|
|
Private quantityField As TImportQuantity
|
|
|
|
Private tradeQuantityField As TImportQuantity
|
|
|
|
Private packageQuantityField As Decimal
|
|
|
|
Private packageQuantityFieldSpecified As Boolean
|
|
|
|
Private netMassField As Decimal
|
|
|
|
Private netMassFieldSpecified As Boolean
|
|
|
|
Private grossMassField As Decimal
|
|
|
|
Private grossMassFieldSpecified As Boolean
|
|
|
|
Private statisticalQuantityField As Decimal
|
|
|
|
Private statisticalQuantityFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.tradeQuantityField = New TImportQuantity()
|
|
Me.quantityField = New TImportQuantity()
|
|
End Sub
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authNr() As String
|
|
Get
|
|
Return Me.authNrField
|
|
End Get
|
|
Set
|
|
Me.authNrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property impShpNr() As String
|
|
Get
|
|
Return Me.impShpNrField
|
|
End Get
|
|
Set
|
|
Me.impShpNrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property lineNo() As String
|
|
Get
|
|
Return Me.lineNoField
|
|
End Get
|
|
Set
|
|
Me.lineNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authRegistryNo() As String
|
|
Get
|
|
Return Me.authRegistryNoField
|
|
End Get
|
|
Set
|
|
Me.authRegistryNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property commCode() As String
|
|
Get
|
|
Return Me.commCodeField
|
|
End Get
|
|
Set
|
|
Me.commCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property usualTreatment() As String
|
|
Get
|
|
Return Me.usualTreatmentField
|
|
End Get
|
|
Set
|
|
Me.usualTreatmentField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importAtlas() As String
|
|
Get
|
|
Return Me.importAtlasField
|
|
End Get
|
|
Set
|
|
Me.importAtlasField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addInfo() As String
|
|
Get
|
|
Return Me.addInfoField
|
|
End Get
|
|
Set
|
|
Me.addInfoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property quantity() As TImportQuantity
|
|
Get
|
|
Return Me.quantityField
|
|
End Get
|
|
Set
|
|
Me.quantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tradeQuantity() As TImportQuantity
|
|
Get
|
|
Return Me.tradeQuantityField
|
|
End Get
|
|
Set
|
|
Me.tradeQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property packageQuantity() As Decimal
|
|
Get
|
|
Return Me.packageQuantityField
|
|
End Get
|
|
Set
|
|
Me.packageQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property packageQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.packageQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.packageQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property netMass() As Decimal
|
|
Get
|
|
Return Me.netMassField
|
|
End Get
|
|
Set
|
|
Me.netMassField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property netMassSpecified() As Boolean
|
|
Get
|
|
Return Me.netMassFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.netMassFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property grossMass() As Decimal
|
|
Get
|
|
Return Me.grossMassField
|
|
End Get
|
|
Set
|
|
Me.grossMassField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property grossMassSpecified() As Boolean
|
|
Get
|
|
Return Me.grossMassFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.grossMassFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticalQuantity() As Decimal
|
|
Get
|
|
Return Me.statisticalQuantityField
|
|
End Get
|
|
Set
|
|
Me.statisticalQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property statisticalQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.statisticalQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.statisticalQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TImportReference))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TImportReference object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TImportReference object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TImportReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportReference)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TImportReference) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TImportReference
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TImportReference)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TImportReference object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TImportReference object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TImportReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TImportReference)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TImportReference) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TImportReference
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TBomNo
|
|
|
|
Private noField As String
|
|
|
|
Private varField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property no() As String
|
|
Get
|
|
Return Me.noField
|
|
End Get
|
|
Set
|
|
Me.noField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property var() As String
|
|
Get
|
|
Return Me.varField
|
|
End Get
|
|
Set
|
|
Me.varField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TBomNo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TBomNo object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TBomNo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TBomNo object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TBomNo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TBomNo)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TBomNo) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TBomNo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TBomNo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TBomNo object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TBomNo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TBomNo object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TBomNo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TBomNo)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TBomNo) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TBomNo
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TOrder
|
|
|
|
Private ordNoField As String
|
|
|
|
Private ordDateField As Date
|
|
|
|
Private ordDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property ordNo() As String
|
|
Get
|
|
Return Me.ordNoField
|
|
End Get
|
|
Set
|
|
Me.ordNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ordDate() As Date
|
|
Get
|
|
Return Me.ordDateField
|
|
End Get
|
|
Set
|
|
Me.ordDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property ordDateSpecified() As Boolean
|
|
Get
|
|
Return Me.ordDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.ordDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TOrder))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TOrder object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TOrder object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TOrder object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TOrder, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOrder)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TOrder) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TOrder
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TOrder)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TOrder object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TOrder object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TOrder object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TOrder, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TOrder)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TOrder) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TOrder
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TDelNote
|
|
|
|
Private delNoField As String
|
|
|
|
Private positionField As Long
|
|
|
|
Private positionFieldSpecified As Boolean
|
|
|
|
Private delDateField As Date
|
|
|
|
Private delDateFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property delNo() As String
|
|
Get
|
|
Return Me.delNoField
|
|
End Get
|
|
Set
|
|
Me.delNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property position() As Long
|
|
Get
|
|
Return Me.positionField
|
|
End Get
|
|
Set
|
|
Me.positionField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property positionSpecified() As Boolean
|
|
Get
|
|
Return Me.positionFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.positionFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property delDate() As Date
|
|
Get
|
|
Return Me.delDateField
|
|
End Get
|
|
Set
|
|
Me.delDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property delDateSpecified() As Boolean
|
|
Get
|
|
Return Me.delDateFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.delDateFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDelNote))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDelNote object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TDelNote object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDelNote object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelNote, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelNote)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelNote) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDelNote
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDelNote)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDelNote object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TDelNote object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDelNote object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelNote, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelNote)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelNote) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDelNote
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TItem
|
|
|
|
Private itemNoField As String
|
|
|
|
Private itemDescField As String
|
|
|
|
Private commCodeField As String
|
|
|
|
Private prodGrField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property itemNo() As String
|
|
Get
|
|
Return Me.itemNoField
|
|
End Get
|
|
Set
|
|
Me.itemNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property itemDesc() As String
|
|
Get
|
|
Return Me.itemDescField
|
|
End Get
|
|
Set
|
|
Me.itemDescField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property commCode() As String
|
|
Get
|
|
Return Me.commCodeField
|
|
End Get
|
|
Set
|
|
Me.commCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prodGr() As String
|
|
Get
|
|
Return Me.prodGrField
|
|
End Get
|
|
Set
|
|
Me.prodGrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TItem))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TItem object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TItem object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TItem object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TItem, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TItem)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TItem) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TItem
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TItem)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TItem object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TItem object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TItem object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TItem, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TItem)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TItem) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TItem
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TPreviousDocument
|
|
|
|
Private docTypeField As String
|
|
|
|
Private docNoField As String
|
|
|
|
Private docAddTextField As String
|
|
|
|
Private docCategoryField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property docType() As String
|
|
Get
|
|
Return Me.docTypeField
|
|
End Get
|
|
Set
|
|
Me.docTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docNo() As String
|
|
Get
|
|
Return Me.docNoField
|
|
End Get
|
|
Set
|
|
Me.docNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docAddText() As String
|
|
Get
|
|
Return Me.docAddTextField
|
|
End Get
|
|
Set
|
|
Me.docAddTextField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docCategory() As String
|
|
Get
|
|
Return Me.docCategoryField
|
|
End Get
|
|
Set
|
|
Me.docCategoryField = 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(TPreviousDocument))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPreviousDocument 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 TPreviousDocument object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPreviousDocument 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 TPreviousDocument, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPreviousDocument)
|
|
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 TPreviousDocument) 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 TPreviousDocument
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPreviousDocument)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPreviousDocument 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 TPreviousDocument object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPreviousDocument 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 TPreviousDocument, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPreviousDocument)
|
|
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 TPreviousDocument) 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 TPreviousDocument
|
|
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 lineNoField As String
|
|
|
|
Private unitPriceField As Decimal
|
|
|
|
Private unitPriceFieldSpecified As Boolean
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private amountFieldSpecified As Boolean
|
|
|
|
Private nWeightField As Decimal
|
|
|
|
Private nWeightFieldSpecified As Boolean
|
|
|
|
Private gWeightField As Decimal
|
|
|
|
Private gWeightFieldSpecified As Boolean
|
|
|
|
Private statQuantField As Decimal
|
|
|
|
Private statQuantFieldSpecified As Boolean
|
|
|
|
Private statUnitField As String
|
|
|
|
Private statValField As Decimal
|
|
|
|
Private statValFieldSpecified As Boolean
|
|
|
|
Private custProcField As String
|
|
|
|
Private eUCodeField As String
|
|
|
|
Private statCodeField As String
|
|
|
|
Private transTypeField As String
|
|
|
|
Private cooField As String
|
|
|
|
Private cooStateField As String
|
|
|
|
Private addTextField As List(Of String)
|
|
|
|
Private prevDocField As List(Of TPreviousDocument)
|
|
|
|
Private itemField As TItem
|
|
|
|
Private documentsField As List(Of TDocuments)
|
|
|
|
Private delTermField As TInvoiceLineDelTerm
|
|
|
|
Private quantityField As Decimal
|
|
|
|
Private quantityFieldSpecified As Boolean
|
|
|
|
Private unitField As String
|
|
|
|
Private delnoteField As TDelNote
|
|
|
|
Private orderField As TOrder
|
|
|
|
Private itemRefField As String
|
|
|
|
Private addCostsField As List(Of TAddCosts)
|
|
|
|
Private addCodeField As List(Of String)
|
|
|
|
Private natCodeField As List(Of String)
|
|
|
|
Private stockTypeAddField As String
|
|
|
|
Private stockTypeDedField As String
|
|
|
|
Private bomField As TBomNo
|
|
|
|
Private accountNoField As String
|
|
|
|
Private customerFieldsField As TCustomerFields
|
|
|
|
Private attributesField As List(Of TAttribute)
|
|
|
|
Private containersField As List(Of TContainer)
|
|
|
|
Private shipmentIdentificationField As String
|
|
|
|
Private uNDGField As String
|
|
|
|
Private consigneeEndUserFlagField As String
|
|
|
|
Private endUserInEamField As TInvoiceLineEndUserInEam
|
|
|
|
Private endUserInEamFieldSpecified As Boolean
|
|
|
|
Private carriageCostsField As String
|
|
|
|
Private shipToField As TInvoiceLineShipTo
|
|
|
|
Private endUserField As TInvoiceLineEndUser
|
|
|
|
Private importReferenceField As List(Of TImportReference)
|
|
|
|
Private registrationInfoField As TRegInfo
|
|
|
|
Private serialNoField As String
|
|
|
|
Private referenceValueField As Decimal
|
|
|
|
Private referenceValueFieldSpecified As Boolean
|
|
|
|
Private modelField As String
|
|
|
|
Private brandField As String
|
|
|
|
Private addedValueField As Decimal
|
|
|
|
Private addedValueFieldSpecified As Boolean
|
|
|
|
Private ctoIdField As String
|
|
|
|
Private infoText2Field As String
|
|
|
|
Private branchNoField As String
|
|
|
|
Private additionalInformationField As List(Of TAttribute)
|
|
|
|
Private trackingNumberField As String
|
|
|
|
Private erpDataField As TErpLineData
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.erpDataField = New TErpLineData()
|
|
Me.additionalInformationField = New List(Of TAttribute)()
|
|
Me.registrationInfoField = New TRegInfo()
|
|
Me.importReferenceField = New List(Of TImportReference)()
|
|
Me.endUserField = New TInvoiceLineEndUser()
|
|
Me.shipToField = New TInvoiceLineShipTo()
|
|
Me.containersField = New List(Of TContainer)()
|
|
Me.attributesField = New List(Of TAttribute)()
|
|
Me.customerFieldsField = New TCustomerFields()
|
|
Me.bomField = New TBomNo()
|
|
Me.natCodeField = New List(Of String)()
|
|
Me.addCodeField = New List(Of String)()
|
|
Me.addCostsField = New List(Of TAddCosts)()
|
|
Me.orderField = New TOrder()
|
|
Me.delnoteField = New TDelNote()
|
|
Me.delTermField = New TInvoiceLineDelTerm()
|
|
Me.documentsField = New List(Of TDocuments)()
|
|
Me.itemField = New TItem()
|
|
Me.prevDocField = New List(Of TPreviousDocument)()
|
|
Me.addTextField = New List(Of String)()
|
|
End Sub
|
|
|
|
Public Property lineNo() As String
|
|
Get
|
|
Return Me.lineNoField
|
|
End Get
|
|
Set
|
|
Me.lineNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property unitPrice() As Decimal
|
|
Get
|
|
Return Me.unitPriceField
|
|
End Get
|
|
Set
|
|
Me.unitPriceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property unitPriceSpecified() As Boolean
|
|
Get
|
|
Return Me.unitPriceFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.unitPriceFieldSpecified = 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 nWeight() As Decimal
|
|
Get
|
|
Return Me.nWeightField
|
|
End Get
|
|
Set
|
|
Me.nWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property nWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.nWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.nWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property gWeight() As Decimal
|
|
Get
|
|
Return Me.gWeightField
|
|
End Get
|
|
Set
|
|
Me.gWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property gWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.gWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.gWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statQuant() As Decimal
|
|
Get
|
|
Return Me.statQuantField
|
|
End Get
|
|
Set
|
|
Me.statQuantField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property statQuantSpecified() As Boolean
|
|
Get
|
|
Return Me.statQuantFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.statQuantFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statUnit() As String
|
|
Get
|
|
Return Me.statUnitField
|
|
End Get
|
|
Set
|
|
Me.statUnitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statVal() As Decimal
|
|
Get
|
|
Return Me.statValField
|
|
End Get
|
|
Set
|
|
Me.statValField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property statValSpecified() As Boolean
|
|
Get
|
|
Return Me.statValFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.statValFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property custProc() As String
|
|
Get
|
|
Return Me.custProcField
|
|
End Get
|
|
Set
|
|
Me.custProcField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property EUCode() As String
|
|
Get
|
|
Return Me.eUCodeField
|
|
End Get
|
|
Set
|
|
Me.eUCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statCode() As String
|
|
Get
|
|
Return Me.statCodeField
|
|
End Get
|
|
Set
|
|
Me.statCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property transType() As String
|
|
Get
|
|
Return Me.transTypeField
|
|
End Get
|
|
Set
|
|
Me.transTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property coo() As String
|
|
Get
|
|
Return Me.cooField
|
|
End Get
|
|
Set
|
|
Me.cooField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property cooState() As String
|
|
Get
|
|
Return Me.cooStateField
|
|
End Get
|
|
Set
|
|
Me.cooStateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addText() As List(Of String)
|
|
Get
|
|
Return Me.addTextField
|
|
End Get
|
|
Set
|
|
Me.addTextField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property prevDoc() As List(Of TPreviousDocument)
|
|
Get
|
|
Return Me.prevDocField
|
|
End Get
|
|
Set
|
|
Me.prevDocField = 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 documents() As List(Of TDocuments)
|
|
Get
|
|
Return Me.documentsField
|
|
End Get
|
|
Set
|
|
Me.documentsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property delTerm() As TInvoiceLineDelTerm
|
|
Get
|
|
Return Me.delTermField
|
|
End Get
|
|
Set
|
|
Me.delTermField = 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 unit() As String
|
|
Get
|
|
Return Me.unitField
|
|
End Get
|
|
Set
|
|
Me.unitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property delnote() As TDelNote
|
|
Get
|
|
Return Me.delnoteField
|
|
End Get
|
|
Set
|
|
Me.delnoteField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property order() As TOrder
|
|
Get
|
|
Return Me.orderField
|
|
End Get
|
|
Set
|
|
Me.orderField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property itemRef() As String
|
|
Get
|
|
Return Me.itemRefField
|
|
End Get
|
|
Set
|
|
Me.itemRefField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCosts() As List(Of TAddCosts)
|
|
Get
|
|
Return Me.addCostsField
|
|
End Get
|
|
Set
|
|
Me.addCostsField = 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 natCode() As List(Of String)
|
|
Get
|
|
Return Me.natCodeField
|
|
End Get
|
|
Set
|
|
Me.natCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property stockTypeAdd() As String
|
|
Get
|
|
Return Me.stockTypeAddField
|
|
End Get
|
|
Set
|
|
Me.stockTypeAddField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property stockTypeDed() As String
|
|
Get
|
|
Return Me.stockTypeDedField
|
|
End Get
|
|
Set
|
|
Me.stockTypeDedField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property bom() As TBomNo
|
|
Get
|
|
Return Me.bomField
|
|
End Get
|
|
Set
|
|
Me.bomField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property accountNo() As String
|
|
Get
|
|
Return Me.accountNoField
|
|
End Get
|
|
Set
|
|
Me.accountNoField = 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 attributes() As List(Of TAttribute)
|
|
Get
|
|
Return Me.attributesField
|
|
End Get
|
|
Set
|
|
Me.attributesField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property containers() As List(Of TContainer)
|
|
Get
|
|
Return Me.containersField
|
|
End Get
|
|
Set
|
|
Me.containersField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipmentIdentification() As String
|
|
Get
|
|
Return Me.shipmentIdentificationField
|
|
End Get
|
|
Set
|
|
Me.shipmentIdentificationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property UNDG() As String
|
|
Get
|
|
Return Me.uNDGField
|
|
End Get
|
|
Set
|
|
Me.uNDGField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property consigneeEndUserFlag() As String
|
|
Get
|
|
Return Me.consigneeEndUserFlagField
|
|
End Get
|
|
Set
|
|
Me.consigneeEndUserFlagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property endUserInEam() As TInvoiceLineEndUserInEam
|
|
Get
|
|
Return Me.endUserInEamField
|
|
End Get
|
|
Set
|
|
Me.endUserInEamField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property endUserInEamSpecified() As Boolean
|
|
Get
|
|
Return Me.endUserInEamFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.endUserInEamFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property carriageCosts() As String
|
|
Get
|
|
Return Me.carriageCostsField
|
|
End Get
|
|
Set
|
|
Me.carriageCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipTo() As TInvoiceLineShipTo
|
|
Get
|
|
Return Me.shipToField
|
|
End Get
|
|
Set
|
|
Me.shipToField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property endUser() As TInvoiceLineEndUser
|
|
Get
|
|
Return Me.endUserField
|
|
End Get
|
|
Set
|
|
Me.endUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property importReference() As List(Of TImportReference)
|
|
Get
|
|
Return Me.importReferenceField
|
|
End Get
|
|
Set
|
|
Me.importReferenceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property registrationInfo() As TRegInfo
|
|
Get
|
|
Return Me.registrationInfoField
|
|
End Get
|
|
Set
|
|
Me.registrationInfoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property serialNo() As String
|
|
Get
|
|
Return Me.serialNoField
|
|
End Get
|
|
Set
|
|
Me.serialNoField = 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 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 addedValue() As Decimal
|
|
Get
|
|
Return Me.addedValueField
|
|
End Get
|
|
Set
|
|
Me.addedValueField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property addedValueSpecified() As Boolean
|
|
Get
|
|
Return Me.addedValueFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.addedValueFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ctoId() As String
|
|
Get
|
|
Return Me.ctoIdField
|
|
End Get
|
|
Set
|
|
Me.ctoIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property infoText2() As String
|
|
Get
|
|
Return Me.infoText2Field
|
|
End Get
|
|
Set
|
|
Me.infoText2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalInformation() As List(Of TAttribute)
|
|
Get
|
|
Return Me.additionalInformationField
|
|
End Get
|
|
Set
|
|
Me.additionalInformationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property trackingNumber() As String
|
|
Get
|
|
Return Me.trackingNumberField
|
|
End Get
|
|
Set
|
|
Me.trackingNumberField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property erpData() As TErpLineData
|
|
Get
|
|
Return Me.erpDataField
|
|
End Get
|
|
Set
|
|
Me.erpDataField = 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 TDocuments
|
|
|
|
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 docDetailField As String
|
|
|
|
Private docValueField As Decimal
|
|
|
|
Private docValueFieldSpecified As Boolean
|
|
|
|
Private docStatUnitField As String
|
|
|
|
Private docDepreciateQuantityField As Decimal
|
|
|
|
Private docDepreciateQuantityFieldSpecified As Boolean
|
|
|
|
Private docSupplierField As String
|
|
|
|
Private docCategoryField As String
|
|
|
|
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 docDetail() As String
|
|
Get
|
|
Return Me.docDetailField
|
|
End Get
|
|
Set
|
|
Me.docDetailField = 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 docStatUnit() As String
|
|
Get
|
|
Return Me.docStatUnitField
|
|
End Get
|
|
Set
|
|
Me.docStatUnitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docDepreciateQuantity() As Decimal
|
|
Get
|
|
Return Me.docDepreciateQuantityField
|
|
End Get
|
|
Set
|
|
Me.docDepreciateQuantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property docDepreciateQuantitySpecified() As Boolean
|
|
Get
|
|
Return Me.docDepreciateQuantityFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.docDepreciateQuantityFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docSupplier() As String
|
|
Get
|
|
Return Me.docSupplierField
|
|
End Get
|
|
Set
|
|
Me.docSupplierField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property docCategory() As String
|
|
Get
|
|
Return Me.docCategoryField
|
|
End Get
|
|
Set
|
|
Me.docCategoryField = 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(TDocuments))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDocuments 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 TDocuments object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDocuments 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 TDocuments, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDocuments)
|
|
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 TDocuments) 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 TDocuments
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDocuments)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDocuments 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 TDocuments object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDocuments 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 TDocuments, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDocuments)
|
|
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 TDocuments) 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 TDocuments
|
|
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 TInvoiceLineDelTerm
|
|
|
|
Private codeField As String
|
|
|
|
Private descField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property desc() As String
|
|
Get
|
|
Return Me.descField
|
|
End Get
|
|
Set
|
|
Me.descField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TInvoiceLineDelTerm))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLineDelTerm 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 TInvoiceLineDelTerm object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLineDelTerm 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 TInvoiceLineDelTerm, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLineDelTerm)
|
|
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 TInvoiceLineDelTerm) 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 TInvoiceLineDelTerm
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInvoiceLineDelTerm)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLineDelTerm 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 TInvoiceLineDelTerm object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLineDelTerm 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 TInvoiceLineDelTerm, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLineDelTerm)
|
|
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 TInvoiceLineDelTerm) 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 TInvoiceLineDelTerm
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TAddCosts
|
|
|
|
Private typeField As String
|
|
|
|
Private flagField As TAddCostsFlag
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private currField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property flag() As TAddCostsFlag
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAddCosts))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAddCosts object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TAddCosts object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAddCosts object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCosts)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddCosts) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAddCosts
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAddCosts)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAddCosts object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TAddCosts object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAddCosts object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddCosts, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddCosts)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddCosts) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAddCosts
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Public Enum TAddCostsFlag
|
|
|
|
'''<remarks/>
|
|
P
|
|
|
|
'''<remarks/>
|
|
V
|
|
End Enum
|
|
|
|
Partial Public Class 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 attribTypeField As String
|
|
|
|
Private attribTextField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property attribType() As String
|
|
Get
|
|
Return Me.attribTypeField
|
|
End Get
|
|
Set
|
|
Me.attribTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property attribText() As String
|
|
Get
|
|
Return Me.attribTextField
|
|
End Get
|
|
Set
|
|
Me.attribTextField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAttribute))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAttribute object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TAttribute object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAttribute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAttribute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAttribute)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAttribute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAttribute
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAttribute)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAttribute object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TAttribute object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAttribute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAttribute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAttribute)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAttribute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAttribute
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TContainer
|
|
|
|
Private contNoField As String
|
|
|
|
Private contTypeField As String
|
|
|
|
Private sealNumberField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property contNo() As String
|
|
Get
|
|
Return Me.contNoField
|
|
End Get
|
|
Set
|
|
Me.contNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contType() As String
|
|
Get
|
|
Return Me.contTypeField
|
|
End Get
|
|
Set
|
|
Me.contTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sealNumber() As String
|
|
Get
|
|
Return Me.sealNumberField
|
|
End Get
|
|
Set
|
|
Me.sealNumberField = 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
|
|
|
|
Public Enum TInvoiceLineEndUserInEam
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("")>
|
|
Item
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("0")>
|
|
Item0
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("1")>
|
|
Item1
|
|
End Enum
|
|
|
|
Partial Public Class TInvoiceLineShipTo
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNameField As List(Of String)
|
|
|
|
Private addrStreetField As String
|
|
|
|
Private addrLocField As String
|
|
|
|
Private addrCtryField As String
|
|
|
|
Private addrStateField As String
|
|
|
|
Private addrZipField As String
|
|
|
|
Private addrTinField As String
|
|
|
|
Private addrEoriField As String
|
|
|
|
Private addrNatTField As String
|
|
|
|
Private branchNoField As String
|
|
|
|
Private addrKvbField As String
|
|
|
|
Private contactPersonField As TContactPerson
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.contactPersonField = New TContactPerson()
|
|
Me.addrNameField = New List(Of String)()
|
|
End Sub
|
|
|
|
Public Property addrNo() As String
|
|
Get
|
|
Return Me.addrNoField
|
|
End Get
|
|
Set
|
|
Me.addrNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrName() As List(Of String)
|
|
Get
|
|
Return Me.addrNameField
|
|
End Get
|
|
Set
|
|
Me.addrNameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrStreet() As String
|
|
Get
|
|
Return Me.addrStreetField
|
|
End Get
|
|
Set
|
|
Me.addrStreetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrLoc() As String
|
|
Get
|
|
Return Me.addrLocField
|
|
End Get
|
|
Set
|
|
Me.addrLocField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrCtry() As String
|
|
Get
|
|
Return Me.addrCtryField
|
|
End Get
|
|
Set
|
|
Me.addrCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrState() As String
|
|
Get
|
|
Return Me.addrStateField
|
|
End Get
|
|
Set
|
|
Me.addrStateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrZip() As String
|
|
Get
|
|
Return Me.addrZipField
|
|
End Get
|
|
Set
|
|
Me.addrZipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrTin() As String
|
|
Get
|
|
Return Me.addrTinField
|
|
End Get
|
|
Set
|
|
Me.addrTinField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrEori() As String
|
|
Get
|
|
Return Me.addrEoriField
|
|
End Get
|
|
Set
|
|
Me.addrEoriField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNatT() As String
|
|
Get
|
|
Return Me.addrNatTField
|
|
End Get
|
|
Set
|
|
Me.addrNatTField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrKvb() As String
|
|
Get
|
|
Return Me.addrKvbField
|
|
End Get
|
|
Set
|
|
Me.addrKvbField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contactPerson() As TContactPerson
|
|
Get
|
|
Return Me.contactPersonField
|
|
End Get
|
|
Set
|
|
Me.contactPersonField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TInvoiceLineShipTo))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLineShipTo 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 TInvoiceLineShipTo object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLineShipTo 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 TInvoiceLineShipTo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLineShipTo)
|
|
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 TInvoiceLineShipTo) 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 TInvoiceLineShipTo
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInvoiceLineShipTo)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLineShipTo 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 TInvoiceLineShipTo object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLineShipTo 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 TInvoiceLineShipTo, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLineShipTo)
|
|
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 TInvoiceLineShipTo) 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 TInvoiceLineShipTo
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TContactPerson
|
|
|
|
Private jobField As String
|
|
|
|
Private nameField As String
|
|
|
|
Private emailField As String
|
|
|
|
Private phoneField As String
|
|
|
|
Private faxField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property job() As String
|
|
Get
|
|
Return Me.jobField
|
|
End Get
|
|
Set
|
|
Me.jobField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property name() As String
|
|
Get
|
|
Return Me.nameField
|
|
End Get
|
|
Set
|
|
Me.nameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property email() As String
|
|
Get
|
|
Return Me.emailField
|
|
End Get
|
|
Set
|
|
Me.emailField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property phone() As String
|
|
Get
|
|
Return Me.phoneField
|
|
End Get
|
|
Set
|
|
Me.phoneField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property fax() As String
|
|
Get
|
|
Return Me.faxField
|
|
End Get
|
|
Set
|
|
Me.faxField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TContactPerson))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TContactPerson object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TContactPerson object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TContactPerson object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TContactPerson, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TContactPerson)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TContactPerson) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TContactPerson
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TContactPerson)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TContactPerson object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TContactPerson object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TContactPerson object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TContactPerson, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TContactPerson)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TContactPerson) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TContactPerson
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TInvoiceLineEndUser
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNameField As List(Of String)
|
|
|
|
Private addrStreetField As String
|
|
|
|
Private addrLocField As String
|
|
|
|
Private addrCtryField As String
|
|
|
|
Private addrZipField As String
|
|
|
|
Private addrTinField As String
|
|
|
|
Private addrEoriField As String
|
|
|
|
Private addrNatTField As String
|
|
|
|
Private branchNoField 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 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 addrZip() As String
|
|
Get
|
|
Return Me.addrZipField
|
|
End Get
|
|
Set
|
|
Me.addrZipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrTin() As String
|
|
Get
|
|
Return Me.addrTinField
|
|
End Get
|
|
Set
|
|
Me.addrTinField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrEori() As String
|
|
Get
|
|
Return Me.addrEoriField
|
|
End Get
|
|
Set
|
|
Me.addrEoriField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNatT() As String
|
|
Get
|
|
Return Me.addrNatTField
|
|
End Get
|
|
Set
|
|
Me.addrNatTField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TInvoiceLineEndUser))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLineEndUser 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 TInvoiceLineEndUser object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLineEndUser 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 TInvoiceLineEndUser, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLineEndUser)
|
|
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 TInvoiceLineEndUser) 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 TInvoiceLineEndUser
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInvoiceLineEndUser)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInvoiceLineEndUser 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 TInvoiceLineEndUser object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInvoiceLineEndUser 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 TInvoiceLineEndUser, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceLineEndUser)
|
|
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 TInvoiceLineEndUser) 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 TInvoiceLineEndUser
|
|
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 code2Field As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property desc() As String
|
|
Get
|
|
Return Me.descField
|
|
End Get
|
|
Set
|
|
Me.descField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property code2() As String
|
|
Get
|
|
Return Me.code2Field
|
|
End Get
|
|
Set
|
|
Me.code2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDelTerm))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDelTerm object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TDelTerm object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDelTerm object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelTerm, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelTerm)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDelTerm) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDelTerm
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDelTerm)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDelTerm object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TDelTerm object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDelTerm object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelTerm, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDelTerm)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDelTerm) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDelTerm
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TAddress
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNameField As List(Of String)
|
|
|
|
Private addrStreetField As String
|
|
|
|
Private addrLocField As String
|
|
|
|
Private addrCtryField As String
|
|
|
|
Private addrStateField As String
|
|
|
|
Private addrZipField As String
|
|
|
|
Private addrTinField As String
|
|
|
|
Private addrVatIdField As String
|
|
|
|
Private addrEoriField As String
|
|
|
|
Private addrNatTField As String
|
|
|
|
Private branchNoField As String
|
|
|
|
Private addrKvbField As String
|
|
|
|
Private contactPersonField As TContactPerson
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.contactPersonField = New TContactPerson()
|
|
Me.addrNameField = New List(Of String)()
|
|
End Sub
|
|
|
|
Public Property addrNo() As String
|
|
Get
|
|
Return Me.addrNoField
|
|
End Get
|
|
Set
|
|
Me.addrNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrName() As List(Of String)
|
|
Get
|
|
Return Me.addrNameField
|
|
End Get
|
|
Set
|
|
Me.addrNameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrStreet() As String
|
|
Get
|
|
Return Me.addrStreetField
|
|
End Get
|
|
Set
|
|
Me.addrStreetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrLoc() As String
|
|
Get
|
|
Return Me.addrLocField
|
|
End Get
|
|
Set
|
|
Me.addrLocField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrCtry() As String
|
|
Get
|
|
Return Me.addrCtryField
|
|
End Get
|
|
Set
|
|
Me.addrCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrState() As String
|
|
Get
|
|
Return Me.addrStateField
|
|
End Get
|
|
Set
|
|
Me.addrStateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrZip() As String
|
|
Get
|
|
Return Me.addrZipField
|
|
End Get
|
|
Set
|
|
Me.addrZipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrTin() As String
|
|
Get
|
|
Return Me.addrTinField
|
|
End Get
|
|
Set
|
|
Me.addrTinField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrVatId() As String
|
|
Get
|
|
Return Me.addrVatIdField
|
|
End Get
|
|
Set
|
|
Me.addrVatIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrEori() As String
|
|
Get
|
|
Return Me.addrEoriField
|
|
End Get
|
|
Set
|
|
Me.addrEoriField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNatT() As String
|
|
Get
|
|
Return Me.addrNatTField
|
|
End Get
|
|
Set
|
|
Me.addrNatTField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrKvb() As String
|
|
Get
|
|
Return Me.addrKvbField
|
|
End Get
|
|
Set
|
|
Me.addrKvbField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contactPerson() As TContactPerson
|
|
Get
|
|
Return Me.contactPersonField
|
|
End Get
|
|
Set
|
|
Me.contactPersonField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAddress))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAddress object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TAddress object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddress)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAddress
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAddress)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAddress object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TAddress object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAddress)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAddress
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TInvoiceHead
|
|
|
|
Private invoiceNoField As String
|
|
|
|
Private invoiceDateField As Date
|
|
|
|
Private invTypeField As String
|
|
|
|
Private totAmountField As Decimal
|
|
|
|
Private totAmountFieldSpecified As Boolean
|
|
|
|
Private currField As String
|
|
|
|
Private shipToField As TAddress
|
|
|
|
Private endUserField As TInvoiceHeadEndUser
|
|
|
|
Private delTermField As TDelTerm
|
|
|
|
Private billToField As TAddress
|
|
|
|
Private refField As String
|
|
|
|
Private tradeCtryField As String
|
|
|
|
Private gWeightField As Decimal
|
|
|
|
Private gWeightFieldSpecified As Boolean
|
|
|
|
Private nWeightField As Decimal
|
|
|
|
Private nWeightFieldSpecified As Boolean
|
|
|
|
Private addCostsField As List(Of TAddCosts)
|
|
|
|
Private bolField As String
|
|
|
|
Private transpNrField As String
|
|
|
|
Private addtextField As List(Of String)
|
|
|
|
Private documentsField As List(Of TDocuments)
|
|
|
|
Private mrnExtField As String
|
|
|
|
Private numberOfPackagesField As Decimal
|
|
|
|
Private numberOfPackagesFieldSpecified As Boolean
|
|
|
|
Private transportTypeField As String
|
|
|
|
Private customerFieldsField As TCustomerFields
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.customerFieldsField = New TCustomerFields()
|
|
Me.documentsField = New List(Of TDocuments)()
|
|
Me.addtextField = New List(Of String)()
|
|
Me.addCostsField = New List(Of TAddCosts)()
|
|
Me.billToField = New TAddress()
|
|
Me.delTermField = New TDelTerm()
|
|
Me.endUserField = New TInvoiceHeadEndUser()
|
|
Me.shipToField = New TAddress()
|
|
End Sub
|
|
|
|
Public Property invoiceNo() As String
|
|
Get
|
|
Return Me.invoiceNoField
|
|
End Get
|
|
Set
|
|
Me.invoiceNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invoiceDate() As Date
|
|
Get
|
|
Return Me.invoiceDateField
|
|
End Get
|
|
Set
|
|
Me.invoiceDateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property invType() As String
|
|
Get
|
|
Return Me.invTypeField
|
|
End Get
|
|
Set
|
|
Me.invTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property totAmount() As Decimal
|
|
Get
|
|
Return Me.totAmountField
|
|
End Get
|
|
Set
|
|
Me.totAmountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property totAmountSpecified() As Boolean
|
|
Get
|
|
Return Me.totAmountFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.totAmountFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shipTo() As TAddress
|
|
Get
|
|
Return Me.shipToField
|
|
End Get
|
|
Set
|
|
Me.shipToField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property endUser() As TInvoiceHeadEndUser
|
|
Get
|
|
Return Me.endUserField
|
|
End Get
|
|
Set
|
|
Me.endUserField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property delTerm() As TDelTerm
|
|
Get
|
|
Return Me.delTermField
|
|
End Get
|
|
Set
|
|
Me.delTermField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property billTo() As TAddress
|
|
Get
|
|
Return Me.billToField
|
|
End Get
|
|
Set
|
|
Me.billToField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ref() As String
|
|
Get
|
|
Return Me.refField
|
|
End Get
|
|
Set
|
|
Me.refField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property tradeCtry() As String
|
|
Get
|
|
Return Me.tradeCtryField
|
|
End Get
|
|
Set
|
|
Me.tradeCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property gWeight() As Decimal
|
|
Get
|
|
Return Me.gWeightField
|
|
End Get
|
|
Set
|
|
Me.gWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property gWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.gWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.gWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nWeight() As Decimal
|
|
Get
|
|
Return Me.nWeightField
|
|
End Get
|
|
Set
|
|
Me.nWeightField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property nWeightSpecified() As Boolean
|
|
Get
|
|
Return Me.nWeightFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.nWeightFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addCosts() As List(Of TAddCosts)
|
|
Get
|
|
Return Me.addCostsField
|
|
End Get
|
|
Set
|
|
Me.addCostsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property bol() As String
|
|
Get
|
|
Return Me.bolField
|
|
End Get
|
|
Set
|
|
Me.bolField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property transpNr() As String
|
|
Get
|
|
Return Me.transpNrField
|
|
End Get
|
|
Set
|
|
Me.transpNrField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addtext() As List(Of String)
|
|
Get
|
|
Return Me.addtextField
|
|
End Get
|
|
Set
|
|
Me.addtextField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property documents() As List(Of TDocuments)
|
|
Get
|
|
Return Me.documentsField
|
|
End Get
|
|
Set
|
|
Me.documentsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property mrnExt() As String
|
|
Get
|
|
Return Me.mrnExtField
|
|
End Get
|
|
Set
|
|
Me.mrnExtField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property numberOfPackages() As Decimal
|
|
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 transportType() As String
|
|
Get
|
|
Return Me.transportTypeField
|
|
End Get
|
|
Set
|
|
Me.transportTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customerFields() As TCustomerFields
|
|
Get
|
|
Return Me.customerFieldsField
|
|
End Get
|
|
Set
|
|
Me.customerFieldsField = 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 TInvoiceHeadEndUser
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNameField As List(Of String)
|
|
|
|
Private addrStreetField As String
|
|
|
|
Private addrLocField As String
|
|
|
|
Private addrCtryField As String
|
|
|
|
Private addrZipField As String
|
|
|
|
Private addrTinField As String
|
|
|
|
Private addrEoriField As String
|
|
|
|
Private addrNatTField As String
|
|
|
|
Private branchNoField 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 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 addrZip() As String
|
|
Get
|
|
Return Me.addrZipField
|
|
End Get
|
|
Set
|
|
Me.addrZipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrTin() As String
|
|
Get
|
|
Return Me.addrTinField
|
|
End Get
|
|
Set
|
|
Me.addrTinField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrEori() As String
|
|
Get
|
|
Return Me.addrEoriField
|
|
End Get
|
|
Set
|
|
Me.addrEoriField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNatT() As String
|
|
Get
|
|
Return Me.addrNatTField
|
|
End Get
|
|
Set
|
|
Me.addrNatTField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TInvoiceHeadEndUser))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TInvoiceHeadEndUser 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 TInvoiceHeadEndUser object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TInvoiceHeadEndUser 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 TInvoiceHeadEndUser, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceHeadEndUser)
|
|
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 TInvoiceHeadEndUser) 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 TInvoiceHeadEndUser
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TInvoiceHeadEndUser)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TInvoiceHeadEndUser 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 TInvoiceHeadEndUser object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TInvoiceHeadEndUser 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 TInvoiceHeadEndUser, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TInvoiceHeadEndUser)
|
|
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 TInvoiceHeadEndUser) 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 TInvoiceHeadEndUser
|
|
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 invoiceHeadField As TInvoiceHead
|
|
|
|
Private invoiceLineField As List(Of TInvoiceLine)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.invoiceLineField = New List(Of TInvoiceLine)()
|
|
Me.invoiceHeadField = New TInvoiceHead()
|
|
End Sub
|
|
|
|
Public Property InvoiceHead() As TInvoiceHead
|
|
Get
|
|
Return Me.invoiceHeadField
|
|
End Get
|
|
Set
|
|
Me.invoiceHeadField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property InvoiceLine() As List(Of TInvoiceLine)
|
|
Get
|
|
Return Me.invoiceLineField
|
|
End Get
|
|
Set
|
|
Me.invoiceLineField = 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 TErpShipmentData
|
|
|
|
Private erpSystemIdField As String
|
|
|
|
Private clientField As String
|
|
|
|
Private companyCodeField As String
|
|
|
|
Private customerIdField As String
|
|
|
|
Private consolidationCompanyIdField As String
|
|
|
|
Private accountGroupField As String
|
|
|
|
Private shippingPointField As String
|
|
|
|
Private loadingPointField As String
|
|
|
|
Private offshoreField As Boolean
|
|
|
|
Private offshoreFieldSpecified As Boolean
|
|
|
|
Private routeField As String
|
|
|
|
Private salesOrganizationField As String
|
|
|
|
Private distributionChannelField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property erpSystemId() As String
|
|
Get
|
|
Return Me.erpSystemIdField
|
|
End Get
|
|
Set
|
|
Me.erpSystemIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property client() As String
|
|
Get
|
|
Return Me.clientField
|
|
End Get
|
|
Set
|
|
Me.clientField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property companyCode() As String
|
|
Get
|
|
Return Me.companyCodeField
|
|
End Get
|
|
Set
|
|
Me.companyCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property customerId() As String
|
|
Get
|
|
Return Me.customerIdField
|
|
End Get
|
|
Set
|
|
Me.customerIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property consolidationCompanyId() As String
|
|
Get
|
|
Return Me.consolidationCompanyIdField
|
|
End Get
|
|
Set
|
|
Me.consolidationCompanyIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property accountGroup() As String
|
|
Get
|
|
Return Me.accountGroupField
|
|
End Get
|
|
Set
|
|
Me.accountGroupField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property shippingPoint() As String
|
|
Get
|
|
Return Me.shippingPointField
|
|
End Get
|
|
Set
|
|
Me.shippingPointField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property loadingPoint() As String
|
|
Get
|
|
Return Me.loadingPointField
|
|
End Get
|
|
Set
|
|
Me.loadingPointField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property offshore() As Boolean
|
|
Get
|
|
Return Me.offshoreField
|
|
End Get
|
|
Set
|
|
Me.offshoreField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property offshoreSpecified() As Boolean
|
|
Get
|
|
Return Me.offshoreFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.offshoreFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property route() As String
|
|
Get
|
|
Return Me.routeField
|
|
End Get
|
|
Set
|
|
Me.routeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property salesOrganization() As String
|
|
Get
|
|
Return Me.salesOrganizationField
|
|
End Get
|
|
Set
|
|
Me.salesOrganizationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property distributionChannel() As String
|
|
Get
|
|
Return Me.distributionChannelField
|
|
End Get
|
|
Set
|
|
Me.distributionChannelField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TErpShipmentData))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TErpShipmentData object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TErpShipmentData object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErpShipmentData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpShipmentData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpShipmentData)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErpShipmentData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TErpShipmentData
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErpShipmentData)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TErpShipmentData object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TErpShipmentData object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErpShipmentData object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpShipmentData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErpShipmentData)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErpShipmentData) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TErpShipmentData
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TRoute
|
|
|
|
Private countryField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property country() As String
|
|
Get
|
|
Return Me.countryField
|
|
End Get
|
|
Set
|
|
Me.countryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TRoute))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TRoute object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TRoute object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TRoute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TRoute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRoute)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TRoute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TRoute
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TRoute)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TRoute object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TRoute object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TRoute object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TRoute, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TRoute)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TRoute) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TRoute
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TAssurance
|
|
|
|
Private flagField As String
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private currField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property flag() As String
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TAssurance))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TAssurance object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TAssurance object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TAssurance object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAssurance, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAssurance)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TAssurance) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TAssurance
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TAssurance)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TAssurance object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TAssurance object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TAssurance object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAssurance, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TAssurance)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TAssurance) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TAssurance
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TFreight
|
|
|
|
Private flagField As String
|
|
|
|
Private amountField As Decimal
|
|
|
|
Private currField As String
|
|
|
|
Private noneuField As Decimal
|
|
|
|
Private noneuFieldSpecified As Boolean
|
|
|
|
Private eunatField As Decimal
|
|
|
|
Private eunatFieldSpecified As Boolean
|
|
|
|
Private natField As Decimal
|
|
|
|
Private natFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property flag() As String
|
|
Get
|
|
Return Me.flagField
|
|
End Get
|
|
Set
|
|
Me.flagField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property amount() As Decimal
|
|
Get
|
|
Return Me.amountField
|
|
End Get
|
|
Set
|
|
Me.amountField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property curr() As String
|
|
Get
|
|
Return Me.currField
|
|
End Get
|
|
Set
|
|
Me.currField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property noneu() As Decimal
|
|
Get
|
|
Return Me.noneuField
|
|
End Get
|
|
Set
|
|
Me.noneuField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property noneuSpecified() As Boolean
|
|
Get
|
|
Return Me.noneuFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.noneuFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property eunat() As Decimal
|
|
Get
|
|
Return Me.eunatField
|
|
End Get
|
|
Set
|
|
Me.eunatField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property eunatSpecified() As Boolean
|
|
Get
|
|
Return Me.eunatFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.eunatFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nat() As Decimal
|
|
Get
|
|
Return Me.natField
|
|
End Get
|
|
Set
|
|
Me.natField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property natSpecified() As Boolean
|
|
Get
|
|
Return Me.natFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.natFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TFreight))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TFreight object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TFreight object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TFreight object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TFreight, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreight)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TFreight) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TFreight
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TFreight)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TFreight object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TFreight object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TFreight object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TFreight, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TFreight)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TFreight) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TFreight
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TDeclType
|
|
|
|
Private type1Field As String
|
|
|
|
Private type2Field As String
|
|
|
|
Private type3Field As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property type1() As String
|
|
Get
|
|
Return Me.type1Field
|
|
End Get
|
|
Set
|
|
Me.type1Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type2() As String
|
|
Get
|
|
Return Me.type2Field
|
|
End Get
|
|
Set
|
|
Me.type2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type3() As String
|
|
Get
|
|
Return Me.type3Field
|
|
End Get
|
|
Set
|
|
Me.type3Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TDeclType))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TDeclType object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TDeclType object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TDeclType object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDeclType, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeclType)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TDeclType) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TDeclType
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TDeclType)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TDeclType object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TDeclType object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TDeclType object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeclType, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TDeclType)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TDeclType) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TDeclType
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TSeal
|
|
|
|
Private typeField As String
|
|
|
|
Private quantityField As UInteger
|
|
|
|
Private signField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property quantity() As UInteger
|
|
Get
|
|
Return Me.quantityField
|
|
End Get
|
|
Set
|
|
Me.quantityField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sign() As String
|
|
Get
|
|
Return Me.signField
|
|
End Get
|
|
Set
|
|
Me.signField = 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(TSeal))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TSeal 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 TSeal object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TSeal 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 TSeal, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TSeal)
|
|
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 TSeal) 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 TSeal
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TSeal)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TSeal 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 TSeal object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TSeal 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 TSeal, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TSeal)
|
|
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 TSeal) 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 TSeal
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TMot
|
|
|
|
Private motField As String
|
|
|
|
Private natField As String
|
|
|
|
Private typeField As String
|
|
|
|
Private licNoField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property mot() As String
|
|
Get
|
|
Return Me.motField
|
|
End Get
|
|
Set
|
|
Me.motField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property nat() As String
|
|
Get
|
|
Return Me.natField
|
|
End Get
|
|
Set
|
|
Me.natField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property licNo() As String
|
|
Get
|
|
Return Me.licNoField
|
|
End Get
|
|
Set
|
|
Me.licNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TMot))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMot object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TMot object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMot object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMot, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMot)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMot) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TMot
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMot)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMot object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TMot object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMot object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMot, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMot)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMot) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TMot
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TCustomsOffice
|
|
|
|
Private codeOffField As String
|
|
|
|
Private offCtryField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property codeOff() As String
|
|
Get
|
|
Return Me.codeOffField
|
|
End Get
|
|
Set
|
|
Me.codeOffField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property offCtry() As String
|
|
Get
|
|
Return Me.offCtryField
|
|
End Get
|
|
Set
|
|
Me.offCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TCustomsOffice))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TCustomsOffice object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TCustomsOffice object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TCustomsOffice object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomsOffice, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomsOffice)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TCustomsOffice) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TCustomsOffice
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TCustomsOffice)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TCustomsOffice object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TCustomsOffice object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TCustomsOffice object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomsOffice, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TCustomsOffice)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TCustomsOffice) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TCustomsOffice
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TLocationOfGoods
|
|
|
|
Private codeField As String
|
|
|
|
Private streetField As String
|
|
|
|
Private zipField As String
|
|
|
|
Private locField As String
|
|
|
|
Private additField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property street() As String
|
|
Get
|
|
Return Me.streetField
|
|
End Get
|
|
Set
|
|
Me.streetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property zip() As String
|
|
Get
|
|
Return Me.zipField
|
|
End Get
|
|
Set
|
|
Me.zipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property loc() As String
|
|
Get
|
|
Return Me.locField
|
|
End Get
|
|
Set
|
|
Me.locField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addit() As String
|
|
Get
|
|
Return Me.additField
|
|
End Get
|
|
Set
|
|
Me.additField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TLocationOfGoods))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TLocationOfGoods object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TLocationOfGoods object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TLocationOfGoods object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TLocationOfGoods, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TLocationOfGoods)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TLocationOfGoods) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TLocationOfGoods
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TLocationOfGoods)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TLocationOfGoods object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TLocationOfGoods object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TLocationOfGoods object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TLocationOfGoods, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TLocationOfGoods)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TLocationOfGoods) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TLocationOfGoods
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TPartner
|
|
|
|
Private partnerTypField As String
|
|
|
|
Private partnerAddressField As TPartnerPartnerAddress
|
|
|
|
Private partnerRelationField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.partnerAddressField = New TPartnerPartnerAddress()
|
|
End Sub
|
|
|
|
Public Property partnerTyp() As String
|
|
Get
|
|
Return Me.partnerTypField
|
|
End Get
|
|
Set
|
|
Me.partnerTypField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerAddress() As TPartnerPartnerAddress
|
|
Get
|
|
Return Me.partnerAddressField
|
|
End Get
|
|
Set
|
|
Me.partnerAddressField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerRelation() As String
|
|
Get
|
|
Return Me.partnerRelationField
|
|
End Get
|
|
Set
|
|
Me.partnerRelationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TPartner))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPartner object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TPartner object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPartner object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartner, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartner)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartner) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TPartner
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPartner)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPartner object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TPartner object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPartner object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartner, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartner)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartner) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TPartner
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TPartnerPartnerAddress
|
|
|
|
Private addrNoField As String
|
|
|
|
Private addrNoTypeField As String
|
|
|
|
Private addrNameField As List(Of String)
|
|
|
|
Private addrStreetField As String
|
|
|
|
Private addrStreet2Field As String
|
|
|
|
Private addrLocField As String
|
|
|
|
Private addrCtryField As String
|
|
|
|
Private addrStateField As String
|
|
|
|
Private addrZipField As String
|
|
|
|
Private addrTinField As String
|
|
|
|
Private addrEoriField As String
|
|
|
|
Private addrNatTField As String
|
|
|
|
Private branchNoField As String
|
|
|
|
Private addrKvbField As String
|
|
|
|
Private addrInfoField As String
|
|
|
|
Private contactPersonField As TContactPerson
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.contactPersonField = New TContactPerson()
|
|
Me.addrNameField = New List(Of String)()
|
|
End Sub
|
|
|
|
Public Property addrNo() As String
|
|
Get
|
|
Return Me.addrNoField
|
|
End Get
|
|
Set
|
|
Me.addrNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNoType() As String
|
|
Get
|
|
Return Me.addrNoTypeField
|
|
End Get
|
|
Set
|
|
Me.addrNoTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrName() As List(Of String)
|
|
Get
|
|
Return Me.addrNameField
|
|
End Get
|
|
Set
|
|
Me.addrNameField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrStreet() As String
|
|
Get
|
|
Return Me.addrStreetField
|
|
End Get
|
|
Set
|
|
Me.addrStreetField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrStreet2() As String
|
|
Get
|
|
Return Me.addrStreet2Field
|
|
End Get
|
|
Set
|
|
Me.addrStreet2Field = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrLoc() As String
|
|
Get
|
|
Return Me.addrLocField
|
|
End Get
|
|
Set
|
|
Me.addrLocField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrCtry() As String
|
|
Get
|
|
Return Me.addrCtryField
|
|
End Get
|
|
Set
|
|
Me.addrCtryField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrState() As String
|
|
Get
|
|
Return Me.addrStateField
|
|
End Get
|
|
Set
|
|
Me.addrStateField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrZip() As String
|
|
Get
|
|
Return Me.addrZipField
|
|
End Get
|
|
Set
|
|
Me.addrZipField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrTin() As String
|
|
Get
|
|
Return Me.addrTinField
|
|
End Get
|
|
Set
|
|
Me.addrTinField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrEori() As String
|
|
Get
|
|
Return Me.addrEoriField
|
|
End Get
|
|
Set
|
|
Me.addrEoriField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrNatT() As String
|
|
Get
|
|
Return Me.addrNatTField
|
|
End Get
|
|
Set
|
|
Me.addrNatTField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property branchNo() As String
|
|
Get
|
|
Return Me.branchNoField
|
|
End Get
|
|
Set
|
|
Me.branchNoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrKvb() As String
|
|
Get
|
|
Return Me.addrKvbField
|
|
End Get
|
|
Set
|
|
Me.addrKvbField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property addrInfo() As String
|
|
Get
|
|
Return Me.addrInfoField
|
|
End Get
|
|
Set
|
|
Me.addrInfoField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property contactPerson() As TContactPerson
|
|
Get
|
|
Return Me.contactPersonField
|
|
End Get
|
|
Set
|
|
Me.contactPersonField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer
|
|
Get
|
|
If (sSerializer Is Nothing) Then
|
|
sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TPartnerPartnerAddress))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TPartnerPartnerAddress object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
Public Overridable Function Serialize() As String
|
|
Dim streamReader As System.IO.StreamReader = Nothing
|
|
Dim memoryStream As System.IO.MemoryStream = Nothing
|
|
Try
|
|
memoryStream = New System.IO.MemoryStream()
|
|
Serializer.Serialize(memoryStream, Me)
|
|
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
streamReader = New System.IO.StreamReader(memoryStream)
|
|
Return streamReader.ReadToEnd
|
|
Finally
|
|
If (Not (streamReader) Is Nothing) Then
|
|
streamReader.Dispose()
|
|
End If
|
|
If (Not (memoryStream) Is Nothing) Then
|
|
memoryStream.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TPartnerPartnerAddress object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TPartnerPartnerAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartnerPartnerAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartnerPartnerAddress)
|
|
Try
|
|
obj = Deserialize(xml)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TPartnerPartnerAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return Deserialize(xml, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String) As TPartnerPartnerAddress
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TPartnerPartnerAddress)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TPartnerPartnerAddress object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
Try
|
|
SaveToFile(fileName)
|
|
Return True
|
|
Catch e As System.Exception
|
|
exception = e
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overridable Overloads Sub SaveToFile(ByVal fileName As String)
|
|
Dim streamWriter As System.IO.StreamWriter = Nothing
|
|
Try
|
|
Dim xmlString As String = Serialize()
|
|
Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName)
|
|
streamWriter = xmlFile.CreateText
|
|
streamWriter.WriteLine(xmlString)
|
|
streamWriter.Close()
|
|
Finally
|
|
If (Not (streamWriter) Is Nothing) Then
|
|
streamWriter.Dispose()
|
|
End If
|
|
End Try
|
|
End Sub
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TPartnerPartnerAddress object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TPartnerPartnerAddress object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartnerPartnerAddress, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TPartnerPartnerAddress)
|
|
Try
|
|
obj = LoadFromFile(fileName)
|
|
Return True
|
|
Catch ex As System.Exception
|
|
exception = ex
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TPartnerPartnerAddress) As Boolean
|
|
Dim exception As System.Exception = Nothing
|
|
Return LoadFromFile(fileName, obj, exception)
|
|
End Function
|
|
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TPartnerPartnerAddress
|
|
Dim file As System.IO.FileStream = Nothing
|
|
Dim sr As System.IO.StreamReader = Nothing
|
|
Try
|
|
file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
|
|
sr = New System.IO.StreamReader(file)
|
|
Dim xmlString As String = sr.ReadToEnd
|
|
sr.Close()
|
|
file.Close()
|
|
Return Deserialize(xmlString)
|
|
Finally
|
|
If (Not (file) Is Nothing) Then
|
|
file.Dispose()
|
|
End If
|
|
If (Not (sr) Is Nothing) Then
|
|
sr.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
#End Region
|
|
End Class
|
|
|
|
Partial Public Class TShipmentHeadAuthorisation
|
|
|
|
Private oprEntryInTheRecordsField As String
|
|
|
|
Private oprField As String
|
|
|
|
Private trustworthyExporterField As String
|
|
|
|
Private authorisedExporterField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property oprEntryInTheRecords() As String
|
|
Get
|
|
Return Me.oprEntryInTheRecordsField
|
|
End Get
|
|
Set
|
|
Me.oprEntryInTheRecordsField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property opr() As String
|
|
Get
|
|
Return Me.oprField
|
|
End Get
|
|
Set
|
|
Me.oprField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property trustworthyExporter() As String
|
|
Get
|
|
Return Me.trustworthyExporterField
|
|
End Get
|
|
Set
|
|
Me.trustworthyExporterField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property authorisedExporter() As String
|
|
Get
|
|
Return Me.authorisedExporterField
|
|
End Get
|
|
Set
|
|
Me.authorisedExporterField = 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(TShipmentHeadAuthorisation))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadAuthorisation 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 TShipmentHeadAuthorisation object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadAuthorisation 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 TShipmentHeadAuthorisation, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadAuthorisation)
|
|
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 TShipmentHeadAuthorisation) 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 TShipmentHeadAuthorisation
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipmentHeadAuthorisation)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadAuthorisation 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 TShipmentHeadAuthorisation object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadAuthorisation 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 TShipmentHeadAuthorisation, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadAuthorisation)
|
|
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 TShipmentHeadAuthorisation) 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 TShipmentHeadAuthorisation
|
|
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 TShipmentHeadPostExportDeclaration
|
|
|
|
Private dateOfExitField As Date
|
|
|
|
Private dateOfExitFieldSpecified As Boolean
|
|
|
|
Private dateOfExportField As Date
|
|
|
|
Private dateOfExportFieldSpecified As Boolean
|
|
|
|
Private statisticDeclField As String
|
|
|
|
Private officeExitField As TCustomsOffice
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.officeExitField = New TCustomsOffice()
|
|
End Sub
|
|
|
|
Public Property dateOfExit() As Date
|
|
Get
|
|
Return Me.dateOfExitField
|
|
End Get
|
|
Set
|
|
Me.dateOfExitField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dateOfExitSpecified() As Boolean
|
|
Get
|
|
Return Me.dateOfExitFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dateOfExitFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dateOfExport() As Date
|
|
Get
|
|
Return Me.dateOfExportField
|
|
End Get
|
|
Set
|
|
Me.dateOfExportField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property dateOfExportSpecified() As Boolean
|
|
Get
|
|
Return Me.dateOfExportFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.dateOfExportFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property statisticDecl() As String
|
|
Get
|
|
Return Me.statisticDeclField
|
|
End Get
|
|
Set
|
|
Me.statisticDeclField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property officeExit() As TCustomsOffice
|
|
Get
|
|
Return Me.officeExitField
|
|
End Get
|
|
Set
|
|
Me.officeExitField = 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(TShipmentHeadPostExportDeclaration))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadPostExportDeclaration 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 TShipmentHeadPostExportDeclaration object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadPostExportDeclaration 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 TShipmentHeadPostExportDeclaration, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadPostExportDeclaration)
|
|
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 TShipmentHeadPostExportDeclaration) 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 TShipmentHeadPostExportDeclaration
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipmentHeadPostExportDeclaration)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadPostExportDeclaration 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 TShipmentHeadPostExportDeclaration object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadPostExportDeclaration 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 TShipmentHeadPostExportDeclaration, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadPostExportDeclaration)
|
|
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 TShipmentHeadPostExportDeclaration) 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 TShipmentHeadPostExportDeclaration
|
|
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 TShipmentHeadOprData
|
|
|
|
Private reimportDeadlineField As Date
|
|
|
|
Private reimportDeadlineFieldSpecified As Boolean
|
|
|
|
Private standardExchangeField As String
|
|
|
|
Private reImportField As List(Of TShipmentHeadOprDataReImport)
|
|
|
|
Private meansOfIdentificationField As List(Of TShipmentHeadOprDataMeansOfIdentification)
|
|
|
|
Private productField As List(Of TShipmentHeadOprDataProduct)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.productField = New List(Of TShipmentHeadOprDataProduct)()
|
|
Me.meansOfIdentificationField = New List(Of TShipmentHeadOprDataMeansOfIdentification)()
|
|
Me.reImportField = New List(Of TShipmentHeadOprDataReImport)()
|
|
End Sub
|
|
|
|
Public Property reimportDeadline() As Date
|
|
Get
|
|
Return Me.reimportDeadlineField
|
|
End Get
|
|
Set
|
|
Me.reimportDeadlineField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property reimportDeadlineSpecified() As Boolean
|
|
Get
|
|
Return Me.reimportDeadlineFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.reimportDeadlineFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property standardExchange() As String
|
|
Get
|
|
Return Me.standardExchangeField
|
|
End Get
|
|
Set
|
|
Me.standardExchangeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property reImport() As List(Of TShipmentHeadOprDataReImport)
|
|
Get
|
|
Return Me.reImportField
|
|
End Get
|
|
Set
|
|
Me.reImportField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property meansOfIdentification() As List(Of TShipmentHeadOprDataMeansOfIdentification)
|
|
Get
|
|
Return Me.meansOfIdentificationField
|
|
End Get
|
|
Set
|
|
Me.meansOfIdentificationField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property product() As List(Of TShipmentHeadOprDataProduct)
|
|
Get
|
|
Return Me.productField
|
|
End Get
|
|
Set
|
|
Me.productField = 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(TShipmentHeadOprData))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprData 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 TShipmentHeadOprData object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprData 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 TShipmentHeadOprData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprData)
|
|
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 TShipmentHeadOprData) 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 TShipmentHeadOprData
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipmentHeadOprData)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprData 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 TShipmentHeadOprData object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprData 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 TShipmentHeadOprData, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprData)
|
|
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 TShipmentHeadOprData) 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 TShipmentHeadOprData
|
|
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 TShipmentHeadOprDataReImport
|
|
|
|
Private ctryField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property ctry() As String
|
|
Get
|
|
Return Me.ctryField
|
|
End Get
|
|
Set
|
|
Me.ctryField = 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(TShipmentHeadOprDataReImport))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprDataReImport 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 TShipmentHeadOprDataReImport object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprDataReImport 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 TShipmentHeadOprDataReImport, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprDataReImport)
|
|
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 TShipmentHeadOprDataReImport) 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 TShipmentHeadOprDataReImport
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipmentHeadOprDataReImport)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprDataReImport 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 TShipmentHeadOprDataReImport object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprDataReImport 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 TShipmentHeadOprDataReImport, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprDataReImport)
|
|
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 TShipmentHeadOprDataReImport) 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 TShipmentHeadOprDataReImport
|
|
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 TShipmentHeadOprDataMeansOfIdentification
|
|
|
|
Private typeField As String
|
|
|
|
Private descriptionField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property description() As String
|
|
Get
|
|
Return Me.descriptionField
|
|
End Get
|
|
Set
|
|
Me.descriptionField = 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(TShipmentHeadOprDataMeansOfIdentification))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprDataMeansOfIdentification 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 TShipmentHeadOprDataMeansOfIdentification object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprDataMeansOfIdentification 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 TShipmentHeadOprDataMeansOfIdentification, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprDataMeansOfIdentification)
|
|
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 TShipmentHeadOprDataMeansOfIdentification) 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 TShipmentHeadOprDataMeansOfIdentification
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipmentHeadOprDataMeansOfIdentification)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprDataMeansOfIdentification 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 TShipmentHeadOprDataMeansOfIdentification object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprDataMeansOfIdentification 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 TShipmentHeadOprDataMeansOfIdentification, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprDataMeansOfIdentification)
|
|
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 TShipmentHeadOprDataMeansOfIdentification) 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 TShipmentHeadOprDataMeansOfIdentification
|
|
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 TShipmentHeadOprDataProduct
|
|
|
|
Private commodityCodeField As String
|
|
|
|
Private partDescriptionField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property commodityCode() As String
|
|
Get
|
|
Return Me.commodityCodeField
|
|
End Get
|
|
Set
|
|
Me.commodityCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partDescription() As String
|
|
Get
|
|
Return Me.partDescriptionField
|
|
End Get
|
|
Set
|
|
Me.partDescriptionField = 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(TShipmentHeadOprDataProduct))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprDataProduct 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 TShipmentHeadOprDataProduct object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprDataProduct 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 TShipmentHeadOprDataProduct, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprDataProduct)
|
|
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 TShipmentHeadOprDataProduct) 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 TShipmentHeadOprDataProduct
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TShipmentHeadOprDataProduct)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TShipmentHeadOprDataProduct 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 TShipmentHeadOprDataProduct object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TShipmentHeadOprDataProduct 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 TShipmentHeadOprDataProduct, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TShipmentHeadOprDataProduct)
|
|
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 TShipmentHeadOprDataProduct) 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 TShipmentHeadOprDataProduct
|
|
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 InsertExportShipment
|
|
|
|
Private exportShipmentMessageField As TExportShipMsg
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.exportShipmentMessageField = New TExportShipMsg()
|
|
End Sub
|
|
|
|
Public Property ExportShipmentMessage() As TExportShipMsg
|
|
Get
|
|
Return Me.exportShipmentMessageField
|
|
End Get
|
|
Set
|
|
Me.exportShipmentMessageField = 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(InsertExportShipment))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current InsertExportShipment 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 InsertExportShipment object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output InsertExportShipment 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 InsertExportShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, InsertExportShipment)
|
|
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 InsertExportShipment) 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 InsertExportShipment
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), InsertExportShipment)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current InsertExportShipment 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 InsertExportShipment object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output InsertExportShipment 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 InsertExportShipment, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, InsertExportShipment)
|
|
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 InsertExportShipment) 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 InsertExportShipment
|
|
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 TExportShipMsg
|
|
|
|
Private metadataField As TMicMetadata
|
|
|
|
Private messageDetailField As TMessageDetail
|
|
|
|
Private exportShipmentField As ExportShipment
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.exportShipmentField = New ExportShipment()
|
|
Me.messageDetailField = New TMessageDetail()
|
|
Me.metadataField = New TMicMetadata()
|
|
End Sub
|
|
|
|
Public Property Metadata() As TMicMetadata
|
|
Get
|
|
Return Me.metadataField
|
|
End Get
|
|
Set
|
|
Me.metadataField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MessageDetail() As TMessageDetail
|
|
Get
|
|
Return Me.messageDetailField
|
|
End Get
|
|
Set
|
|
Me.messageDetailField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ExportShipment() As ExportShipment
|
|
Get
|
|
Return Me.exportShipmentField
|
|
End Get
|
|
Set
|
|
Me.exportShipmentField = 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(TExportShipMsg))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TExportShipMsg 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 TExportShipMsg object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TExportShipMsg 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 TExportShipMsg, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TExportShipMsg)
|
|
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 TExportShipMsg) 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 TExportShipMsg
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TExportShipMsg)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TExportShipMsg 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 TExportShipMsg object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TExportShipMsg 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 TExportShipMsg, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TExportShipMsg)
|
|
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 TExportShipMsg) 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 TExportShipMsg
|
|
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 TMicMetadata
|
|
|
|
Private connectionIdField As String
|
|
|
|
Private partnerIdField As String
|
|
|
|
Private dateTimeField As Date
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property connectionId() As String
|
|
Get
|
|
Return Me.connectionIdField
|
|
End Get
|
|
Set
|
|
Me.connectionIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerId() As String
|
|
Get
|
|
Return Me.partnerIdField
|
|
End Get
|
|
Set
|
|
Me.partnerIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property dateTime() As Date
|
|
Get
|
|
Return Me.dateTimeField
|
|
End Get
|
|
Set
|
|
Me.dateTimeField = 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(TMicMetadata))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMicMetadata 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 TMicMetadata object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMicMetadata 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 TMicMetadata, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMicMetadata)
|
|
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 TMicMetadata) 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 TMicMetadata
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMicMetadata)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMicMetadata 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 TMicMetadata object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMicMetadata 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 TMicMetadata, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMicMetadata)
|
|
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 TMicMetadata) 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 TMicMetadata
|
|
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 TMessageDetail
|
|
|
|
Private messageIdField As String
|
|
|
|
Private partyIdField As String
|
|
|
|
Private transactionIdField As String
|
|
|
|
Private sequenceNumField As String
|
|
|
|
Private actionCodeField As TActionCode
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.actionCodeField = New TActionCode()
|
|
End Sub
|
|
|
|
Public Property messageId() As String
|
|
Get
|
|
Return Me.messageIdField
|
|
End Get
|
|
Set
|
|
Me.messageIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partyId() As String
|
|
Get
|
|
Return Me.partyIdField
|
|
End Get
|
|
Set
|
|
Me.partyIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property transactionId() As String
|
|
Get
|
|
Return Me.transactionIdField
|
|
End Get
|
|
Set
|
|
Me.transactionIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sequenceNum() As String
|
|
Get
|
|
Return Me.sequenceNumField
|
|
End Get
|
|
Set
|
|
Me.sequenceNumField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ActionCode() As TActionCode
|
|
Get
|
|
Return Me.actionCodeField
|
|
End Get
|
|
Set
|
|
Me.actionCodeField = 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(TMessageDetail))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMessageDetail 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 TMessageDetail object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMessageDetail 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 TMessageDetail, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMessageDetail)
|
|
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 TMessageDetail) 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 TMessageDetail
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMessageDetail)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMessageDetail 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 TMessageDetail object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMessageDetail 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 TMessageDetail, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMessageDetail)
|
|
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 TMessageDetail) 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 TMessageDetail
|
|
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 TActionCode
|
|
|
|
Private codeField As String
|
|
|
|
Private parameterField As List(Of TActionCodeParameter)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.parameterField = New List(Of TActionCodeParameter)()
|
|
End Sub
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property parameter() As List(Of TActionCodeParameter)
|
|
Get
|
|
Return Me.parameterField
|
|
End Get
|
|
Set
|
|
Me.parameterField = 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(TActionCode))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TActionCode 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 TActionCode object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TActionCode 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 TActionCode, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCode)
|
|
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 TActionCode) 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 TActionCode
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TActionCode)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TActionCode 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 TActionCode object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TActionCode 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 TActionCode, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCode)
|
|
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 TActionCode) 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 TActionCode
|
|
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 TActionCodeParameter
|
|
|
|
Private keyField As String
|
|
|
|
Private valueField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property key() As String
|
|
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(TActionCodeParameter))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TActionCodeParameter 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 TActionCodeParameter object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TActionCodeParameter 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 TActionCodeParameter, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCodeParameter)
|
|
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 TActionCodeParameter) 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 TActionCodeParameter
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TActionCodeParameter)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TActionCodeParameter 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 TActionCodeParameter object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TActionCodeParameter 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 TActionCodeParameter, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCodeParameter)
|
|
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 TActionCodeParameter) 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 TActionCodeParameter
|
|
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 TStatusResponse
|
|
|
|
Private statusField As TStatus
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.statusField = New TStatus()
|
|
End Sub
|
|
|
|
Public Property Status() As TStatus
|
|
Get
|
|
Return Me.statusField
|
|
End Get
|
|
Set
|
|
Me.statusField = 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(TStatusResponse))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TStatusResponse 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 TStatusResponse object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TStatusResponse 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 TStatusResponse, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatusResponse)
|
|
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 TStatusResponse) 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 TStatusResponse
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TStatusResponse)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TStatusResponse 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 TStatusResponse object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TStatusResponse 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 TStatusResponse, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatusResponse)
|
|
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 TStatusResponse) 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 TStatusResponse
|
|
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 TStatus
|
|
|
|
Private statusField As TStatusStatus
|
|
|
|
Private itemField As Object
|
|
|
|
Private itemElementNameField As ItemChoiceType
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property status() As TStatusStatus
|
|
Get
|
|
Return Me.statusField
|
|
End Get
|
|
Set
|
|
Me.statusField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemElementName")>
|
|
Public Property Item() As Object
|
|
Get
|
|
Return Me.itemField
|
|
End Get
|
|
Set
|
|
Me.itemField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property ItemElementName() As ItemChoiceType
|
|
Get
|
|
Return Me.itemElementNameField
|
|
End Get
|
|
Set
|
|
Me.itemElementNameField = 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(TStatus))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TStatus 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 TStatus object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TStatus 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 TStatus, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatus)
|
|
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 TStatus) 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 TStatus
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TStatus)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TStatus 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 TStatus object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TStatus 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 TStatus, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatus)
|
|
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 TStatus) 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 TStatus
|
|
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 TStatusStatus
|
|
|
|
'''<remarks/>
|
|
OK
|
|
|
|
'''<remarks/>
|
|
[ERROR]
|
|
|
|
'''<remarks/>
|
|
WARNING
|
|
End Enum
|
|
|
|
Partial Public Class ErrorMessages
|
|
|
|
Private errorMessageField As List(Of TErrorMessageType)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.errorMessageField = New List(Of TErrorMessageType)()
|
|
End Sub
|
|
|
|
Public Property ErrorMessage() As List(Of TErrorMessageType)
|
|
Get
|
|
Return Me.errorMessageField
|
|
End Get
|
|
Set
|
|
Me.errorMessageField = 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(ErrorMessages))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current ErrorMessages 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 ErrorMessages object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output ErrorMessages 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 ErrorMessages, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ErrorMessages)
|
|
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 ErrorMessages) 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 ErrorMessages
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), ErrorMessages)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current ErrorMessages 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 ErrorMessages object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output ErrorMessages 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 ErrorMessages, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, ErrorMessages)
|
|
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 ErrorMessages) 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 ErrorMessages
|
|
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 TErrorMessageType
|
|
|
|
Private moduleField As String
|
|
|
|
Private processField As String
|
|
|
|
Private errorCodeField As String
|
|
|
|
Private errorDescField As String
|
|
|
|
Private referenceField As TReference
|
|
|
|
Private detailsField As TErrorDetail
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.detailsField = New TErrorDetail()
|
|
Me.referenceField = New TReference()
|
|
End Sub
|
|
|
|
Public Property [module]() As String
|
|
Get
|
|
Return Me.moduleField
|
|
End Get
|
|
Set
|
|
Me.moduleField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property process() As String
|
|
Get
|
|
Return Me.processField
|
|
End Get
|
|
Set
|
|
Me.processField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property errorCode() As String
|
|
Get
|
|
Return Me.errorCodeField
|
|
End Get
|
|
Set
|
|
Me.errorCodeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property errorDesc() As String
|
|
Get
|
|
Return Me.errorDescField
|
|
End Get
|
|
Set
|
|
Me.errorDescField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Reference() As TReference
|
|
Get
|
|
Return Me.referenceField
|
|
End Get
|
|
Set
|
|
Me.referenceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Details() As TErrorDetail
|
|
Get
|
|
Return Me.detailsField
|
|
End Get
|
|
Set
|
|
Me.detailsField = 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(TErrorMessageType))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TErrorMessageType 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 TErrorMessageType object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErrorMessageType 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 TErrorMessageType, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErrorMessageType)
|
|
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 TErrorMessageType) 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 TErrorMessageType
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErrorMessageType)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TErrorMessageType 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 TErrorMessageType object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErrorMessageType 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 TErrorMessageType, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErrorMessageType)
|
|
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 TErrorMessageType) 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 TErrorMessageType
|
|
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 TReference
|
|
|
|
Private companyField As String
|
|
|
|
Private plantField As String
|
|
|
|
Private correlationIdField As String
|
|
|
|
Private referenceTypeField As String
|
|
|
|
Private referenceSidField As Long
|
|
|
|
Private referenceSidFieldSpecified As Boolean
|
|
|
|
Private userField As String
|
|
|
|
Private partnerIdField As String
|
|
|
|
Private routeIdField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
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 correlationId() As String
|
|
Get
|
|
Return Me.correlationIdField
|
|
End Get
|
|
Set
|
|
Me.correlationIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceType() As String
|
|
Get
|
|
Return Me.referenceTypeField
|
|
End Get
|
|
Set
|
|
Me.referenceTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceSid() As Long
|
|
Get
|
|
Return Me.referenceSidField
|
|
End Get
|
|
Set
|
|
Me.referenceSidField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property referenceSidSpecified() As Boolean
|
|
Get
|
|
Return Me.referenceSidFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.referenceSidFieldSpecified = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property user() As String
|
|
Get
|
|
Return Me.userField
|
|
End Get
|
|
Set
|
|
Me.userField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partnerId() As String
|
|
Get
|
|
Return Me.partnerIdField
|
|
End Get
|
|
Set
|
|
Me.partnerIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property routeId() As String
|
|
Get
|
|
Return Me.routeIdField
|
|
End Get
|
|
Set
|
|
Me.routeIdField = 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(TReference))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TReference 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 TReference object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TReference 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 TReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TReference)
|
|
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 TReference) 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 TReference
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TReference)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TReference 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 TReference object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TReference 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 TReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TReference)
|
|
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 TReference) 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 TReference
|
|
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 TErrorDetail
|
|
|
|
Private timestampField As Date
|
|
|
|
Private stackTraceField As String
|
|
|
|
Private additionalDetailsField As List(Of TErrorDetailAdditionalDetails)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.additionalDetailsField = New List(Of TErrorDetailAdditionalDetails)()
|
|
End Sub
|
|
|
|
Public Property timestamp() As Date
|
|
Get
|
|
Return Me.timestampField
|
|
End Get
|
|
Set
|
|
Me.timestampField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property stackTrace() As String
|
|
Get
|
|
Return Me.stackTraceField
|
|
End Get
|
|
Set
|
|
Me.stackTraceField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property additionalDetails() As List(Of TErrorDetailAdditionalDetails)
|
|
Get
|
|
Return Me.additionalDetailsField
|
|
End Get
|
|
Set
|
|
Me.additionalDetailsField = 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(TErrorDetail))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TErrorDetail 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 TErrorDetail object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErrorDetail 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 TErrorDetail, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErrorDetail)
|
|
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 TErrorDetail) 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 TErrorDetail
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErrorDetail)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TErrorDetail 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 TErrorDetail object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErrorDetail 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 TErrorDetail, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErrorDetail)
|
|
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 TErrorDetail) 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 TErrorDetail
|
|
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 TErrorDetailAdditionalDetails
|
|
|
|
Private typeField As String
|
|
|
|
Private keyField As String
|
|
|
|
Private valueField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property type() As String
|
|
Get
|
|
Return Me.typeField
|
|
End Get
|
|
Set
|
|
Me.typeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property key() As String
|
|
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(TErrorDetailAdditionalDetails))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TErrorDetailAdditionalDetails 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 TErrorDetailAdditionalDetails object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErrorDetailAdditionalDetails 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 TErrorDetailAdditionalDetails, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErrorDetailAdditionalDetails)
|
|
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 TErrorDetailAdditionalDetails) 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 TErrorDetailAdditionalDetails
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErrorDetailAdditionalDetails)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TErrorDetailAdditionalDetails 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 TErrorDetailAdditionalDetails object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErrorDetailAdditionalDetails 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 TErrorDetailAdditionalDetails, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TErrorDetailAdditionalDetails)
|
|
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 TErrorDetailAdditionalDetails) 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 TErrorDetailAdditionalDetails
|
|
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 WarningMessages
|
|
|
|
Private warningMessageField As List(Of TErrorMessageType)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.warningMessageField = New List(Of TErrorMessageType)()
|
|
End Sub
|
|
|
|
Public Property WarningMessage() As List(Of TErrorMessageType)
|
|
Get
|
|
Return Me.warningMessageField
|
|
End Get
|
|
Set
|
|
Me.warningMessageField = 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(WarningMessages))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current WarningMessages 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 WarningMessages object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output WarningMessages 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 WarningMessages, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, WarningMessages)
|
|
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 WarningMessages) 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 WarningMessages
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), WarningMessages)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current WarningMessages 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 WarningMessages object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output WarningMessages 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 WarningMessages, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, WarningMessages)
|
|
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 WarningMessages) 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 WarningMessages
|
|
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 TMetaReference
|
|
|
|
Private correlationIdField As String
|
|
|
|
Private companyField As String
|
|
|
|
Private plantField As String
|
|
|
|
Private referenceTypeField As String
|
|
|
|
Private referenceSidField As Long
|
|
|
|
Private referenceSidFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property correlationId() As String
|
|
Get
|
|
Return Me.correlationIdField
|
|
End Get
|
|
Set
|
|
Me.correlationIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
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 referenceType() As String
|
|
Get
|
|
Return Me.referenceTypeField
|
|
End Get
|
|
Set
|
|
Me.referenceTypeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property referenceSid() As Long
|
|
Get
|
|
Return Me.referenceSidField
|
|
End Get
|
|
Set
|
|
Me.referenceSidField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property referenceSidSpecified() As Boolean
|
|
Get
|
|
Return Me.referenceSidFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.referenceSidFieldSpecified = 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(TMetaReference))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMetaReference 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 TMetaReference object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMetaReference 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 TMetaReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMetaReference)
|
|
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 TMetaReference) 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 TMetaReference
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMetaReference)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMetaReference 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 TMetaReference object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMetaReference 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 TMetaReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMetaReference)
|
|
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 TMetaReference) 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 TMetaReference
|
|
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 ItemChoiceType
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("urn:http://www.mic-cust.com/MicErrorWarningMessage/5.2:ErrorMessages")>
|
|
ErrorMessages
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("urn:http://www.mic-cust.com/MicErrorWarningMessage/5.2:WarningMessages")>
|
|
WarningMessages
|
|
|
|
'''<remarks/>
|
|
Reference
|
|
End Enum
|
|
End Namespace
|