Migrate configuration from UserConfig to database
This commit is contained in:
parent
ac50cf661b
commit
cdff23b646
@ -6,5 +6,6 @@ Namespace My
|
|||||||
Friend Property TemplateConfiguration As TemplateConfig
|
Friend Property TemplateConfiguration As TemplateConfig
|
||||||
Friend Property MappingConfiguration As MappingConfig
|
Friend Property MappingConfiguration As MappingConfig
|
||||||
Friend Property MandatorConfiguration As MandatorConfig
|
Friend Property MandatorConfiguration As MandatorConfig
|
||||||
|
Friend Property GeneralConfiguration As GeneralConfig
|
||||||
End Module
|
End Module
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|||||||
@ -30,29 +30,19 @@ Public Class frmConfig
|
|||||||
TBEDI_XML_ITEMSTableAdapter.Connection.ConnectionString = oBuilder.ToString()
|
TBEDI_XML_ITEMSTableAdapter.Connection.ConnectionString = oBuilder.ToString()
|
||||||
TBEDI_XML_ITEMSTableAdapter.Fill(Me.DS_DD_ECM.TBEDI_XML_ITEMS)
|
TBEDI_XML_ITEMSTableAdapter.Fill(Me.DS_DD_ECM.TBEDI_XML_ITEMS)
|
||||||
|
|
||||||
txtInputDir.EditValue = Config.InputDirectory
|
txtInputDir.EditValue = My.GeneralConfiguration.InputDirectory
|
||||||
txtOutputDir.EditValue = Config.OutputDirectory
|
txtOutputDir.EditValue = My.GeneralConfiguration.OutputDirectory
|
||||||
txtSchemaDir.EditValue = Config.SchemaDirectory
|
txtSchemaDir.EditValue = My.GeneralConfiguration.TemplateDirectory
|
||||||
|
|
||||||
txtBaseURL.EditValue = Config.Webservice.BaseUrl
|
txtBaseURL.EditValue = My.GeneralConfiguration.Webservice.BaseUrl
|
||||||
txtUsername.EditValue = Config.Webservice.Username
|
txtUsername.EditValue = My.GeneralConfiguration.Webservice.Username
|
||||||
txtPassword.EditValue = Config.Webservice.Password
|
txtPassword.EditValue = My.GeneralConfiguration.Webservice.Password
|
||||||
txtImportBasePath.EditValue = Config.Webservice.ImportBasePath
|
txtImportBasePath.EditValue = My.GeneralConfiguration.Webservice.ImportBasePath
|
||||||
txtImportRelativePath.EditValue = Config.Webservice.ImportRelativePath
|
txtImportRelativePath.EditValue = My.GeneralConfiguration.Webservice.ImportRelativePath
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||||
Config.Webservice.BaseUrl = txtBaseURL.EditValue
|
|
||||||
Config.Webservice.Username = txtUsername.EditValue
|
|
||||||
Config.Webservice.Password = txtPassword.EditValue
|
|
||||||
Config.Webservice.ImportBasePath = txtImportBasePath.EditValue
|
|
||||||
Config.Webservice.ImportRelativePath = txtImportRelativePath.EditValue
|
|
||||||
|
|
||||||
Config.InputDirectory = txtInputDir.EditValue
|
|
||||||
Config.OutputDirectory = txtOutputDir.EditValue
|
|
||||||
Config.SchemaDirectory = txtSchemaDir.EditValue
|
|
||||||
|
|
||||||
ConfigManager.Save()
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
TBEDIXMLITEMSBindingSource.EndEdit()
|
TBEDIXMLITEMSBindingSource.EndEdit()
|
||||||
|
|||||||
@ -76,8 +76,8 @@ Public Class frmImportMain
|
|||||||
GridViewFiles.OptionsView.ShowAutoFilterRow = False
|
GridViewFiles.OptionsView.ShowAutoFilterRow = False
|
||||||
|
|
||||||
FileEx = New DigitalData.Modules.Filesystem.File(LogConfig)
|
FileEx = New DigitalData.Modules.Filesystem.File(LogConfig)
|
||||||
Winline = New WinlineData(LogConfig, Database, ConfigManager.Config, My.MappingConfiguration, My.MandatorConfiguration)
|
Winline = New WinlineData(LogConfig, Database, My.GeneralConfiguration, My.MappingConfiguration, My.MandatorConfiguration)
|
||||||
WebService = New WebServiceData(LogConfig, ConfigManager.Config, Application.UserAppDataPath)
|
WebService = New WebServiceData(LogConfig, My.GeneralConfiguration.Webservice, Application.UserAppDataPath)
|
||||||
AddHandler WebService.WebServiceProgress, AddressOf WebService_Progress
|
AddHandler WebService.WebServiceProgress, AddressOf WebService_Progress
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -239,7 +239,7 @@ Public Class frmImportMain
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
If DocumentLoader.LoadFiles(
|
If DocumentLoader.LoadFiles(
|
||||||
ConfigManager.Config.InputDirectory,
|
My.GeneralConfiguration.InputDirectory,
|
||||||
CurrentTemplate,
|
CurrentTemplate,
|
||||||
lookupMandator.EditValue
|
lookupMandator.EditValue
|
||||||
) Then
|
) Then
|
||||||
@ -418,7 +418,7 @@ Public Class frmImportMain
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnOpenInputDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenInputDirectory.ItemClick
|
Private Sub btnOpenInputDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenInputDirectory.ItemClick
|
||||||
TryOpenDirectory(ConfigManager.Config.InputDirectory, My.Resources.frmImportMainExtra.Eingangsverzeichnis)
|
TryOpenDirectory(My.GeneralConfiguration.InputDirectory, My.Resources.frmImportMainExtra.Eingangsverzeichnis)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnOpenOutputDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenOutputDirectory.ItemClick
|
Private Sub btnOpenOutputDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenOutputDirectory.ItemClick
|
||||||
@ -427,7 +427,7 @@ Public Class frmImportMain
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnOpenSchemaDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenSchemaDirectory.ItemClick
|
Private Sub btnOpenSchemaDirectory_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenSchemaDirectory.ItemClick
|
||||||
TryOpenDirectory(ConfigManager.Config.SchemaDirectory, My.Resources.frmImportMainExtra.Vorlagenverzeichnis)
|
TryOpenDirectory(My.GeneralConfiguration.TemplateDirectory, My.Resources.frmImportMainExtra.Vorlagenverzeichnis)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub TryOpenDirectory(pPath As String, pDisplayName As String)
|
Private Sub TryOpenDirectory(pPath As String, pDisplayName As String)
|
||||||
|
|||||||
@ -53,6 +53,7 @@ Public Class frmMain
|
|||||||
|
|
||||||
' Initialize Schemas
|
' Initialize Schemas
|
||||||
TemplateLoader = New TemplateLoader(LogConfig, Database)
|
TemplateLoader = New TemplateLoader(LogConfig, Database)
|
||||||
|
Await TemplateLoader.LoadGeneralConfiguration()
|
||||||
Await TemplateLoader.LoadTemplates()
|
Await TemplateLoader.LoadTemplates()
|
||||||
Await TemplateLoader.LoadTemplateConfiguration()
|
Await TemplateLoader.LoadTemplateConfiguration()
|
||||||
Await TemplateLoader.LoadMappingConfiguration()
|
Await TemplateLoader.LoadMappingConfiguration()
|
||||||
@ -62,6 +63,7 @@ Public Class frmMain
|
|||||||
My.MappingConfiguration = TemplateLoader.MappingConfiguration
|
My.MappingConfiguration = TemplateLoader.MappingConfiguration
|
||||||
My.TemplateConfiguration = TemplateLoader.TemplateConfiguration
|
My.TemplateConfiguration = TemplateLoader.TemplateConfiguration
|
||||||
My.MandatorConfiguration = TemplateLoader.MandatorConfiguration
|
My.MandatorConfiguration = TemplateLoader.MandatorConfiguration
|
||||||
|
My.GeneralConfiguration = TemplateLoader.GeneralConfiguration
|
||||||
|
|
||||||
Dim oBindingSource = New BindingList(Of Template)
|
Dim oBindingSource = New BindingList(Of Template)
|
||||||
For Each oTemplate As Template In TemplateLoader.TemplateList
|
For Each oTemplate As Template In TemplateLoader.TemplateList
|
||||||
@ -84,7 +86,7 @@ Public Class frmMain
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oTemplate = TemplateLoader.UpdateTemplateFromFile(oTemplate, ConfigManager.Config.SchemaDirectory)
|
oTemplate = TemplateLoader.UpdateTemplateFromFile(oTemplate, My.GeneralConfiguration.TemplateDirectory)
|
||||||
oTemplate = TemplateLoader.UpdateTemplateFromDatabase(oTemplate, TemplateLoader.TemplateConfiguration)
|
oTemplate = TemplateLoader.UpdateTemplateFromDatabase(oTemplate, TemplateLoader.TemplateConfiguration)
|
||||||
|
|
||||||
If oTemplate.IsImport Then
|
If oTemplate.IsImport Then
|
||||||
|
|||||||
@ -3,36 +3,4 @@
|
|||||||
Public Class Config
|
Public Class Config
|
||||||
<ConnectionString>
|
<ConnectionString>
|
||||||
Public Property ConnectionString As String = ""
|
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
|
End Class
|
||||||
|
|||||||
@ -306,48 +306,25 @@ Namespace Documents
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If oFunctionName = "EAN" Then
|
If oFunctionName = "EAN" Then
|
||||||
Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(oField.Key)
|
SetArticleByEAN(oRow, pMandator, oField.Key)
|
||||||
Dim oArticleNumber = Winline.TryGetArticleNumber(oNumberItem.Original, pMandator)
|
|
||||||
If oArticleNumber IsNot Nothing Then
|
|
||||||
oNumberItem.External = oArticleNumber
|
|
||||||
oNumberItem.Final = oArticleNumber
|
|
||||||
Else
|
|
||||||
oNumberItem.Error = DocumentRow.FieldError.ArticleNotFound
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
|
|
||||||
'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
|
|
||||||
' Else
|
|
||||||
' oNumberItem.Error = DocumentRow.FieldError.ArticleNotFound
|
|
||||||
' End If
|
|
||||||
' End Sub).
|
|
||||||
' ToList()
|
|
||||||
|
|
||||||
'Dim oList As New List(Of DocumentRow) From {oHead}
|
|
||||||
'pDocument.Rows = oList.Concat(oPositions).ToList()
|
|
||||||
|
|
||||||
Return pDocument
|
Return pDocument
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Sub SetArticleByEAN(pRow As DocumentRow, pMandator As Mandator, pArticleField As String)
|
||||||
|
Dim oNumberItem As DocumentRow.FieldValue = pRow.Fields.GetOrDefault(pArticleField)
|
||||||
|
Dim oArticleNumber = Winline.TryGetArticleNumber(oNumberItem.Original, pMandator)
|
||||||
|
If oArticleNumber IsNot Nothing Then
|
||||||
|
oNumberItem.External = oArticleNumber
|
||||||
|
oNumberItem.Final = oArticleNumber
|
||||||
|
Else
|
||||||
|
oNumberItem.Error = DocumentRow.FieldError.ArticleNotFound
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub SetAccountByGLN(oRow As DocumentRow, pMandator As Mandator, pNumberField As String, pNameField As String)
|
Private Sub SetAccountByGLN(oRow As DocumentRow, pMandator As Mandator, pNumberField As String, pNameField As String)
|
||||||
' Try to read the Account number (which is a GLN really) and account Name
|
' Try to read the Account number (which is a GLN really) and account Name
|
||||||
Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(pNumberField)
|
Dim oNumberItem As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(pNumberField)
|
||||||
|
|||||||
@ -124,6 +124,7 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Templates\GeneralConfig.vb" />
|
||||||
<Compile Include="Templates\MandatorConfig.vb" />
|
<Compile Include="Templates\MandatorConfig.vb" />
|
||||||
<Compile Include="Templates\MandatorConfigItem.vb" />
|
<Compile Include="Templates\MandatorConfigItem.vb" />
|
||||||
<Compile Include="Templates\MappingConfig.vb" />
|
<Compile Include="Templates\MappingConfig.vb" />
|
||||||
|
|||||||
27
MultiTool.Shared/Templates/GeneralConfig.vb
Normal file
27
MultiTool.Shared/Templates/GeneralConfig.vb
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
Namespace Templates
|
||||||
|
Public Class GeneralConfig
|
||||||
|
Public Property InputDirectory As String = ""
|
||||||
|
Public Property OutputDirectory As String = ""
|
||||||
|
Public Property TemplateDirectory 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
|
||||||
|
|
||||||
|
<DebuggerStepThrough>
|
||||||
|
Public Function GetYear() As Integer
|
||||||
|
If DefaultYearOverride > 0 Then
|
||||||
|
Return DefaultYearOverride
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return Now.Year
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
@ -12,13 +12,15 @@ Namespace Templates
|
|||||||
Public Property TemplateConfiguration As New TemplateConfig
|
Public Property TemplateConfiguration As New TemplateConfig
|
||||||
Public Property MappingConfiguration As New MappingConfig
|
Public Property MappingConfiguration As New MappingConfig
|
||||||
Public Property MandatorConfiguration As New MandatorConfig
|
Public Property MandatorConfiguration As New MandatorConfig
|
||||||
|
Public Property GeneralConfiguration As New GeneralConfig
|
||||||
|
|
||||||
Private ReadOnly Database As MSSQLServer
|
Private ReadOnly Database As MSSQLServer
|
||||||
|
|
||||||
Private Const VWEDI_XML_ITEMS = "VWEDI_XML_ITEMS"
|
Private Const SQL_VWEDI_XML_ITEMS = "SELECT * FROM [DD_ECM].[dbo].[VWEDI_XML_ITEMS]"
|
||||||
Private Const VWEDI_XML_MAPPING = "VWEDI_XML_MAPPING"
|
Private Const SQL_VWEDI_XML_MAPPING = "SELECT * FROM [DD_ECM].[dbo].[VWEDI_XML_MAPPING]"
|
||||||
Private Const TBEDI_XML_MANDATORS = "TBEDI_XML_MANDATORS"
|
Private Const SQL_TBEDI_XML_MANDATORS = "SELECT * FROM [DD_ECM].[dbo].[TBEDI_XML_MANDATORS] ORDER BY ORDER_KEY"
|
||||||
Private Const TBEDI_XML_TEMPLATES = "TBEDI_XML_TEMPLATES"
|
Private Const SQL_TBEDI_XML_CONFIG = "SELECT * FROM [DD_ECM].[dbo].[TBEDI_XML_CONFIG]"
|
||||||
|
Private Const SQL_TBEDI_XML_TEMPLATES = "SELECT * FROM [DD_ECM].[dbo].[TBEDI_XML_TEMPLATES]"
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pMSSQL As MSSQLServer)
|
Public Sub New(pLogConfig As LogConfig, pMSSQL As MSSQLServer)
|
||||||
MyBase.New(pLogConfig, pLogConfig.GetLogger)
|
MyBase.New(pLogConfig, pLogConfig.GetLogger)
|
||||||
@ -27,8 +29,7 @@ Namespace Templates
|
|||||||
|
|
||||||
Public Async Function LoadTemplates() As Task(Of Boolean)
|
Public Async Function LoadTemplates() As Task(Of Boolean)
|
||||||
Try
|
Try
|
||||||
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{TBEDI_XML_TEMPLATES}]"
|
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_TBEDI_XML_TEMPLATES)
|
||||||
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
|
|
||||||
Dim oTemplates As New List(Of Template)
|
Dim oTemplates As New List(Of Template)
|
||||||
|
|
||||||
For Each oRow As DataRow In oTable.Rows
|
For Each oRow As DataRow In oTable.Rows
|
||||||
@ -52,10 +53,58 @@ Namespace Templates
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Async Function LoadGeneralConfiguration() As Task(Of Boolean)
|
||||||
|
Try
|
||||||
|
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_TBEDI_XML_CONFIG)
|
||||||
|
Dim oGeneralConfig As New GeneralConfig
|
||||||
|
|
||||||
|
For Each oRow As DataRow In oTable.Rows
|
||||||
|
Dim oValue As String = oRow.ItemEx("VALUE", String.Empty)
|
||||||
|
|
||||||
|
Select Case oRow.Item("KEY")
|
||||||
|
Case "YEAR_OVERRIDE"
|
||||||
|
oGeneralConfig.DefaultYearOverride = oRow.ItemEx("VALUE", 0)
|
||||||
|
|
||||||
|
Case "WEBSERVICE_BASEURL"
|
||||||
|
oGeneralConfig.Webservice.BaseUrl = oValue
|
||||||
|
|
||||||
|
Case "WEBSERVICE_USERNAME"
|
||||||
|
oGeneralConfig.Webservice.Username = oValue
|
||||||
|
|
||||||
|
Case "WEBSERIVCE_PASSWORD"
|
||||||
|
oGeneralConfig.Webservice.Password = oValue
|
||||||
|
|
||||||
|
Case "WEBSERVICE_IMPORT_BASE_PATH"
|
||||||
|
oGeneralConfig.Webservice.ImportBasePath = oValue
|
||||||
|
|
||||||
|
Case "WEBSERVICE_IMPORT_RELATIVE_PATH"
|
||||||
|
oGeneralConfig.Webservice.ImportRelativePath = oValue
|
||||||
|
|
||||||
|
Case "INPUT_DIRECTORY"
|
||||||
|
oGeneralConfig.InputDirectory = oValue
|
||||||
|
|
||||||
|
Case "OUTPUT_DIRECTORY"
|
||||||
|
oGeneralConfig.OutputDirectory = oValue
|
||||||
|
|
||||||
|
Case "TEMPLATE_DIRECTORY"
|
||||||
|
oGeneralConfig.TemplateDirectory = oValue
|
||||||
|
|
||||||
|
End Select
|
||||||
|
Next
|
||||||
|
|
||||||
|
GeneralConfiguration = oGeneralConfig
|
||||||
|
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
Return False
|
||||||
|
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Async Function LoadMappingConfiguration() As Task(Of Boolean)
|
Public Async Function LoadMappingConfiguration() As Task(Of Boolean)
|
||||||
Try
|
Try
|
||||||
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{VWEDI_XML_MAPPING}]"
|
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_VWEDI_XML_MAPPING)
|
||||||
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
|
|
||||||
Dim oMappingConfig As New MappingConfig
|
Dim oMappingConfig As New MappingConfig
|
||||||
|
|
||||||
For Each oRow As DataRow In oTable.Rows
|
For Each oRow As DataRow In oTable.Rows
|
||||||
@ -84,8 +133,7 @@ Namespace Templates
|
|||||||
|
|
||||||
Public Async Function LoadMandatorConfiguration() As Task(Of Boolean)
|
Public Async Function LoadMandatorConfiguration() As Task(Of Boolean)
|
||||||
Try
|
Try
|
||||||
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{TBEDI_XML_MANDATORS}] ORDER BY ORDER_KEY"
|
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_TBEDI_XML_MANDATORS)
|
||||||
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
|
|
||||||
Dim oMandatorConfig As New MandatorConfig
|
Dim oMandatorConfig As New MandatorConfig
|
||||||
|
|
||||||
For Each oRow As DataRow In oTable.Rows
|
For Each oRow As DataRow In oTable.Rows
|
||||||
@ -109,8 +157,7 @@ Namespace Templates
|
|||||||
|
|
||||||
Public Async Function LoadTemplateConfiguration() As Task(Of Boolean)
|
Public Async Function LoadTemplateConfiguration() As Task(Of Boolean)
|
||||||
Try
|
Try
|
||||||
Dim oSql = $"SELECT * FROM [DD_ECM].[dbo].[{VWEDI_XML_ITEMS}]"
|
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_VWEDI_XML_ITEMS)
|
||||||
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSql)
|
|
||||||
Dim oItems As New List(Of TemplateConfigItem)
|
Dim oItems As New List(Of TemplateConfigItem)
|
||||||
|
|
||||||
For Each oRow As DataRow In oTable.Rows
|
For Each oRow As DataRow In oTable.Rows
|
||||||
|
|||||||
@ -3,28 +3,29 @@ Imports System.Text
|
|||||||
Imports System.Net.Http
|
Imports System.Net.Http
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
Imports MultiTool.Shared.Documents
|
Imports MultiTool.Shared.Documents
|
||||||
|
Imports MultiTool.Shared.Templates.GeneralConfig
|
||||||
Imports MultiTool.Shared.Winline.Entities
|
Imports MultiTool.Shared.Winline.Entities
|
||||||
|
|
||||||
Namespace Winline
|
Namespace Winline
|
||||||
Public Class WebServiceData
|
Public Class WebServiceData
|
||||||
Inherits BaseClass
|
Inherits BaseClass
|
||||||
|
|
||||||
Private ReadOnly Config As Config
|
Private ReadOnly Config As WebServiceConfig
|
||||||
Private ReadOnly Serializer As Serializer
|
Private ReadOnly Serializer As Serializer
|
||||||
Private ReadOnly AppDataPath As String
|
Private ReadOnly AppDataPath As String
|
||||||
|
|
||||||
Public Event WebServiceProgress As EventHandler(Of String)
|
Public Event WebServiceProgress As EventHandler(Of String)
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pConfig As Config, pAppDataPath As String)
|
Public Sub New(pLogConfig As LogConfig, pWebserviceConfig As WebServiceConfig, pAppDataPath As String)
|
||||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||||
Serializer = New Serializer(pLogConfig)
|
Serializer = New Serializer(pLogConfig)
|
||||||
Config = pConfig
|
Config = pWebserviceConfig
|
||||||
AppDataPath = pAppDataPath
|
AppDataPath = pAppDataPath
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Async Function TransferDocumentToWinline(pDocument As Document, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean)
|
Public Async Function TransferDocumentToWinline(pDocument As Document, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean)
|
||||||
Dim oBytes As Byte() = GetBytesFromDocument(pDocument)
|
Dim oBytes As Byte() = GetBytesFromDocument(pDocument)
|
||||||
Dim oWS As Config.WebServiceConfig = Config.Webservice
|
Dim oWS = Config
|
||||||
|
|
||||||
' --- Get and create path for request/response files
|
' --- Get and create path for request/response files
|
||||||
|
|
||||||
@ -41,10 +42,10 @@ Namespace Winline
|
|||||||
Dim oFileName = GetXmlFilenameWithSuffix(oBaseFileName, "Request", "xml")
|
Dim oFileName = GetXmlFilenameWithSuffix(oBaseFileName, "Request", "xml")
|
||||||
|
|
||||||
' Relative Path for Webservice Call
|
' Relative Path for Webservice Call
|
||||||
Dim oImportRelativeFilePath = IO.Path.Combine(GetDateSubDirectoryPath(Config.Webservice.ImportRelativePath), oFileName)
|
Dim oImportRelativeFilePath = IO.Path.Combine(GetDateSubDirectoryPath(oWS.ImportRelativePath), oFileName)
|
||||||
|
|
||||||
' Absolute Path to copy Request file
|
' Absolute Path to copy Request file
|
||||||
Dim oImportAbsolutePath = IO.Path.Combine(Config.Webservice.ImportBasePath, Config.Webservice.ImportRelativePath)
|
Dim oImportAbsolutePath = IO.Path.Combine(oWS.ImportBasePath, oWS.ImportRelativePath)
|
||||||
Dim oImportAbsoluteFilePath = IO.Path.Combine(GetDateSubDirectoryPath(oImportAbsolutePath), oFileName)
|
Dim oImportAbsoluteFilePath = IO.Path.Combine(GetDateSubDirectoryPath(oImportAbsolutePath), oFileName)
|
||||||
|
|
||||||
' --- Serialize Data into XML string
|
' --- Serialize Data into XML string
|
||||||
|
|||||||
@ -9,19 +9,19 @@ Namespace Winline
|
|||||||
Public Class WinlineData
|
Public Class WinlineData
|
||||||
Inherits BaseClass
|
Inherits BaseClass
|
||||||
|
|
||||||
Private ReadOnly Database As MSSQLServer
|
Private ReadOnly Property Database As MSSQLServer
|
||||||
Private ReadOnly Config As Config
|
Private ReadOnly Property Config As GeneralConfig
|
||||||
Private ReadOnly MandatorConfig As MandatorConfig
|
Private ReadOnly Property MandatorConfig As MandatorConfig
|
||||||
Private ReadOnly MappingConfig As MappingConfig
|
Private ReadOnly Property MappingConfig As MappingConfig
|
||||||
|
|
||||||
Public Articles As New List(Of Article)
|
Public Property Articles As New List(Of Article)
|
||||||
Public Accounts As New List(Of Account)
|
Public Property Accounts As New List(Of Account)
|
||||||
Public Mandators As New List(Of Mandator)
|
Public Property Mandators As New List(Of Mandator)
|
||||||
Public DocumentKinds As New List(Of DocumentKind)
|
Public Property DocumentKinds As New List(Of DocumentKind)
|
||||||
|
|
||||||
Public Years As List(Of Integer)
|
Public Years As List(Of Integer)
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config, pMappingConfig As MappingConfig, pMandatorConfig As MandatorConfig)
|
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As GeneralConfig, pMappingConfig As MappingConfig, pMandatorConfig As MandatorConfig)
|
||||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||||
Database = pDatabase
|
Database = pDatabase
|
||||||
Config = pConfig
|
Config = pConfig
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user