Change Name to MultiTool

This commit is contained in:
Jonathan Jenne
2021-10-29 10:37:04 +02:00
parent f00e332737
commit 1035a0fb1f
121 changed files with 186 additions and 185 deletions

View File

@@ -0,0 +1,11 @@
Imports DigitalData.Modules.Logging
Public Class BaseClass
Public ReadOnly LogConfig As LogConfig
Public ReadOnly Logger As Logger
Public Sub New(pLogConfig As LogConfig, pLogger As Logger)
LogConfig = pLogConfig
Logger = pLogger
End Sub
End Class

View File

@@ -0,0 +1,35 @@
Public Class Config
Public Property ConnectionString As String = ""
Public Property Mandators As New List(Of MandatorConfig)
Public Property InputDirectory As String = ""
Public Property OutputDirectory As String = ""
Public Property SchemaDirectory As String = ""
Public Property Webservice As New WebServiceConfig()
Public Property DefaultYearOverride As Integer = 0
Public Class WebServiceConfig
Public Property BaseUrl As String = "http://127.0.0.1/EWL"
Public Property Username As String = "Username"
Public Property Password As String = "Password"
Public Property ImportBasePath As String = ""
Public Property ImportRelativePath As String = ""
End Class
Public Class MandatorConfig
Public Property Order As Integer
Public Property Name As String
Public Property ArticleRegex As String
End Class
<DebuggerStepThrough>
Public Function GetYear() As Integer
If DefaultYearOverride > 0 Then
Return DefaultYearOverride
End If
Return Now.Year
End Function
End Class

View File

@@ -0,0 +1,14 @@
Public Class Constants
Public Enum XmlFunction
GLN = 1
EAN = 2
End Enum
Public Enum ColumnType As Integer
[String]
[Integer]
[Date]
[Boolean]
[Decimal]
End Enum
End Class

View File

@@ -0,0 +1,76 @@
Imports System.IO
Imports MultiTool.Shared.Schemas
Imports MultiTool.Shared.Winline
Namespace Documents
Public Class Document
Public File As FileInfo
Public Type As DocumentType
Public Schema As Schema
Public Mandator As Mandator
Public TemplateName As String
Public TemplateType As Integer
Public [Option] As Integer
Public PrintVoucher As Integer
''' <summary>
''' Original Values, read-only
''' </summary>
Public Property Rows As New List(Of DocumentRow)
Public Property Selected As Boolean = False
Public ReadOnly Property MandatorId As String
Get
Return Mandator?.Id
End Get
End Property
Public ReadOnly Property CreatedAt As Date
Get
Return File?.CreationTime
End Get
End Property
Public ReadOnly Property FullName As String
Get
Return File?.FullName
End Get
End Property
Public ReadOnly Property Name As String
Get
Return File?.Name
End Get
End Property
Public Overrides Function Equals(obj As Object) As Boolean
Return FullName = DirectCast(obj, Document).FullName
End Function
' Public Type As DocumentType
' Public Data As Object
' Public DataOriginal As Object
' Public DataOutput As Object
' Public DataString As String
' Public Selected As Boolean = False
' Public Shared Function GetDocumentTypeFromTemplateName(pTemplateName As String) As DocumentType
' Return DocumentMatch.TypeMatchingTable.
' Where(Function(kv) pTemplateName.Contains(kv.Key)).
' Select(Function(kv) kv.Value).
' FirstOrDefault()
' End Function
' Public Shared Function GetDocumentSchemaFromDocumentType(pDocumentType As DocumentType) As Type
' Return DocumentMatch.SchemaMatchingTable.
' Where(Function(kv) pDocumentType = kv.Key).
' Select(Function(kv) kv.Value).
' FirstOrDefault()
' End Function
End Class
End Namespace

View File

@@ -0,0 +1,270 @@
Imports System.Globalization
Imports System.IO
Imports DigitalData.Modules.Logging
Imports MultiTool.Shared.Schemas
Imports MultiTool.Shared.Winline
Namespace Documents
Public Class DocumentLoader
Inherits BaseClass
Private ReadOnly Winline As Winline.Data
Public Files As New List(Of Document)
Public Sub New(pLogConfig As LogConfig, pWinline As Winline.Data)
MyBase.New(pLogConfig, pLogConfig.GetLogger())
Winline = pWinline
End Sub
Public Function LoadFiles(pInputDirectory As String, pSchema As Schema, pMandator As Mandator) As Boolean
If pInputDirectory = String.Empty Then
Throw New ArgumentNullException("InputDirectory")
End If
Logger.Info("Loading files from directory [{0}]", pInputDirectory)
Files.Clear()
Try
Dim oDirectory As New DirectoryInfo(pInputDirectory)
Dim oFiles = oDirectory.GetFiles()
Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory)
For Each oFile In oFiles
Dim oDocument = LoadFile(oFile, pSchema, pMandator)
Files.Add(oDocument)
Next
Return True
Catch ex As Exception
Logger.Error(ex)
Throw ex
End Try
End Function
Public Function LoadFile(pFileInfo As FileInfo, pSchema As Schema, pMandator As Mandator) As Document
Dim oFileList As New List(Of FileInfo) From {pFileInfo}
Logger.Info("Loading file [{0}]", pFileInfo.Name)
Try
Return oFileList.
Select(AddressOf WrapFileInfo).
Select(Function(d) IncludeSchema(d, pSchema)).
Select(Function(d) LoadDocumentData(d, pSchema)).
Select(Function(d) MatchDataFromWinLine(d, Winline.Mandators, pMandator)).
SingleOrDefault()
Catch ex As Exception
Logger.Error(ex)
Throw ex
End Try
End Function
Private Function IncludeSchema(pDocument As Document, pSchema As Schema) As Document
pDocument.Schema = pSchema
Return pDocument
End Function
''' <summary>
''' Loads a single document from the FullName Property in the Document Object
''' </summary>
''' <example>
'''
''' A document might look like this:
''' <MESOWebService>
''' <Row1></Row1>
''' <Row2></Row2>
''' <Row3></Row3>
''' </MESOWebService>
'''
''' </example>
Private Function LoadDocumentData(pDocument As Document, pSchema As Schema) As Document
Dim oText As String = IO.File.ReadAllText(pDocument.FullName)
Dim oDoc = XDocument.Parse(oText)
Dim oRootElement As XElement = XmlData.GetElement(oDoc, "MESOWebService")
If oRootElement Is Nothing Then
Throw New Exceptions.MalformedXmlException("Datei enthält kein MESOWebService-Element")
End If
Dim oTemplateName = XmlData.GetElementAttribute(oRootElement, "Template")
If oTemplateName Is Nothing Then
Throw New Exceptions.MalformedXmlException("Datei enthält kein Template-Attribut")
End If
Dim oTemplateType = XmlData.GetElementAttribute(oRootElement, "TemplateType")
If oTemplateType Is Nothing Then
Throw New Exceptions.MalformedXmlException("Datei enthält kein TemplateType-Attribut")
End If
Dim oOption = XmlData.GetElementAttribute(oRootElement, "option")
If oOption Is Nothing Then
Throw New Exceptions.MalformedXmlException("Datei enthält kein option-Attribut")
End If
Dim oPrintVoucher = XmlData.GetElementAttribute(oRootElement, "printVoucher")
If oPrintVoucher Is Nothing Then
Throw New Exceptions.MalformedXmlException("Datei enthält kein printVoucher-Attribut")
End If
' The first level of Elements are the document Rows
Dim oTopLevelElements As List(Of XElement) = oRootElement.Elements.ToList
Dim oDocumentRows As New List(Of DocumentRow)
For Each oTopLevelElement As XElement In oTopLevelElements
Dim oFields As New Dictionary(Of String, DocumentRow.FieldValue)
Dim oSubElements = oTopLevelElement.Descendants().ToList()
Dim oTable = pSchema.Tables.
Where(Function(t) t.Name = oTopLevelElement.Name).
FirstOrDefault()
For Each oSubElement As XElement In oSubElements
Dim oSchemaField = oTable.Columns.
Where(Function(c) c.Name = oSubElement.Name).
SingleOrDefault()
Dim oValue = oSubElement.Value
' TODO: Needed when we have time for date times
'If oSchemaField.DataType = Constants.ColumnType.Date Then
' Dim oDate = Date.ParseExact(oValue, "yyyy-MM-dd", CultureInfo.InvariantCulture)
' oValue = oDate.ToString("d")
'End If
oFields.Add(oSubElement.Name.ToString, New DocumentRow.FieldValue With {
.Original = oValue,
.Final = oValue,
.DataType = oSchemaField.DataType
})
Next
' Create a DocumentRow object for each Top Level Element
Dim oRow = New DocumentRow With {
.Name = oTopLevelElement.Name.ToString,
.Fields = oFields
}
oDocumentRows.Add(oRow)
Next
' Update the document
pDocument.TemplateName = oTemplateName
pDocument.TemplateType = oTemplateType
pDocument.Option = oOption
pDocument.PrintVoucher = oPrintVoucher
pDocument.Rows = oDocumentRows
Return pDocument
End Function
Private Function MatchDataFromWinLine(pDocument As Document, pMandators As List(Of Mandator), pMandator As Mandator) As Document
Dim oMandators As List(Of Winline.Mandator) = pMandators.
Where(Function(m) m.IsWhitelisted = True).
OrderBy(Function(m) m.Order).
ToList()
Dim oMandator As Mandator = Nothing
If pMandator IsNot Nothing Then
oMandator = pMandator
Else
oMandator = Winline.FindMatchingMandatorFromOrder(pDocument)
End If
If oMandator Is Nothing Then
Logger.Warn("Mandator not found for File [{0}]", pDocument.File.Name)
Throw New Exceptions.NoMandatorException($"Mandator not found for file [{pDocument.File.Name}]")
End If
pDocument = MatchDocumentData(pDocument, oMandator)
pDocument.Mandator = oMandator
Return pDocument
End Function
Private Function MatchDocumentData(pDocument As Document, pMandator As Winline.Mandator) As Document
Dim oYear = Winline.GetWinLineYear()
If pMandator Is Nothing Then
Return pDocument
End If
Dim oHead As DocumentRow = pDocument.Rows.
Where(Function(r) r.Name.ToUpper.EndsWith("T025")).
SetValue(Sub(r As DocumentRow) SetAccountByGLN(r, pMandator, "Fakt_Kontonummer", "Fakt_Name")).
SetValue(Sub(r As DocumentRow) SetAccountByGLN(r, pMandator, "Lief_Kontonummer", "Lief_Name")).
FirstOrDefault()
Dim oPositions As List(Of DocumentRow) = pDocument.Rows.
Where(Function(r) r.Name.ToUpper.EndsWith("T026")).
SetValue(Sub(oRow As DocumentRow)
Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault("Artikelnummer")
If oNumberItem Is Nothing Then
Exit Sub
End If
Dim oArticleNumber = Winline.TryGetArticleNumber(oNumberItem.Original, pMandator)
If oArticleNumber IsNot Nothing Then
oNumberItem.External = oArticleNumber
oNumberItem.Final = oArticleNumber
End If
End Sub).
ToList()
Dim oList As New List(Of DocumentRow) From {oHead}
pDocument.Rows = oList.Concat(oPositions).ToList()
Return pDocument
End Function
Private Sub SetAccountByGLN(oRow As DocumentRow, pMandator As Winline.Mandator, pNumberField As String, pNameField As String)
' Try to read the Account number (which is a GLN really) and account Name
Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(pNumberField)
Dim oNameItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(pNameField)
Dim oContainsAccountName As Boolean = Not IsNothing(oNameItem)
If oNumberItem Is Nothing Then
Exit Sub
End If
' Try to find an account that matches the GLN
Dim oAccount = Winline.TryGetAccount(oNumberItem.Original, pMandator)
' If an account was found, set it for External and Final value
If oAccount IsNot Nothing Then
oNumberItem.External = oAccount.Id
oNumberItem.Final = oAccount.Id
If oContainsAccountName Then
oNameItem.External = oAccount.Name
oNameItem.Final = oAccount.Name
Else
oRow.Fields.Add(pNameField, New DocumentRow.FieldValue() With {
.External = oAccount.Name,
.Final = oAccount.Name
})
End If
End If
End Sub
Private Function TryGetDictionaryItem(Of T)(pDictionary As IDictionary(Of String, T), pKey As String) As T
If pDictionary.ContainsKey(pKey) Then
Return pDictionary.Item(pKey)
Else
Return Nothing
End If
End Function
Private Function WrapFileInfo(pFileInfo As FileInfo) As Document
Return New Document With {.File = pFileInfo}
End Function
End Class
End Namespace

