move test guis to GUIs.Test folders
This commit is contained in:
103
GUIs.Test.ZUGFeRDTest/Form1.vb
Normal file
103
GUIs.Test.ZUGFeRDTest/Form1.vb
Normal file
@@ -0,0 +1,103 @@
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Xml
|
||||
Imports DigitalData.Modules
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Jobs
|
||||
Imports DigitalData.Modules.Jobs.ImportZUGFeRDFiles
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Form1
|
||||
Private _logConfig As LogConfig
|
||||
Private _firebird As Firebird
|
||||
Private _zugferd As ZUGFeRDInterface
|
||||
|
||||
Private PropertyMap As New Dictionary(Of String, XmlItemProperty)
|
||||
|
||||
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
_logConfig = New LogConfig(LogConfig.PathType.CurrentDirectory)
|
||||
_logConfig.Debug = True
|
||||
_firebird = New Firebird(_logConfig, My.Settings.FB_DATASOURCE, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PASS)
|
||||
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig)
|
||||
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.WatchDirectories.Add(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")
|
||||
End Select
|
||||
Next
|
||||
|
||||
Return args
|
||||
End Function
|
||||
|
||||
Private Function LoadPropertyMapFor(args As WorkerArgs, specification As String)
|
||||
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE SPECIFICATION = '{specification}' AND ACTIVE = True"
|
||||
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
|
||||
|
||||
For Each row As DataRow In oResult.Rows
|
||||
Dim xmlPath = row.Item("XML_PATH")
|
||||
Dim tableName = row.Item("TABLE_NAME")
|
||||
Dim description = row.Item("DESCRIPTION")
|
||||
Dim isRequired = row.Item("IS_REQUIRED")
|
||||
|
||||
args.PropertyMap.Add(xmlPath, New XmlItemProperty() With {
|
||||
.Description = description,
|
||||
.TableName = tableName,
|
||||
.IsRequired = isRequired
|
||||
})
|
||||
Next
|
||||
|
||||
Return args
|
||||
End Function
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Dim args As New WorkerArgs()
|
||||
args = LoadFolderConfig(args)
|
||||
args = LoadPropertyMapFor(args, "DEFAULT")
|
||||
|
||||
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _firebird)
|
||||
|
||||
job.Start(args)
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
_zugferd.ValidateZUGFeRDFile(OpenFileDialog1.FileName)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
Dim oDoc = _zugferd.ValidateZUGFeRDFile(OpenFileDialog1.FileName)
|
||||
Dim oZUGFERD = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
Console.WriteLine()
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user