EMailProfiler: Config-Daten in zentraler Klasse. abfrage der GDPicture Lizenz über Config-Modul

This commit is contained in:
PitzM 2025-01-09 10:13:07 +01:00
parent 6193019051
commit ba999fa1d9
15 changed files with 178 additions and 103 deletions

View File

@ -23,7 +23,6 @@ Public Class ClassCurrent
Public Shared Property CURRENT_DRIVE_CHECK As String = "" Public Shared Property CURRENT_DRIVE_CHECK As String = ""
Public Shared Property CURRENT_DRIVE_ISFULL As Boolean = False 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_WORKMAIL_UID_LIST As New List(Of Long)
Public Shared Property CURRENT_ImapObject As Imap Public Shared Property CURRENT_ImapObject As Imap

View 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

View File

@ -52,6 +52,9 @@
<Reference Include="DigitalData.Modules.Base"> <Reference Include="DigitalData.Modules.Base">
<HintPath>..\..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath> <HintPath>..\..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Config">
<HintPath>..\..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database"> <Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath> <HintPath>..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference> </Reference>
@ -117,6 +120,7 @@
<Compile Include="ClassDBConfig.vb" /> <Compile Include="ClassDBConfig.vb" />
<Compile Include="ClassCurrent.vb" /> <Compile Include="ClassCurrent.vb" />
<Compile Include="clsEmail.IMAP.vb" /> <Compile Include="clsEmail.IMAP.vb" />
<Compile Include="Data\ConfigData.vb" />
<Compile Include="Data\EmailAttachment.vb" /> <Compile Include="Data\EmailAttachment.vb" />
<Compile Include="EmailStrings.vb" /> <Compile Include="EmailStrings.vb" />
<Compile Include="clsEncryption.vb" /> <Compile Include="clsEncryption.vb" />

View File