View File

@@ -0,0 +1,28 @@
Namespace Documents
Public Class DocumentMatch
Public Shared Property TypeMatchingTable As New Dictionary(Of String, DocumentType) From {
{"orders", DocumentType.Order},
{"ordrsp", DocumentType.OrderResponse},
{"desadv", DocumentType.DispatchNotification},
{"invoic", DocumentType.Invoice}
}
Public Shared Property SchemaMatchingTable As New Dictionary(Of DocumentType, Type) From {
{DocumentType.Order, GetType(Schemas.OrderSchema)}
}
Public Shared Function GetDocumentTypeFromTemplateName(pTemplateName As String) As DocumentType
Return TypeMatchingTable.
Where(Function(kv) pTemplateName.Contains(kv.Key)).
Select(Function(kv) kv.Value).
FirstOrDefault()
End Function
Public Shared Function GetDocumentSchemaFromDocumentType(pDocumentType As DocumentType) As Type
Return SchemaMatchingTable.
Where(Function(kv) pDocumentType = kv.Key).
Select(Function(kv) kv.Value).
FirstOrDefault()
End Function
End Class
End Namespace

View File

@@ -0,0 +1,24 @@
Public Class DocumentRow
''' <summary>
''' Tabellen/Elementname aus XML
''' </summary>
Public Name As String
Public Id As New Guid
Public Fields As Dictionary(Of String, FieldValue)
Public Sub New()
Id = Guid.NewGuid()
End Sub
Public Class FieldValue
Public Original As String = ""
Public External As String = ""
Public Final As String = ""
Public Property DataType As Constants.ColumnType = Constants.ColumnType.String
Public Overrides Function ToString() As String
Return Final
End Function
End Class
End Class

View File

@@ -0,0 +1,8 @@
Namespace Documents
Public Enum DocumentType
Order ' Auftrag
OrderResponse ' Bestellbestätigung
DispatchNotification ' Lieferavis/ Eingangs Lieferschein
Invoice ' Rechnung
End Enum
End Namespace

View File

@@ -0,0 +1,49 @@
Public Class Exceptions
Public MustInherit Class DocumentShowException
Inherits ApplicationException
Public Sub New(message As String)
MyBase.New(message)
End Sub
End Class
Public Class WebServiceException
Inherits ApplicationException
Public Sub New(message As String)
MyBase.New(message)
End Sub
End Class
Public Class NoMandatorException
Inherits DocumentShowException
Public Sub New(message As String)
MyBase.New(message)
End Sub
End Class
Public Class MultipleAccountsException
Inherits DocumentShowException
Public Sub New(message As String)
MyBase.New(message)
End Sub
End Class
Public Class NoAccountException
Inherits DocumentShowException
Public Sub New(message As String)
MyBase.New(message)
End Sub
End Class
Public Class MalformedXmlException
Inherits ApplicationException
Public Sub New(message As String)
MyBase.New(message)
End Sub
End Class
End Class

View File

@@ -0,0 +1,17 @@
Imports System.Runtime.CompilerServices
Module IDictionaryEx
<Extension()>
Function GetOrDefault(Of TKey, TValue)(pDictionary As Dictionary(Of TKey, TValue), pKey As TKey, Optional pOnMissing As TValue = Nothing) As TValue
Dim oValue As TValue
Return IIf(pDictionary.TryGetValue(pKey, oValue), oValue, pOnMissing)
End Function
<Extension()>
Function GetOrInsertNew(Of T, U As New)(dic As Dictionary(Of T, U), key As T) As U
If dic.ContainsKey(key) Then Return dic(key)
Dim newObj As U = New U()
dic(key) = newObj
Return newObj
End Function
End Module

View File

@@ -0,0 +1,12 @@
Imports System.Runtime.CompilerServices
Module IEnumerableEx
<Extension()>
Function SetValue(Of T)(items As IEnumerable(Of T), updateMethod As Action(Of T)) As IEnumerable(Of T)
For Each item As T In items
updateMethod(item)
Next
Return items
End Function
End Module

View File

@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ImporterShared</RootNamespace>
<AssemblyName>ImporterShared</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>ImporterShared.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>ImporterShared.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=10.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.10.1.1\lib\net461\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="DevExpress.DataAccess.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Filesystem">
<HintPath>..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Language">
<HintPath>..\..\DDMonorepo\Modules.Language\bin\Release\DigitalData.Modules.Language.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Release\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseClass.vb" />
<Compile Include="Config.vb" />
<Compile Include="Documents\Document.vb" />
<Compile Include="Documents\DocumentMatch.vb" />
<Compile Include="Documents\DocumentType.vb" />
<Compile Include="Documents\DocumentLoader.vb" />
<Compile Include="IEnumerableEx.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Mapper.vb" />
<Compile Include="Schemas\Orders\Input.vb" />
<Compile Include="Schemas\Orders\Output.vb" />
<Compile Include="Schemas\Orders\ReportSource.vb" />
<Compile Include="Serializer.vb" />
<Compile Include="Winline\Account.vb" />
<Compile Include="Winline\Data.vb" />
<Compile Include="Winline\Mandator.vb" />
<Compile Include="Winline\WebService.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@@ -0,0 +1,47 @@
Imports System.Globalization
Imports AutoMapper
Imports AutoMapper.Configuration
Public Class MapperFactory
Private Shared MapperConfig As Object
'Public Shared Function GetMapper() As Mapper
' MapperConfig = New MapperConfiguration(CreateMapperConfig())
' MapperConfig.AssertConfigurationIsValid()
' Return MapperConfig.CreateMapper()
'End Function
'Private Shared Function CreateMapperConfig() As MapperConfigurationExpression
' Dim oConfig As New MapperConfigurationExpression()
' oConfig.CreateMap(Of String, Integer)().ConvertUsing(New IntegerTypeConverter())
' oConfig.CreateMap(Of String, Decimal)().ConvertUsing(New DecimalTypeConverter())
' oConfig.CreateMap(Of String, DateTime)().ConvertUsing(New DateTimeTypeConverter())
' oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebService, Schemas.Orders.Output.MESOWebService)()
' oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT025, Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT025)()
' oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026, Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT026)()
' Return oConfig
'End Function
Private Class DateTimeTypeConverter
Implements ITypeConverter(Of String, DateTime)
Public Function Convert(source As String, destination As Date, context As ResolutionContext) As Date Implements ITypeConverter(Of String, Date).Convert
Return System.Convert.ToDateTime(source)
End Function
End Class
Private Class IntegerTypeConverter
Implements ITypeConverter(Of String, Integer)
Public Function Convert(source As String, destination As Integer, context As ResolutionContext) As Integer Implements ITypeConverter(Of String, Integer).Convert
Return System.Convert.ToInt32(source)
End Function
End Class
Private Class DecimalTypeConverter
Implements ITypeConverter(Of String, Decimal)
Public Function Convert(source As String, destination As Decimal, context As ResolutionContext) As Decimal Implements ITypeConverter(Of String, Decimal).Convert
Return System.Convert.ToDecimal(source, CultureInfo.InvariantCulture)
End Function
End Class
End Class

View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>MultiTool.Shared</RootNamespace>
<AssemblyName>MultiTool.Shared</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>MultiTool.Shared.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>MultiTool.Shared.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=10.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.10.1.1\lib\net461\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="DevExpress.DataAccess.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Filesystem">
<HintPath>..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Interfaces">
<HintPath>..\..\DDMonorepo\Modules.Interfaces\bin\Debug\DigitalData.Modules.Interfaces.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Language">
<HintPath>..\..\DDMonorepo\Modules.Language\bin\Release\DigitalData.Modules.Language.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Release\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseClass.vb" />
<Compile Include="Config.vb" />
<Compile Include="Constants.vb" />
<Compile Include="Documents\Document.vb" />
<Compile Include="Documents\DocumentMatch.vb" />
<Compile Include="Documents\DocumentRow.vb" />
<Compile Include="Documents\DocumentType.vb" />
<Compile Include="Documents\DocumentLoader.vb" />
<Compile Include="Exceptions.vb" />
<Compile Include="IDictionaryEx.vb" />
<Compile Include="IEnumerableEx.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Mapper.vb" />
<Compile Include="Schemas\BaseSchema.vb" />
<Compile Include="Schemas\Orders\Helpers.vb" />
<Compile Include="Schemas\Orders\Input.vb" />
<Compile Include="Schemas\Orders\OrderSchema.vb" />
<Compile Include="Schemas\Orders\ReportSource.vb" />
<Compile Include="Schemas\Response.vb" />
<Compile Include="Schemas\Schema.vb" />
<Compile Include="Schemas\SchemaLoader.vb" />
<Compile Include="Serializer.vb" />
<Compile Include="Winline\Configuration.vb" />
<Compile Include="Winline\Entities\Account.vb" />
<Compile Include="Winline\Data.vb" />
<Compile Include="Winline\Entities\Contact.vb" />
<Compile Include="Winline\Entities\DocumentKind.vb" />
<Compile Include="Winline\Entities\Mandator.vb" />
<Compile Include="Winline\Entities\TemplateColumn.vb" />
<Compile Include="Winline\WebService.vb" />
<Compile Include="XmlData.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die einer Assembly zugeordnet sind.
' Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("MultiTool.Shared")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("MultiTool.Shared")>
<Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("c3902aa5-4b44-4ae2-8a57-b3c8e031d076")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("MultiTool.Shared.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "Automatische My.Settings-Speicherfunktion"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.MultiTool.[Shared].My.MySettings
Get
Return Global.MultiTool.[Shared].My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,8 @@
Namespace Schemas
Public Class BaseSchema
Public Property Template As String
Public Property TemplateType As Integer
Public Property [Option] As Integer
Public Property PrintVoucher As Integer
End Class
End Namespace

View File

@@ -0,0 +1,28 @@
Namespace Schemas.Orders
'Public Class Helpers
' Public Shared Function GetOrderHead(Of T)(pData As IMesoWebservice) As T
' Dim oHead As T = pData.Items.
' Where(Function(i) TypeOf i Is T).
' FirstOrDefault()
' Return oHead
' End Function
' Public Shared Sub SetOrderHead(Of T)(pData As IMesoWebservice, pUpdateFunction As Action(Of T))
' Dim oHead As T = pData.Items.
' Where(Function(i) TypeOf i Is T).
' SetValue(Sub(pObject As T)
' pUpdateFunction(pObject)
' End Sub).
' FirstOrDefault()
' End Sub
' Public Shared Function GetOrderPositions(Of T)(pData As IMesoWebservice) As List(Of T)
' Dim oPositions As List(Of T) = pData.Items.
' Where(Function(i) TypeOf i Is T).
' Select(Of T)(Function(i) i).
' ToList()
' Return oPositions
' End Function
'End Class
End Namespace

View File

@@ -0,0 +1,713 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System.Xml.Serialization
'
'This source code was auto-generated by xsd, Version=4.8.3928.0.
'
Namespace Schemas.Orders.Input
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
Partial Public Class MESOWebService
Private itemsField() As Object
Private templateTypeField As String
Private templateField As String
Private optionField As String
Private amountField As String
Private extEntryField As String
Private printVoucherField As String
Private extInsertField As String
Private changeLotSizeField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("EXIM-VRG_ordersT025", GetType(MESOWebServiceEXIMVRG_ordersT025), Form:=System.Xml.Schema.XmlSchemaForm.Unqualified),
System.Xml.Serialization.XmlElementAttribute("EXIM-VRG_ordersT026", GetType(MESOWebServiceEXIMVRG_ordersT026), Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property Items() As Object()
Get
Return Me.itemsField
End Get
Set
Me.itemsField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
Public Property TemplateType() As String
Get
Return Me.templateTypeField
End Get
Set
Me.templateTypeField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute()>
Public Property Template() As String
Get
Return Me.templateField
End Get
Set
Me.templateField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
Public Property [option]() As String
Get
Return Me.optionField
End Get
Set
Me.optionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
Public Property amount() As String
Get
Return Me.amountField
End Get
Set
Me.amountField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
Public Property extEntry() As String
Get
Return Me.extEntryField
End Get
Set
Me.extEntryField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
Public Property printVoucher() As String
Get
Return Me.printVoucherField
End Get
Set
Me.printVoucherField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
Public Property extInsert() As String
Get
Return Me.extInsertField
End Get
Set
Me.extInsertField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
Public Property ChangeLotSize() As String
Get
Return Me.changeLotSizeField
End Get
Set
Me.changeLotSizeField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true)> _
Partial Public Class MESOWebServiceEXIMVRG_ordersT025
Private bELEGKEYField As String
Private fakt_KontonummerField As String
Private laufnummerField As String
Private fakt_NameField As String
Private fakt_StrasseField As String
Private fakt_PLZField As String
Private fakt_OrtField As String
Private fakt_AnsprechpartnerField As String
Private lief_KontonummerField As String
Private lief_NameField As String
Private lief_StrasseField As String
Private lief_PLZField As String
Private lief_OrtField As String
Private belegartField As String
Private datum_AuftragBestellungField As String
Private datum_AuftragBestellungFieldSpecified As Boolean
Private auftragsBestellnummerField As String
Private leistungsdatumField As String
Private leistungsdatumFieldSpecified As Boolean
Private auftragsreferenzField As String
Private infotextField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
Public Property BELEGKEY() As String
Get
Return Me.bELEGKEYField
End Get
Set
Me.bELEGKEYField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Fakt_Kontonummer() As String
Get
Return Me.fakt_KontonummerField
End Get
Set
Me.fakt_KontonummerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Laufnummer() As String
Get
Return Me.laufnummerField
End Get
Set
Me.laufnummerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Fakt_Name() As String
Get
Return Me.fakt_NameField
End Get
Set
Me.fakt_NameField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Fakt_Strasse() As String
Get
Return Me.fakt_StrasseField
End Get
Set
Me.fakt_StrasseField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Fakt_PLZ() As String
Get
Return Me.fakt_PLZField
End Get
Set
Me.fakt_PLZField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Fakt_Ort() As String
Get
Return Me.fakt_OrtField
End Get
Set
Me.fakt_OrtField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Fakt_Ansprechpartner() As String
Get
Return Me.fakt_AnsprechpartnerField
End Get
Set
Me.fakt_AnsprechpartnerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Lief_Kontonummer() As String
Get
Return Me.lief_KontonummerField
End Get
Set
Me.lief_KontonummerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Lief_Name() As String
Get
Return Me.lief_NameField
End Get
Set
Me.lief_NameField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Lief_Strasse() As String
Get
Return Me.lief_StrasseField
End Get
Set
Me.lief_StrasseField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Lief_PLZ() As String
Get
Return Me.lief_PLZField
End Get
Set
Me.lief_PLZField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Lief_Ort() As String
Get
Return Me.lief_OrtField
End Get
Set
Me.lief_OrtField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Belegart() As String
Get
Return Me.belegartField
End Get
Set
Me.belegartField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("Datum_Auftrag-Bestellung", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
Public Property Datum_AuftragBestellung() As String
Get
Return Me.datum_AuftragBestellungField
End Get
Set
Me.datum_AuftragBestellungField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property Datum_AuftragBestellungSpecified() As Boolean
Get
Return Me.datum_AuftragBestellungFieldSpecified
End Get
Set
Me.datum_AuftragBestellungFieldSpecified = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("Auftrags-Bestellnummer", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property AuftragsBestellnummer() As String
Get
Return Me.auftragsBestellnummerField
End Get
Set
Me.auftragsBestellnummerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
Public Property Leistungsdatum() As String
Get
Return Me.leistungsdatumField
End Get
Set
Me.leistungsdatumField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property LeistungsdatumSpecified() As Boolean
Get
Return Me.leistungsdatumFieldSpecified
End Get
Set
Me.leistungsdatumFieldSpecified = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Auftragsreferenz() As String
Get
Return Me.auftragsreferenzField
End Get
Set
Me.auftragsreferenzField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Infotext() As String
Get
Return Me.infotextField
End Get
Set
Me.infotextField = value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true)> _
Partial Public Class MESOWebServiceEXIMVRG_ordersT026
Private bELEGKEYField As String
Private zeilennummerField As String
Private datentypField As String
Private artikelnummerField As String
Private bezeichnungField As String
Private notizblockField As String
Private lieferantenartikelnummerField As String
Private menge_bestelltField As String
Private menge_bestelltFieldSpecified As Boolean
Private menge_geliefertField As String
Private colliField As String
Private einzelpreisField As String
Private einzelpreisFieldSpecified As Boolean
Private zeilenrabatt1Field As String
Private zeilenrabatt1FieldSpecified As Boolean
Private zeilenrabatt2Field As String
Private zeilenrabatt2FieldSpecified As Boolean
Private zeilenrabatt3Field As String
Private zeilenrabatt3FieldSpecified As Boolean
Private zeilenrabatt4Field As String
Private zeilenrabatt4FieldSpecified As Boolean
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
Public Property BELEGKEY() As String
Get
Return Me.bELEGKEYField
End Get
Set
Me.bELEGKEYField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
Public Property Zeilennummer() As String
Get
Return Me.zeilennummerField
End Get
Set
Me.zeilennummerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Datentyp() As String
Get
Return Me.datentypField
End Get
Set
Me.datentypField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Artikelnummer() As String
Get
Return Me.artikelnummerField
End Get
Set
Me.artikelnummerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Bezeichnung() As String
Get
Return Me.bezeichnungField
End Get
Set
Me.bezeichnungField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Notizblock() As String
Get
Return Me.notizblockField
End Get
Set
Me.notizblockField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Lieferantenartikelnummer() As String
Get
Return Me.lieferantenartikelnummerField
End Get
Set
Me.lieferantenartikelnummerField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Menge_bestellt() As String
Get
Return Me.menge_bestelltField
End Get
Set
Me.menge_bestelltField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property Menge_bestelltSpecified() As Boolean
Get
Return Me.menge_bestelltFieldSpecified
End Get
Set
Me.menge_bestelltFieldSpecified = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Menge_geliefert() As String
Get
Return Me.menge_geliefertField
End Get
Set
Me.menge_geliefertField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Colli() As String
Get
Return Me.colliField
End Get
Set
Me.colliField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Einzelpreis() As String
Get
Return Me.einzelpreisField
End Get
Set
Me.einzelpreisField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property EinzelpreisSpecified() As Boolean
Get
Return Me.einzelpreisFieldSpecified
End Get
Set
Me.einzelpreisFieldSpecified = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Zeilenrabatt1() As String
Get
Return Me.zeilenrabatt1Field
End Get
Set
Me.zeilenrabatt1Field = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property Zeilenrabatt1Specified() As Boolean
Get
Return Me.zeilenrabatt1FieldSpecified
End Get
Set
Me.zeilenrabatt1FieldSpecified = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Zeilenrabatt2() As String
Get
Return Me.zeilenrabatt2Field
End Get
Set
Me.zeilenrabatt2Field = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property Zeilenrabatt2Specified() As Boolean
Get
Return Me.zeilenrabatt2FieldSpecified
End Get
Set
Me.zeilenrabatt2FieldSpecified = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Zeilenrabatt3() As String
Get
Return Me.zeilenrabatt3Field
End Get
Set
Me.zeilenrabatt3Field = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property Zeilenrabatt3Specified() As Boolean
Get
Return Me.zeilenrabatt3FieldSpecified
End Get
Set
Me.zeilenrabatt3FieldSpecified = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
Public Property Zeilenrabatt4() As String
Get
Return Me.zeilenrabatt4Field
End Get
Set
Me.zeilenrabatt4Field = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public Property Zeilenrabatt4Specified() As Boolean
Get
Return Me.zeilenrabatt4FieldSpecified
End Get
Set
Me.zeilenrabatt4FieldSpecified = value
End Set
End Property
End Class
End Namespace

View File

@@ -0,0 +1,55 @@
Imports System.ComponentModel
Namespace Schemas
''' <summary>
''' XML Schema to import the Data-Files
''' </summary>
Public Class OrderSchema
Inherits BaseSchema
<Description("EXIM-VRG_ordersT025")>
Public Property Head As New OrderHead
<Description("EXIM-VRG_ordersT026")>
Public Property Positions As New List(Of OrderPosition)
Public Class OrderHead
<Description("BELEGKEY")>
Public Property DocumentKey As String
<Description("Fakt_Kontonummer")>
Public Property AccountNumber As String
<Description("Laufnummer")>
Public Property RunningNumber As String
<Description("Bestellt_von")>
Public Property OrderedBy As String
<Description("Lief_Kontonummer")>
Public Property AccountNumber2 As String
<Description("Belegart")>
Public Property DocumentType As Integer
<Description("Datum_Auftrag-Bestellung")>
Public Property OrderDate As Date
<Description("Auftrags-Bestellnummer")>
Public Property OrderNumber As String
<Description("Infotext")>
Public Property InfoText As String
End Class
Public Class OrderPosition
<Description("BELEGKEY")>
Public Property DocumentKey As String
<Description("Zeilennummer")>
Public Property LineNumber As String
<Description("Artikelnummer")>
Public Property ArticleNumber As String
<Description("Bezeichnung")>
Public Property ArticleDescription As String
<Description("Lieferantenartikelnummer")>
Public Property VendorNumber As String
End Class
End Class
End Namespace

