Logging und Bugfixes

This commit is contained in:
Digital Data - Marlon Schreiber
2019-06-27 17:04:48 +02:00
parent 18ae60e75d
commit 25f8db19ad
41 changed files with 142 additions and 145 deletions

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2.0.0")>
<Assembly: AssemblyVersion("2.1.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@@ -11,7 +11,7 @@ Public Class clsWorkEmail
Private Shared Logger As Logger
Private MyLogger As LogConfig
Private _email As clsEmail
Private _Database As clsDatabase
Private _DB_MSSQL As clsDatabase
Private _windream As clsWindream_allgemein
Private _windream_index As clsWindream_Index
Private _firebird As Firebird
@@ -24,7 +24,7 @@ Public Class clsWorkEmail
Logger.Info("Detail-Log is on")
End If
_email = New clsEmail(LogConf)
_Database = New clsDatabase(LogConf, ConStr)
_DB_MSSQL = New clsDatabase(LogConf, ConStr)
_windream = New clsWindream_allgemein(LogConf)
_windream_index = New clsWindream_Index(LogConf)
If FB_DATASOURCE <> String.Empty Then
@@ -252,6 +252,7 @@ Public Class clsWorkEmail
Dim cleanPath As String = String.Join("", oTempFilename.Split(Path.GetInvalidPathChars()))
If System.IO.File.Exists(cleanPath) = False Then
CURRENT_MAIL_MESSAGE.Save(cleanPath, True)
Logger.Info($"Email saved to ({cleanPath})")
Else
Logger.Info("EMail (" & CURRENT_MAIL_MESSAGE.Subject & ") already existing!", False, "RUN_THREAD.COPY_2_HDD")
End If
@@ -266,7 +267,7 @@ Public Class clsWorkEmail
End Function
Private Function EXTRACT_BODY()
TEMP_HTML_RESULTS.Clear()
Dim oDTFunctionRegex As DataTable = _Database.Return_Datatable("SELECT * FROM TBDD_FUNCTION_REGEX WHERE UPPER(FUNCTION_NAME) IN (UPPER('EMAIL_PROFILER - RemoveHTMLText'),UPPER('EMAIL_PROFILER - RemoveHTMLText1'))")
Dim oDTFunctionRegex As DataTable = _DB_MSSQL.Return_Datatable("SELECT * FROM TBDD_FUNCTION_REGEX WHERE UPPER(FUNCTION_NAME) IN (UPPER('EMAIL_PROFILER - RemoveHTMLText'),UPPER('EMAIL_PROFILER - RemoveHTMLText1'))")
Dim oMsg_email As New Independentsoft.Email.Mime.Message(CURRENT_TEMP_MAIL_PATH)
@@ -461,7 +462,9 @@ Public Class clsWorkEmail
If System.IO.File.Exists(oAttachmentFileString) = False Then
Logger.Debug(String.Format("Trying to save attachment [{0}]", oAttachmentFileString))
oAttachment.Save(oAttachmentFileString)
Logger.Info(String.Format("Attachment saved to [{0}]", oAttachmentFileString))
INSERT_HISTORY_FB(oMSGID, oAttachment.GetFileName)
INSERT_HISTORY_MSSQL(oMSGID, oAttachment.GetFileName)
Else
Logger.Info("Attachment (" & oAttachmentFileString & ") already existing!", False, "EXTRACT_ATTACHMENTS")
End If
@@ -520,7 +523,7 @@ Public Class clsWorkEmail
$"'{CURRENT_MAIL_BODY_ANSWER1}'," &
$"'{CURRENT_MAIL_BODY_Substr2}'," &
$"'{CURRENT_MAIL_FROM}')"
_Database.Execute_non_Query(ins)
_DB_MSSQL.Execute_non_Query(ins)
End If
End Function
@@ -539,6 +542,19 @@ Public Class clsWorkEmail
_firebird.ExecuteNonQuery(ins)
End If
End Function
Private Function INSERT_HISTORY_MSSQL(oMSGID As String, ATTMT1 As String)
If MessageError = False Then
Dim ins = $"INSERT INTO TBEMLP_HISTORY_ATTACHMENT (WORK_PROCESS,EMAIL_MSGID,EMAIL_FROM,EMAIL_SUBJECT,EMAIL_DATETIME,EMAIL_BODY,EMAIL_ATTMT) VALUES " &
$"('{CURRENT_MAIL_PROCESS_NAME}'," &
$"'{oMSGID}'," &
$"'{CURRENT_MAIL_MESSAGE.From.EmailAddress}'," &
$"'{CURRENT_MAIL_MESSAGE.Subject}'," &
$"'{CURRENT_MAIL_MESSAGE.Date}'," &
$"'{CURRENT_MAIL_BODY_ALL}'," &
$"'{ATTMT1}')"
_DB_MSSQL.Execute_non_Query(ins)
End If
End Function
Private Function GetChildren(ByVal bodyParts As BodyPartCollection) As BodyPartCollection
Dim children As New BodyPartCollection()
@@ -576,7 +592,7 @@ Public Class clsWorkEmail
Logger.Info(String.Format("Found Keyword '{0}' in MessageBody", oKeyWord))
oFoundSomething = True
Dim sql As String = String.Format("SELECT * FROM TBEMLP_POLL_INDEXING_STEPS WHERE STEP_ID = {0} AND ACTIVE = 1", POLL_STEP_GUID)
DT_INDEXING_STEPS = _Database.Return_Datatable(sql)
DT_INDEXING_STEPS = _DB_MSSQL.Return_Datatable(sql)
If DT_INDEXING_STEPS.Rows.Count > 0 Then
WORK_INDEXING_STEPS()
Else
@@ -592,7 +608,7 @@ Public Class clsWorkEmail
End If
If _worked_email = False And oFoundSomething = False Then
Dim sql As String = String.Format("SELECT * FROM TBEMLP_POLL_INDEXING_STEPS WHERE STEP_ID = {0} AND ACTIVE = 1 AND USE_FOR_DIRECT_ANSWER = 1", POLL_STEP_GUID)
DT_INDEXING_STEPS = _Database.Return_Datatable(sql)
DT_INDEXING_STEPS = _DB_MSSQL.Return_Datatable(sql)
If DT_INDEXING_STEPS.Rows.Count >= 1 Then
Logger.Info($"An index for direct answer was configured. Therefore it will be used...")
End If
@@ -691,21 +707,26 @@ Public Class clsWorkEmail
Try
Dim oDOC_ID = REGEX_CHECK_DOC_ID(CURRENT_MAIL_SUBJECT.Replace("10636", "133092").Replace("10644", "133092"))
If Not IsNothing(oDOC_ID) Then
Dim oDT_BASE_ATTR As DataTable = _Database.Return_DatatableCS("SELECT * FROM BaseAttributes WHERE dwDocID = " & oDOC_ID, WM_CON_STRING)
Dim oDT_BASE_ATTR As DataTable = _DB_MSSQL.Return_DatatableCS("SELECT * FROM BaseAttributes WHERE dwDocID = " & oDOC_ID, WM_CON_STRING)
If Not IsNothing(oDT_BASE_ATTR) Then
If oDT_BASE_ATTR.Rows.Count = 1 Then
CURRENT_DOC_ID = oDOC_ID
Dim oSql = String.Format("Select[dbo].[FNDD_GET_WINDREAM_FILE_PATH]({0},'{1}')", CURRENT_DOC_ID, WM_DRIVE)
CURRENT_DOC_PATH = _Database.Execute_Scalar(oSql)
CURRENT_DOC_PATH = _DB_MSSQL.Execute_Scalar(oSql)
Logger.Debug("CURRENT_DOC_PATH is: " & CURRENT_DOC_PATH)
CURRENT_WM_DOC = Nothing
Dim oWMDOC As WMObject
Dim oWMNormpath = CURRENT_DOC_PATH.ToLower.Replace(WM_DRIVE.ToLower & ":", "")
oWMNormpath = CURRENT_DOC_PATH.ToLower.Replace("\\windream\objects", "")
oWMNormpath = CURRENT_DOC_PATH.ToLower.Replace("w:", "")
Logger.Debug("oWMNormpath is: " & oWMNormpath)
Try
oWMDOC = _windream.oWMSession.GetWMObjectByPath(WMEntity.WMEntityDocument, CURRENT_DOC_PATH.Substring(2))
oWMDOC = _windream.oWMSession.GetWMObjectByPath(WMEntity.WMEntityDocument, oWMNormpath)
CURRENT_WM_DOC = oWMDOC
Return True
Catch ex As Exception
Logger.Warn("error while creating WMObject in (GET_DOC_INFO): " & ex.Message)
Logger.Warn("oWMNormpath: " & oWMNormpath)
Return False
End Try

View File

@@ -82,7 +82,7 @@ Public Class clsWorker
MAIL_USER_PW = ""
CURRENT_POLL_TYPE = oDR_Profile.Item("POLL_TYPE")
Logger.Info(String.Format("Working on profile: ({0}-{1}-{2}) ", oDR_Profile.Item("GUID"), oDR_Profile.Item("PROFILE_NAME"), CURRENT_POLL_TYPE))
Logger.Debug(String.Format("Working on profile: ({0}-{1}-{2}) ", oDR_Profile.Item("GUID"), oDR_Profile.Item("PROFILE_NAME"), CURRENT_POLL_TYPE))
CURRENT_EMAIL_GUID = oDR_Profile.Item("EMAIL_CONF_ID")
Dim EMAIL_PROF_TABLE As DataTable = DT_TBDD_EMAIL
@@ -145,7 +145,7 @@ Public Class clsWorker
End If
Next
Else
Logger.Info(String.Format("No emails for profile!"))
Logger.Debug(String.Format("No emails for profile!"))
End If
Else
Logger.Warn("For the Email-Profile ID " & CURRENT_EMAIL_GUID & " no record could be found!")

View File

@@ -28,3 +28,4 @@ E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.dll
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.xml
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.pdb
E:\SchreiberM\Visual Studio\GIT\DD_EmailProfiler\App\DigitalData.EMLProfiler\obj\Debug\DigitalData.EMLProfiler.vbprojAssemblyReference.cache