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_ISFULL As Boolean = False
Public Shared Property CURRENT_WORKMAIL_UID_LIST As New List(Of Long)
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">
<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" />

View File

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

View File

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

View File

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

View File

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

View File

@ -19,4 +19,11 @@ Public Class Config
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

@ -62,27 +62,27 @@
<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">
<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 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>..\..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Config, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<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 Include="DigitalData.Modules.Database, Version=2.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<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 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>..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Messaging, Version=1.9.3.0, Culture=neutral, processorArchitecture=MSIL">
<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 Include="Microsoft.CSharp" />
<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
Private Logger As Logger
Private LogConfig As LogConfig
Private ConfigManager As ConfigManager(Of Config)
Private ConfigManager As ConfigManager(Of ConfigData)
Private _database As MSSQLServer
Private _Encryption As clsEncryption
Private _windream As clsWindream_allgemein
@ -21,7 +21,6 @@ Public Class frmMain
Private _SQLServerConString As String
Private _Worklist As List(Of String)
Private _limilab As Limilab
Private _ConfigManager As ClassDBConfig
Private _DBConfig As ClassDBConfig.Config
Private MyConnectionString As String
@ -29,7 +28,7 @@ Public Class frmMain
Try
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)
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()
If ConfigManager.Config.Debug = True Then
@ -47,8 +46,6 @@ Public Class frmMain
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in FormLoad")
End Try
If Set_ConnectionStrings() Then
Load_AllData()
Check_Steps()
@ -210,8 +207,8 @@ Public Class frmMain
_database = New MSSQLServer(LogConfig, _SQLServerConString)
Logger.Debug("Inititalizing Configuration")
_ConfigManager = New ClassDBConfig(LogConfig, _database)
_DBConfig = _ConfigManager.GetConfig()
Dim oConfigManager As ClassDBConfig = New ClassDBConfig(LogConfig, _database)
_DBConfig = oConfigManager.GetConfig()
If _DBConfig Is Nothing Then
MsgBox("Configuration could not be loaded. Please check the Logfile.", MsgBoxStyle.Critical, Text)
@ -251,7 +248,6 @@ Public Class frmMain
If chkbxUserAut.Checked Then
con = "Data Source=" & Me.txtServer.Text & ";Trusted_Connection=True;"
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 & ";"
End If
Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString)
@ -299,9 +295,6 @@ Public Class frmMain
'DialogResult = Windows.Forms.DialogResult.OK
Dim result As MsgBoxResult
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)
If result = MsgBoxResult.Yes Then
'Set the construction string
@ -309,7 +302,7 @@ Public Class frmMain
ConfigManager.Config.ConnectionString = MyConnectionString
_database = New MSSQLServer(LogConfig, MyConnectionString)
_ConfigManager = New ClassDBConfig(LogConfig, _database)
Dim oConfigManager As ClassDBConfig = New ClassDBConfig(LogConfig, _database)
'csb.ConnectionString
'_database.Init(MyConnectionString)
@ -336,20 +329,20 @@ Public Class frmMain
End Sub
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
LogConfig.Debug = True
Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text,
ConfigManager.Config.UseWindream, ToolStripEmailAccountID2.Text, "EmailProfilerTestClient",
ConfigManager.Config.EmailSenderLimitation, ConfigManager.Config.RejectionTemplateId, ConfigManager.Config.InfoTemplateId)
Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text, ConfigManager.Config)
_work.Start_WorkingProfiles()
Else
For Each ofile As String In _Worklist
Logger.Info($"## Manual working on file {ofile} ... ")
Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text,
ConfigManager.Config.UseWindream, ToolStripEmailAccountID2.Text, "EmailProfilerTestClient",
ConfigManager.Config.EmailSenderLimitation, ConfigManager.Config.RejectionTemplateId, ConfigManager.Config.InfoTemplateId, ofile.ToString)
Dim _work As New clsWorker(LogConfig, _SQLServerConString, _DBConfig.WindreamConnectionString, GUIDTextBox.Text, ConfigManager.Config, ofile.ToString)
_work.Start_WorkingProfiles(True)
Next

View File

@ -24,4 +24,11 @@ Public Class Config
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

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

View File

@ -1,24 +1,23 @@
Imports System.ComponentModel
Imports System.IO
Imports System.Net.Mail
Imports System.IO
Imports System.Text.RegularExpressions
Imports DigitalData.Modules
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports GdPicture14
Imports Independentsoft.Email.Mime
Imports Attachment = Independentsoft.Email.Mime.Attachment
Imports LicenseManager = GdPicture14.LicenseManager
Public Class Form1
Private _logger As DigitalData.Modules.Logging.Logger
Private Shared MyLogger As LogConfig
Private _logger As Logger
Private Shared _MyLogger As LogConfig
Private _Worklist As List(Of String)
Private MyDatabase As MSSQLServer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
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()
MyLogger.Debug = True
_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()
_MyLogger.Debug = True
Dim dbResult As Boolean
@ -27,7 +26,7 @@ Public Class Form1
Exit Sub
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
dbResult = True
@ -112,7 +111,7 @@ Public Class Form1
If oCount = 1 Then
Continue For
End If
Dim oAttachmentFileString
Dim oAttachmentFileString As String = ""
oString = String.Format(" Working on Attachment [{0}]", oAttachment.GetFileName)
_logger.Info(oString)
ListBox1.Items.Add(oString)
@ -206,8 +205,9 @@ Public Class Form1
End Sub
Private Sub ExtractEmbeddedPDFAttachments(pFilename As String)
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 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))
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))
If GraphicExt = False Then
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"?>
<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" />
</packages>

View File

@ -15,6 +15,8 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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.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>
</Reference>
<Reference Include="DigitalData.Modules.Database">
<HintPath>..\..\..\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>
</Reference>
<Reference Include="GdPicture.NET.14">
<HintPath>D:\ProgramFiles\GdPicture.net 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
<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>
</Reference>
<Reference Include="Independentsoft.Email">
<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" />
</ItemGroup>
<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>