View File

@@ -0,0 +1,21 @@
Imports DevExpress.DataAccess.ObjectBinding
Imports System.Collections.Generic
Imports System.ComponentModel
Namespace Schemas.Orders
<DisplayName("OrdersReport"), HighlightedClass>
Public Class ReportSource
<HighlightedMember>
Public Property Head As Orders.Input.MESOWebServiceEXIMVRG_ordersT025
<HighlightedMember>
Public Property Positions As IEnumerable(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)
<HighlightedMember>
Public Iterator Function GetPositionList() As IEnumerable(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)
For Each oPosition In Positions
Yield oPosition
Next
End Function
End Class
End Namespace

View File

@@ -0,0 +1,130 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System.Xml.Serialization
'
'This source code was auto-generated by xsd, Version=4.8.3928.0.
'
Namespace Schemas
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true), _
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=false)> _
Partial Public Class MESOWebServiceResult
Private overallSuccessField As Boolean
Private resultDetailsField As MESOWebServiceResultResultDetails()
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property OverallSuccess() As Boolean
Get
Return Me.overallSuccessField
End Get
Set
Me.overallSuccessField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("ResultDetails", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property ResultDetails() As MESOWebServiceResultResultDetails()
Get
Return Me.resultDetailsField
End Get
Set
Me.resultDetailsField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)>
Partial Public Class MESOWebServiceResultResultDetails
Private successField As Boolean
Private errorCodeField As String
Private errorTextField As String
Private keyValueField As String
Private voucherNumberField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property Success() As Boolean
Get
Return Me.successField
End Get
Set
Me.successField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property ErrorCode() As String
Get
Return Me.errorCodeField
End Get
Set
Me.errorCodeField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property ErrorText() As String
Get
Return Me.errorTextField
End Get
Set
Me.errorTextField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property KeyValue() As String
Get
Return Me.keyValueField
End Get
Set
Me.keyValueField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
Public Property VoucherNumber() As String
Get
Return Me.voucherNumberField
End Get
Set
Me.voucherNumberField = Value
End Set
End Property
End Class
End Namespace

