diff --git a/Controls.DocumentViewer/DocumentViewer.Designer.vb b/Controls.DocumentViewer/DocumentViewer.Designer.vb index 22527f3c..9d82beb5 100644 --- a/Controls.DocumentViewer/DocumentViewer.Designer.vb +++ b/Controls.DocumentViewer/DocumentViewer.Designer.vb @@ -58,6 +58,7 @@ Partial Class DocumentViewer Me.statusLabel = New System.Windows.Forms.ToolStripStatusLabel() Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog() Me.RichEditControl1 = New DevExpress.XtraRichEdit.RichEditControl() + Me.SpreadsheetControl1 = New DevExpress.XtraSpreadsheet.SpreadsheetControl() Me.mainToolStrip.SuspendLayout() Me.statusbar.SuspendLayout() Me.SuspendLayout() @@ -195,7 +196,7 @@ Partial Class DocumentViewer ' Me.DefaultToolStripMenuItem.CheckOnClick = True Me.DefaultToolStripMenuItem.Name = "DefaultToolStripMenuItem" - Me.DefaultToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.DefaultToolStripMenuItem.Size = New System.Drawing.Size(151, 22) Me.DefaultToolStripMenuItem.Text = "Default" ' 'PanToolStripMenuItem @@ -204,28 +205,28 @@ Partial Class DocumentViewer Me.PanToolStripMenuItem.CheckOnClick = True Me.PanToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked Me.PanToolStripMenuItem.Name = "PanToolStripMenuItem" - Me.PanToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.PanToolStripMenuItem.Size = New System.Drawing.Size(151, 22) Me.PanToolStripMenuItem.Text = "Pan" ' 'AreaSelectionToolStripMenuItem ' Me.AreaSelectionToolStripMenuItem.CheckOnClick = True Me.AreaSelectionToolStripMenuItem.Name = "AreaSelectionToolStripMenuItem" - Me.AreaSelectionToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.AreaSelectionToolStripMenuItem.Size = New System.Drawing.Size(151, 22) Me.AreaSelectionToolStripMenuItem.Text = "Area selection" ' 'AreaZoomingToolStripMenuItem ' Me.AreaZoomingToolStripMenuItem.CheckOnClick = True Me.AreaZoomingToolStripMenuItem.Name = "AreaZoomingToolStripMenuItem" - Me.AreaZoomingToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.AreaZoomingToolStripMenuItem.Size = New System.Drawing.Size(151, 22) Me.AreaZoomingToolStripMenuItem.Text = "Area zooming" ' 'MagnifierToolStripMenuItem ' Me.MagnifierToolStripMenuItem.CheckOnClick = True Me.MagnifierToolStripMenuItem.Name = "MagnifierToolStripMenuItem" - Me.MagnifierToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.MagnifierToolStripMenuItem.Size = New System.Drawing.Size(151, 22) Me.MagnifierToolStripMenuItem.Text = "Magnifier" ' 'ToolStripSeparator6 @@ -410,20 +411,31 @@ Partial Class DocumentViewer ' 'RichEditControl1 ' - Me.RichEditControl1.Location = New System.Drawing.Point(735, 313) + Me.RichEditControl1.Location = New System.Drawing.Point(735, 377) Me.RichEditControl1.Name = "RichEditControl1" Me.RichEditControl1.Options.HorizontalRuler.Visibility = DevExpress.XtraRichEdit.RichEditRulerVisibility.Hidden Me.RichEditControl1.Options.VerticalRuler.Visibility = DevExpress.XtraRichEdit.RichEditRulerVisibility.Hidden Me.RichEditControl1.ReadOnly = True - Me.RichEditControl1.Size = New System.Drawing.Size(249, 225) + Me.RichEditControl1.Size = New System.Drawing.Size(249, 161) Me.RichEditControl1.TabIndex = 8 Me.RichEditControl1.Text = "RichEditControl1" Me.RichEditControl1.Visible = False ' + 'SpreadsheetControl1 + ' + Me.SpreadsheetControl1.Location = New System.Drawing.Point(461, 377) + Me.SpreadsheetControl1.Name = "SpreadsheetControl1" + Me.SpreadsheetControl1.ReadOnly = True + Me.SpreadsheetControl1.Size = New System.Drawing.Size(268, 161) + Me.SpreadsheetControl1.TabIndex = 9 + Me.SpreadsheetControl1.Text = "SpreadsheetControl1" + Me.SpreadsheetControl1.Visible = False + ' 'DocumentViewer ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.SpreadsheetControl1) Me.Controls.Add(Me.RichEditControl1) Me.Controls.Add(Me.GdViewer) Me.Controls.Add(Me.statusbar) @@ -474,4 +486,5 @@ Partial Class DocumentViewer Friend WithEvents statusLabel As ToolStripStatusLabel Friend WithEvents OpenFileDialog As OpenFileDialog Friend WithEvents RichEditControl1 As DevExpress.XtraRichEdit.RichEditControl + Friend WithEvents SpreadsheetControl1 As DevExpress.XtraSpreadsheet.SpreadsheetControl End Class diff --git a/Controls.DocumentViewer/DocumentViewer.resx b/Controls.DocumentViewer/DocumentViewer.resx index 0c5f888b..967f33a5 100644 --- a/Controls.DocumentViewer/DocumentViewer.resx +++ b/Controls.DocumentViewer/DocumentViewer.resx @@ -124,13 +124,13 @@ iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFhSURBVEhLvVVBToRAEESNF/+kv+BIuPEAEgIXM4/wsnLQ - kx9gvRkf4oVw4AWb3XAQZ+yanXaHQcLsrlhJZao73V3TuxCCKeR5LokKZ1EUg5OJmGna/CCEuKQByhdH - GyRJcr2sgRA3C2/wqDeQUuoB9snkGDjK4K5Yq3NoxhxA7u9RFH3hqej7Xt3mFXElUYzT1nbOjaHBtm31 - 0xXH8WeWZS8w+Hn0/tLAzOy1ARMGXHgq+T9hLr2BHBh0XafEwys1VLp4b3bQds6NodHbNM20QVVVqq5r - iVtgVZy2tnNuDI3esizHBktysMGctnNuPKX/ZwMtDKCnbmTn3HhKY6BO2OQiX7hDWeNtxodlTYmRCeiL - 33qJPXFlfpgxUMR4fvtQTw6RY+C2+EiZVj/YBnM422BuA9SGYXhlWv3gbuC+uRwDp26wMf2zSNN0Ry0X - +05P0K3Io9hgkxluifemzUEQfAOjsN87/RDFYwAAAABJRU5ErkJggg== + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQ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0jVOS + wCam4YnsE1Q4pQ2a9qLJsfK0cUoS9LBnqPA2HXPBbkAP+IVT2iChTyYHorgyslmqv84p3YH7RrFtJLLo + +/5Z8k/TIB8692mv/QX2BJrkJyZDsZnSxFg7ruU7l/UGKmgYYbMas2Pjowmd6iaXb4xyubwDhZatdMRd + jZpsZ5mNQclpFNA1PUBcqVT20ZSLmBQ8rUu0dxB75L9j/p8/EP/F+Pj4NnY1SAQ/QN2AxO8xrUHcYXb7 + Bx2/AHG280yvg1TqD2SNZIrdoGvMAAAAAElFTkSuQmCC diff --git a/Controls.DocumentViewer/DocumentViewer.vb b/Controls.DocumentViewer/DocumentViewer.vb index 5d4b4d5a..681a36dd 100644 --- a/Controls.DocumentViewer/DocumentViewer.vb +++ b/Controls.DocumentViewer/DocumentViewer.vb @@ -2,8 +2,10 @@ Imports System.Globalization Imports System.Text.RegularExpressions Imports DigitalData.Modules.Logging +Imports Independentsoft.Msg +Imports DevExpress.Spreadsheet.DocumentFormat +Imports DevExpress.Spreadsheet Imports GdPicture14 -Imports Independentsoft Public Class DocumentViewer Private Enum ZoomMode @@ -17,14 +19,14 @@ Public Class DocumentViewer ZoomFitHeight End Enum - Private _docPath As String Private _currentSearchOccurence As Integer = 0 Private _toggleGamma As Boolean = True Private _licenseKey As String = String.Empty Private _licenseManager As New GdPicture14.LicenseManager() Private _logConfig As LogConfig Private _logger As Logger - Private _view_only As Boolean = False + + Private _hide_file_info_from_user As Boolean = False ' List of all created temp files when converting msg files Private _TempFiles As New List(Of String) @@ -67,7 +69,7 @@ Public Class DocumentViewer ''' Terminate Viewer, freeing up resources and deleting temp files ''' Public Sub Done() - _logger.Debug("(DocView)Called Done, removing temp files") + _logger.Warn("Called Done, removing temp files") DeleteTempFiles() 'Dispose() End Sub @@ -75,23 +77,19 @@ Public Class DocumentViewer ''' ''' Load a file and display it ''' - ''' - Public Sub LoadFile(filepath As String) + ''' + Public Sub LoadFile(FilePath As String) If _licenseKey = String.Empty Then - _logger.Warn("(DocView)License key was not provided. File {0} not loaded.", filepath) + _logger.Warn("License key was not provided. File {0} not loaded.", FilePath) Exit Sub End If GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter - _logger.Info("(DocView)Loading File {0}", filepath) + _logger.Info("Loading File {0}", FilePath) - DoLoadFile(filepath) - - If _view_only Then - statusLabel.Text = _docPath - End If + DoLoadFile(FilePath) UpdateMainUi() End Sub @@ -104,9 +102,9 @@ Public Class DocumentViewer Public Sub DeleteTempFiles() For Each oFile In _TempFiles Try - System.IO.File.Delete(oFile) + IO.File.Delete(oFile) Catch ex As Exception - _logger.Warn("(DocView)Could not delete temp file {0}", oFile) + _logger.Warn("Could not delete temp file {0}", oFile) End Try Next _TempFiles.Clear() @@ -114,16 +112,24 @@ Public Class DocumentViewer Private Sub DoLoadFile(FilePath As String) Try - Dim oFileInfo = New System.IO.FileInfo(FilePath) + Dim oFileInfo = New IO.FileInfo(FilePath) Dim oExtension As String = oFileInfo.Extension.ToUpper + RichEditControl1.Visible = False + RichEditControl1.Dock = DockStyle.None + + SpreadsheetControl1.Visible = False + SpreadsheetControl1.Dock = DockStyle.None + + mainToolStrip.Visible = False + Select Case oExtension.ToUpper Case ".MSG" - Dim oMsg As New Msg.Message(FilePath) + Dim oMsg As New Message(FilePath) ' TODO: Improve Encoding, maybe convert based on encoding oMsg.Encoding = System.Text.Encoding.UTF32 Dim oMime = oMsg.ConvertToMimeMessage() - Dim oTempFileName = System.IO.Path.GetTempFileName() + Dim oTempFileName = IO.Path.GetTempFileName() oMime.Save(oTempFileName, True) RichEditControl1.LoadDocument(oTempFileName, DevExpress.XtraRichEdit.DocumentFormat.Mht) @@ -132,21 +138,48 @@ Public Class DocumentViewer RichEditControl1.Visible = True RichEditControl1.Dock = DockStyle.Fill + + Me.infoLabel.Text = "Type: " & "MSG Email File" Case ".EML" RichEditControl1.LoadDocument(FilePath, DevExpress.XtraRichEdit.DocumentFormat.Mht) RichEditControl1.Visible = True RichEditControl1.Dock = DockStyle.Fill + + Me.infoLabel.Text = "Type: " & "EML Email File" + Case ".XLSX", ".XLS", "CSV" + Dim oFormat As DevExpress.Spreadsheet.DocumentFormat = Undefined + + Select Case oExtension.ToUpper + Case "XLSX" : oFormat = Xlsx + Case "XLS" : oFormat = Xls + Case "CSV" : oFormat = Csv + End Select + + SpreadsheetControl1.LoadDocument(FilePath, oFormat) + + Dim oRange = SpreadsheetControl1.ActiveWorksheet.GetUsedRange() + oRange.AutoFitColumns() + + SpreadsheetControl1.Visible = True + SpreadsheetControl1.Dock = DockStyle.Fill + + Me.infoLabel.Text = "Type: " & "Excel/CSV File" Case Else - _docPath = FilePath + _logger.Info("Displaying file {0}", FilePath) - _logger.Info("(DocView)Displaying file {0}", _docPath) + mainToolStrip.Visible = True - GdViewer.DisplayFromFile(_docPath) + GdViewer.DisplayFromFile(FilePath) - RichEditControl1.Visible = False - RichEditControl1.Dock = DockStyle.None + Me.infoLabel.Text = "Type: " & GetDocumentTypeLabel() End Select + + If _hide_file_info_from_user Then + statusLabel.Text = String.Empty + Else + statusLabel.Text = "Path: " & FilePath + End If Catch ex As Exception _logger.Error(ex) End Try @@ -183,14 +216,21 @@ Public Class DocumentViewer Return result End Function - Public Sub RightOnlyView(ValueRight As Boolean) - If ValueRight Then + ''' + ''' Configures the viewer to hide the file path to the end-user. + ''' + ''' + ''' True means that all file info should be hidden from the end-user + ''' False means the end user may see the filepath or other info about the file + ''' + Public Sub RightOnlyView(ViewOnly As Boolean) + If ViewOnly Then btnPrint.Visible = False Else btnPrint.Visible = True End If - _view_only = ValueRight + _hide_file_info_from_user = Not ViewOnly End Sub Private Sub UpdateMainUi() Exit Sub @@ -459,24 +499,6 @@ Public Class DocumentViewer btnLastPage.Enabled = True End If cbZoom.Text = String.Format(CultureInfo.InvariantCulture, "{0:#0.##%}", GdViewer.Zoom) - - - Dim widthInches, heightInches As Double - - If GdViewer.GetDocumentType = DocumentType.DocumentTypePDF Then - widthInches = GdViewer.PdfGetPageWidth / 72 - heightInches = GdViewer.PdfGetPageHeight / 72 - Else - widthInches = GdViewer.PageWidth / GdViewer.HorizontalResolution - heightInches = GdViewer.PageHeight / GdViewer.VerticalResolution - End If - - Me.infoLabel.Text = "Type: " + GetDocumentTypeLabel() + " - " + - "Pagesize (zoll): " + Trim(Str(Math.Round(widthInches, 2))) + " × " + Trim(Str(Math.Round(heightInches, 2))) + " - " + - "Pagesize (pixel): " + Trim(Str(GdViewer.PageWidth)) + " × " + Trim(Str(GdViewer.PageHeight)) + " - " + - "Horizontal resolution: " + Trim(Str(Math.Round(GdViewer.HorizontalResolution, 2))) + " DPI - " + - "Vertical resolution: " + Trim(Str(Math.Round(GdViewer.VerticalResolution, 2))) + " DPI" - End Sub Private Sub btnFitWidth_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnFitWidth.Click diff --git a/Controls.DocumentViewer/DocumentViewer.vbproj b/Controls.DocumentViewer/DocumentViewer.vbproj index baf6f8f2..cf329d0f 100644 --- a/Controls.DocumentViewer/DocumentViewer.vbproj +++ b/Controls.DocumentViewer/DocumentViewer.vbproj @@ -48,23 +48,33 @@ On + + + + + + + + + + D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll - - P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Independentsoft.Msg.dll + + P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.dll diff --git a/Controls.DocumentViewer/My Project/AssemblyInfo.vb b/Controls.DocumentViewer/My Project/AssemblyInfo.vb index af56c15f..81972474 100644 --- a/Controls.DocumentViewer/My Project/AssemblyInfo.vb +++ b/Controls.DocumentViewer/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Controls.DocumentViewer/My Project/licenses.licx b/Controls.DocumentViewer/My Project/licenses.licx index 93bd4e76..6374a2b9 100644 --- a/Controls.DocumentViewer/My Project/licenses.licx +++ b/Controls.DocumentViewer/My Project/licenses.licx @@ -1 +1,2 @@ +DevExpress.XtraSpreadsheet.SpreadsheetControl, DevExpress.XtraSpreadsheet.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraRichEdit.RichEditControl, DevExpress.XtraRichEdit.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/Controls.LookupGrid/LookupControl.vbproj b/Controls.LookupGrid/LookupControl.vbproj index f25e63bc..22c5730b 100644 --- a/Controls.LookupGrid/LookupControl.vbproj +++ b/Controls.LookupGrid/LookupControl.vbproj @@ -48,34 +48,27 @@ False - False - False - False - False - False - False - diff --git a/Controls.LookupGrid/LookupControl2.vb b/Controls.LookupGrid/LookupControl2.vb index 99463d1c..29ab0e90 100644 --- a/Controls.LookupGrid/LookupControl2.vb +++ b/Controls.LookupGrid/LookupControl2.vb @@ -80,6 +80,7 @@ Public Class LookupControl2 Properties.Buttons.Item(0).Tag = TAG_DROPDOWN Properties.Buttons.AddRange({_LookupFormButton}) + Properties.NullText = TEXT_NO_RECORDS AddHandler ButtonClick, AddressOf HandleButtonClick AddHandler EditValueChanging, AddressOf HandleEditValueChanging diff --git a/Controls.LookupGrid/My Project/AssemblyInfo.vb b/Controls.LookupGrid/My Project/AssemblyInfo.vb index fbb24296..319086d6 100644 --- a/Controls.LookupGrid/My Project/AssemblyInfo.vb +++ b/Controls.LookupGrid/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/Controls.LookupGrid/My Project/licenses.licx b/Controls.LookupGrid/My Project/licenses.licx index fb064627..ca29cac8 100644 --- a/Controls.LookupGrid/My Project/licenses.licx +++ b/Controls.LookupGrid/My Project/licenses.licx @@ -1 +1,3 @@ +DevExpress.XtraEditors.GridLookUpEdit, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.Repository.RepositoryItemGridLookUpEdit, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/DDMonorepo.sln b/DDMonorepo.sln index 84d2659d..14eaac25 100644 --- a/DDMonorepo.sln +++ b/DDMonorepo.sln @@ -104,6 +104,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GUIs.Test.DocumentViewerTes EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DDEmailService", "DDEmailService\DDEmailService.vbproj", "{83ED2617-B398-4859-8F59-B38F8807E83E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebServices", "WebServices", "{D3BAE68E-406E-493D-A4E5-DB6EDDFFB371}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZUGFeRDRESTService", "WEBSERVICES\ZUGFeRDRESTService\ZUGFeRDRESTService.csproj", "{FD50590A-59C1-4798-AD90-419A588DCE76}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -270,6 +274,10 @@ Global {83ED2617-B398-4859-8F59-B38F8807E83E}.Debug|Any CPU.Build.0 = Debug|Any CPU {83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.ActiveCfg = Release|Any CPU {83ED2617-B398-4859-8F59-B38F8807E83E}.Release|Any CPU.Build.0 = Release|Any CPU + {FD50590A-59C1-4798-AD90-419A588DCE76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD50590A-59C1-4798-AD90-419A588DCE76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD50590A-59C1-4798-AD90-419A588DCE76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD50590A-59C1-4798-AD90-419A588DCE76}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -315,6 +323,7 @@ Global {609B09B4-AD1E-40F7-8899-A6685924621C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A} {F9CCEFCD-21B3-4319-9DB1-A0756DA5BA1C} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A} {83ED2617-B398-4859-8F59-B38F8807E83E} = {7AF3F9C2-C939-4A08-95C1-0453207E298A} + {FD50590A-59C1-4798-AD90-419A588DCE76} = {D3BAE68E-406E-493D-A4E5-DB6EDDFFB371} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286} diff --git a/DDZUGFeRDService/App.config b/DDZUGFeRDService/App.config index e496d645..3caf5e6e 100644 --- a/DDZUGFeRDService/App.config +++ b/DDZUGFeRDService/App.config @@ -32,11 +32,14 @@ 10 - + False + + 1234567890_EXAMPLE_KEY + diff --git a/DDZUGFeRDService/My Project/AssemblyInfo.vb b/DDZUGFeRDService/My Project/AssemblyInfo.vb index dc3c2d34..aeefacd3 100644 --- a/DDZUGFeRDService/My Project/AssemblyInfo.vb +++ b/DDZUGFeRDService/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/DDZUGFeRDService/My Project/Settings.Designer.vb b/DDZUGFeRDService/My Project/Settings.Designer.vb index 66da4ee7..039b8db7 100644 --- a/DDZUGFeRDService/My Project/Settings.Designer.vb +++ b/DDZUGFeRDService/My Project/Settings.Designer.vb @@ -15,7 +15,7 @@ Option Explicit On Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase @@ -134,6 +134,15 @@ Namespace My Return CType(Me("MSSQL_ENABLED"),Boolean) End Get End Property + + _ + Public ReadOnly Property GDPICTURE_KEY() As String + Get + Return CType(Me("GDPICTURE_KEY"),String) + End Get + End Property End Class End Namespace diff --git a/DDZUGFeRDService/My Project/Settings.settings b/DDZUGFeRDService/My Project/Settings.settings index 05b0c648..2358b177 100644 --- a/DDZUGFeRDService/My Project/Settings.settings +++ b/DDZUGFeRDService/My Project/Settings.settings @@ -29,5 +29,8 @@ False + + 1234567890_EXAMPLE_KEY + \ No newline at end of file diff --git a/DDZUGFeRDService/ThreadRunner.vb b/DDZUGFeRDService/ThreadRunner.vb index f0f570aa..ba8c6a17 100644 --- a/DDZUGFeRDService/ThreadRunner.vb +++ b/DDZUGFeRDService/ThreadRunner.vb @@ -27,7 +27,7 @@ Public Class ThreadRunner Private Const TIMER_INTERVAL_MS = 10_000 - Public Sub New(LogConfig As LogConfig, Firebird As Firebird, Optional MSSQL As MSSQLServer = Nothing) + Public Sub New(LogConfig As LogConfig, GDPictureKey As String, Firebird As Firebird, Optional MSSQL As MSSQLServer = Nothing) _logConfig = LogConfig _logger = _logConfig.GetLogger() _firebird = Firebird @@ -113,25 +113,6 @@ Public Class ThreadRunner Dim args As WorkerArgs = e.Argument _logger.Debug("Background worker running..") - ' Use MSSQL Server if available - If Not IsNothing(_mssql) Then - 'Checking if documents have bee´n rejected - Dim oSQL As String = "Select * from TBEDMI_DOC_REJECTED WHERE MD5_UPDATE = 0" - 'Dim oDT As DataTable = _mssql.GetDatatable(oSQL) - 'If Not IsNothing(oDT) Then - ' For Each oRow As DataRow In oDT.Rows - ' oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET REJECTED = TRUE WHERE MESSAGE_ID = '{oRow.Item("MESSAGE_ID")}'" - ' If _firebird.ExecuteNonQuery(oSQL) = True Then - ' oSQL = $"UPDATE TBEDMI_DOC_REJECTED SET MD5_UPDATE = 1 WHERE GUID = '{oRow.Item("GUID")}'" - ' If _mssql.ExecuteNonQuery(oSQL) = True Then - ' _logger.Debug($"Refreshed the Rejected Info for messageid [{oRow.Item("MESSAGE_ID")}]") - ' End If - ' End If - ' Next - 'Else - ' _logger.Warn("oDTTBEDMI_DOC_REJECTED is nothing...") - 'End If - End If Dim job As New ImportZUGFeRDFiles(_logConfig, _firebird, _mssql) job.Start(args) Catch ex As Exception diff --git a/DDZUGFeRDService/ZUGFeRDService.vb b/DDZUGFeRDService/ZUGFeRDService.vb index eb7070ca..cdf5aa3e 100644 --- a/DDZUGFeRDService/ZUGFeRDService.vb +++ b/DDZUGFeRDService/ZUGFeRDService.vb @@ -24,6 +24,7 @@ Public Class ZUGFeRDService Dim oJobInterval As Integer = My.Settings.JOB_INTERVAL Dim oMSSQLConnectionString As String = My.Settings.MSSQL_CONNECTIONSTRING Dim oMSSQLEnabled As Boolean = My.Settings.MSSQL_ENABLED + Dim oGDPictureKey As String = My.Settings.GDPICTURE_KEY _firebird = New Firebird(_logConfig, oDataSource, oDatabase, oUser, oPassword) @@ -37,7 +38,7 @@ Public Class ZUGFeRDService End If Try - _threadRunner = New ThreadRunner(_logConfig, _firebird, _mssql) + _threadRunner = New ThreadRunner(_logConfig, oGDPictureKey, _firebird, _mssql) _threadRunner.Start(oJobInterval) Catch ex As Exception _logger.Error(ex) diff --git a/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj b/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj index 700af33c..d6d2b412 100644 --- a/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj +++ b/GUIs.Test.DocumentViewerTest/GUIs.Test.DocumentViewerTest.vbproj @@ -50,9 +50,6 @@ D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll - - P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\Independentsoft.Msg.2.0.570.21482.dll - ..\packages\NLog.4.6.8\lib\net45\NLog.dll diff --git a/GUIs.Test.ZUGFeRDTest/App.config b/GUIs.Test.ZUGFeRDTest/App.config index ee850a55..7d636a2e 100644 --- a/GUIs.Test.ZUGFeRDTest/App.config +++ b/GUIs.Test.ZUGFeRDTest/App.config @@ -32,6 +32,9 @@ + + Server=SDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM_TEST;User Id=sa;Password=dd + diff --git a/GUIs.Test.ZUGFeRDTest/Form1.Designer.vb b/GUIs.Test.ZUGFeRDTest/Form1.Designer.vb index adc6be79..ea45550e 100644 --- a/GUIs.Test.ZUGFeRDTest/Form1.Designer.vb +++ b/GUIs.Test.ZUGFeRDTest/Form1.Designer.vb @@ -32,6 +32,7 @@ Partial Class Form1 Me.Button5 = New System.Windows.Forms.Button() Me.GroupBox1 = New System.Windows.Forms.GroupBox() Me.GroupBox2 = New System.Windows.Forms.GroupBox() + Me.Button7 = New System.Windows.Forms.Button() Me.GroupBox3 = New System.Windows.Forms.GroupBox() Me.txtPropName = New System.Windows.Forms.TextBox() Me.GroupBox4 = New System.Windows.Forms.GroupBox() @@ -60,7 +61,7 @@ Partial Class Form1 Me.ListBox1.FormattingEnabled = True Me.ListBox1.Location = New System.Drawing.Point(378, 12) Me.ListBox1.Name = "ListBox1" - Me.ListBox1.Size = New System.Drawing.Size(526, 407) + Me.ListBox1.Size = New System.Drawing.Size(526, 472) Me.ListBox1.TabIndex = 1 ' 'Button2 @@ -122,19 +123,29 @@ Partial Class Form1 'GroupBox2 ' Me.GroupBox2.Controls.Add(Me.Button2) + Me.GroupBox2.Controls.Add(Me.Button7) Me.GroupBox2.Controls.Add(Me.Button3) Me.GroupBox2.Location = New System.Drawing.Point(12, 110) Me.GroupBox2.Name = "GroupBox2" - Me.GroupBox2.Size = New System.Drawing.Size(360, 90) + Me.GroupBox2.Size = New System.Drawing.Size(360, 155) Me.GroupBox2.TabIndex = 8 Me.GroupBox2.TabStop = False Me.GroupBox2.Text = "Run Functions on a single file (needs Breakpoint)" ' + 'Button7 + ' + Me.Button7.Location = New System.Drawing.Point(6, 77) + Me.Button7.Name = "Button7" + Me.Button7.Size = New System.Drawing.Size(221, 23) + Me.Button7.TabIndex = 3 + Me.Button7.Text = "Extract PDF Attachments" + Me.Button7.UseVisualStyleBackColor = True + ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.Button4) Me.GroupBox3.Controls.Add(Me.txtMD5Checksum) - Me.GroupBox3.Location = New System.Drawing.Point(12, 206) + Me.GroupBox3.Location = New System.Drawing.Point(12, 271) Me.GroupBox3.Name = "GroupBox3" Me.GroupBox3.Size = New System.Drawing.Size(360, 85) Me.GroupBox3.TabIndex = 9 @@ -152,7 +163,7 @@ Partial Class Form1 ' Me.GroupBox4.Controls.Add(Me.Button6) Me.GroupBox4.Controls.Add(Me.txtPropName) - Me.GroupBox4.Location = New System.Drawing.Point(12, 297) + Me.GroupBox4.Location = New System.Drawing.Point(12, 362) Me.GroupBox4.Name = "GroupBox4" Me.GroupBox4.Size = New System.Drawing.Size(360, 122) Me.GroupBox4.TabIndex = 11 @@ -172,7 +183,7 @@ Partial Class Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(916, 435) + Me.ClientSize = New System.Drawing.Size(916, 492) Me.Controls.Add(Me.GroupBox4) Me.Controls.Add(Me.GroupBox3) Me.Controls.Add(Me.GroupBox2) @@ -204,4 +215,5 @@ Partial Class Form1 Friend WithEvents txtPropName As TextBox Friend WithEvents GroupBox4 As GroupBox Friend WithEvents Button6 As Button + Friend WithEvents Button7 As Button End Class diff --git a/GUIs.Test.ZUGFeRDTest/Form1.vb b/GUIs.Test.ZUGFeRDTest/Form1.vb index ec510ee9..0a680b35 100644 --- a/GUIs.Test.ZUGFeRDTest/Form1.vb +++ b/GUIs.Test.ZUGFeRDTest/Form1.vb @@ -13,6 +13,7 @@ Imports DigitalData.Modules.Logging Public Class Form1 Private _logConfig As LogConfig Private _firebird As Firebird + Private _mssql As MSSQLServer Private _zugferd As ZUGFeRDInterface Private PropertyMap As New Dictionary(Of String, XmlItemProperty) @@ -22,6 +23,7 @@ Public Class Form1 _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) + _mssql = New MSSQLServer(_logConfig, My.Settings.MSSQL_CONNECTIONSTRING) _zugferd = New ZUGFeRDInterface(_logConfig) End Sub @@ -86,7 +88,7 @@ Public Class Form1 args = LoadFolderConfig(args) args = LoadPropertyMapFor(args, "DEFAULT") - Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _firebird) + Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _firebird, _mssql) job.Start(args) End Sub @@ -138,7 +140,7 @@ Public Class Form1 End Function Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click - Process.Start("\\dd-sto01\DD-STO01-A2\SharedObjects\Public\Projekte\Test\Import\ZUGFerD\Email_in") + 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 @@ -160,4 +162,13 @@ Public Class Form1 End Try End If End Sub + + Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click + Dim oExtractor = New Jobs.PDFAttachments(_logConfig) + Dim oResult = OpenFileDialog1.ShowDialog() + + If oResult = DialogResult.OK Then + oExtractor.Extract(OpenFileDialog1.FileName, AllowedExtensions:=New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}) + End If + End Sub End Class diff --git a/GUIs.Test.ZUGFeRDTest/My Project/Settings.Designer.vb b/GUIs.Test.ZUGFeRDTest/My Project/Settings.Designer.vb index 9d3b1474..b77f9d20 100644 --- a/GUIs.Test.ZUGFeRDTest/My Project/Settings.Designer.vb +++ b/GUIs.Test.ZUGFeRDTest/My Project/Settings.Designer.vb @@ -15,7 +15,7 @@ Option Explicit On Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase @@ -107,6 +107,18 @@ Namespace My Me("MD5Cheksum") = value End Set End Property + + _ + Public Property MSSQL_CONNECTIONSTRING() As String + Get + Return CType(Me("MSSQL_CONNECTIONSTRING"),String) + End Get + Set + Me("MSSQL_CONNECTIONSTRING") = value + End Set + End Property End Class End Namespace diff --git a/GUIs.Test.ZUGFeRDTest/My Project/Settings.settings b/GUIs.Test.ZUGFeRDTest/My Project/Settings.settings index fd42a2b7..2e7a8ce5 100644 --- a/GUIs.Test.ZUGFeRDTest/My Project/Settings.settings +++ b/GUIs.Test.ZUGFeRDTest/My Project/Settings.settings @@ -17,5 +17,8 @@ + + Server=SDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM_TEST;User Id=sa;Password=dd + \ No newline at end of file diff --git a/Modules.Filesystem/File.vb b/Modules.Filesystem/File.vb index 1d73a274..b6b30ae8 100644 --- a/Modules.Filesystem/File.vb +++ b/Modules.Filesystem/File.vb @@ -161,11 +161,13 @@ Public Class File Return True End Function + Public Sub MoveTo(FilePath As String, Directory As String) Dim oFileInfo As New FileInfo(FilePath) IO.File.Move(FilePath, Path.Combine(Directory, oFileInfo.Name)) End Sub + Public Sub MoveTo(FilePath As String, NewFileName As String, Directory As String) Dim oFileInfo As New FileInfo(FilePath) IO.File.Move(FilePath, Path.Combine(Directory, NewFileName)) diff --git a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index 8d1f8af5..7b8f889f 100644 --- a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -13,6 +13,7 @@ Imports DigitalData.Modules.Interfaces.Exceptions Imports DigitalData.Modules.Jobs.Exceptions Imports DigitalData.Modules.Logging Imports FirebirdSql.Data.FirebirdClient +Imports GdPicture14 Public Class ImportZUGFeRDFiles Implements IJob @@ -42,6 +43,9 @@ Public Class ImportZUGFeRDFiles

