EMailProfiler: Config-Daten in zentraler Klasse. abfrage der GDPicture Lizenz über Config-Modul
This commit is contained in:
@@ -23,7 +23,6 @@ Public Class ClassCurrent
|
||||
Public Shared Property CURRENT_DRIVE_CHECK As String = ""
|
||||
Public Shared Property CURRENT_DRIVE_ISFULL As Boolean = False
|
||||
|
||||
|
||||
Public Shared Property CURRENT_WORKMAIL_UID_LIST As New List(Of Long)
|
||||
|
||||
Public Shared Property CURRENT_ImapObject As Imap
|
||||
|
||||
39
App/EmailProfiler.Common/Data/ConfigData.vb
Normal file
39
App/EmailProfiler.Common/Data/ConfigData.vb
Normal file
@@ -0,0 +1,39 @@
|
||||
Imports DigitalData.Modules.Config.ConfigAttributes
|
||||
|
||||
Public Class ConfigData
|
||||
<ConnectionString>
|
||||
Public Property ConnectionString As String = ""
|
||||
|
||||
Public Property Debug As Boolean = False
|
||||
|
||||
Public Property EmailAccountId As Integer = 0
|
||||
|
||||
Public Property EmailTitlePrefix As String = "EmailProfiler"
|
||||
|
||||
Public Property EmailSenderLimitation As String = ""
|
||||
|
||||
Public Property UseWindream As Boolean = False
|
||||
|
||||
''' <summary>
|
||||
''' GUID des EMail Templates das bei Ablehnungsmails verwendet wird.
|
||||
''' Siehe Tabelle DD_ECM.dbo.TBDD_EMAIL_TEMPLATE
|
||||
''' </summary>
|
||||
Public Property RejectionTemplateId As Integer = 0
|
||||
|
||||
''' <summary>
|
||||
''' GUID des EMail Templates das bei Info-Mails verwendet wird.
|
||||
''' Siehe Tabelle DD_ECM.dbo.TBDD_EMAIL_TEMPLATE
|
||||
''' </summary>
|
||||
Public Property InfoTemplateId As Integer = 0
|
||||
|
||||
Public Property EmailTestReceiver As String = ""
|
||||
|
||||
Public Property EmailTestHTML As String = ""
|
||||
|
||||
''' <summary>
|
||||
''' Enthält die Version des GDPicture Modules,
|
||||
''' für das der Lizenzschlüssel aus TBDD_3RD_PARTY_MODULES
|
||||
''' gelesen werden soll.
|
||||
''' </summary>
|
||||
Public Property GDPictureVersion As String = ""
|
||||
End Class
|
||||
@@ -52,6 +52,9 @@
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<HintPath>..\..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Config">
|
||||
<HintPath>..\..\..\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>
|
||||
</Reference>
|
||||
@@ -117,6 +120,7 @@
|
||||
<Compile Include="ClassDBConfig.vb" />
|
||||
<Compile Include="ClassCurrent.vb" />
|
||||
<Compile Include="clsEmail.IMAP.vb" />
|
||||
<Compile Include="Data\ConfigData.vb" />
|
||||
<Compile Include="Data\EmailAttachment.vb" />
|
||||
<Compile Include="EmailStrings.vb" />
|
||||
<Compile Include="clsEncryption.vb" />
|
||||
|
||||
@@ -115,6 +115,8 @@ Public Class clsWindream_Index
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
Return "String"
|
||||
End Function
|
||||
Public Function RunIndexing_Vektor(ByVal oDocument As WMObject, ByVal Indizes As String(), ByVal aValues As String())
|
||||
Try
|
||||
@@ -244,9 +246,9 @@ Public Class clsWindream_Index
|
||||
'clsLogger.AddError("## Fehler in RunIndexing_Vektor - Fehler: " & ex.Message, "RunIndexingVektor")
|
||||
oDocument.Save()
|
||||
oDocument.unlock()
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Try
|
||||
Return False
|
||||
|
||||
End Function
|
||||
Public Function RunIndexing(ByVal oDocument As WMObject, ByVal Indizes() As String, ByVal aValues() As Object, Objekttyp As String)
|
||||
@@ -630,8 +632,9 @@ Public Class clsWindream_Index
|
||||
'clsLogger.AddError(ex.Message, "ClassSearchResult.RunIndexing")
|
||||
oDocument.Save()
|
||||
oDocument.unlock()
|
||||
Return False
|
||||
End Try
|
||||
|
||||
Return False
|
||||
End Function
|
||||
#End Region
|
||||
Public Function GetVektorArray(ByVal oDocument As WMObject, oIndexName As String, NIIndexe As Object, CheckDuplikat As Boolean)
|
||||
@@ -834,7 +837,7 @@ Public Class clsWindream_Index
|
||||
''' _indexname = Name des zu überprüfenden Indexfeldes
|
||||
Public Function GetValueforIndex_WMFile(ByVal _dok As WMObject, _indexname As String)
|
||||
Try
|
||||
Const WMEntityDocument = 1
|
||||
'Const WMEntityDocument = 1
|
||||
Dim IndexwertAusWindream As Object = Nothing
|
||||
IndexwertAusWindream = _dok.GetVariableValue(_indexname)
|
||||
Return IndexwertAusWindream.ToString
|
||||
|
||||
@@ -279,8 +279,9 @@ Public Class clsWindream_allgemein
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Patterns
|
||||
@@ -52,31 +53,48 @@ Public Class clsWorkEmail
|
||||
|
||||
Private _worked_email As Boolean = False
|
||||
|
||||
Sub New(LogConf As LogConfig, ConStr As String, WmConStr As String, pUseWindream As Boolean, EmailAccountID As Integer, EmlProfPraefix As String, pRejectionTemplateId As Integer, pInfoTemplateId As Integer)
|
||||
'Sub New(LogConf As LogConfig,
|
||||
' ConStr As String,
|
||||
' WmConStr As String,
|
||||
' pUseWindream As Boolean,
|
||||
' EmailAccountID As Integer,
|
||||
' EmlProfPraefix As String,
|
||||
' pRejectionTemplateId As Integer,
|
||||
' pInfoTemplateId As Integer,
|
||||
' pConfigData As ConfigData)
|
||||
Sub New(LogConf As LogConfig,
|
||||
ConStr As String,
|
||||
WmConStr As String,
|
||||
pConfigData As ConfigData)
|
||||
Try
|
||||
_Logger = LogConf.GetLogger
|
||||
_LogConfig = LogConf
|
||||
_DB_MSSQL = New MSSQLServer(LogConf, ConStr)
|
||||
_Logger.Debug("clsWorkmail _email initialized")
|
||||
_UseWindream = pUseWindream
|
||||
_UseWindream = pConfigData.UseWindream
|
||||
_Patterns = New Patterns2(LogConf)
|
||||
_RejectionTemplateId = pRejectionTemplateId
|
||||
_InfoTemplateId = pInfoTemplateId
|
||||
_RejectionTemplateId = pConfigData.RejectionTemplateId
|
||||
_InfoTemplateId = pConfigData.InfoTemplateId
|
||||
_Logger.Debug($"_RejectionTemplateId: {_RejectionTemplateId}")
|
||||
|
||||
_ValidExtensions = New List(Of String) From {"pdf", "xls", "xlsx", "doc", "docx", "ppt", "pptx"}
|
||||
_GraphicExtensions = New List(Of String) From {"jpg", "bmp", "jpeg", "gif", "png", "xml"}
|
||||
|
||||
If pUseWindream Then
|
||||
If _UseWindream Then
|
||||
_windream = New clsWindream_allgemein(LogConf)
|
||||
_windream_index = New clsWindream_Index(LogConf)
|
||||
_windreamConnectionString = WmConStr
|
||||
End If
|
||||
|
||||
_LicenseManager.RegisterKEY(GDPictureLicense)
|
||||
GDPictureLicense = ConfigDbFunct.GetProductLicense("GDPICTURE", pConfigData.GDPictureVersion, _LogConfig, ConStr)
|
||||
If String.IsNullOrEmpty(GDPictureLicense) = False Then
|
||||
_LicenseManager.RegisterKEY(GDPictureLicense)
|
||||
Else
|
||||
_Logger.Error("clsWorkEmail() No value for GDPictureLicense found!")
|
||||
End If
|
||||
|
||||
_EmailAccountID = EmailAccountID
|
||||
SUBJECT_PRAFIX = EmlProfPraefix
|
||||
_EmailAccountID = pConfigData.EmailAccountId
|
||||
SUBJECT_PRAFIX = pConfigData.EmailTitlePrefix
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
Imports EmailProfiler.Common.ClassCurrent
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Messaging.Mail
|
||||
Imports EmailProfiler.Common.ClassCurrent
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Mail.Headers
|
||||
Imports System.Reflection.Emit
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class clsWorker
|
||||
Private ReadOnly Logger As Logger
|
||||
Private ReadOnly Fetcher As MailFetcher
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly UseWindream As Boolean = False
|
||||
Private ReadOnly _UseWindream As Boolean = False
|
||||
Private ReadOnly ClassWindreamAllgemein As clsWindream_allgemein
|
||||
Private ReadOnly ClassWindreamIndex As clsWindream_Index
|
||||
Private ReadOnly ClassWorkMail As clsWorkEmail
|
||||
Private ReadOnly Encryption As clsEncryption
|
||||
Private ReadOnly ProfileId As Integer = 0D
|
||||
Private ReadOnly _ProfileId As Integer = 0D
|
||||
Private ReadOnly EmailLimitationSender As String = ""
|
||||
Private ReadOnly EmailLimitationEnabled As Boolean = False
|
||||
|
||||
@@ -25,30 +23,28 @@ Public Class clsWorker
|
||||
|
||||
Private ReadOnly LocalEmlFile As String = ""
|
||||
|
||||
Sub New(pLogConfig As LogConfig, pConnectionString As String, pWindreamConnectionString As String, pPollProfileId As Integer, pUseWindream As Boolean,
|
||||
pEmailAccountID As Integer, pEmailPrefix As String, pEmailLimitationSender As String, pRejectionTemplateId As Integer, pInfoTemplateId As Integer, Optional pLocalEML As String = "")
|
||||
Sub New(pLogConfig As LogConfig, pConnectionString As String, pWindreamConnectionString As String, pPollProfileId As Integer, pConfigData As ConfigData, Optional pLocalEML As String = "")
|
||||
Logger = pLogConfig.GetLogger
|
||||
'ClassEmailImap = New clsEmailIMAP(pLogConfig)
|
||||
Fetcher = New MailFetcher(pLogConfig)
|
||||
Database = New MSSQLServer(pLogConfig, pConnectionString)
|
||||
|
||||
UseWindream = pUseWindream
|
||||
EmailLimitationSender = pEmailLimitationSender
|
||||
_UseWindream = pConfigData.UseWindream
|
||||
EmailLimitationSender = pConfigData.EmailSenderLimitation
|
||||
If EmailLimitationSender.Contains("@") Then
|
||||
Logger.Info("Email Sender Limitation active for address: [{0}]", EmailLimitationSender)
|
||||
EmailLimitationEnabled = True
|
||||
End If
|
||||
|
||||
If UseWindream Then
|
||||
If _UseWindream Then
|
||||
ClassWindreamAllgemein = New clsWindream_allgemein(pLogConfig)
|
||||
ClassWindreamIndex = New clsWindream_Index(pLogConfig)
|
||||
End If
|
||||
|
||||
ClassWorkMail = New clsWorkEmail(pLogConfig, pConnectionString, pWindreamConnectionString, pUseWindream, pEmailAccountID, pEmailPrefix, pRejectionTemplateId, pInfoTemplateId)
|
||||
|
||||
ClassWorkMail = New clsWorkEmail(pLogConfig, pConnectionString, pWindreamConnectionString, pConfigData)
|
||||
|
||||
Encryption = New clsEncryption("!35452didalog=", pLogConfig)
|
||||
ProfileId = pPollProfileId
|
||||
_ProfileId = pPollProfileId
|
||||
LocalEmlFile = pLocalEML
|
||||
End Sub
|
||||
|
||||
@@ -68,7 +64,6 @@ Public Class clsWorker
|
||||
TEMP_FILES.Clear()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function LoadEmailAccounts() As DataTable
|
||||
Return Database.GetDatatable("SELECT * FROM TBDD_EMAIL_ACCOUNT WHERE ACTIVE = 1")
|
||||
End Function
|
||||
@@ -76,7 +71,7 @@ Public Class clsWorker
|
||||
Private Function LoadPollingProfiles(pProfileId As Integer) As DataTable
|
||||
Dim oSQL = "SELECT * FROM TBEMLP_POLL_PROFILES WHERE ACTIVE = 1"
|
||||
|
||||
If ProfileId = 0 Then
|
||||
If _ProfileId = 0 Then
|
||||
oSQL &= " ORDER BY SEQUENCE"
|
||||
Else
|
||||
oSQL &= $" AND GUID = {pProfileId}"
|
||||
@@ -95,7 +90,7 @@ Public Class clsWorker
|
||||
End If
|
||||
|
||||
Logger.Debug("now windream_init... ")
|
||||
If UseWindream Then
|
||||
If _UseWindream Then
|
||||
If ClassWindreamAllgemein.Init = False Then
|
||||
Logger.Info("windream could not be initialized!!")
|
||||
Exit Sub
|
||||
@@ -105,14 +100,14 @@ Public Class clsWorker
|
||||
End If
|
||||
|
||||
Dim EmailAccountTable As DataTable = LoadEmailAccounts()
|
||||
Dim PollingProfileTable = LoadPollingProfiles(ProfileId)
|
||||
Dim PollingProfileTable = LoadPollingProfiles(_ProfileId)
|
||||
|
||||
Dim oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE ACTIVE = 1"
|
||||
If CallFromService = True Then
|
||||
oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE EMAIL_PROFILER'"
|
||||
End If
|
||||
'Dim oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE ACTIVE = 1"
|
||||
'If CallFromService = True Then
|
||||
' oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE EMAIL_PROFILER'"
|
||||
'End If
|
||||
|
||||
GDPictureLicense = Database.GetScalarValue(oSQLGDPicture)
|
||||
'GDPictureLicense = Database.GetScalarValue(oSQLGDPicture)
|
||||
|
||||
If IsNothing(PollingProfileTable) Then
|
||||
Logger.Warn("Error while fetching Polling Profiles. Exiting.")
|
||||
|
||||
Reference in New Issue
Block a user