View File

@@ -0,0 +1,18 @@
Namespace Schemas
Public Class Schema
Public Property Tables As New List(Of Table)
Public Property Name As String
Class Table
Public Property Name As String
Public Property Columns As New List(Of Column)
End Class
Class Column
Public Property Name As String
Public Property Required As String
Public Property DataType As Constants.ColumnType
End Class
End Class
End Namespace

View File

@@ -0,0 +1,119 @@
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Imports DigitalData.Modules.Logging
Namespace Schemas
Public Class SchemaLoader
Inherits BaseClass
Private ns As XNamespace = "http://www.w3.org/2001/XMLSchema"
Public SchemaList As List(Of FileInfo)
Public Sub New(pLogConfig As LogConfig)
MyBase.New(pLogConfig, pLogConfig.GetLogger)
End Sub
Public Function LoadFiles(pSchemaDirectory) As Boolean
If pSchemaDirectory = String.Empty Then
Throw New ArgumentNullException("SchemaDirectory")
End If
Logger.Info("Loading files from directory [{0}]", pSchemaDirectory)
Try
Dim oDirectory As New DirectoryInfo(pSchemaDirectory)
Dim oFiles = oDirectory.GetFiles()
Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory)
SchemaList = oFiles.ToList()
Return True
Catch ex As Exception
Logger.Error(ex)
Throw New IO.IOException($"Could not load files from directory {pSchemaDirectory}", ex)
End Try
End Function
Public Function GetSchemaFromFile(pSchemaFilePath As String) As Schema
Dim oSchema As New Schema
Dim oFileInfo As New FileInfo(pSchemaFilePath)
Dim oElements = GetSchemaElements(pSchemaFilePath)
oSchema.Name = oFileInfo.Name
For Each oElement In oElements
Dim oColumns = GetElementColumns(oElement)
Dim oSchemaColumns As New List(Of Schema.Column)
For Each oColumn As XElement In oColumns
Dim oName = XmlData.GetElementAttribute(oColumn, "name")
Dim oMinOccurs = XmlData.GetElementAttribute(oColumn, "minOccurs")
Dim oMaxOccurs = XmlData.GetElementAttribute(oColumn, "maxOccurs")
Dim oType = GetElementType(oColumn)
Dim oRequired = False
If oMinOccurs = 1 And oMaxOccurs = 1 Then
oRequired = True
End If
Dim oSchemaColumn As New Schema.Column With {
.Name = oName,
.Required = oRequired,
.DataType = oType
}
oSchemaColumns.Add(oSchemaColumn)
Next
oSchema.Tables.Add(New Schema.Table With {
.Name = XmlData.GetElementAttribute(oElement, "name"),
.Columns = oSchemaColumns
})
Next
Return oSchema
End Function
Public Function GetElementType(pElement As XElement) As Constants.ColumnType
Dim oTypeString = XmlData.GetElementAttribute(pElement, "type")
If oTypeString Is Nothing Then
Dim oRestrictionElement As XElement = pElement.
Descendants(ns + "restriction").
FirstOrDefault()
oTypeString = XmlData.GetElementAttribute(oRestrictionElement, "base")
End If
Select Case oTypeString
Case "xs:date"
Return Constants.ColumnType.Date
Case "xs:integer"
Return Constants.ColumnType.Integer
Case "xs:decimal"
Return Constants.ColumnType.Decimal
Case "xs:boolean"
Return Constants.ColumnType.Boolean
Case Else
Return Constants.ColumnType.String
End Select
End Function
Public Function GetSchemaElements(pSchemaFilePath As String) As List(Of XElement)
Dim oText As String = IO.File.ReadAllText(pSchemaFilePath)
Dim oDoc = XDocument.Parse(oText)
Return XmlData.GetElementsFromElement(oDoc, "choice", ns)
End Function
Public Function GetElementColumns(pElement As XElement) As List(Of XElement)
Return XmlData.GetElementsFromElement(pElement, "sequence", ns)
End Function
End Class
End Namespace

View File

@@ -0,0 +1,31 @@
Imports System.Xml.Serialization
Imports DigitalData.Modules.Logging
Public Class Serializer
Inherits BaseClass
Public Sub New(pLogConfig As LogConfig)
MyBase.New(pLogConfig, pLogConfig.GetLogger())
End Sub
Public Function GetSerializer(pSchemaType As Type) As XmlSerializer
Dim oSerializer As New XmlSerializer(pSchemaType)
AddHandler oSerializer.UnknownAttribute, Sub(sender As Object, e As XmlAttributeEventArgs)
Logger.Debug("[{1}] Unknown Attribute: {0}", e.Attr, pSchemaType.Name)
End Sub
AddHandler oSerializer.UnknownElement, Sub(sender As Object, e As XmlElementEventArgs)
Logger.Debug("[{1}] Unknown Element: {0}", e.Element, pSchemaType.Name)
End Sub
AddHandler oSerializer.UnknownNode, Sub(sender As Object, e As XmlNodeEventArgs)
Logger.Debug("[{1}] Unknown Node: {0}", e.Name, pSchemaType.Name)
End Sub
AddHandler oSerializer.UnreferencedObject, Sub(sender As Object, e As UnreferencedObjectEventArgs)
Logger.Debug("[{1}] Unreferenced Object: {0}", e.UnreferencedId, pSchemaType.Name)
End Sub
Return oSerializer
End Function
End Class

View File

@@ -0,0 +1,7 @@
''' <summary>
''' Class for loading column/field config from database
''' </summary>
Public Class Configuration
End Class

View File

@@ -0,0 +1,580 @@
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Database
Imports MultiTool.Shared
Imports System.Text.RegularExpressions
Namespace Winline
Public Class Data
Inherits BaseClass
Private ReadOnly Database As MSSQLServer
Private ReadOnly Config As Config
Public Accounts As New List(Of Account)
Public Mandators As New List(Of Mandator)
Public DocumentKinds As New List(Of DocumentKind)
Public Years As List(Of Integer)
Public TemplateConfiguration As New List(Of TemplateColumn)
'Public XmlConfigHead As List(Of TemplateColumn)
'Public XmlConfigPositions As List(Of TemplateColumn)
Public Const ALL_MESOCOMP = "mesocomp"
Public Const V21_ARTICLENUMBER = "c011"
Public Const V21_REPLACEMENTARTICLENUMBER = "c123"
Public Const V50_ACCOUNTNUMBER = "c002"
Public Const V50_ACCOUNTNAME = "c003"
Public Const V50_STREETNAME = "c050"
Public Const V50_ZIPCODE = "c051"
Public Const V50_CITYNAME = "c052"
Public Const T45_KEY = "c000"
Public Const T45_NAME = "c001"
Public Const T45_CONTACTNUMBER = "c063"
Public Const V05_ACCOUNTID = "c002"
Public Const V05_ACCOUNTNAME = "c003"
Public Const T357_KINDID = "c030"
Public Const T357_KINDNAME = "c001"
Public Const T01_DATABASEINFO = "c004"
Public Const T01_MANDATORID = "c000"
Public Const T01_MANDATORNAME = "c003"
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config)
MyBase.New(pLogConfig, pLogConfig.GetLogger())
Database = pDatabase
Config = pConfig
End Sub
<DebuggerStepThrough>
Public Function GetWinLineYear(pYear As Integer)
Return (pYear - 1900) * 12
End Function
<DebuggerStepThrough>
Public Function GetWinLineYear()
Return GetWinLineYear(Config.GetYear)
End Function
Public Sub LoadAccounts(pMandator As Mandator)
Logger.Info("Loading Accounts for Mandator [{0}]", pMandator)
Dim oYear = GetWinLineYear()
Try
Dim oSQL = $"
SELECT DISTINCT
[c002], -- Kundennummer
[c003], -- Kundenname
[c050], -- Straße
[c052], -- Ort
[c051] -- PLZ
FROM [{pMandator.Server}].[{pMandator.Database}].[dbo].[v050]
WHERE
c139 IS NULL
AND mesocomp = '{pMandator.Id}'
AND mesoyear = {oYear}"
Dim oTable = Database.GetDatatable(oSQL)
Dim oAccounts As New List(Of Account)
For Each oRow As DataRow In oTable.Rows
Dim oAccountNumber As String = Utils.NotNull(oRow.Item(V50_ACCOUNTNUMBER), String.Empty)
Dim oAccountName As String = Utils.NotNull(oRow.Item(V50_ACCOUNTNAME), String.Empty)
Dim oStreetName As String = Utils.NotNull(oRow.Item(V50_STREETNAME), String.Empty)
Dim oZipCode As String = Utils.NotNull(oRow.Item(V50_ZIPCODE), String.Empty)
Dim oCityName As String = Utils.NotNull(oRow.Item(V50_CITYNAME), String.Empty)
oAccounts.Add(New Account With {
.Id = oAccountNumber,
.Name = oAccountName,
.StreetName = oStreetName,
.ZipCode = oZipCode,
.CityName = oCityName,
.Mandator = pMandator.Id
})
Next
Accounts.AddRange(oAccounts)
Logger.Info("[{0}] Accounts loaded for Mandator [{1}]", oAccounts.Count, pMandator)
Catch ex As Exception
Logger.Warn("Could not load Accounts for Mandator [{0}]", pMandator)
Logger.Error(ex)
End Try
End Sub
Public Sub LoadMandators()
Try
Dim oSQL = "SELECT [c000], [c003], [c004] FROM [cwlsystem].[dbo].[T001SRV] (NOLOCK)"
Dim oTable = Database.GetDatatable(oSQL)
Mandators.Clear()
For Each oRow As DataRow In oTable.Rows
Dim oDbInfo = SplitConnectionInfo(oRow)
Dim oMandator = New Mandator With {
.Id = oRow.Item(T01_MANDATORID),
.Name = oRow.Item(T01_MANDATORNAME),
.Database = oDbInfo.Item1,
.Server = oDbInfo.Item2
}
Dim oMandatorConfig As Config.MandatorConfig = Config.Mandators.
Where(Function(m) oMandator.Id = m.Name).
SingleOrDefault()
If oMandatorConfig IsNot Nothing Then
oMandator.IsWhitelisted = True
oMandator.Regex = oMandatorConfig.ArticleRegex
oMandator.Order = oMandatorConfig.Order
End If
Mandators.Add(oMandator)
Next
Logger.Info("[{0}] Mandators loaded", Mandators.Count)
Catch ex As Exception
Logger.Warn("Could not load Mandators")
Logger.Error(ex)
End Try
End Sub
Public Sub LoadEconomicYears()
Dim oCurrentYear = Now.Year
Dim oRange As IEnumerable(Of Integer) = Enumerable.Range(oCurrentYear - 10, 12).ToList()
Years = oRange
End Sub
Public Sub LoadDocumentKinds(pMandators As List(Of Mandator))
Dim oDocumentKinds As New List(Of DocumentKind)
Dim oMandatorString = String.Join(",", pMandators.Select(Function(m) $"'{m.Id}'").ToArray)
Dim oYear As Integer = GetWinLineYear()
DocumentKinds.Clear()
For Each oMandator As Mandator In pMandators
Try
Dim oSQL = $"
SELECT
[c030],
[c001],
[mesocomp]
FROM [{oMandator.Database}].[dbo].[t357] (NOLOCK)
WHERE (
[c001] LIKE 'Werk%(VK)' OR
[c001] LIKE 'Werk%(WK)'
)
AND [mesocomp] = '{oMandator.Id}' AND [mesoyear] = {oYear}"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
If oTable.Rows.Count = 0 Then
Logger.Warn("No DocumentKinds found for Mandator [{0}]", oMandator.Id)
Continue For
End If
For Each oRow As DataRow In oTable.Rows
oDocumentKinds.Add(New DocumentKind With {
.Id = oRow.Item(T357_KINDID),
.Name = oRow.Item(T357_KINDNAME),
.Mandator = oRow.Item(ALL_MESOCOMP)
})
Next
Catch ex As Exception
Logger.Warn("Could not load DocumentKinds")
Logger.Error(ex)
End Try
Next
DocumentKinds = oDocumentKinds.ToList()
End Sub
Public Function TryGetAccount(pGLN As String, pMandator As Mandator) As Account
Try
If pGLN Is Nothing OrElse pGLN = String.Empty Then
Return Nothing
End If
Dim oYear As Integer = GetWinLineYear()
Dim oSQL = $"
SELECT
[c002], -- Kundennummer
[c003], -- Kundenname
[c050], -- Straße
[c052], -- Ort
[c051] -- PLZ
FROM [{pMandator.Database}].[dbo].[v050]
WHERE [c004] = 2 -- KontoTyp
AND [c260] = '{pGLN}'
AND [mesocomp] = '{pMandator.Id}' and [mesoyear] = {oYear}"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
' GLN not found in this Mandator, continue to next one
If oTable.Rows.Count = 0 Then
Logger.Debug("GLN [{0}] was not found in Mandator: [{1}]", pGLN, pMandator.Id)
Return Nothing
End If
' Duplicate GLN, exit and do nothing about this number
If oTable.Rows.Count > 1 Then
Logger.Warn("GLN [{0}] was found more than once in Mandator: [{1}]", pGLN, pMandator.Id)
Return Nothing
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oAccountNumber As String = Utils.NotNull(oRow.Item(V50_ACCOUNTNUMBER), String.Empty)
Dim oAccountName As String = Utils.NotNull(oRow.Item(V50_ACCOUNTNAME), String.Empty)
Dim oStreetName As String = Utils.NotNull(oRow.Item(V50_STREETNAME), String.Empty)
Dim oZipCode As String = Utils.NotNull(oRow.Item(V50_ZIPCODE), String.Empty)
Dim oCityName As String = Utils.NotNull(oRow.Item(V50_CITYNAME), String.Empty)
Return New Account With {
.Id = oAccountNumber,
.Name = oAccountName,
.StreetName = oStreetName,
.CityName = oCityName,
.ZipCode = oZipCode,
.Mandator = pMandator.Id
}
Catch ex As Exception
Logger.Warn("Error while trying to get account for GLN [{0}]", pGLN)
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function TryGetArticleNumber(pEAN As String, pMandator As Mandator) As String
Try
Dim oYear As Integer = GetWinLineYear()
Dim oSQL As String = $"
SELECT
[c011], -- Artikelnummer
[c003], -- Artikelbezeichnung
[c075], -- EAN-Nummer
[c123] -- Ersatzartikelnummer
FROM [{pMandator.Database}].[dbo].[v021]
WHERE [c075] = '{pEAN}'
AND [mesocomp] = '{pMandator.Id}' AND [mesoyear] = {oYear}"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
' EAN not found in this Mandator, continue to next one
If oTable.Rows.Count = 0 Then
Logger.Debug("EAN [{0}] was not found in Mandator: [{1}]", pEAN, pMandator.Id)
Return Nothing
End If
' Duplicate EAN, exit and do nothing about this number
If oTable.Rows.Count > 1 Then
Logger.Warn("EAN [{0}] was found more than once", pEAN)
Return Nothing
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oArticleNumber As String = Utils.NotNull(oRow.Item(V21_ARTICLENUMBER), String.Empty)
Return oArticleNumber
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function GetContacts(pAccountNumber As String, pMandator As Mandator) As List(Of Contact)
Try
Dim oContacts As New List(Of Contact)
Dim oYear As Integer = GetWinLineYear()
Dim oSQL As String = $"
SELECT
[c000], -- Key
[c001], -- Name
[c063] -- Kontaktnummer
FROM [{pMandator.Database}].[dbo].[t045]
WHERE [c063] LIKE '{pAccountNumber}-%'
AND [mesocomp] = '{pMandator.Id}' AND [mesoyear] = {oYear}"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
' Contact not found in this Mandator, continue to next one
If oTable.Rows.Count = 0 Then
Logger.Debug("Contact for Account [{0}] was not found in Mandator: [{1}]", pAccountNumber, pMandator.Id)
Return Nothing
End If
For Each oRow In oTable.Rows
oContacts.Add(New Contact With {
.Id = Utils.NotNull(oRow.Item(T45_KEY), Nothing),
.Name = Utils.NotNull(oRow.Item(T45_NAME), Nothing),
.Number = Utils.NotNull(oRow.Item(T45_CONTACTNUMBER), Nothing)
})
Next
Return oContacts
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function GetReplacementArticleNumber(pArticleNumber As String, pMandator As Mandator)
Try
Dim oYear As Integer = GetWinLineYear()
Dim oSQL As String = $"
SELECT
[c011], -- Artikelnummer
[c003], -- Artikelbezeichnung
[c075], -- EAN-Nummer
[c123] -- Ersatzartikelnummer
FROM [{pMandator.Database}].[dbo].[v021]
WHERE [c011] = '{pArticleNumber}'
AND [mesocomp] = '{pMandator.Id}' AND [mesoyear] = {oYear}"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
' ArticleNumber not found in this Mandator, continue to next one
If oTable.Rows.Count = 0 Then
Logger.Debug("ArticleNumber [{0}] was not found in Mandator: [{1}]", pArticleNumber, pMandator.Id)
Return Nothing
End If
' Duplicate EAN, exit and do nothing about this number
If oTable.Rows.Count > 1 Then
Logger.Warn("ArticleNumber [{0}] was found more than once", pArticleNumber)
Return Nothing
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oReplacementArticleNumber = Utils.NotNull(oRow.Item(V21_REPLACEMENTARTICLENUMBER), Nothing)
If oReplacementArticleNumber Is Nothing Then
Return pArticleNumber
End If
Return GetReplacementArticleNumber(oReplacementArticleNumber, pMandator)
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function FindMatchingMandatorFromOrder(pData As Documents.Document) As Mandator
Dim oPositions = pData.Rows.
Where(Function(r) r.Name.ToUpper.EndsWith("T026")).
ToList()
Dim oEANNumbers = oPositions.
Select(Function(p) p.Fields.Item("Artikelnummer").Original).
Distinct().
ToList()
'Dim oPositions As List(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items.
' Where(Function(i) TypeOf i Is Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026).
' Select(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
' ToList()
Dim oYear = GetWinLineYear()
Dim oMandatorId As String = String.Empty
Dim oWhitelistedMandators = Mandators.
Where(Function(m) m.IsWhitelisted = True).
ToList()
For Each oEANNumber In oEANNumbers
For Each oMandator In oWhitelistedMandators
Dim oSQL As String = $"
SELECT
[c011], -- Artikelnummer
[c003], -- Artikelbezeichnung
[c075], -- EAN-Nummer
[c123] -- Ersatzartikelnummer
FROM [{oMandator.Database}].[dbo].[v021]
WHERE [c075] = '{oEANNumber}'
AND [mesocomp] = '{oMandator.Id}' AND [mesoyear] = {oYear}"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
' EAN not found in this Mandator, continue to next one
If oTable.Rows.Count = 0 Then
Logger.Debug("EAN [{0}] was not found in Mandator: [{1}]", oEANNumber, oMandator.Id)
Continue For
End If
' Duplicate EAN, exit and do nothing about this manda
If oTable.Rows.Count > 1 Then
Logger.Warn("EAN [{0}] was found more than once. Skipping Mandator [{1}]", oEANNumber, oMandator.Id)
Exit For
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oArticleNumber As String = Utils.NotNull(oRow.Item(V21_ARTICLENUMBER), String.Empty)
' EAN was found, now we need to check it against the Regex of the current Mandantor, if one exists
If oMandator.Regex <> String.Empty Then
Try
Dim oRegex As New Regex(oMandator.Regex)
Dim oMatch = oRegex.Match(oArticleNumber)
' If ArticleNumber matches the regex, we assign it and exit
If oMatch.Success Then
oMandatorId = oMandator.Id
Exit For
Else
' If it does not match, continue to the next mandator
End If
Catch ex As Exception
Logger.Error(ex)
Logger.Warn("Regex [{0}] could not be parsed. Skipping.", oMandator.Regex)
End Try
Else
' If no regex was found, we assume the number matches
oMandatorId = oMandator.Id
End If
Next
Next
If oMandatorId = String.Empty Then
Return Nothing
Else
Return oWhitelistedMandators.
Where(Function(m) m.Id = oMandatorId).
Take(1).
SingleOrDefault()
End If
End Function
'Public Function FindMatchingMandatorFromOrder(pData As Schemas.Orders.Input.MESOWebService) As Mandator
' Dim oPositions As List(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items.
' Where(Function(i) TypeOf i Is Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026).
' Select(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
' ToList()
' Dim oYear = GetWinLineYear()
' Dim oMandatorId As String = String.Empty
' Dim oWhitelistedMandators = Mandators.
' Where(Function(m) m.IsWhitelisted = True).
' ToList()
' For Each oPos In oPositions
' For Each oMandator In oWhitelistedMandators
' Dim oSQL As String = $"
' SELECT
' [c011], -- Artikelnummer
' [c003], -- Artikelbezeichnung
' [c075], -- EAN-Nummer
' [c123] -- Ersatzartikelnummer
' FROM [{oMandator.Database}].[dbo].[v021]
' WHERE [c075] = '{oPos.Artikelnummer}'
' AND [mesocomp] = '{oMandator.Id}' AND [mesoyear] = {oYear}"
' Dim oTable As DataTable = Database.GetDatatable(oSQL)
' ' EAN not found in this Mandator, continue to next one
' If oTable.Rows.Count = 0 Then
' Logger.Debug("EAN [{0}] was not found in Mandator: [{1}]", oPos.Artikelnummer, oMandator.Id)
' Continue For
' End If
' ' Duplicate EAN, exit and do nothing about this manda
' If oTable.Rows.Count > 1 Then
' Logger.Warn("EAN [{0}] was found more than once. Skipping Mandator [{1}]", oPos.Artikelnummer, oMandator.Id)
' Exit For
' End If
' Dim oRow As DataRow = oTable.Rows.Item(0)
' Dim oArticleNumber As String = Utils.NotNull(oRow.Item(V21_ARTICLENUMBER), String.Empty)
' ' EAN was found, now we need to check it against the Regex of the current Mandantor, if one exists
' If oMandator.Regex <> String.Empty Then
' Try
' Dim oRegex As New Regex(oMandator.Regex)
' Dim oMatch = oRegex.Match(oArticleNumber)
' ' If ArticleNumber matches the regex, we assign it and exit
' If oMatch.Success Then
' oMandatorId = oMandator.Id
' Exit For
' Else
' ' If it does not match, continue to the next mandator
' End If
' Catch ex As Exception
' Logger.Error(ex)
' Logger.Warn("Regex [{0}] could not be parsed. Skipping.", oMandator.Regex)
' End Try
' Else
' ' If no regex was found, we assume the number matches
' oMandatorId = oMandator.Id
' End If
' Next
' Next
' If oMandatorId = String.Empty Then
' Return Nothing
' Else
' Return oWhitelistedMandators.
' Where(Function(m) m.Id = oMandatorId).
' Take(1).
' SingleOrDefault()
' End If
'End Function
Public Function LoadTemplateConfiguration() As Boolean
Try
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[VWEDI_XML_ITEMS]"
Dim oTable As DataTable = Database.GetDatatable(oSql)
Dim oItems As New List(Of TemplateColumn)
For Each oRow As DataRow In oTable.Rows
Dim oColumn As New TemplateColumn With {
.Name = oRow.Item("XML_NAME"),
.Root = oRow.Item("XML_ROOT"),
.Type = oRow.Item("XML_TYPE"),
.Template = oRow.Item("TEMPLATE_NAME"),
.[Function] = oRow.Item("FUNCTION_ID"),
.[ReadOnly] = oRow.Item("IS_READ_ONLY"),
.[Visible] = oRow.Item("IS_VISIBLE")
}
oItems.Add(oColumn)
Next
TemplateConfiguration = oItems
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
''' <summary>
''' Turns a database info like "SQLCWLDATEN on SERVER\INSTANCE" into a Tuple of two strings
''' </summary>
''' <param name="pRow"></param>
''' <returns></returns>
Private Function SplitConnectionInfo(pRow As DataRow) As Tuple(Of String, String)
Dim oDbInfo = pRow.Item(T01_DATABASEINFO).ToString()
Dim oSplittedInfo = SplitAtString(oDbInfo.ToUpper, "ON")
Dim oServer = oSplittedInfo.Item(1).Trim()
Dim oDatabase = oSplittedInfo.Item(0).Trim()
If oDatabase.StartsWith("SQL") Then
oDatabase = oDatabase.Remove(0, 3)
End If
Return New Tuple(Of String, String)(oDatabase, oServer)
End Function
Private Function SplitAtString(pStringToSplit As String, pDelimiter As String) As List(Of String)
Dim oDelimiter As String() = New String(0) {pDelimiter}
Return pStringToSplit.
Split(oDelimiter, StringSplitOptions.None).
ToList()
End Function
End Class
End Namespace

View File

@@ -0,0 +1,24 @@
Namespace Winline
Public Class Account
Public Property Id As String
Public Property Name As String
Public Property StreetName As String
Public Property CityName As String
Public Property ZipCode As String
Public Property Mandator As String
Public Overrides Function GetHashCode() As Integer
Return Id.GetHashCode()
End Function
Public Overrides Function Equals(obj As Object) As Boolean
Return DirectCast(obj, Account).Id = Id
End Function
Public Overrides Function ToString() As String
Return $"{Name} ({Id})"
End Function
End Class
End Namespace

View File

@@ -0,0 +1,12 @@
Namespace Winline
Public Class Contact
Public Property Id As Integer
Public Property Number As String
Public Property Name As String
Public Overrides Function ToString() As String
Return Name
End Function
End Class
End Namespace

View File

@@ -0,0 +1,19 @@
Namespace Winline
Public Class DocumentKind
Public Id As Integer
Public Name As String
Public Mandator As String
Public Overrides Function GetHashCode() As Integer
Return Id.GetHashCode()
End Function
Public Overrides Function Equals(obj As Object) As Boolean
Return DirectCast(obj, DocumentKind).Id = Id
End Function
Public Overrides Function ToString() As String
Return $"{Name} ({Id})"
End Function
End Class
End Namespace

View File

@@ -0,0 +1,23 @@
Namespace Winline
Public Class Mandator
Public Property Id As String
Public Property Name As String
Public Property Database As String
Public Property Server As String
Public Property Regex As String
Public Property Order As Integer
Public Property IsWhitelisted As Boolean
Public Overrides Function GetHashCode() As Integer
Return Id.GetHashCode()
End Function
Public Overrides Function Equals(obj As Object) As Boolean
Return DirectCast(obj, Mandator).Id = Id
End Function
Public Overrides Function ToString() As String
Return $"{Name} ({Id})"
End Function
End Class
End Namespace

View File

@@ -0,0 +1,13 @@
Namespace Winline
Public Class TemplateColumn
Public Name As String
Public Root As String
Public Type As String
Public IsHead As Boolean
Public Template As String
Public [ReadOnly] As Boolean
Public Visible As Boolean
Public [Function] As Constants.XmlFunction
End Class
End Namespace

View File

