diff --git a/App/EmailProfiler.Common/EmailProfiler.Common.vbproj b/App/EmailProfiler.Common/EmailProfiler.Common.vbproj index 312cc0c..d354b21 100644 --- a/App/EmailProfiler.Common/EmailProfiler.Common.vbproj +++ b/App/EmailProfiler.Common/EmailProfiler.Common.vbproj @@ -51,30 +51,26 @@ False - ..\..\..\2_DLL Projekte\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll + ..\..\..\..\2_DLL Projekte\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll - ..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll + ..\..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll False - ..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll - - - False - ..\..\..\2_DLL Projekte\DDModules\Language\bin\Debug\DigitalData.Modules.Language.dll + ..\..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll False - ..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll + ..\..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll False - ..\..\..\2_DLL Projekte\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll + ..\..\..\..\2_DLL Projekte\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll False - ..\..\..\2_DLL Projekte\DDModules\Patterns\bin\Debug\DigitalData.Modules.Patterns.dll + ..\..\..\..\2_DLL Projekte\DDModules\Patterns\bin\Debug\DigitalData.Modules.Patterns.dll False diff --git a/App/EmailProfiler.Common/clsWorkEmail.vb b/App/EmailProfiler.Common/clsWorkEmail.vb index 6a3bc73..ea46e03 100644 --- a/App/EmailProfiler.Common/clsWorkEmail.vb +++ b/App/EmailProfiler.Common/clsWorkEmail.vb @@ -101,11 +101,11 @@ Public Class clsWorkEmail 'TODO: Move all of these CURRENT_MAIL vars into a business object of type mail container _CurrentMail = New MailContainer(pMailMessage, poUID) - _Logger.Debug($"Working on email from: {CURRENT_MAIL_FROM}...Subject: {pMailMessage.Subject}") - CURRENT_MAIL_BODY_ALL = "" - CURRENT_MAIL_BODY_ANSWER1 = "" - CURRENT_MAIL_BODY_Substr2 = "" - CURRENT_MAIL_SUBJECT = pMailMessage.Subject.ToUpper.EscapeForSQL() + _Logger.Info($"Working on email from: {_CurrentMail.SenderAddress} - Subject: {_CurrentMail.SubjectOriginal} - MessageID: {_CurrentMail.MessageId}") + CURRENT_MAIL_BODY_ALL = String.Empty + CURRENT_MAIL_BODY_ANSWER1 = String.Empty + CURRENT_MAIL_BODY_Substr2 = String.Empty + CURRENT_MAIL_SUBJECT = String.Empty CURRENT_MAIL_UID = poUID @@ -134,19 +134,19 @@ Public Class clsWorkEmail ' 'End If - If IsNothing(CURRENT_MAIL_SUBJECT) Then - CURRENT_MAIL_SUBJECT = "" + If IsNothing(_CurrentMail.SubjectOriginal) Then + CURRENT_MAIL_SUBJECT = String.Empty + _Logger.Warn("Subject was nothing!") Else - _Logger.Debug("Subject: [{0}]", CURRENT_MAIL_SUBJECT) + CURRENT_MAIL_SUBJECT = _CurrentMail.SubjectOriginal.ToUpper.EscapeForSQL() + _Logger.Debug("Fixed Subject: [{0}]", CURRENT_MAIL_SUBJECT) End If - _Logger.Info($"Working on email from : {CURRENT_MAIL_FROM}...") - Dim oSql = $"Select COALESCE(MAX(GUID),0) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{_CurrentMail.MessageId}'" Dim oHistoryID = _DB_MSSQL.GetScalarValue(oSql) If oHistoryID > 0 And IS_LOCAL_TEST = False Then - _Logger.Info($"Message with subject [{CURRENT_MAIL_SUBJECT}] from [{CURRENT_MAIL_FROM}] has already been worked!") + _Logger.Info($"Message with subject [{_CurrentMail.SubjectOriginal}] from [{_CurrentMail.SenderAddress}] has already been worked!") Return True End If @@ -208,9 +208,8 @@ Public Class clsWorkEmail _Logger.Debug("CommonEmail-Process-Sniffer") - Dim oCommonEmailResult = CommonEmail_IN(_CurrentMail) - - If oCommonEmailResult = False Then + ' Allgemeine Verarbeitung der EMail + If CommonEmail_IN(_CurrentMail) = False Then Return False End If @@ -539,7 +538,7 @@ Public Class clsWorkEmail Try _Logger.Info(String.Format("PM-related message found....[{0}]", pCurrentMail.Mail.Subject)) - _Logger.Debug(String.Format("PM-related message found....[{0}]", pCurrentMail.Mail.Subject)) + Dim oExpression = "PROCESS_NAME = 'ProcessManager'" 'Filter the rows using Select() method of DataTable Dim TEMP_PROCESS_PROFILE_DT As DataTable = DT_POLL_PROCESS @@ -997,15 +996,25 @@ Public Class clsWorkEmail ' Verarbeite Embedded Attachments WorkEmbeddedAttachments(oEmailAttachment, oGdPicturePDF) + ' Prüfen ob es ungültige Anhänge gibt. + Dim oEmbeddedAttachmentsNotValid As Boolean = EmailAttachments. + Where(Function(att) att.EmbeddedFiles.Count > 0). + Any(Function(emb) emb.EmbeddedFiles.Any(Function(ext) ext.IsAttachmentValid = False)) + + If oEmbeddedAttachmentsNotValid = True Then + MESSAGE_ERROR = True + Continue For + End If + Else oAttachmentCount -= 1 CleanUpFilePath(oEmailAttachment.DestFilePath) + UpdateAttachmentTableAfterError(oEmailAttachment.OrgFileName, pCurrentMail.MessageId, "PDF Structure corrupt") oEmailAttachment.FileStatus = oStatus oEmailAttachment.ErrorCodeValue = ErrorCode.NormalFileAttachmentCorrupt oEmailAttachment.ErrorCodeComment = "PDF Structure corrupt" oEmailAttachment.IsAttachmentValid = False - MESSAGE_ERROR = True Continue For End If @@ -1029,6 +1038,7 @@ Public Class clsWorkEmail End Function + ''' ''' Holt aus alle Anhängen diejenigen raus, ''' die einen erlaubten Dateianhang haben @@ -1143,6 +1153,38 @@ Public Class clsWorkEmail End Try End Function + ''' + ''' Aktualisiert Datensätze in der Tabelle TBEMLP_HISTORY_ATTACHMENT + ''' wenn ein Fehler bei einem Attachment aufgetreten ist. + ''' + Private Sub UpdateAttachmentTableAfterError(pOrgFileName As String, pMessageID As String, pComment As String) + + If String.IsNullOrEmpty(pOrgFileName) Then + _Logger.Info("Parameter [pOrgFileName] missing") + Return + End If + + If String.IsNullOrEmpty(pMessageID) Then + _Logger.Info("Parameter [pMessageID] missing") + Return + End If + + If pComment Is Nothing Then + pComment = "-" + Return + End If + + Dim updateSQL As String = "UPDATE [DD_ECM].[dbo].[TBEMLP_HISTORY_ATTACHMENT] SET COMMENT = '@PARAM_COMMENT', EMAIL_ATTMT_INDEX = '-' WHERE EMAIL_MSGID = '@PARAM_MSGID' AND EMAIL_ATTMT = '@PARAM_ORGFILE';" + + updateSQL = updateSQL.Replace("@PARAM_COMMENT", pComment) + updateSQL = updateSQL.Replace("@PARAM_MSGID", pMessageID) + updateSQL = updateSQL.Replace("@PARAM_ORGFILE", pOrgFileName) + + _Logger.Info("Execute UPDATE-SQL: [{0}]", updateSQL) + _DB_MSSQL.ExecuteNonQuery(updateSQL) + + End Sub + ''' ''' Falls Datei bereits existiert, lösche sie jetzt ''' diff --git a/App/EmailProfiler.Service/EmailProfiler.Service.vbproj b/App/EmailProfiler.Service/EmailProfiler.Service.vbproj index 430e972..ea9ca25 100644 --- a/App/EmailProfiler.Service/EmailProfiler.Service.vbproj +++ b/App/EmailProfiler.Service/EmailProfiler.Service.vbproj @@ -67,6 +67,9 @@ ..\EmailProfiler.Common\bin\Debug\EmailProfiler.Common.dll + + ..\EmailProfiler.Common\bin\Debug\EmailProfiler.Common.dll + ..\packages\NLog.5.0.5\lib\net46\NLog.dll diff --git a/App/EmailProfiler.sln b/App/EmailProfiler.sln index cd2adff..c4216c1 100644 --- a/App/EmailProfiler.sln +++ b/App/EmailProfiler.sln @@ -10,6 +10,9 @@ EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EmailProfiler.Common", "EmailProfiler.Common\EmailProfiler.Common.vbproj", "{9F748DCD-952E-40A0-9DAD-65BF8A39B231}" EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "wisag_check_Att", "wisag_check_Att\wisag_check_Att.vbproj", "{CD67B0B9-A7DE-447D-9982-E7AC43481DDC}" + ProjectSection(ProjectDependencies) = postProject + {9F748DCD-952E-40A0-9DAD-65BF8A39B231} = {9F748DCD-952E-40A0-9DAD-65BF8A39B231} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/App/wisag_check_Att/Form1.Designer.vb b/App/wisag_check_Att/Form1.Designer.vb index 1e68b2b..deb881c 100644 --- a/App/wisag_check_Att/Form1.Designer.vb +++ b/App/wisag_check_Att/Form1.Designer.vb @@ -98,14 +98,14 @@ Partial Class Form1 ' 'BarButtonItem4 ' - Me.BarButtonItem4.Caption = "Extract PDF-Attachments" + Me.BarButtonItem4.Caption = "Extract Attachments from PDF-File" Me.BarButtonItem4.Id = 6 Me.BarButtonItem4.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem4.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.BarButtonItem4.Name = "BarButtonItem4" ' 'btExtractMailAttachments ' - Me.btExtractMailAttachments.Caption = "Extract Mail-Attachments" + Me.btExtractMailAttachments.Caption = "Extract Attachments from EML-File" Me.btExtractMailAttachments.Id = 7 Me.btExtractMailAttachments.ImageOptions.SvgImage = CType(resources.GetObject("btExtractMailAttachments.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.btExtractMailAttachments.Name = "btExtractMailAttachments" diff --git a/App/wisag_check_Att/Form1.vb b/App/wisag_check_Att/Form1.vb index 2c62fb6..57c8d97 100644 --- a/App/wisag_check_Att/Form1.vb +++ b/App/wisag_check_Att/Form1.vb @@ -70,6 +70,12 @@ Public Class Form1 Private Sub btRunEmailCheck_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btRunEmailCheck.ItemClick ' Check Email ListBox1.Items.Clear() + + If bsifolderbrowser Is Nothing Or String.IsNullOrEmpty(bsifolderbrowser.Caption) Then + MsgBox("Es wurde kein input-Verzeichnis konfiguriert. Abbruch!", MsgBoxStyle.Information) + Return + End If + Dim di As New DirectoryInfo(bsifolderbrowser.Caption) ' Get a reference to each file in that directory. Dim fiArr As FileInfo() = di.GetFiles() diff --git a/App/wisag_check_Att/wisag_check_Att.vbproj b/App/wisag_check_Att/wisag_check_Att.vbproj index 6aaff29..fa347f3 100644 --- a/App/wisag_check_Att/wisag_check_Att.vbproj +++ b/App/wisag_check_Att/wisag_check_Att.vbproj @@ -57,13 +57,16 @@ - ..\..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll + ..\..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll - ..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll + ..\..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll - ..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll + ..\..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll + + + ..\EmailProfiler.Common\bin\Debug\EmailProfiler.Common.dll ..\packages\GdPicture.14.2.90\lib\net462\GdPicture.NET.14.dll