zugferd test
This commit is contained in:
@@ -12,6 +12,7 @@ Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Form1
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _firebird As Firebird
|
||||
Private _mssql As MSSQLServer
|
||||
Private _zugferd As ZUGFeRDInterface
|
||||
@@ -23,82 +24,61 @@ Public Class Form1
|
||||
_logConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath & "\Log", Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName) With {
|
||||
.Debug = True
|
||||
}
|
||||
_logger = _logConfig.GetLogger()
|
||||
_mssql = New MSSQLServer(_logConfig, My.Settings.MSSQL_CONNECTIONSTRING)
|
||||
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig, "21182889975216572111813147150675976632")
|
||||
End Sub
|
||||
|
||||
Private Function LoadFolderConfig(args As WorkerArgs)
|
||||
Dim oSQL As String = "SELECT T1.FOLDER_TYPE, T.FOLDER_PATH FROM TBEDM_FOLDER T, TBEDM_FOLDER_TYPE T1 WHERE T.FOLDER_TYPE_ID = T1.GUID AND T1.""ACTIVE"" = True AND T.""ACTIVE"" = True"
|
||||
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
|
||||
|
||||
For Each row As DataRow In oResult.Rows
|
||||
Dim oFolderType = row.Item("FOLDER_TYPE")
|
||||
|
||||
Select Case oFolderType
|
||||
Case ZUGFERD_IN
|
||||
args.WatchDirectory = row.Item("FOLDER_PATH")
|
||||
|
||||
Case ZUGFERD_SUCCESS
|
||||
args.SuccessDirectory = row.Item("FOLDER_PATH")
|
||||
|
||||
Case ZUGFERD_ERROR
|
||||
args.ErrorDirectory = row.Item("FOLDER_PATH")
|
||||
|
||||
Case ZUGFERD_EML
|
||||
args.OriginalEmailDirectory = row.Item("FOLDER_PATH")
|
||||
|
||||
Case ZUGFERD_REJECTED_EML
|
||||
args.RejectedEmailDirectory = row.Item("FOLDER_PATH")
|
||||
|
||||
Case ZUGFERD_ATTACHMENTS
|
||||
args.AttachmentsSubDirectory = row.Item("FOLDER_PATH")
|
||||
End Select
|
||||
Next
|
||||
|
||||
Return args
|
||||
End Function
|
||||
|
||||
Private Function LoadPropertyMapFor(Args As WorkerArgs)
|
||||
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE ACTIVE = True ORDER BY XML_PATH"
|
||||
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
|
||||
Try
|
||||
Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH"
|
||||
Dim oResult As DataTable = _mssql.GetDatatable(oSQL)
|
||||
|
||||
For Each oRow As DataRow In oResult.Rows
|
||||
Dim xmlPath = oRow.Item("XML_PATH")
|
||||
Dim tableName = oRow.Item("TABLE_NAME")
|
||||
Dim tableColumn = oRow.Item("TABLE_COLUMN")
|
||||
Dim description = oRow.Item("DESCRIPTION")
|
||||
Dim isRequired = oRow.Item("IS_REQUIRED")
|
||||
Dim isGrouped = oRow.Item("IS_GROUPED")
|
||||
Dim groupScope = oRow.Item("GROUP_SCOPE")
|
||||
Dim specification = oRow.Item("SPECIFICATION")
|
||||
For Each oRow As DataRow In oResult.Rows
|
||||
Dim xmlPath = oRow.Item("XML_PATH")
|
||||
Dim tableName = oRow.Item("TABLE_NAME")
|
||||
Dim tableColumn = oRow.Item("TABLE_COLUMN")
|
||||
Dim description = oRow.Item("DESCRIPTION")
|
||||
Dim isRequired = oRow.Item("IS_REQUIRED")
|
||||
Dim isGrouped = oRow.Item("IS_GROUPED")
|
||||
Dim groupScope = oRow.Item("GROUP_SCOPE")
|
||||
Dim specification = oRow.Item("SPECIFICATION")
|
||||
|
||||
Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With {
|
||||
.Description = description,
|
||||
.TableName = tableName,
|
||||
.TableColumn = tableColumn,
|
||||
.IsRequired = isRequired,
|
||||
.IsGrouped = isGrouped,
|
||||
.GroupScope = groupScope,
|
||||
.Specification = specification
|
||||
})
|
||||
Next
|
||||
Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With {
|
||||
.Description = description,
|
||||
.TableName = tableName,
|
||||
.TableColumn = tableColumn,
|
||||
.IsRequired = isRequired,
|
||||
.IsGrouped = isGrouped,
|
||||
.GroupScope = groupScope,
|
||||
.Specification = specification
|
||||
})
|
||||
Next
|
||||
|
||||
Return Args
|
||||
Return Args
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return Args
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Dim args As New WorkerArgs() With {
|
||||
.MaxAttachmentSizeInMegaBytes = 10,
|
||||
.IgnoreRejectionStatus = False,
|
||||
.NamePortal = "TEST FROM FORM"
|
||||
}
|
||||
args = LoadFolderConfig(args)
|
||||
args = LoadPropertyMapFor(args)
|
||||
Dim oResult = FolderBrowserDialog1.ShowDialog()
|
||||
|
||||
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _mssql)
|
||||
If oResult = DialogResult.OK Then
|
||||
Dim args As New WorkerArgs() With {
|
||||
.MaxAttachmentSizeInMegaBytes = 10,
|
||||
.IgnoreRejectionStatus = False,
|
||||
.NamePortal = "TEST FROM FORM",
|
||||
.WatchDirectory = FolderBrowserDialog1.SelectedPath
|
||||
}
|
||||
args = LoadPropertyMapFor(args)
|
||||
|
||||
job.Start(args)
|
||||
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _mssql)
|
||||
|
||||
job.Start(args)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
@@ -192,10 +172,6 @@ Public Class Form1
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
|
||||
Process.Start("\\dd-sto01\DD-DFSR01\SharedObjects\Public\Projekte\Test\Import\ZUGFerD\Email_in")
|
||||
End Sub
|
||||
|
||||
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user