@ -115,6 +115,8 @@ Public Class clsWindream_Index
Catch ex As Exception Catch ex As Exception
End Try End Try
Return "String"
End Function End Function
Public Function RunIndexing_Vektor(ByVal oDocument As WMObject, ByVal Indizes As String(), ByVal aValues As String()) Public Function RunIndexing_Vektor(ByVal oDocument As WMObject, ByVal Indizes As String(), ByVal aValues As String())
Try Try
@ -244,9 +246,9 @@ Public Class clsWindream_Index
'clsLogger.AddError("## Fehler in RunIndexing_Vektor - Fehler: " & ex.Message, "RunIndexingVektor") 'clsLogger.AddError("## Fehler in RunIndexing_Vektor - Fehler: " & ex.Message, "RunIndexingVektor")
oDocument.Save() oDocument.Save()
oDocument.unlock() oDocument.unlock()
Return False
End Try
End Try
Return False
End Function End Function
Public Function RunIndexing(ByVal oDocument As WMObject, ByVal Indizes() As String, ByVal aValues() As Object, Objekttyp As String) 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") 'clsLogger.AddError(ex.Message, "ClassSearchResult.RunIndexing")
oDocument.Save() oDocument.Save()
oDocument.unlock() oDocument.unlock()
Return False
End Try End Try
Return False
End Function End Function
#End Region #End Region
Public Function GetVektorArray(ByVal oDocument As WMObject, oIndexName As String, NIIndexe As Object, CheckDuplikat As Boolean) 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 ''' _indexname = Name des zu überprüfenden Indexfeldes
Public Function GetValueforIndex_WMFile(ByVal _dok As WMObject, _indexname As String) Public Function GetValueforIndex_WMFile(ByVal _dok As WMObject, _indexname As String)
Try Try
Const WMEntityDocument = 1 'Const WMEntityDocument = 1
Dim IndexwertAusWindream As Object = Nothing Dim IndexwertAusWindream As Object = Nothing
IndexwertAusWindream = _dok.GetVariableValue(_indexname) IndexwertAusWindream = _dok.GetVariableValue(_indexname)
Return IndexwertAusWindream.ToString Return IndexwertAusWindream.ToString

View File

@ -279,8 +279,9 @@ Public Class clsWindream_allgemein
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
Return False
End Try End Try
Return False
End Function End Function
#End Region #End Region

View File

@ -3,6 +3,7 @@ Imports System.IO
Imports System.Text.RegularExpressions Imports System.Text.RegularExpressions
Imports System.Threading Imports System.Threading
Imports DigitalData.Modules.Base Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Patterns Imports DigitalData.Modules.Patterns
@ -52,31 +53,48 @@ Public Class clsWorkEmail
Private _worked_email As Boolean = False 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 Try
_Logger = LogConf.GetLogger _Logger = LogConf.GetLogger
_LogConfig = LogConf _LogConfig = LogConf
_DB_MSSQL = New MSSQLServer(LogConf, ConStr) _DB_MSSQL = New MSSQLServer(LogConf, ConStr)
_Logger.Debug("clsWorkmail _email initialized") _Logger.Debug("clsWorkmail _email initialized")
_UseWindream = pUseWindream _UseWindream = pConfigData.UseWindream
_Patterns = New Patterns2(LogConf) _Patterns = New Patterns2(LogConf)
_RejectionTemplateId = pRejectionTemplateId _RejectionTemplateId = pConfigData.RejectionTemplateId
_InfoTemplateId = pInfoTemplateId _InfoTemplateId = pConfigData.InfoTemplateId
_Logger.Debug($"_RejectionTemplateId: {_RejectionTemplateId}") _Logger.Debug($"_RejectionTemplateId: {_RejectionTemplateId}")
_ValidExtensions = New List(Of String) From {"pdf", "xls", "xlsx", "doc", "docx", "ppt", "pptx"} _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"} _GraphicExtensions = New List(Of String) From {"jpg", "bmp", "jpeg", "gif", "png", "xml"}
If pUseWindream Then If _UseWindream Then
_windream = New clsWindream_allgemein(LogConf) _windream = New clsWindream_allgemein(LogConf)
_windream_index = New clsWindream_Index(LogConf) _windream_index = New clsWindream_Index(LogConf)
_windreamConnectionString = WmConStr _windreamConnectionString = WmConStr
End If End If
GDPictureLicense = ConfigDbFunct.GetProductLicense("GDPICTURE", pConfigData.GDPictureVersion, _LogConfig, ConStr)
If String.IsNullOrEmpty(GDPictureLicense) = False Then
_LicenseManager.RegisterKEY(GDPictureLicense) _LicenseManager.RegisterKEY(GDPictureLicense)
Else
_Logger.Error("clsWorkEmail() No value for GDPictureLicense found!")
End If
_EmailAccountID = EmailAccountID _EmailAccountID = pConfigData.EmailAccountId
SUBJECT_PRAFIX = EmlProfPraefix SUBJECT_PRAFIX = pConfigData.EmailTitlePrefix
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
End Try End Try

View File

@ -1,23 +1,21 @@
Imports EmailProfiler.Common.ClassCurrent Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Base Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Messaging.Mail Imports DigitalData.Modules.Messaging.Mail
Imports EmailProfiler.Common.ClassCurrent
Imports Limilabs.Mail Imports Limilabs.Mail
Imports Limilabs.Mail.Headers Imports Limilabs.Mail.Headers
Imports System.Reflection.Emit
Imports GdPicture14
Public Class clsWorker Public Class clsWorker
Private ReadOnly Logger As Logger Private ReadOnly Logger As Logger
Private ReadOnly Fetcher As MailFetcher Private ReadOnly Fetcher As MailFetcher
Private ReadOnly Database As MSSQLServer 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 ClassWindreamAllgemein As clsWindream_allgemein
Private ReadOnly ClassWindreamIndex As clsWindream_Index Private ReadOnly ClassWindreamIndex As clsWindream_Index
Private ReadOnly ClassWorkMail As clsWorkEmail Private ReadOnly ClassWorkMail As clsWorkEmail
Private ReadOnly Encryption As clsEncryption Private ReadOnly Encryption As clsEncryption
Private ReadOnly ProfileId As Integer = 0D Private ReadOnly _ProfileId As Integer = 0D
Private ReadOnly EmailLimitationSender As String = "" Private ReadOnly EmailLimitationSender As String = ""
Private ReadOnly EmailLimitationEnabled As Boolean = False Private ReadOnly EmailLimitationEnabled As Boolean = False
@ -25,30 +23,28 @@ Public Class clsWorker
Private ReadOnly LocalEmlFile As String = "" Private ReadOnly LocalEmlFile As String = ""
Sub New(pLogConfig As LogConfig, pConnectionString As String, pWindreamConnectionString As String, pPollProfileId As Integer, pUseWindream As Boolean, Sub New(pLogConfig As LogConfig, pConnectionString As String, pWindreamConnectionString As String, pPollProfileId As Integer, pConfigData As ConfigData, Optional pLocalEML As String = "")
pEmailAccountID As Integer, pEmailPrefix As String, pEmailLimitationSender As String, pRejectionTemplateId As Integer, pInfoTemplateId As Integer, Optional pLocalEML As String = "")
Logger = pLogConfig.GetLogger Logger = pLogConfig.GetLogger
'ClassEmailImap = New clsEmailIMAP(pLogConfig) 'ClassEmailImap = New clsEmailIMAP(pLogConfig)
Fetcher = New MailFetcher(pLogConfig) Fetcher = New MailFetcher(pLogConfig)
Database = New MSSQLServer(pLogConfig, pConnectionString) Database = New MSSQLServer(pLogConfig, pConnectionString)
UseWindream = pUseWindream _UseWindream = pConfigData.UseWindream
EmailLimitationSender = pEmailLimitationSender EmailLimitationSender = pConfigData.EmailSenderLimitation
If EmailLimitationSender.Contains("@") Then If EmailLimitationSender.Contains("@") Then
Logger.Info("Email Sender Limitation active for address: [{0}]", EmailLimitationSender) Logger.Info("Email Sender Limitation active for address: [{0}]", EmailLimitationSender)
EmailLimitationEnabled = True EmailLimitationEnabled = True
End If End If
If UseWindream Then If _UseWindream Then
ClassWindreamAllgemein = New clsWindream_allgemein(pLogConfig) ClassWindreamAllgemein = New clsWindream_allgemein(pLogConfig)
ClassWindreamIndex = New clsWindream_Index(pLogConfig) ClassWindreamIndex = New clsWindream_Index(pLogConfig)
End If 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) Encryption = New clsEncryption("!35452didalog=", pLogConfig)
ProfileId = pPollProfileId _ProfileId = pPollProfileId
LocalEmlFile = pLocalEML LocalEmlFile = pLocalEML
End Sub End Sub
@ -68,7 +64,6 @@ Public Class clsWorker
TEMP_FILES.Clear() TEMP_FILES.Clear()
End Sub End Sub
Private Function LoadEmailAccounts() As DataTable Private Function LoadEmailAccounts() As DataTable
Return Database.GetDatatable("SELECT * FROM TBDD_EMAIL_ACCOUNT WHERE ACTIVE = 1") Return Database.GetDatatable("SELECT * FROM TBDD_EMAIL_ACCOUNT WHERE ACTIVE = 1")
End Function End Function
@ -76,7 +71,7 @@ Public Class clsWorker
Private Function LoadPollingProfiles(pProfileId As Integer) As DataTable Private Function LoadPollingProfiles(pProfileId As Integer) As DataTable
Dim oSQL = "SELECT * FROM TBEMLP_POLL_PROFILES WHERE ACTIVE = 1" Dim oSQL = "SELECT * FROM TBEMLP_POLL_PROFILES WHERE ACTIVE = 1"
If ProfileId = 0 Then If _ProfileId = 0 Then
oSQL &= " ORDER BY SEQUENCE" oSQL &= " ORDER BY SEQUENCE"
Else Else
oSQL &= $" AND GUID = {pProfileId}" oSQL &= $" AND GUID = {pProfileId}"
@ -95,7 +90,7 @@ Public Class clsWorker
End If End If
Logger.Debug("now windream_init... ") Logger.Debug("now windream_init... ")
If UseWindream Then If _UseWindream Then
If ClassWindreamAllgemein.Init = False Then If ClassWindreamAllgemein.Init = False Then
Logger.Info("windream could not be initialized!!") Logger.Info("windream could not be initialized!!")
Exit Sub Exit Sub
@ -105,14 +100,14 @@ Public Class clsWorker
End If End If
Dim EmailAccountTable As DataTable = LoadEmailAccounts() 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" 'Dim oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE ACTIVE = 1"
If CallFromService = True Then 'If CallFromService = True Then
oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE EMAIL_PROFILER'" ' oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE EMAIL_PROFILER'"
End If 'End If
GDPictureLicense = Database.GetScalarValue(oSQLGDPicture) 'GDPictureLicense = Database.GetScalarValue(oSQLGDPicture)
If IsNothing(PollingProfileTable) Then If IsNothing(PollingProfileTable) Then
Logger.Warn("Error while fetching Polling Profiles. Exiting.") Logger.Warn("Error while fetching Polling Profiles. Exiting.")

View File

@ -19,4 +19,11 @@ Public Class Config
Public Property EmailTestReceiver As String = "" Public Property EmailTestReceiver As String = ""
Public Property EmailTestHTML 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 End Class

View File

@ -62,27 +62,27 @@
<Reference Include="DevExpress.XtraPrinting.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <Reference Include="DevExpress.XtraPrinting.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DigitalData.GUIs.Common, Version=2.5.6.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.GUIs.Common, Version=2.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDMonorepo\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll</HintPath> <HintPath>..\..\..\DDMonorepo\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Base, Version=1.3.6.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Base, Version=1.3.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath> <HintPath>..\..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Config, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Config, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath> <HintPath>..\..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Database, Version=2.3.4.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Database, Version=2.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath> <HintPath>..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Logging, Version=2.6.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Logging, Version=2.6.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath> <HintPath>..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Messaging, Version=1.9.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DigitalData.Modules.Messaging, Version=1.9.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\2_DLL Projekte\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath> <HintPath>..\..\..\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">

View File

@ -12,7 +12,7 @@ Imports EmailProfiler.Common
Public Class frmMain Public Class frmMain
Private Logger As Logger Private Logger As Logger
Private LogConfig As LogConfig Private LogConfig As LogConfig
Private ConfigManager As ConfigManager(Of Config) Private ConfigManager As ConfigManager(Of ConfigData)
Private _database As MSSQLServer Private _database As MSSQLServer
Private _Encryption As clsEncryption Private _Encryption As clsEncryption
Private _windream As clsWindream_allgemein Private _windream As clsWindream_allgemein
@ -21,7 +21,6 @@ Public Class frmMain
Private _SQLServerConString As String Private _SQLServerConString As String
Private _Worklist As List(Of String) Private _Worklist As List(Of String)
Private _limilab As Limilab Private _limilab As Limilab
Private _ConfigManager As ClassDBConfig
Private _DBConfig As ClassDBConfig.Config Private _DBConfig As ClassDBConfig.Config
Private MyConnectionString As String Private MyConnectionString As String
@ -29,7 +28,7 @@ Public Class frmMain
Try Try
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName) LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName)
_limilab = New Limilab(LogConfig) _limilab = New Limilab(LogConfig)
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath, Application.CommonAppDataPath, Application.StartupPath) ConfigManager = New ConfigManager(Of ConfigData)(LogConfig, Application.UserAppDataPath, Application.CommonAppDataPath, Application.StartupPath)
Logger = LogConfig.GetLogger() Logger = LogConfig.GetLogger()
If ConfigManager.Config.Debug = True Then If ConfigManager.Config.Debug = True Then
@ -47,8 +46,6 @@ Public Class frmMain
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in FormLoad") MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in FormLoad")
End Try End Try
If Set_ConnectionStrings() Then If Set_ConnectionStrings() Then
Load_AllData() Load_AllData()
Check_Steps() Check_Steps()
@ -210,8 +207,8 @@ Public Class frmMain
_database = New MSSQLServer(LogConfig, _SQLServerConString) _database = New MSSQLServer(LogConfig, _SQLServerConString)
Logger.Debug("Inititalizing Configuration") Logger.Debug("Inititalizing Configuration")
_ConfigManager = New ClassDBConfig(LogConfig, _database) Dim oConfigManager As ClassDBConfig = New ClassDBConfig(LogConfig, _database)
_DBConfig = _ConfigManager.GetConfig() _DBConfig = oConfigManager.GetConfig()
If _DBConfig Is Nothing Then If _DBConfig Is Nothing Then
MsgBox("Configuration could not be loaded. Please check the Logfile.", MsgBoxStyle.Critical, Text) MsgBox("Configuration could not be loaded. Please check the Logfile.", MsgBoxStyle.Critical, Text)
@ -251,7 +248,6 @@ Public Class frmMain
If chkbxUserAut.Checked Then If chkbxUserAut.Checked Then
con = "Data Source=" & Me.txtServer.Text & ";Trusted_Connection=True;" con = "Data Source=" & Me.txtServer.Text & ";Trusted_Connection=True;"
Else Else
'con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
con = "Server=" & Me.txtServer.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";" con = "Server=" & Me.txtServer.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
End If End If
Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString) Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString)
@ -299,9 +295,6 @@ Public Class frmMain
'DialogResult = Windows.Forms.DialogResult.OK 'DialogResult = Windows.Forms.DialogResult.OK
Dim result As MsgBoxResult Dim result As MsgBoxResult
Dim msg = "Die Verbindung wurde erfolgreich aufgebaut!" & vbNewLine & "Möchten Sie diese Verbindung nun in der Anwendung speichern?" Dim msg = "Die Verbindung wurde erfolgreich aufgebaut!" & vbNewLine & "Möchten Sie diese Verbindung nun in der Anwendung speichern?"
'If USER_LANGUAGE <> "de-DE" Then
' msg = "Connection was successfully opened!" & vbNewLine & "Would You like to save it?"
'End If
result = MessageBox.Show(msg, "Database-Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Question) result = MessageBox.Show(msg, "Database-Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then If result = MsgBoxResult.Yes Then
'Set the construction string 'Set the construction string
@ -309,7 +302,7 @@ Public Class frmMain
ConfigManager.Config.ConnectionString = MyConnectionString ConfigManager.Config.ConnectionString = MyConnectionString
_database = New MSSQLServer(LogConfig, MyConnectionString) _database = New MSSQLServer(LogConfig, MyConnectionString)
_ConfigManager = New ClassDBConfig(LogConfig, _database) Dim oConfigManager As ClassDBConfig = New ClassDBConfig(LogConfig, _database)
'csb.ConnectionString 'csb.ConnectionString
'_database.Init(MyConnectionString) '_database.Init(MyConnectionString)
@ -336,20 +329,20 @@ Public Class frmMain
End Sub End Sub
Private Sub BackgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker1.DoWork Private Sub BackgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs) Handles BackgroundWorker1.DoWork
ConfigManager.Config.EmailTitlePrefix = "EmailProfilerTestClient"
ConfigManager.Config.EmailAccountId = ToolStripEmailAccountID2.Text
If _RunwithLocalemail = False Then If _RunwithLocalemail = False Then
LogConfig.Debug = True LogConfig.Debug = True
Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text, Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text, ConfigManager.Config)
ConfigManager.Config.UseWindream, ToolStripEmailAccountID2.Text, "EmailProfilerTestClient",
ConfigManager.Config.EmailSenderLimitation, ConfigManager.Config.RejectionTemplateId, ConfigManager.Config.InfoTemplateId)
_work.Start_WorkingProfiles() _work.Start_WorkingProfiles()
Else Else
For Each ofile As String In _Worklist For Each ofile As String In _Worklist
Logger.Info($"## Manual working on file {ofile} ... ") Logger.Info($"## Manual working on file {ofile} ... ")
Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text, Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text, ConfigManager.Config, ofile.ToString)
ConfigManager.Config.UseWindream, ToolStripEmailAccountID2.Text, "EmailProfilerTestClient",
ConfigManager.Config.EmailSenderLimitation, ConfigManager.Config.RejectionTemplateId, ConfigManager.Config.InfoTemplateId, ofile.ToString)
_work.Start_WorkingProfiles(True) _work.Start_WorkingProfiles(True)
Next Next

View File

@ -24,4 +24,11 @@ Public Class Config
Public Property EmailTestReceiver As String = "" Public Property EmailTestReceiver As String = ""
Public Property EmailTestHTML 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 End Class

View File

@ -4,6 +4,7 @@ Imports EmailProfiler.Common
Imports DigitalData.Modules.Config Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Public Class MyService Public Class MyService
#Region "+++++ variables +++++" #Region "+++++ variables +++++"
Private Worker As BackgroundWorker Private Worker As BackgroundWorker
@ -11,17 +12,17 @@ Public Class MyService
Private LogConfig As LogConfig Private LogConfig As LogConfig
Private Logger As Logger Private Logger As Logger
'Private _database As clsDatabase
Private EmailWorker As clsWorkEmail Private EmailWorker As clsWorkEmail
Private DBConfigManager As ClassDBConfig Private _DBConfig As ClassDBConfig.Config
Private DBConfig As ClassDBConfig.Config
Private ConfigManager As ConfigManager(Of Config) Private ConfigManager As ConfigManager(Of ConfigData)
Private Config As Config Private _ConfigData As ConfigData
Private Database As MSSQLServer Private Database As MSSQLServer
#End Region #End Region
Protected Overrides Sub OnStart(args() As String) Protected Overrides Sub OnStart(args() As String)
Try Try
Dim oLogPath = Path.Combine(My.Application.Info.DirectoryPath, "Log") Dim oLogPath = Path.Combine(My.Application.Info.DirectoryPath, "Log")
@ -30,33 +31,31 @@ Public Class MyService
Logger.Info("Service started.") Logger.Info("Service started.")
ConfigManager = New ConfigManager(Of Config)(LogConfig, My.Application.Info.DirectoryPath) ConfigManager = New ConfigManager(Of ConfigData)(LogConfig, My.Application.Info.DirectoryPath)
Config = ConfigManager.Config _ConfigData = ConfigManager.Config
If Config.ConnectionString = String.Empty Then If _ConfigData.ConnectionString = String.Empty Then
Logger.Warn("No ConnectionString configured. Exiting.") Logger.Warn("No ConnectionString configured. Exiting.")
Else Else
If Config.Debug = True Then If _ConfigData.Debug = True Then
LogConfig.Debug = True LogConfig.Debug = True
Else Else
LogConfig.Debug = False LogConfig.Debug = False
End If End If
Database = New MSSQLServer(LogConfig, Config.ConnectionString) Database = New MSSQLServer(LogConfig, _ConfigData.ConnectionString)
Logger.Debug("Database initialized!") Logger.Debug("Database initialized!")
DBConfigManager = New ClassDBConfig(LogConfig, Database) Dim oDBConfigManager As ClassDBConfig = New ClassDBConfig(LogConfig, Database)
DBConfig = DBConfigManager.GetConfig() _DBConfig = oDBConfigManager.GetConfig()
If DBConfig IsNot Nothing Then If _DBConfig IsNot Nothing Then
Logger.Debug("DBConfig initialized!") Logger.Debug("DBConfig initialized!")
Else Else
Logger.Warn("Error while initializing DBConfig") Logger.Warn("Error while initializing DBConfig")
End If End If
EmailWorker = New clsWorkEmail(LogConfig, Config.ConnectionString, DBConfig.WindreamConnectionString, EmailWorker = New clsWorkEmail(LogConfig, _ConfigData.ConnectionString, _DBConfig.WindreamConnectionString, _ConfigData)
Config.UseWindream, Config.EmailAccountId, Config.EmailTitlePrefix,
Config.RejectionTemplateId, Config.InfoTemplateId)
Logger.Debug("Module Workmail initialized") Logger.Debug("Module Workmail initialized")
If Database.DBInitialized = False Then If Database.DBInitialized = False Then
@ -72,7 +71,7 @@ Public Class MyService
AddHandler Worker.RunWorkerCompleted, AddressOf Worker_Completed AddHandler Worker.RunWorkerCompleted, AddressOf Worker_Completed
' Set the Interval ' Set the Interval
Timer.Interval = DBConfig.TimerInterval * 60000 Timer.Interval = _DBConfig.TimerInterval * 60000
Timer.Enabled = True Timer.Enabled = True
Logger.Debug("Timer started.") Logger.Debug("Timer started.")
@ -97,15 +96,10 @@ Public Class MyService
Dim oProfileIdForPolling = 0 Dim oProfileIdForPolling = 0
Dim oWorker As New clsWorker(LogConfig, Dim oWorker As New clsWorker(LogConfig,
Config.ConnectionString, _ConfigData.ConnectionString,
DBConfig.WindreamConnectionString, _DBConfig.WindreamConnectionString,
oProfileIdForPolling, oProfileIdForPolling,
Config.UseWindream, _ConfigData)
Config.EmailAccountId,
Config.EmailSenderLimitation,
Config.EmailTitlePrefix,
Config.RejectionTemplateId,
Config.InfoTemplateId)
oWorker.Start_WorkingProfiles(False, True) oWorker.Start_WorkingProfiles(False, True)
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
@ -114,6 +108,7 @@ Public Class MyService
Protected Overrides Sub OnStop() Protected Overrides Sub OnStop()
Logger.Info("## Service was stopped manually. ##") Logger.Info("## Service was stopped manually. ##")
End Sub End Sub
Private Sub Worker_Completed(sender As Object, e As RunWorkerCompletedEventArgs) Private Sub Worker_Completed(sender As Object, e As RunWorkerCompletedEventArgs)
'This event fires when the DoWork event completes 'This event fires when the DoWork event completes
Try Try

View File

@ -1,24 +1,23 @@
Imports System.ComponentModel Imports System.IO
Imports System.IO
Imports System.Net.Mail
Imports System.Text.RegularExpressions Imports System.Text.RegularExpressions
Imports DigitalData.Modules Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports GdPicture14 Imports GdPicture14
Imports Independentsoft.Email.Mime Imports Independentsoft.Email.Mime
Imports Attachment = Independentsoft.Email.Mime.Attachment Imports Attachment = Independentsoft.Email.Mime.Attachment
Imports LicenseManager = GdPicture14.LicenseManager Imports LicenseManager = GdPicture14.LicenseManager
Public Class Form1 Public Class Form1
Private _logger As DigitalData.Modules.Logging.Logger Private _logger As Logger
Private Shared MyLogger As LogConfig Private Shared _MyLogger As LogConfig
Private _Worklist As List(Of String) Private _Worklist As List(Of String)
Private MyDatabase As MSSQLServer Private MyDatabase As MSSQLServer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Try Try
MyLogger = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName) _MyLogger = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName)
_logger = MyLogger.GetLogger() _logger = _MyLogger.GetLogger()
MyLogger.Debug = True _MyLogger.Debug = True
Dim dbResult As Boolean Dim dbResult As Boolean
@ -27,7 +26,7 @@ Public Class Form1
Exit Sub Exit Sub
End If End If
MyDatabase = New MSSQLServer(MyLogger, My.Settings.DD_ECM_CONSTRING) MyDatabase = New MSSQLServer(_MyLogger, My.Settings.DD_ECM_CONSTRING)
If MyDatabase.DBInitialized = True Then If MyDatabase.DBInitialized = True Then
dbResult = True dbResult = True
@ -112,7 +111,7 @@ Public Class Form1
If oCount = 1 Then If oCount = 1 Then
Continue For Continue For
End If End If
Dim oAttachmentFileString Dim oAttachmentFileString As String = ""
oString = String.Format(" Working on Attachment [{0}]", oAttachment.GetFileName) oString = String.Format(" Working on Attachment [{0}]", oAttachment.GetFileName)
_logger.Info(oString) _logger.Info(oString)
ListBox1.Items.Add(oString) ListBox1.Items.Add(oString)
@ -206,8 +205,9 @@ Public Class Form1
End Sub End Sub
Private Sub ExtractEmbeddedPDFAttachments(pFilename As String) Private Sub ExtractEmbeddedPDFAttachments(pFilename As String)
Try Try
Dim oSQLGDPicture = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE ACTIVE = 1"
Dim GDPictureLicense As String = "21182889975216572111813147150675976632" Dim GDPictureLicense As String = ConfigDbFunct.GetProductLicense("GDPICTURE", "11.2024", _MyLogger, My.Settings.DD_ECM_CONSTRING)
Dim oValidExtensions = New List(Of String) From {"pdf", "xls", "xlsx", "doc", "docx", "ppt", "pptx"} Dim oValidExtensions = New List(Of String) From {"pdf", "xls", "xlsx", "doc", "docx", "ppt", "pptx"}
Dim oGraphicExtensions = New List(Of String) From {"jpg", "bmp", "jpeg", "gif", "png", "xml"} Dim oGraphicExtensions = New List(Of String) From {"jpg", "bmp", "jpeg", "gif", "png", "xml"}
@ -236,7 +236,7 @@ Public Class Form1
Dim oValidExt = oValidExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext)) Dim oValidExt = oValidExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext))
If oValidExt = False Then If oValidExt = False Then
_Logger.Info("Invalid FileExtension of embedded file [{0}]", oEmbAttName) _logger.Info("Invalid FileExtension of embedded file [{0}]", oEmbAttName)
Dim GraphicExt = oGraphicExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext)) Dim GraphicExt = oGraphicExtensions.Any(Function(ext) oEmbAttName.EndsWith(ext))
If GraphicExt = False Then If GraphicExt = False Then
Dim oInfo = $"Consistency or extension of attached file [{oEmbAttName}] is not ok." Dim oInfo = $"Consistency or extension of attached file [{oEmbAttName}] is not ok."

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="GdPicture" version="14.2.90" targetFramework="net48" />
<package id="GdPicture.runtimes.windows" version="14.2.90" targetFramework="net48" />
<package id="NLog" version="5.0.5" targetFramework="net461" /> <package id="NLog" version="5.0.5" targetFramework="net461" />
</packages> </packages>

View File

@ -15,6 +15,8 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -54,14 +56,17 @@
<Reference Include="DevExpress.Utils.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <Reference Include="DevExpress.Utils.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <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="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>
</Reference>
<Reference Include="DigitalData.Modules.Database"> <Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath> <HintPath>..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Logging"> <Reference Include="DigitalData.Modules.Logging">
<HintPath>..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath> <HintPath>..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference> </Reference>
<Reference Include="GdPicture.NET.14"> <Reference Include="GdPicture.NET.14, Version=14.2.90.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb, processorArchitecture=MSIL">
<HintPath>D:\ProgramFiles\GdPicture.net 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath> <HintPath>..\packages\GdPicture.14.2.90\lib\net462\GdPicture.NET.14.dll</HintPath>
</Reference> </Reference>
<Reference Include="Independentsoft.Email"> <Reference Include="Independentsoft.Email">
<HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Email .NET\Bin\Independentsoft.Email.dll</HintPath> <HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Email .NET\Bin\Independentsoft.Email.dll</HintPath>
@ -150,4 +155,11 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<Import Project="..\packages\GdPicture.runtimes.windows.14.2.90\build\net462\GdPicture.runtimes.windows.targets" Condition="Exists('..\packages\GdPicture.runtimes.windows.14.2.90\build\net462\GdPicture.runtimes.windows.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\GdPicture.runtimes.windows.14.2.90\build\net462\GdPicture.runtimes.windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GdPicture.runtimes.windows.14.2.90\build\net462\GdPicture.runtimes.windows.targets'))" />
</Target>
</Project> </Project>