""" + ' List of allowed extensions for PDF/A Attachments + Private AllowedExtensions = New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"} + Private _logger As Logger Private _logConfig As LogConfig Private _zugferd As ZUGFeRDInterface @@ -326,9 +330,27 @@ Public Class ImportZUGFeRDFiles Public Sub Start(Arguments As Object) Implements IJob.Start Dim oArgs As WorkerArgs = Arguments Dim oPropertyExtractor = New PropertyValues(_logConfig) + Dim oAttachmentExtractor = New PDFAttachments(_logConfig) _logger.Debug("Starting Job {0}", [GetType].Name) + _logger.Debug("Registering GDPicture License") + If _mssql IsNot Nothing Then + Try + Dim oSQL = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'" + Dim oLicenseKey As String = _mssql.GetScalarValue(oSQL) + Dim oLicenseManager As New LicenseManager + oLicenseManager.RegisterKEY(oLicenseKey) + Catch ex As Exception + _logger.Error(ex) + _logger.Warn("GDPicture License could not be retrieved! Query failed! Exiting job.") + Exit Sub + End Try + Else + _logger.Warn("GDPicture License could not be retrieved! MSSQL is not enabled! Exiting job.") + Exit Sub + End If + Try For Each oPath As String In oArgs.WatchDirectories Dim oDirInfo As New DirectoryInfo(oPath) @@ -368,14 +390,15 @@ Public Class ImportZUGFeRDFiles Dim oMoveDirectory As String = oArgs.SuccessDirectory ' Create file lists Dim oFileGroupFiles As List(Of FileInfo) = oFileGroup.Value - Dim oFileAttachmentFiles As New List(Of FileInfo) + Dim oEmailAttachmentFiles As New List(Of FileInfo) + Dim oEmbeddedAttachmentFiles As New List(Of PDFAttachments.AttachmentResult) - Dim oFileGroupId As String = oFileGroup.Key + Dim oMessageId As String = oFileGroup.Key Dim oMissingProperties As New List(Of String) Dim oMD5CheckSum As String = String.Empty - _logger.NewBlock($"Message Id {oFileGroupId}") - _logger.Info("Start processing file group {0}", oFileGroupId) + _logger.NewBlock($"Message Id {oMessageId}") + _logger.Info("Start processing file group {0}", oMessageId) Try For Each oFile In oFileGroupFiles @@ -389,7 +412,7 @@ Public Class ImportZUGFeRDFiles ' Only pdf files are allowed from here on If Not oFile.Name.EndsWith(".pdf") Then _logger.Debug("Skipping non-pdf file {0}", oFile.Name) - oFileAttachmentFiles.Add(oFile) + oEmailAttachmentFiles.Add(oFile) Continue For End If @@ -401,7 +424,7 @@ Public Class ImportZUGFeRDFiles Select Case ex.ErrorType Case ZUGFeRDInterface.ErrorType.NoZugferd _logger.Warn("File is not a valid ZUGFeRD document! Skipping.") - oFileAttachmentFiles.Add(oFile) + oEmailAttachmentFiles.Add(oFile) Continue For Case ZUGFeRDInterface.ErrorType.NoValidZugferd @@ -412,10 +435,16 @@ Public Class ImportZUGFeRDFiles _logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", oFile.FullName) Throw ex End Select - - End Try + ' Extract all attachments other than the zugferd-invoice.xml + Dim oAttachments = oAttachmentExtractor.Extract(oFile.FullName, AllowedExtensions) + If oAttachments Is Nothing Then + _logger.Warn("Attachments for file [{0}] could not be extracted", oFile.FullName) + Else + oEmbeddedAttachmentFiles.AddRange(oAttachments) + End If + oMD5CheckSum = CreateMD5(oFile.FullName) If oMD5CheckSum <> String.Empty Then Dim oCheckCommand = $"SELECT * FROM TBEDM_ZUGFERD_HISTORY_IN WHERE GUID = (SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))" @@ -453,9 +482,7 @@ Public Class ImportZUGFeRDFiles ' PropertyMap items with `IsGrouped = False` are handled normally Dim oDefaultProperties As Dictionary(Of String, XmlItemProperty) = oArgs.PropertyMap. - Where(Function(Item As KeyValuePair(Of String, XmlItemProperty)) - Return Item.Value.IsGrouped = False - End Function). + Where(Function(Item) Item.Value.IsGrouped = True). ToDictionary(Function(Item) Item.Key, Function(Item) Item.Value) @@ -532,7 +559,7 @@ Public Class ImportZUGFeRDFiles _logger.Debug("Property {0} has value '{1}'", oPropertyDescription, oPropertyValue) - Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oFileGroupId}', '{oPropertyDescription}', '{oPropertyValue}', {oRowCounter})" + Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oMessageId}', '{oPropertyDescription}', '{oPropertyValue}', {oRowCounter})" _logger.Debug("Mapping Property {0} to value {1}. Will be inserted into table {2} with RowCounter {3}", oPropertyDescription, oPropertyValue, oTableName, oRowCounter) ' Insert into SQL Server @@ -601,7 +628,7 @@ Public Class ImportZUGFeRDFiles End If Dim oTableName = Item.Value.TableName - Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE) VALUES ('{oFileGroupId}', '{oPropertyDescription}', '{oPropertyValue}')" + Dim oCommand = $"INSERT INTO {oTableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE) VALUES ('{oMessageId}', '{oPropertyDescription}', '{oPropertyValue}')" _logger.Debug("Mapping Property [{0}] to value [{1}] . Will be inserted into table {2}", oPropertyDescription, oPropertyValue, oTableName) ' Insert into SQL Server @@ -629,12 +656,12 @@ Public Class ImportZUGFeRDFiles 'If no errors occurred... 'Log the History If oMD5CheckSum <> String.Empty Then - Dim oInsertCommand = $"INSERT INTO TBEDM_ZUGFERD_HISTORY_IN (MESSAGE_ID, MD5HASH) VALUES ('{oFileGroupId}', '{oMD5CheckSum}')" + Dim oInsertCommand = $"INSERT INTO TBEDM_ZUGFERD_HISTORY_IN (MESSAGE_ID, MD5HASH) VALUES ('{oMessageId}', '{oMD5CheckSum}')" _firebird.ExecuteNonQueryWithConnection(oInsertCommand, oConnection, Firebird.TransactionMode.ExternalTransaction, oTransaction) 'commit the transaction oTransaction.Commit() Try - Dim oSQL = $"SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE MESSAGE_ID = '{oFileGroupId}'" + Dim oSQL = $"SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE MESSAGE_ID = '{oMessageId}'" HISTORY_ID = _firebird.GetScalarValue(oSQL) Catch ex As Exception HISTORY_ID = 0 @@ -648,9 +675,9 @@ Public Class ImportZUGFeRDFiles _firebird.ExecuteNonQuery(oSQL) Dim oBody = EMAIL_MD5_ERROR - Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId) - AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "MD5HashException") - AddRejectedState(oFileGroupId, "MD5HashException", "Die gesendete Rechnung wurde bereits verarbeitet!", "") + Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId) + AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MD5HashException") + AddRejectedState(oMessageId, "MD5HashException", "Die gesendete Rechnung wurde bereits verarbeitet!", "") Catch ex As InvalidFerdException _logger.Error(ex) @@ -658,9 +685,9 @@ Public Class ImportZUGFeRDFiles Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - ZUGFeRD yes but incorrect format' WHERE GUID = '{HISTORY_ID}'" _firebird.ExecuteNonQuery(oSQL) Dim oBody = EMAIL_INVALID_DOCUMENT - Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId) - AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "InvalidFerdException") - AddRejectedState(oFileGroupId, "InvalidFerdException", "Inkorrekte Formate", "") + Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId) + AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "InvalidFerdException") + AddRejectedState(oMessageId, "InvalidFerdException", "Inkorrekte Formate", "") Catch ex As TooMuchFerdsException _logger.Error(ex) @@ -668,9 +695,9 @@ Public Class ImportZUGFeRDFiles Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - More than one ZUGFeRD-document in email' WHERE GUID = '{HISTORY_ID}'" _firebird.ExecuteNonQuery(oSQL) Dim oBody = EMAIL_TOO_MUCH_FERDS - Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId) - AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "TooMuchFerdsException") - AddRejectedState(oFileGroupId, "TooMuchFerdsException", "Email enthielt mehr als ein ZUGFeRD-Dokument", "") + Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId) + AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "TooMuchFerdsException") + AddRejectedState(oMessageId, "TooMuchFerdsException", "Email enthielt mehr als ein ZUGFeRD-Dokument", "") Catch ex As NoFerdsException _logger.Error(ex) @@ -678,9 +705,9 @@ Public Class ImportZUGFeRDFiles Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - no ZUGFeRD-Document in email' WHERE GUID = '{HISTORY_ID}'" _firebird.ExecuteNonQuery(oSQL) Dim oBody = EMAIL_NO_FERDS - Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId) - AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "NoFerdsException") - AddRejectedState(oFileGroupId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "") + Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId) + AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "NoFerdsException") + AddRejectedState(oMessageId, "NoFerdsException", " Email enthielt keine ZUGFeRD-Dokumente", "") Catch ex As MissingValueException _logger.Error(ex) @@ -693,9 +720,9 @@ Public Class ImportZUGFeRDFiles _firebird.ExecuteNonQuery(oSQL) Dim oBody = CreateBodyForMissingProperties(ex.File.Name, oMissingProperties) - Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oFileGroupId) - AddToEmailQueueMSSQL(oFileGroupId, oBody, oEmailData, "MissingValueException") - AddRejectedState(oFileGroupId, "MissingValueException", "Es fehlten ZugferdSpezifikationen", oMessage) + Dim oEmailData = MoveAndRenameEmailToRejected(oArgs, oMessageId) + AddToEmailQueueMSSQL(oMessageId, oBody, oEmailData, "MissingValueException") + AddRejectedState(oMessageId, "MissingValueException", "Es fehlten ZugferdSpezifikationen", oMessage) Catch ex As Exception _logger.Warn("Unknown Error occurred: {0}", ex.Message) @@ -703,14 +730,14 @@ Public Class ImportZUGFeRDFiles Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = 'REJECTED - Unknown error occured' WHERE GUID = '{HISTORY_ID}'" _firebird.ExecuteNonQuery(oSQL) oMoveDirectory = oArgs.ErrorDirectory - AddRejectedState(oFileGroupId, "UnexpectedException", "", ex.Message) + AddRejectedState(oMessageId, "UnexpectedException", "", ex.Message) Finally oConnection.Close() ' Move all files of the current group Try - MoveFiles(oArgs, oFileGroupFiles, oFileAttachmentFiles, oMoveDirectory) - _logger.Info("Finished processing file group {0}", oFileGroupId) + MoveFiles(oArgs, oMessageId, oFileGroupFiles, oEmailAttachmentFiles, oEmbeddedAttachmentFiles, oMoveDirectory) + _logger.Info("Finished processing file group {0}", oMessageId) Catch ex As Exception _logger.Warn("Could not move files!") _logger.Error(ex) @@ -730,19 +757,30 @@ Public Class ImportZUGFeRDFiles End Try End Sub - Private Sub MoveFiles(Args As WorkerArgs, Files As List(Of FileInfo), AttachmentFiles As List(Of FileInfo), MoveDirectory As String) + Private Sub MoveFiles(Args As WorkerArgs, MessageId As String, Files As List(Of FileInfo), AttachmentFiles As List(Of FileInfo), EmbeddedAttachments As List(Of PDFAttachments.AttachmentResult), MoveDirectory As String) + Dim oFinalMoveDirectory As String = MoveDirectory + Dim oAttachmentDirectory As String = Path.Combine(MoveDirectory, Args.AttachmentsSubDirectory) + + ' Create directories if they don't exist + If Not Directory.Exists(oFinalMoveDirectory) Then + Try + Directory.CreateDirectory(oFinalMoveDirectory) + Catch ex As Exception + _logger.Error(ex) + End Try + End If + + If Not Directory.Exists(oAttachmentDirectory) And AttachmentFiles.Count > 0 Then + Try + Directory.CreateDirectory(oAttachmentDirectory) + Catch ex As Exception + _logger.Error(ex) + End Try + End If + + ' Move PDF/A Files For Each oFile In Files Try - Dim oFinalMoveDirectory As String = MoveDirectory - - If AttachmentFiles.Contains(oFile) Then - oFinalMoveDirectory = Path.Combine(MoveDirectory, Args.AttachmentsSubDirectory) - - If Not Directory.Exists(oFinalMoveDirectory) Then - Directory.CreateDirectory(oFinalMoveDirectory) - End If - End If - Dim oFileName = _filesystem.GetVersionedFilename(Path.Combine(oFinalMoveDirectory, oFile.Name)) _filesystem.MoveTo(oFile.FullName, oFileName, oFinalMoveDirectory) @@ -754,6 +792,36 @@ Public Class ImportZUGFeRDFiles _logger.Error(ex) End Try Next + + ' Move non-PDF/A Email Attachments/Files + For Each oFile In AttachmentFiles + Try + Dim oFileName = _filesystem.GetVersionedFilename(Path.Combine(oAttachmentDirectory, oFile.Name)) + + _filesystem.MoveTo(oFile.FullName, oFileName, oAttachmentDirectory) + + _logger.Info("Finished processing file {0}", oFile.Name) + _logger.Info("Attachment moved to {0}", oFileName) + Catch ex As Exception + _logger.Warn("Could not move attachment {0}", oFile.FullName) + _logger.Error(ex) + End Try + Next + + ' Write Embedded Files to disk + For Each oResult In EmbeddedAttachments + Try + Dim oFileName As String = $"{MessageId}~{oResult.FileName}" + Dim oFilePath As String = Path.Combine(oAttachmentDirectory, oFileName) + + Using oWriter As New FileStream(oFilePath, FileMode.Create) + oWriter.Write(oResult.FileContents, 0, oResult.FileContents.Length) + End Using + Catch ex As Exception + _logger.Warn("Could not save embedded attachment {0}", oResult.FileName) + _logger.Error(ex) + End Try + Next End Sub diff --git a/Modules.Jobs/EDMI/ZUGFeRD/PDFAttachments.vb b/Modules.Jobs/EDMI/ZUGFeRD/PDFAttachments.vb index 78708998..3f170017 100644 --- a/Modules.Jobs/EDMI/ZUGFeRD/PDFAttachments.vb +++ b/Modules.Jobs/EDMI/ZUGFeRD/PDFAttachments.vb @@ -1,9 +1,100 @@ -Public Class PDFAttachments - Public Sub New(GdPictureKey As String) +Imports System.Collections.Generic +Imports System.IO +Imports DigitalData.Modules.Logging +Imports GdPicture14 +Public Class PDFAttachments + Private Logger As Logger + + Private Const ZUGFERD_XML_FILENAME = "ZUGFeRD-invoice.xml" + + Public Class AttachmentResult + Public FileName As String + Public FileContents As Byte() + End Class + + Public Sub New(LogConfig As LogConfig) + Logger = LogConfig.GetLogger End Sub - Public Shared Function Extract(FileName As String) - Using oGDPicturePDF As New GDPicturePDF + Public Function Extract(FileName As String, AllowedExtensions As List(Of String)) As List(Of AttachmentResult) + Dim oResults As New List(Of AttachmentResult) + Dim oExtensions = AllowedExtensions.ConvertAll(Of String)(New Converter(Of String, String)(Function(ext) ext.ToUpper)) + + Try + Using oGDPicturePDF As New GdPicturePDF() + If oGDPicturePDF.LoadFromFile(FileName, False) = GdPictureStatus.OK Then + Dim oEmbeddedFileCount As Integer = oGDPicturePDF.GetEmbeddedFileCount() + If oGDPicturePDF.GetStat() = GdPictureStatus.OK Then + If oEmbeddedFileCount > 1 Then + For index = 0 To oEmbeddedFileCount - 1 + Dim oFileName As String = oGDPicturePDF.GetEmbeddedFileName(index) + + If oGDPicturePDF.GetStat() = GdPictureStatus.OK Then + Dim oExtension = New FileInfo(oFileName).Extension.ToUpper.Substring(1) + If oFileName.ToUpper <> ZUGFERD_XML_FILENAME.ToUpper Then + If oExtensions.Contains(oExtension) Then + Dim FileSize As Integer = oGDPicturePDF.GetEmbeddedFileSize(index) + + If oGDPicturePDF.GetStat() = GdPictureStatus.OK Then + Dim oFileData As Byte() = New Byte(FileSize) {} + Dim status As GdPictureStatus = oGDPicturePDF.ExtractEmbeddedFile(index, oFileData) + + If status = GdPictureStatus.OK Then + oResults.Add(New AttachmentResult() With { + .FileContents = oFileData, + .FileName = oFileName + }) + Else + Logger.Error("The embedded file [{0}] has failed to extract. Status: {1}", oFileName, oGDPicturePDF.GetStat().ToString()) + Continue For + End If + + 'If status = GdPictureStatus.OK Then + ' Dim oVersionedName = Filesystem.GetVersionedFilename(oFileName) + ' Dim oTempName As String = Path.Combine(Path.GetTempPath(), oVersionedName) + ' Using oFileStream As New FileStream(oTempName, FileMode.OpenOrCreate) + ' oFileStream.Write(oFileData, 0, oFileData.Length) + ' End Using + + ' oResults.Add(New FileInfo(oTempName)) + 'Else + ' Logger.Error("The embedded file [{0}] has failed to extract. Status: {1}", oFileName, oGDPicturePDF.GetStat().ToString()) + ' Continue For + 'End If + Else + Logger.Error("An error occurred getting the file size for [{0}]. Status: {1}", oFileName, oGDPicturePDF.GetStat().ToString()) + Continue For + End If + Else + Logger.Warn("File [{0}] was skipped because its extension [{1}] is not allowed.", oFileName, oExtension) + Continue For + End If + Else + Logger.Debug("File [{0}] was skipped because its name indicates the invoice data file.", oFileName) + Continue For + End If + Else + Logger.Error("An error occurred getting the file name for [{0}]. Status: {1}", oFileName, oGDPicturePDF.GetStat().ToString()) + Continue For + End If + Next + End If + Else + Logger.Error("An error occurred getting the number of embedded files. Status: {0}", oGDPicturePDF.GetStat().ToString()) + Return Nothing + End If + Else + Logger.Error("The file [{0}] can't be loaded.", FileName) + Return Nothing + End If + End Using + + Return oResults + Catch ex As Exception + Logger.Warn("Unexpected Error while Extracting attachments from File [{0}]", FileName) + Logger.Error(ex) + Return Nothing + End Try End Function End Class diff --git a/Modules.Jobs/Jobs.vbproj b/Modules.Jobs/Jobs.vbproj index 8258ced9..3a28c163 100644 --- a/Modules.Jobs/Jobs.vbproj +++ b/Modules.Jobs/Jobs.vbproj @@ -109,6 +109,9 @@ ..\packages\FirebirdSql.Data.FirebirdClient.6.4.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll + + D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll + ..\packages\NLog.4.6.8\lib\net45\NLog.dll diff --git a/Modules.Jobs/My Project/AssemblyInfo.vb b/Modules.Jobs/My Project/AssemblyInfo.vb index 228bfeee..8a735eeb 100644 --- a/Modules.Jobs/My Project/AssemblyInfo.vb +++ b/Modules.Jobs/My Project/AssemblyInfo.vb @@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices ' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern ' übernehmen, indem Sie "*" eingeben: - + diff --git a/WEBSERVICES/ZUGFeRDRESTService/Controllers/ZugferdValidationController.cs b/WEBSERVICES/ZUGFeRDRESTService/Controllers/ZugferdValidationController.cs new file mode 100644 index 00000000..f8d462c3 --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/Controllers/ZugferdValidationController.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace ZUGFeRDRESTService.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class ZugferdValidationController : ControllerBase + { + public static string RESPONSE_OK = "OK"; + public static string RESPONSE_ERROR = "ERROR"; + + private readonly IZugferdValidationDataService _dataService; + + public class ZugferdValidationResponse + { + public string status; + public string message; + public List errors; + + + + public ZugferdValidationResponse() + { + status = RESPONSE_OK; + message = String.Empty; + errors = new List(); + } + } + + public ZugferdValidationController(IZugferdValidationDataService dataService) + { + _dataService = dataService; + } + + /// + /// POST: api/ZugferdValidation + /// + /// This parameter's name needs to correspond to the html form's file-input name + [HttpPost] + public async Task Post(List files) + { + var oFilePaths = new List(); + var oFileNames = new List(); + + if (files.Count == 0) { + return new ZugferdValidationResponse() + { + status = RESPONSE_ERROR, + message = "No File received!" + }; + } + + foreach (var formFile in files) + { + var oFilePath = Path.GetTempFileName(); + oFilePaths.Add(oFilePath); + oFileNames.Add(formFile.FileName); + + using (var oStream = new FileStream(oFilePath, FileMode.Create)) + { + await formFile.CopyToAsync(oStream); + } + } + + var oResponse = new ZugferdValidationResponse + { + message = "You uploaded the following file: " + oFileNames.First() + }; + + return oResponse; + } + } +} diff --git a/WEBSERVICES/ZUGFeRDRESTService/IZugferdValidationDataService.cs b/WEBSERVICES/ZUGFeRDRESTService/IZugferdValidationDataService.cs new file mode 100644 index 00000000..181a091a --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/IZugferdValidationDataService.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace ZUGFeRDRESTService +{ + public interface IZugferdValidationDataService + { + } +} diff --git a/WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml b/WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml new file mode 100644 index 00000000..b5f02066 --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml @@ -0,0 +1,16 @@ +@page +@{ + ViewData["Title"] = "UploadTest"; +} + +

UploadTest

+ +
+

+ PDF Datei: + +

+ + +
+ diff --git a/WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml.cs b/WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml.cs new file mode 100644 index 00000000..60608930 --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/Pages/Index.cshtml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ZUGFeRDRESTService +{ + public class UploadTestModel : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/WEBSERVICES/ZUGFeRDRESTService/Program.cs b/WEBSERVICES/ZUGFeRDRESTService/Program.cs new file mode 100644 index 00000000..5a4e487d --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/Program.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace ZUGFeRDRESTService +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/WEBSERVICES/ZUGFeRDRESTService/Properties/launchSettings.json b/WEBSERVICES/ZUGFeRDRESTService/Properties/launchSettings.json new file mode 100644 index 00000000..06475a99 --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52235", + "sslPort": 44388 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/zugferdvalidation", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "ZUGFeRDRESTService": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/zugferdvalidation", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/WEBSERVICES/ZUGFeRDRESTService/Startup.cs b/WEBSERVICES/ZUGFeRDRESTService/Startup.cs new file mode 100644 index 00000000..22e70f10 --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/Startup.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace ZUGFeRDRESTService +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddControllers().AddNewtonsoftJson(); + services.AddRazorPages(); + services.AddTransient(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + endpoints.MapRazorPages(); + }); + } + } +} diff --git a/WEBSERVICES/ZUGFeRDRESTService/ZUGFeRDRESTService.csproj b/WEBSERVICES/ZUGFeRDRESTService/ZUGFeRDRESTService.csproj new file mode 100644 index 00000000..a7b78335 --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/ZUGFeRDRESTService.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp3.1 + + + + + + + + + diff --git a/WEBSERVICES/ZUGFeRDRESTService/ZugferdValidationDataService.cs b/WEBSERVICES/ZUGFeRDRESTService/ZugferdValidationDataService.cs new file mode 100644 index 00000000..045f481f --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/ZugferdValidationDataService.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace ZUGFeRDRESTService +{ + public class ZugferdValidationDataService: IZugferdValidationDataService + { + } +} diff --git a/WEBSERVICES/ZUGFeRDRESTService/appsettings.Development.json b/WEBSERVICES/ZUGFeRDRESTService/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/WEBSERVICES/ZUGFeRDRESTService/appsettings.json b/WEBSERVICES/ZUGFeRDRESTService/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/WEBSERVICES/ZUGFeRDRESTService/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +}