Stage Commit clsWorkemail

This commit is contained in:
Developer01 2025-12-03 13:01:50 +01:00
commit f150041a33
7 changed files with 84 additions and 31 deletions

View File

@ -51,30 +51,26 @@
</Reference>
<Reference Include="DigitalData.Modules.Base, Version=1.3.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Config">
<HintPath>..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Language, Version=1.7.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Language\bin\Debug\DigitalData.Modules.Language.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging, Version=2.6.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Messaging, Version=1.9.4.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Patterns, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Patterns\bin\Debug\DigitalData.Modules.Patterns.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Patterns\bin\Debug\DigitalData.Modules.Patterns.dll</HintPath>
</Reference>
<Reference Include="GdPicture.NET.14, Version=14.2.90.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@ -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
''' <summary>
''' Holt aus alle Anhängen diejenigen raus,
''' die einen erlaubten Dateianhang haben
@ -1143,6 +1153,38 @@ Public Class clsWorkEmail
End Try
End Function
''' <summary>
''' Aktualisiert Datensätze in der Tabelle TBEMLP_HISTORY_ATTACHMENT
''' wenn ein Fehler bei einem Attachment aufgetreten ist.
''' </summary>
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
''' <summary>
''' Falls Datei bereits existiert, lösche sie jetzt
''' </summary>

View File

@ -67,6 +67,9 @@
<Reference Include="EmailProfiler.Common">
<HintPath>..\EmailProfiler.Common\bin\Debug\EmailProfiler.Common.dll</HintPath>
</Reference>
<Reference Include="EmailProfiler.Common">
<HintPath>..\EmailProfiler.Common\bin\Debug\EmailProfiler.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>

View File

@ -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

View File

@ -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"

View File

@ -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()

View File

@ -57,13 +57,16 @@
<Reference Include="DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DigitalData.Modules.Config">
<HintPath>..\..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
<HintPath>..\..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="EmailProfiler.Common">
<HintPath>..\EmailProfiler.Common\bin\Debug\EmailProfiler.Common.dll</HintPath>
</Reference>
<Reference Include="GdPicture.NET.14, Version=14.2.90.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>..\packages\GdPicture.14.2.90\lib\net462\GdPicture.NET.14.dll</HintPath>