@@ -0,0 +1,259 @@
Imports System.Xml
Imports System.Net
Imports System.Net.Http
Imports System.Globalization
Imports AutoMapper
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Filesystem
Imports MultiTool.Shared.Documents
Imports System.Text
Namespace Winline
Public Class WebService
Inherits BaseClass
Private ReadOnly Config As Config
Private ReadOnly Serializer As Serializer
Private ReadOnly Mapper As AutoMapper.Mapper
Private ReadOnly FileEx As File
Public Sub New(pLogConfig As LogConfig, pConfig As Config)
MyBase.New(pLogConfig, pLogConfig.GetLogger())
FileEx = New File(pLogConfig)
Serializer = New Serializer(pLogConfig)
Config = pConfig
'Mapper = MapperFactory.GetMapper()
End Sub
Public Async Function TransferDocumentToWinline(pDocument As Document) As Task(Of Boolean)
Dim oBytes As Byte() = GetBytesFromDocument(pDocument)
Dim oWS As Config.WebServiceConfig = Config.Webservice
' --- Get and create path for request/response files
Dim oPath As String = GetBaseWebServicePath()
If IO.Directory.Exists(oPath) = False Then
IO.Directory.CreateDirectory(oPath)
End If
' --- Build all teh filenamez and pathz
Dim oBaseFileName As String = GetBaseFilenameForRequest()
Dim oFileName = GetXmlFilenameWithSuffix(oBaseFileName, "Request", "xml")
' Relative Path for Webservice Call
Dim oImportRelativeFilePath = IO.Path.Combine(GetDateSubDirectoryPath(Config.Webservice.ImportRelativePath), oFileName)
' Absolute Path to copy Request file
Dim oImportAbsolutePath = IO.Path.Combine(Config.Webservice.ImportBasePath, Config.Webservice.ImportRelativePath)
Dim oImportAbsoluteFilePath = IO.Path.Combine(GetDateSubDirectoryPath(oImportAbsolutePath), oFileName)
' --- Serialize Data into XML string
Dim oOutputFilePath = IO.Path.Combine(GetBaseWebServicePath(), oFileName)
IO.File.WriteAllBytes(oOutputFilePath, oBytes)
' --- Copy file to Winline Import Directory
Try
IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True)
Catch ex As Exception
Logger.Error(ex)
Throw ex
End Try
' --- Prepare URL and HTTP Client
Dim oTemplateType = pDocument.TemplateType
Dim oTemplateName = pDocument.TemplateName
' ActionCode: Should this be a test or not?
' 0 = Testcall
' 1 = Real call
Dim oActionCode = 1
' Byref: Should data be supplied as file or as string?
' 0 = As String
' 1 = As File (relative to Winline Server directory)
Dim oByref = 1
Dim oURL As String = $"{oWS.BaseUrl}/ewlservice/import?User={oWS.Username}&Password={oWS.Password}&Company={pDocument.Mandator.Id}&Type={oTemplateType}&Vorlage={oTemplateName}&ActionCode={oActionCode}&Byref={oByref}&Data={oImportRelativeFilePath}"
Dim oClient As New HttpClient()
Logger.Info("Creating HTTP Request to [{0}]", oWS.BaseUrl)
' --- Bring the action!
Try
Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL)
Await HandleResponse(oResponse, oPath, oBaseFileName)
Return True
Catch ex As Exception
Logger.Error(ex)
Throw ex
Finally
oClient.Dispose()
End Try
End Function
Private Async Function HandleResponse(pResponse As HttpResponseMessage, pPath As String, pBaseFileNAme As String) As Task
pResponse.EnsureSuccessStatusCode()
Dim oResponseBody As String = Await pResponse.Content.ReadAsStringAsync()
Dim oContentType = pResponse.Content.Headers.ContentType.MediaType
Dim oSerializer = Serializer.GetSerializer(GetType(Schemas.MESOWebServiceResult))
Select Case oContentType
Case "text/xml"
WriteResponseFile(pPath, pBaseFileNAme, oResponseBody, "xml")
Dim oBytes As Byte() = Encoding.UTF8.GetBytes(oResponseBody)
Using oStream As New IO.MemoryStream(oBytes)
Dim oResponseObject As Schemas.MESOWebServiceResult = oSerializer.Deserialize(oStream)
Dim oErrorStrings As New List(Of String)
For Each oDetails As Schemas.MESOWebServiceResultResultDetails In oResponseObject.ResultDetails
If oDetails.Success = True Then
Logger.Info("KeyValue: [{0}]", oDetails.KeyValue)
Logger.Info("VoucherNumber: [{0}]", oDetails.VoucherNumber)
Else
Logger.Warn("ErrorCode: [{0}]", oDetails.ErrorCode)
Logger.Warn("ErrorText: [{0}]", oDetails.ErrorText)
oErrorStrings.Add($"[{oDetails.ErrorCode}] {oDetails.ErrorText}")
End If
Next
If oResponseObject.OverallSuccess = False Then
Dim oMessage = $"Request to Webservice was unsuccessful:{vbNewLine}{vbNewLine}{String.Join(vbNewLine, oErrorStrings.ToArray)}"
Throw New ApplicationException(oMessage)
End If
End Using
Case "text/html"
WriteResponseFile(pPath, pBaseFileNAme, oResponseBody, "txt")
Throw New ApplicationException(oResponseBody)
Case Else
Throw New ApplicationException(oResponseBody)
End Select
End Function
Private Function WriteResponseFile(pPath As String, pBaseFileName As String, pResponseBody As String, pExtension As String)
Try
Dim oRequestFileName As String = GetXmlFilenameWithSuffix(pBaseFileName, "Response", pExtension)
Dim oFilePath As String = IO.Path.Combine(pPath, oRequestFileName)
IO.File.WriteAllText(oFilePath, pResponseBody)
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Private Function GetBytesFromDocument(pDocument As Document) As Byte()
Dim oFilteredFields As New List(Of String) From {
"Fakt_Name",
"Lief_Name"
}
Using oStream As New IO.MemoryStream()
Dim w = XmlWriter.Create(oStream)
w.WriteStartDocument()
w.WriteStartElement("MESOWebService")
w.WriteAttributeString("Template", pDocument.TemplateName)
w.WriteAttributeString("TemplateType", pDocument.TemplateType)
w.WriteAttributeString("option", pDocument.Option)
w.WriteAttributeString("printVoucher", pDocument.PrintVoucher)
For Each oRow In pDocument.Rows
w.WriteStartElement(oRow.Name)
For Each oField As KeyValuePair(Of String, DocumentRow.FieldValue) In oRow.Fields
If oField.Value.Final = String.Empty Then
Continue For
End If
If oFilteredFields.Contains(oField.Key) Then
Continue For
End If
w.WriteStartElement(oField.Key)
w.WriteValue(oField.Value.Final)
w.WriteEndElement() ' Field
Next
w.WriteEndElement() ' Row
Next
w.WriteEndElement() ' MESOWebService
w.WriteEndDocument() ' Document
w.Close()
Return oStream.ToArray()
End Using
End Function
'Private Function TransformOrderToOutput(pData As Schemas.Orders.Input.MESOWebService) As Schemas.Orders.Output.MESOWebService
' Dim oData As Schemas.Orders.Input.MESOWebService = pData
' Dim oResult As Schemas.Orders.Output.MESOWebService = Mapper.Map(Of Schemas.Orders.Output.MESOWebService)(oData)
' Dim oItems = oData.Items.
' Select(Function(i)
' If TypeOf i Is Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT025 Then
' Return Mapper.Map(Of Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT025)(i)
' Else
' Return Mapper.Map(Of Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT026)(i)
' End If
' End Function).
' ToList()
' oResult.Items = oItems.ToArray()
' Return oResult
'End Function
'Private Function SerializeOrder(pData As Schemas.Orders.Output.MESOWebService, pFileName As String) As String
' Dim oSerializer = Serializer.GetSerializer(GetType(Schemas.Orders.Output.MESOWebService))
' Dim oPath As String = GetBaseWebServicePath()
' Dim oFilePath As String = IO.Path.Combine(oPath, pFileName)
' Using oWriter = XmlWriter.Create(oFilePath, New XmlWriterSettings With {.Indent = True})
' oSerializer.Serialize(oWriter, pData)
' End Using
' Return oFilePath
'End Function
Private Function GetBaseWebServicePath() As String
Return IO.Path.Combine(FileEx.GetAppDataPath("Digital Data", "EDI Document Importer"), "WebService")
End Function
Private Function GetBaseFilenameForRequest() As String
Return $"{Now:yyyy-MM-dd_hh-mm-ffff}"
End Function
Private Function GetXmlFilenameWithSuffix(pBaseString As String, pSuffix As String, pExtension As String)
Return $"{pBaseString}-{pSuffix}.{pExtension}"
End Function
Private Function GetDateSubDirectoryPath(pBasePath As String)
Dim oDirectoryPath As String = Now.ToString("yyyy\\MM\\dd")
Dim oFullPath As String = IO.Path.Combine(pBasePath, oDirectoryPath)
If IO.Directory.Exists(oFullPath) = False Then
Try
IO.Directory.CreateDirectory(oFullPath)
Return oFullPath
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
Else
Return oFullPath
End If
End Function
End Class
End Namespace

View File

@@ -0,0 +1,43 @@
Imports DigitalData.Modules.Logging
Public Class XmlData
'<DebuggerStepThrough>
Public Shared Function GetElementAttribute(pElement As XElement, pName As String) As String
Try
Dim oAttribute As XAttribute = pElement.Attribute(pName)
Return oAttribute?.Value
Catch ex As Exception
Return Nothing
End Try
End Function
Public Shared Function GetElementsFromElement(pElement As XContainer, pElementName As String) As List(Of XElement)
Return pElement.Descendants(pElementName).
Elements().
ToList()
End Function
Public Shared Function GetElementsFromElement(pElement As XContainer, pElementName As String, pNamespace As XNamespace) As List(Of XElement)
Return pElement.Descendants(pNamespace + pElementName).
Elements().
ToList()
End Function
Public Shared Function GetElement(pContainer As XContainer, pElementName As String, pNamespace As XNamespace) As XElement
Return pContainer.Descendants(pNamespace + pElementName).
FirstOrDefault()
End Function
Public Shared Function GetElement(pContainer As XContainer, pElementName As String) As XElement
Return pContainer.Descendants(pElementName).
FirstOrDefault()
End Function
Public Shared Function GetElementValue(pElement As XElement) As String
Return pElement.Value
End Function
End Class

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="10.1.1" targetFramework="net461" />
<package id="NLog" version="4.7.10" targetFramework="net461" />
</packages>