diff --git a/App/EmailProfiler.Common/ClassCurrent.vb b/App/EmailProfiler.Common/ClassCurrent.vb index ff4883d..30ec714 100644 --- a/App/EmailProfiler.Common/ClassCurrent.vb +++ b/App/EmailProfiler.Common/ClassCurrent.vb @@ -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 diff --git a/App/EmailProfiler.Common/Data/ConfigData.vb b/App/EmailProfiler.Common/Data/ConfigData.vb new file mode 100644 index 0000000..67e50c3 --- /dev/null +++ b/App/EmailProfiler.Common/Data/ConfigData.vb @@ -0,0 +1,39 @@ +Imports DigitalData.Modules.Config.ConfigAttributes + +Public Class ConfigData + + 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 + + ''' + ''' GUID des EMail Templates das bei Ablehnungsmails verwendet wird. + ''' Siehe Tabelle DD_ECM.dbo.TBDD_EMAIL_TEMPLATE + ''' + Public Property RejectionTemplateId As Integer = 0 + + ''' + ''' GUID des EMail Templates das bei Info-Mails verwendet wird. + ''' Siehe Tabelle DD_ECM.dbo.TBDD_EMAIL_TEMPLATE + ''' + Public Property InfoTemplateId As Integer = 0 + + Public Property EmailTestReceiver As String = "" + + Public Property EmailTestHTML As String = "" + + ''' + ''' Enthält die Version des GDPicture Modules, + ''' für das der Lizenzschlüssel aus TBDD_3RD_PARTY_MODULES + ''' gelesen werden soll. + ''' + Public Property GDPictureVersion As String = "" +End Class diff --git a/App/EmailProfiler.Common/EmailProfiler.Common.vbproj b/App/EmailProfiler.Common/EmailProfiler.Common.vbproj index 7367dac..9fca3e1 100644 --- a/App/EmailProfiler.Common/EmailProfiler.Common.vbproj +++ b/App/EmailProfiler.Common/EmailProfiler.Common.vbproj @@ -52,6 +52,9 @@ ..\..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll + + ..\..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll + ..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll @@ -117,6 +120,7 @@ + diff --git a/App/EmailProfiler.Common/clsWindream_Index.vb b/App/EmailProfiler.Common/clsWindream_Index.vb index 843ce40..66996dc 100644 --- a/App/EmailProfiler.Common/clsWindream_Index.vb +++ b/App/EmailProfiler.Common/clsWindream_Index.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 diff --git a/App/EmailProfiler.Common/clsWindream_allgemein.vb b/App/EmailProfiler.Common/clsWindream_allgemein.vb index 82e06dc..e465bf4 100644 --- a/App/EmailProfiler.Common/clsWindream_allgemein.vb +++ b/App/EmailProfiler.Common/clsWindream_allgemein.vb @@ -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 diff --git a/App/EmailProfiler.Common/clsWorkEmail.vb b/App/EmailProfiler.Common/clsWorkEmail.vb index db709ad..62e1884 100644 --- a/App/EmailProfiler.Common/clsWorkEmail.vb +++ b/App/EmailProfiler.Common/clsWorkEmail.vb @@ -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 diff --git a/App/EmailProfiler.Common/clsWorker.vb b/App/EmailProfiler.Common/clsWorker.vb index 70cad43..db619d6 100644 --- a/App/EmailProfiler.Common/clsWorker.vb +++ b/App/EmailProfiler.Common/clsWorker.vb @@ -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.") diff --git a/App/EmailProfiler.Form/Config.vb b/App/EmailProfiler.Form/Config.vb index ae1b2a6..dd516d9 100644 --- a/App/EmailProfiler.Form/Config.vb +++ b/App/EmailProfiler.Form/Config.vb @@ -19,4 +19,11 @@ Public Class Config Public Property EmailTestReceiver As String = "" Public Property EmailTestHTML As String = "" + + ''' + ''' Enthält die Version des GDPicture Modules, + ''' für das der Lizenzschlüssel aus TBDD_3RD_PARTY_MODULES + ''' gelesen werden soll. + ''' + Public Property GDPictureVersion As String = "" End Class diff --git a/App/EmailProfiler.Form/EmailProfiler.Form.vbproj b/App/EmailProfiler.Form/EmailProfiler.Form.vbproj index b7f1bdb..06886bd 100644 --- a/App/EmailProfiler.Form/EmailProfiler.Form.vbproj +++ b/App/EmailProfiler.Form/EmailProfiler.Form.vbproj @@ -62,27 +62,27 @@ False - ..\..\..\2_DLL Projekte\DDMonorepo\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll + ..\..\..\DDMonorepo\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll False - ..\..\..\2_DLL Projekte\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll + ..\..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll False - ..\..\..\2_DLL Projekte\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll + ..\..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll False - ..\..\..\2_DLL Projekte\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll + ..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll False - ..\..\..\2_DLL Projekte\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll + ..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll False - ..\..\..\2_DLL Projekte\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll + ..\..\..\DDModules\Messaging\bin\Debug\DigitalData.Modules.Messaging.dll diff --git a/App/EmailProfiler.Form/frmMain.vb b/App/EmailProfiler.Form/frmMain.vb index be91aab..78d5f1d 100644 --- a/App/EmailProfiler.Form/frmMain.vb +++ b/App/EmailProfiler.Form/frmMain.vb @@ -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 diff --git a/App/EmailProfiler.Service/Config.vb b/App/EmailProfiler.Service/Config.vb index 7e69647..16ab445 100644 --- a/App/EmailProfiler.Service/Config.vb +++ b/App/EmailProfiler.Service/Config.vb @@ -24,4 +24,11 @@ Public Class Config Public Property EmailTestReceiver As String = "" Public Property EmailTestHTML As String = "" + + ''' + ''' Enthält die Version des GDPicture Modules, + ''' für das der Lizenzschlüssel aus TBDD_3RD_PARTY_MODULES + ''' gelesen werden soll. + ''' + Public Property GDPictureVersion As String = "" End Class diff --git a/App/EmailProfiler.Service/MyService.vb b/App/EmailProfiler.Service/MyService.vb index 2bec176..1828ac1 100644 --- a/App/EmailProfiler.Service/MyService.vb +++ b/App/EmailProfiler.Service/MyService.vb @@ -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 diff --git a/App/wisag_check_Att/Form1.vb b/App/wisag_check_Att/Form1.vb index c30e2c7..1e40ffa 100644 --- a/App/wisag_check_Att/Form1.vb +++ b/App/wisag_check_Att/Form1.vb @@ -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." diff --git a/App/wisag_check_Att/packages.config b/App/wisag_check_Att/packages.config index 37cb921..5782d9c 100644 --- a/App/wisag_check_Att/packages.config +++ b/App/wisag_check_Att/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/App/wisag_check_Att/wisag_check_Att.vbproj b/App/wisag_check_Att/wisag_check_Att.vbproj index a6f6281..65b0fea 100644 --- a/App/wisag_check_Att/wisag_check_Att.vbproj +++ b/App/wisag_check_Att/wisag_check_Att.vbproj @@ -15,6 +15,8 @@ true true + + AnyCPU @@ -54,14 +56,17 @@ + + ..\..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll + ..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll ..\..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll - - D:\ProgramFiles\GdPicture.net 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll + + ..\packages\GdPicture.14.2.90\lib\net462\GdPicture.NET.14.dll P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Email .NET\Bin\Independentsoft.Email.dll @@ -150,4 +155,11 @@ + + + + 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}. + + + \ No newline at end of file