From 71fdc188c29e3850a7d9bc730905fa94a3315e87 Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Mon, 17 Dec 2018 18:30:17 +0100 Subject: [PATCH] MS Service ZuGferd und Begin GUI --- DDMonorepo.sln | 14 ++ DD_CommunicationService/App.config | 27 +++ .../DD_CommunicationService.vbproj | 141 +++++++++++ .../My Project/Application.Designer.vb | 13 ++ .../My Project/Application.myapp | 10 + .../My Project/AssemblyInfo.vb | 35 +++ .../My Project/Resources.Designer.vb | 62 +++++ .../My Project/Resources.resx | 117 ++++++++++ .../My Project/Settings.Designer.vb | 109 +++++++++ .../My Project/Settings.settings | 18 ++ .../MyComService.Designer.vb | 52 +++++ DD_CommunicationService/MyComService.resx | 123 ++++++++++ DD_CommunicationService/MyComService.vb | 156 +++++++++++++ .../ProjectInstaller.Designer.vb | 48 ++++ DD_CommunicationService/ProjectInstaller.resx | 129 +++++++++++ DD_CommunicationService/ProjectInstaller.vb | 16 ++ DD_CommunicationService/clsEncryption.vb | 72 ++++++ GUI_EDMI/App.config | 6 + GUI_EDMI/Form1.Designer.vb | 109 +++++++++ GUI_EDMI/Form1.resx | 123 ++++++++++ GUI_EDMI/Form1.vb | 3 + GUI_EDMI/GUI_EDMI.vbproj | 127 ++++++++++ GUI_EDMI/My Project/Application.Designer.vb | 38 +++ GUI_EDMI/My Project/Application.myapp | 11 + GUI_EDMI/My Project/AssemblyInfo.vb | 35 +++ GUI_EDMI/My Project/Resources.Designer.vb | 62 +++++ GUI_EDMI/My Project/Resources.resx | 117 ++++++++++ GUI_EDMI/My Project/Settings.Designer.vb | 73 ++++++ GUI_EDMI/My Project/Settings.settings | 7 + GUI_EDMI/My Project/licenses.licx | 1 + Message/Email.vb | 219 +++++++++++------- Message/Messaging.vbproj | 7 +- Modules.Database/Database.vbproj | 3 +- Modules.Database/Firebird.vb | 3 + Modules.Windream/Windream2.vb | 113 +++++++++ TestGUI/ApplicationEvents.vb | 8 +- 36 files changed, 2115 insertions(+), 92 deletions(-) create mode 100644 DD_CommunicationService/App.config create mode 100644 DD_CommunicationService/DD_CommunicationService.vbproj create mode 100644 DD_CommunicationService/My Project/Application.Designer.vb create mode 100644 DD_CommunicationService/My Project/Application.myapp create mode 100644 DD_CommunicationService/My Project/AssemblyInfo.vb create mode 100644 DD_CommunicationService/My Project/Resources.Designer.vb create mode 100644 DD_CommunicationService/My Project/Resources.resx create mode 100644 DD_CommunicationService/My Project/Settings.Designer.vb create mode 100644 DD_CommunicationService/My Project/Settings.settings create mode 100644 DD_CommunicationService/MyComService.Designer.vb create mode 100644 DD_CommunicationService/MyComService.resx create mode 100644 DD_CommunicationService/MyComService.vb create mode 100644 DD_CommunicationService/ProjectInstaller.Designer.vb create mode 100644 DD_CommunicationService/ProjectInstaller.resx create mode 100644 DD_CommunicationService/ProjectInstaller.vb create mode 100644 DD_CommunicationService/clsEncryption.vb create mode 100644 GUI_EDMI/App.config create mode 100644 GUI_EDMI/Form1.Designer.vb create mode 100644 GUI_EDMI/Form1.resx create mode 100644 GUI_EDMI/Form1.vb create mode 100644 GUI_EDMI/GUI_EDMI.vbproj create mode 100644 GUI_EDMI/My Project/Application.Designer.vb create mode 100644 GUI_EDMI/My Project/Application.myapp create mode 100644 GUI_EDMI/My Project/AssemblyInfo.vb create mode 100644 GUI_EDMI/My Project/Resources.Designer.vb create mode 100644 GUI_EDMI/My Project/Resources.resx create mode 100644 GUI_EDMI/My Project/Settings.Designer.vb create mode 100644 GUI_EDMI/My Project/Settings.settings create mode 100644 GUI_EDMI/My Project/licenses.licx diff --git a/DDMonorepo.sln b/DDMonorepo.sln index f966aadb..b6793c02 100644 --- a/DDMonorepo.sln +++ b/DDMonorepo.sln @@ -53,6 +53,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ZUGFeRDTest", "ZUGFeRDTest\ EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Jobs", "Jobs\Jobs.vbproj", "{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}" EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DD_CommunicationService", "DD_CommunicationService\DD_CommunicationService.vbproj", "{1FB2854F-C050-427D-9FAC-1D8F232E8025}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GUI_EDMI", "GUI_EDMI\GUI_EDMI.vbproj", "{88EDAD5B-1B98-43E4-B068-1251E7AF01A0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -123,6 +127,14 @@ Global {39EC839A-3C30-4922-A41E-6B09D1DDE5C3}.Debug|Any CPU.Build.0 = Debug|Any CPU {39EC839A-3C30-4922-A41E-6B09D1DDE5C3}.Release|Any CPU.ActiveCfg = Release|Any CPU {39EC839A-3C30-4922-A41E-6B09D1DDE5C3}.Release|Any CPU.Build.0 = Release|Any CPU + {1FB2854F-C050-427D-9FAC-1D8F232E8025}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FB2854F-C050-427D-9FAC-1D8F232E8025}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FB2854F-C050-427D-9FAC-1D8F232E8025}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FB2854F-C050-427D-9FAC-1D8F232E8025}.Release|Any CPU.Build.0 = Release|Any CPU + {88EDAD5B-1B98-43E4-B068-1251E7AF01A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88EDAD5B-1B98-43E4-B068-1251E7AF01A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88EDAD5B-1B98-43E4-B068-1251E7AF01A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88EDAD5B-1B98-43E4-B068-1251E7AF01A0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -144,6 +156,8 @@ Global {AB6F09BF-E794-4F6A-94BB-C97C0BA84D64} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} {16156434-E471-43F1-8030-76A0DA17CD5A} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB} {39EC839A-3C30-4922-A41E-6B09D1DDE5C3} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} + {1FB2854F-C050-427D-9FAC-1D8F232E8025} = {7AF3F9C2-C939-4A08-95C1-0453207E298A} + {88EDAD5B-1B98-43E4-B068-1251E7AF01A0} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286} diff --git a/DD_CommunicationService/App.config b/DD_CommunicationService/App.config new file mode 100644 index 00000000..0a9fe0f9 --- /dev/null +++ b/DD_CommunicationService/App.config @@ -0,0 +1,27 @@ + + + + +
+ + + + + + + + + 172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB + + + 172.24.12.41 + + + sysdba + + + dd + + + + \ No newline at end of file diff --git a/DD_CommunicationService/DD_CommunicationService.vbproj b/DD_CommunicationService/DD_CommunicationService.vbproj new file mode 100644 index 00000000..3dc2c1c1 --- /dev/null +++ b/DD_CommunicationService/DD_CommunicationService.vbproj @@ -0,0 +1,141 @@ + + + + + Debug + AnyCPU + {1FB2854F-C050-427D-9FAC-1D8F232E8025} + WinExe + DD_CommunicationService.MyComService + DD_CommunicationService + DD_CommunicationService + 512 + Console + v4.6.1 + true + + + x64 + true + full + true + true + bin\Debug\ + DD_CommunicationService.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + DD_CommunicationService.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + ..\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll + + + ..\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll + + + ..\Message\bin\Debug\DigitalData.Modules.Messaging.dll + + + ..\Modules.Logging\bin\Debug\NLog.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + Component + + + MyComService.vb + + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ProjectInstaller.vb + + + Component + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + MyComService.vb + + + ProjectInstaller.vb + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + \ No newline at end of file diff --git a/DD_CommunicationService/My Project/Application.Designer.vb b/DD_CommunicationService/My Project/Application.Designer.vb new file mode 100644 index 00000000..88dd01c7 --- /dev/null +++ b/DD_CommunicationService/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/DD_CommunicationService/My Project/Application.myapp b/DD_CommunicationService/My Project/Application.myapp new file mode 100644 index 00000000..602de37e --- /dev/null +++ b/DD_CommunicationService/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 3 + true + diff --git a/DD_CommunicationService/My Project/AssemblyInfo.vb b/DD_CommunicationService/My Project/AssemblyInfo.vb new file mode 100644 index 00000000..2137d903 --- /dev/null +++ b/DD_CommunicationService/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' Allgemeine Informationen über eine Assembly werden über die folgenden +' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +' die einer Assembly zugeordnet sind. + +' Werte der Assemblyattribute überprüfen + + + + + + + + + + +'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird. + + +' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +' +' Hauptversion +' Nebenversion +' Buildnummer +' Revision +' +' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +' übernehmen, indem Sie "*" eingeben: +' + + + diff --git a/DD_CommunicationService/My Project/Resources.Designer.vb b/DD_CommunicationService/My Project/Resources.Designer.vb new file mode 100644 index 00000000..32ad5d87 --- /dev/null +++ b/DD_CommunicationService/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DD_CommunicationService.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/DD_CommunicationService/My Project/Resources.resx b/DD_CommunicationService/My Project/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/DD_CommunicationService/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DD_CommunicationService/My Project/Settings.Designer.vb b/DD_CommunicationService/My Project/Settings.Designer.vb new file mode 100644 index 00000000..2dd1520d --- /dev/null +++ b/DD_CommunicationService/My Project/Settings.Designer.vb @@ -0,0 +1,109 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "Automatische My.Settings-Speicherfunktion" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + + _ + Public ReadOnly Property FB_ConnString() As String + Get + Return CType(Me("FB_ConnString"),String) + End Get + End Property + + _ + Public ReadOnly Property FB_DATABASE() As String + Get + Return CType(Me("FB_DATABASE"),String) + End Get + End Property + + _ + Public ReadOnly Property FB_USER() As String + Get + Return CType(Me("FB_USER"),String) + End Get + End Property + + _ + Public ReadOnly Property FB_PW() As String + Get + Return CType(Me("FB_PW"),String) + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.DD_CommunicationService.My.MySettings + Get + Return Global.DD_CommunicationService.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/DD_CommunicationService/My Project/Settings.settings b/DD_CommunicationService/My Project/Settings.settings new file mode 100644 index 00000000..597dda7d --- /dev/null +++ b/DD_CommunicationService/My Project/Settings.settings @@ -0,0 +1,18 @@ + + + + + + 172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB + + + 172.24.12.41 + + + sysdba + + + dd + + + \ No newline at end of file diff --git a/DD_CommunicationService/MyComService.Designer.vb b/DD_CommunicationService/MyComService.Designer.vb new file mode 100644 index 00000000..5166ce05 --- /dev/null +++ b/DD_CommunicationService/MyComService.Designer.vb @@ -0,0 +1,52 @@ +Imports System.ServiceProcess + + _ +Partial Class MyComService + Inherits System.ServiceProcess.ServiceBase + + 'UserService überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + ' Der Haupteinstiegspunkt für den Prozess + _ + _ + Shared Sub Main() + Dim ServicesToRun() As System.ServiceProcess.ServiceBase + + ' Innerhalb eines Prozesses können mehrere NT-Dienste ausgeführt werden. Um einen + ' weiteren Dienst zu diesem Prozess hinzuzufügen, ändern Sie die folgende Zeile, + ' um ein zweites Dienstobjekt zu erstellen. Zum Beispiel + ' + ' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService} + ' + ServicesToRun = New System.ServiceProcess.ServiceBase() {New MyComService} + + System.ServiceProcess.ServiceBase.Run(ServicesToRun) + End Sub + + 'Wird vom Komponenten-Designer benötigt. + Private components As System.ComponentModel.IContainer + + ' Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich. + ' Das Bearbeiten ist mit dem Komponenten-Designer möglich. + ' Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + ' + 'MyComService + ' + Me.CanShutdown = True + Me.ServiceName = "DDEDMI_ComService" + + End Sub + +End Class diff --git a/DD_CommunicationService/MyComService.resx b/DD_CommunicationService/MyComService.resx new file mode 100644 index 00000000..e5858cc2 --- /dev/null +++ b/DD_CommunicationService/MyComService.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file diff --git a/DD_CommunicationService/MyComService.vb b/DD_CommunicationService/MyComService.vb new file mode 100644 index 00000000..d161b978 --- /dev/null +++ b/DD_CommunicationService/MyComService.vb @@ -0,0 +1,156 @@ +Imports System.ComponentModel +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Messaging +Imports System.IO +Public Class MyComService + Private _Logger As Logger + Private _MyLogger As LogConfig + Private _firebird As Firebird + Private _Email As Email + Public Shared threadEmailQueue As BackgroundWorker + Protected Overrides Sub OnStart(ByVal args() As String) + ' Code zum Starten des Dienstes hier einfügen. Diese Methode sollte Vorgänge + ' ausführen, damit der Dienst gestartet werden kann. + Try + _MyLogger = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log")) + _Logger = _MyLogger.GetLogger() + _firebird = New Firebird(_MyLogger, My.Settings.FB_ConnString, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW) + _Email = New Email(_MyLogger) + If _firebird._DBInitialized = True Then + MyComService.threadEmailQueue = New BackgroundWorker() + MyComService.threadEmailQueue.WorkerReportsProgress = True + MyComService.threadEmailQueue.WorkerSupportsCancellation = True + AddHandler threadEmailQueue.DoWork, AddressOf RunThread_EmailQueue + AddHandler threadEmailQueue.RunWorkerCompleted, AddressOf ThreadEMailQueue_Completed + ' Und den Durchlauf das erste Mal starten + threadEmailQueue.RunWorkerAsync() + + '### Den Timer generieren + Dim Timer1_OneMinute As New System.Timers.Timer() + 'Das Event hinterlegen welches bei "Tick" ausgelöst wird + AddHandler Timer1_OneMinute.Elapsed, AddressOf Timer1_Tick + ' Set the Interval + Timer1_OneMinute.Interval = 60000 + 'ClassLogger.Add("Timer - Intervall: " & clsSQLITE.konf_intervall & " Minuten", False) + Timer1_OneMinute.Enabled = True + + _Logger.Debug("Timer1_OneMinute started...") + End If + Catch ex As Exception + If Not IsNothing(_MyLogger.LogFile) And File.Exists(_MyLogger.LogFile) Then + _Logger.Error(ex) + End If + End Try + End Sub + Public Sub Timer1_Tick() + If Not threadEmailQueue.IsBusy Then + threadEmailQueue.RunWorkerAsync() + End If + End Sub + Protected Overrides Sub OnStop() + Try + ' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen. + _Logger.Warn("Service has been stopped!") + Catch ex As Exception + _Logger.Error(ex) + End Try + + End Sub + Public Sub RunThread_EmailQueue(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) + Try + _firebird = New Firebird(_MyLogger, My.Settings.FB_ConnString, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW) + If _firebird._DBInitialized = False Then + _Logger.Warn("Firebird-DB could not be intitialized!") + Exit Sub + End If + Dim oSQL = "SELECT * FROM TBEDM_EMAIL_ACCOUNT WHERE GUID IN (SELECT DISTINCT EMAIL_ACCOUNT_ID FROM TBEDM_EMAIL_QUEUE WHERE EMAIL_SENT IS NULL and EMAIL_TO is not null)" + Dim oDT_EMAIL_ACCOUNT As DataTable = _firebird.GetDatatable(oSQL) + If IsNothing(oDT_EMAIL_ACCOUNT) Then + _Logger.Warn("DT_EMAIL_ACCOUNT is nothing!") + Exit Sub + End If + oSQL = "SELECT * FROM TBEDM_EMAIL_QUEUE WHERE EMAIL_SENT IS NULL and EMAIL_TO is not null" + Dim oDT_EMAIL_QUEUE As DataTable = _firebird.GetDatatable(oSQL) + If Not IsNothing(oDT_EMAIL_QUEUE) And oDT_EMAIL_ACCOUNT.Rows.Count >= 1 Then + Dim oEmailTo, oSubject, oBody As String + Dim oEMAILACCOUNT_ID, oGUID, oJOB_ID As Integer + For Each oEmail_Row As DataRow In oDT_EMAIL_QUEUE.Rows + oEMAILACCOUNT_ID = oEmail_Row.Item("GUID") + Dim oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType As String + + For Each oAccountRow As DataRow In oDT_EMAIL_ACCOUNT.Rows + If oAccountRow.Item("GUID") = oEMAILACCOUNT_ID Then + oMailFrom = oAccountRow.Item("EMAIL_FROM") + oMailSMTP = oAccountRow.Item("SERVER_OUT") + oMailport = oAccountRow.Item("PORT") + oMailUser = oAccountRow.Item("EMAIL_USER") + oAuthType = oAccountRow.Item("AUTH_TYPE") + oMailPW = oAccountRow.Item("EMAIL_PW") + + Dim owrapper As New clsEncryption("!35452didalog=") + + Dim oPWPlain = owrapper.DecryptData(oMailPW) + If Not IsNothing(oPWPlain) Then + oMailPW = oPWPlain + Else + _Logger.Warn("PWPlain is Nothing - Could not decrypt password..") + Exit Sub + End If + End If + Next + If IsNothing(oMailFrom) Or IsNothing(oMailPW) Then + _Logger.Warn("ACCOUNT-Infos are nothing!") + Exit Sub + End If + + + oGUID = oEmail_Row.Item("GUID") + oEmailTo = oEmail_Row.Item("EMAIL_TO") + oSubject = oEmail_Row.Item("EMAIL_SUBJ") + oBody = oEmail_Row.Item("EMAIL_BODY") + oJOB_ID = oEmail_Row.Item("JOB_ID") + Dim link As String = "pmo://" & oJOB_ID & "-" & oEmail_Row.Item("REFERENCE1") + If oBody.Contains("[%PMOLINK_GER]") Then + oBody = oBody.Replace("[%PMOLINK_GER]", "hier") + End If + If oBody.Contains("[%PMOLINK_EN]") Or oBody.Contains("[%PMOLINK_US]") Then + oBody = oBody.Replace("[%PMOLINK_EN]", "here") + oBody = oBody.Replace("[%PMOLINK_US]", "here") + End If + + If _Email.NewEmail(oEmailTo, oSubject, oBody, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType) = True Then + Dim upd = "UPDATE TBPMO_WORKFLOW_REMINDER SET EMAIL_SENT = CURRENT_TIMESTAMP WHERE GUID = " & oGUID + _firebird.ExecuteNonQuery(upd) + End If + Next + Else + _Logger.Warn("Check the Email_Config Tables in EDM_MASTER. At least on table returns nothing or is empty.") + End If + + + + Catch ex As Exception + _Logger.Error(ex) + End Try + End Sub +#Region "*** BackgroundWorker Stop/Completed ***" + Private Sub ThreadEMailQueue_Completed(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) 'Handles threadDateiimport.RunWorkerCompleted + ' This event fires when the DoWork event completes + Try + Dim result As String = "" + If e.Cancelled Then + _Logger.Warn("ThreadEMailQueue has been cancelled manually...") + + ElseIf e.Error IsNot Nothing Then + _Logger.Warn("Unexpected error in running thread: " & e.Error.Message) + + End If + Catch ex As Exception + _Logger.Error(ex) + End Try + + End Sub + +#End Region +End Class diff --git a/DD_CommunicationService/ProjectInstaller.Designer.vb b/DD_CommunicationService/ProjectInstaller.Designer.vb new file mode 100644 index 00000000..13e6433c --- /dev/null +++ b/DD_CommunicationService/ProjectInstaller.Designer.vb @@ -0,0 +1,48 @@ + Partial Class ProjectInstaller + Inherits System.Configuration.Install.Installer + + 'Installer überschreibt den Löschvorgang zum Bereinigen der Komponentenliste. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Komponenten-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich. + 'Das Bearbeiten ist mit dem Komponenten-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.ServiceProcessInstaller1 = New System.ServiceProcess.ServiceProcessInstaller() + Me.ServiceInstaller1 = New System.ServiceProcess.ServiceInstaller() + ' + 'ServiceProcessInstaller1 + ' + Me.ServiceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem + Me.ServiceProcessInstaller1.Password = Nothing + Me.ServiceProcessInstaller1.Username = Nothing + ' + 'ServiceInstaller1 + ' + Me.ServiceInstaller1.Description = "Communication Service for sending and receiving notifications and messages" + Me.ServiceInstaller1.DisplayName = "DDEDMI_ComService" + Me.ServiceInstaller1.ServiceName = "DDEDMI_ComService" + Me.ServiceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic + ' + 'ProjectInstaller + ' + Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller1, Me.ServiceInstaller1}) + + End Sub + + Friend WithEvents ServiceProcessInstaller1 As ServiceProcess.ServiceProcessInstaller + Friend WithEvents ServiceInstaller1 As ServiceProcess.ServiceInstaller +End Class diff --git a/DD_CommunicationService/ProjectInstaller.resx b/DD_CommunicationService/ProjectInstaller.resx new file mode 100644 index 00000000..e1b81e8f --- /dev/null +++ b/DD_CommunicationService/ProjectInstaller.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 56 + + + 197, 17 + + + False + + \ No newline at end of file diff --git a/DD_CommunicationService/ProjectInstaller.vb b/DD_CommunicationService/ProjectInstaller.vb new file mode 100644 index 00000000..733dfc0c --- /dev/null +++ b/DD_CommunicationService/ProjectInstaller.vb @@ -0,0 +1,16 @@ +Imports System.ComponentModel +Imports System.Configuration.Install + +Public Class ProjectInstaller + + Public Sub New() + MyBase.New() + + 'Dieser Aufruf ist für den Komponenten-Designer erforderlich. + InitializeComponent() + + 'Initialisierungscode nach dem Aufruf von InitializeComponent hinzufügen + + End Sub + +End Class diff --git a/DD_CommunicationService/clsEncryption.vb b/DD_CommunicationService/clsEncryption.vb new file mode 100644 index 00000000..d6adca68 --- /dev/null +++ b/DD_CommunicationService/clsEncryption.vb @@ -0,0 +1,72 @@ +Imports System.Security.Cryptography +Public Class clsEncryption + Private TripleDes As New TripleDESCryptoServiceProvider + Sub New(ByVal key As String) + ' Initialize the crypto provider. + TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8) + TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8) + End Sub + + Private Function TruncateHash( + ByVal key As String, + ByVal length As Integer) As Byte() + + Dim sha1 As New SHA1CryptoServiceProvider + + ' Hash the key. + Dim keyBytes() As Byte = + System.Text.Encoding.Unicode.GetBytes(key) + Dim hash() As Byte = sha1.ComputeHash(keyBytes) + + ' Truncate or pad the hash. + ReDim Preserve hash(length - 1) + Return hash + End Function + Public Function EncryptData( + ByVal plaintext As String) As String + + ' Convert the plaintext string to a byte array. + Dim plaintextBytes() As Byte = + System.Text.Encoding.Unicode.GetBytes("!Didalog35452Heuchelheim=" & plaintext) + + ' Create the stream. + Dim ms As New System.IO.MemoryStream + ' Create the encoder to write to the stream. + Dim encStream As New CryptoStream(ms, + TripleDes.CreateEncryptor(), + System.Security.Cryptography.CryptoStreamMode.Write) + + ' Use the crypto stream to write the byte array to the stream. + encStream.Write(plaintextBytes, 0, plaintextBytes.Length) + encStream.FlushFinalBlock() + + ' Convert the encrypted stream to a printable string. + Return Convert.ToBase64String(ms.ToArray) + End Function + 'Entschlüsselt die Zeichenfolge + Public Function DecryptData( + ByVal encryptedtext As String) As String + Try + ' Convert the encrypted text string to a byte array. + Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext) + + ' Create the stream. + Dim ms As New System.IO.MemoryStream + ' Create the decoder to write to the stream. + Dim decStream As New CryptoStream(ms, + TripleDes.CreateDecryptor(), + System.Security.Cryptography.CryptoStreamMode.Write) + + ' Use the crypto stream to write the byte array to the stream. + decStream.Write(encryptedBytes, 0, encryptedBytes.Length) + decStream.FlushFinalBlock() + Dim result = System.Text.Encoding.Unicode.GetString(ms.ToArray) + result = result.Replace("!Didalog35452Heuchelheim=", "") + ' Convert the plaintext stream to a string. + Return result + Catch ex As Exception + Return Nothing + End Try + + End Function +End Class diff --git a/GUI_EDMI/App.config b/GUI_EDMI/App.config new file mode 100644 index 00000000..5534e287 --- /dev/null +++ b/GUI_EDMI/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/GUI_EDMI/Form1.Designer.vb b/GUI_EDMI/Form1.Designer.vb new file mode 100644 index 00000000..8b3cdbd0 --- /dev/null +++ b/GUI_EDMI/Form1.Designer.vb @@ -0,0 +1,109 @@ + _ +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() + Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() + Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() + Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroupAdministration = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage() + Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'StatusStrip1 + ' + Me.StatusStrip1.Location = New System.Drawing.Point(0, 428) + Me.StatusStrip1.Name = "StatusStrip1" + Me.StatusStrip1.Size = New System.Drawing.Size(800, 22) + Me.StatusStrip1.TabIndex = 0 + Me.StatusStrip1.Text = "StatusStrip1" + ' + 'RibbonControl1 + ' + Me.RibbonControl1.ExpandCollapseItem.Id = 0 + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem}) + Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) + Me.RibbonControl1.MaxItemId = 1 + Me.RibbonControl1.Name = "RibbonControl1" + Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1, Me.RibbonPage2}) + Me.RibbonControl1.Size = New System.Drawing.Size(800, 141) + ' + 'RibbonPage1 + ' + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroupAdministration}) + Me.RibbonPage1.Name = "RibbonPage1" + Me.RibbonPage1.Text = "Main" + ' + 'RibbonPageGroup1 + ' + Me.RibbonPageGroup1.Name = "RibbonPageGroup1" + Me.RibbonPageGroup1.Text = "RibbonPageGroup1" + ' + 'RibbonPageGroupAdministration + ' + Me.RibbonPageGroupAdministration.Name = "RibbonPageGroupAdministration" + Me.RibbonPageGroupAdministration.Text = "Adminsitration" + ' + 'RibbonPage2 + ' + Me.RibbonPage2.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup2, Me.RibbonPageGroup3}) + Me.RibbonPage2.Name = "RibbonPage2" + Me.RibbonPage2.Text = "Administration" + ' + 'RibbonPageGroup2 + ' + Me.RibbonPageGroup2.Name = "RibbonPageGroup2" + Me.RibbonPageGroup2.Text = "RibbonPageGroup2" + ' + 'RibbonPageGroup3 + ' + Me.RibbonPageGroup3.Name = "RibbonPageGroup3" + Me.RibbonPageGroup3.Text = "Messaging" + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.RibbonControl1) + Me.Controls.Add(Me.StatusStrip1) + Me.Name = "Form1" + Me.Text = "Form1" + CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents StatusStrip1 As StatusStrip + Friend WithEvents RibbonControl1 As DevExpress.XtraBars.Ribbon.RibbonControl + Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage + Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroupAdministration As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPage2 As DevExpress.XtraBars.Ribbon.RibbonPage + Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup +End Class diff --git a/GUI_EDMI/Form1.resx b/GUI_EDMI/Form1.resx new file mode 100644 index 00000000..74443647 --- /dev/null +++ b/GUI_EDMI/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/GUI_EDMI/Form1.vb b/GUI_EDMI/Form1.vb new file mode 100644 index 00000000..17d65956 --- /dev/null +++ b/GUI_EDMI/Form1.vb @@ -0,0 +1,3 @@ +Public Class Form1 + +End Class diff --git a/GUI_EDMI/GUI_EDMI.vbproj b/GUI_EDMI/GUI_EDMI.vbproj new file mode 100644 index 00000000..20d14a84 --- /dev/null +++ b/GUI_EDMI/GUI_EDMI.vbproj @@ -0,0 +1,127 @@ + + + + + Debug + AnyCPU + {88EDAD5B-1B98-43E4-B068-1251E7AF01A0} + WinExe + GUI_EDMI.My.MyApplication + GUI_EDMI + GUI_EDMI + 512 + WindowsForms + v4.6.1 + true + + + AnyCPU + true + full + true + true + bin\Debug\ + GUI_EDMI.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + AnyCPU + pdbonly + false + true + true + bin\Release\ + GUI_EDMI.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + On + + + Binary + + + Off + + + On + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + Form1.vb + Form + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + Form1.vb + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + \ No newline at end of file diff --git a/GUI_EDMI/My Project/Application.Designer.vb b/GUI_EDMI/My Project/Application.Designer.vb new file mode 100644 index 00000000..b08f5516 --- /dev/null +++ b/GUI_EDMI/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. + ' + Partial Friend Class MyApplication + + _ + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = false + Me.EnableVisualStyles = true + Me.SaveMySettingsOnExit = true + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + _ + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Global.GUI_EDMI.Form1 + End Sub + End Class +End Namespace diff --git a/GUI_EDMI/My Project/Application.myapp b/GUI_EDMI/My Project/Application.myapp new file mode 100644 index 00000000..1243847f --- /dev/null +++ b/GUI_EDMI/My Project/Application.myapp @@ -0,0 +1,11 @@ + + + true + Form1 + false + 0 + true + 0 + 0 + true + diff --git a/GUI_EDMI/My Project/AssemblyInfo.vb b/GUI_EDMI/My Project/AssemblyInfo.vb new file mode 100644 index 00000000..957c671c --- /dev/null +++ b/GUI_EDMI/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' Allgemeine Informationen über eine Assembly werden über die folgenden +' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +' die einer Assembly zugeordnet sind. + +' Werte der Assemblyattribute überprüfen + + + + + + + + + + +'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird. + + +' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +' +' Hauptversion +' Nebenversion +' Buildnummer +' Revision +' +' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +' übernehmen, indem Sie "*" eingeben: +' + + + diff --git a/GUI_EDMI/My Project/Resources.Designer.vb b/GUI_EDMI/My Project/Resources.Designer.vb new file mode 100644 index 00000000..640fa7a1 --- /dev/null +++ b/GUI_EDMI/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GUI_EDMI.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/GUI_EDMI/My Project/Resources.resx b/GUI_EDMI/My Project/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/GUI_EDMI/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUI_EDMI/My Project/Settings.Designer.vb b/GUI_EDMI/My Project/Settings.Designer.vb new file mode 100644 index 00000000..b772c8ab --- /dev/null +++ b/GUI_EDMI/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.GUI_EDMI.My.MySettings + Get + Return Global.GUI_EDMI.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/GUI_EDMI/My Project/Settings.settings b/GUI_EDMI/My Project/Settings.settings new file mode 100644 index 00000000..85b890b3 --- /dev/null +++ b/GUI_EDMI/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/GUI_EDMI/My Project/licenses.licx b/GUI_EDMI/My Project/licenses.licx new file mode 100644 index 00000000..d87e83cf --- /dev/null +++ b/GUI_EDMI/My Project/licenses.licx @@ -0,0 +1 @@ +DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/Message/Email.vb b/Message/Email.vb index 7c18df74..ce81e2f4 100644 --- a/Message/Email.vb +++ b/Message/Email.vb @@ -2,104 +2,147 @@ Imports Independentsoft.Email Imports Independentsoft.Email.Smtp Imports Independentsoft.Email.Mime + +Imports DigitalData.Modules.Logging Public Class Email - Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger - Public Function NewSendMail(ByVal mailSubject As String, ByVal mailBody As String, mailto As String, - mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String, - AUTH_TYPE As String, Optional attment As String = "") - Dim empfaenger As String() - If mailto.Contains(";") Then - empfaenger = mailto.Split(";") - Else - ReDim Preserve empfaenger(0) - empfaenger(0) = mailto - End If - Dim _error As Boolean = False - 'Für jeden Empfänger eine Neue Mail erzeugen - For Each _mailempfaenger As String In empfaenger - Try - Dim message As New Message() - message.From = New Mailbox(mailfrom, mailfrom) - message.[To].Add(New Mailbox(_mailempfaenger)) - message.Subject = mailSubject - Dim textBodyPart As New BodyPart() - textBodyPart.ContentType = New ContentType("text", "html", "utf-8") - textBodyPart.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable - textBodyPart.Body = mailBody - message.BodyParts.Add(textBodyPart) - If attment <> String.Empty Then - If System.IO.File.Exists(attment) Then - Dim attachment1 As New Attachment(attment) - If attment.ToLower.EndsWith("pdf") Then - attachment1.ContentType = New ContentType("application", "pdf") - ElseIf attment.ToLower.EndsWith("jpg") Then - attachment1.ContentType = New ContentType("application", "jpg") - ElseIf attment.ToLower.EndsWith("docx") Then - attachment1.ContentType = New ContentType("application", "MS-word") + Private _logger As DigitalData.Modules.Logging.Logger + Private _logConfig As LogConfig + Public Sub New(LogConfig As LogConfig) + _logger = LogConfig.GetLogger() + _logConfig = LogConfig + End Sub + Public Function NewEmail(mailto As String, mailSubject As String, mailBody As String, + mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String, + AUTH_TYPE As String, Optional attment As String = "") + Try + _logger.Debug($"in NewEmail..") + Dim oEmpfaenger As String() + If mailto.Contains(";") Then + oEmpfaenger = mailto.Split(";") + Else + ReDim Preserve oEmpfaenger(0) + oEmpfaenger(0) = mailto + End If + Dim oError As Boolean = False + 'Für jeden Empfänger eine Neue Mail erzeugen + For Each oMailempfaenger As String In oEmpfaenger + _logger.Debug($"Working on email for {oMailempfaenger}..") + Try + Dim oMessage As New Message() + oMessage.From = New Mailbox(mailfrom, mailfrom) + oMessage.[To].Add(New Mailbox(oMailempfaenger)) + oMessage.Subject = mailSubject + _logger.Debug($"Message created..") + Dim oTextBodyPart As New BodyPart() + oTextBodyPart.ContentType = New ContentType("text", "html", "utf-8") + oTextBodyPart.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable + oTextBodyPart.Body = mailBody + oMessage.BodyParts.Add(oTextBodyPart) + If attment <> String.Empty Then + If System.IO.File.Exists(attment) Then + Dim attachment1 As New Attachment(attment) + If attment.ToLower.EndsWith("pdf") Then + attachment1.ContentType = New ContentType("application", "pdf") + ElseIf attment.ToLower.EndsWith("jpg") Then + attachment1.ContentType = New ContentType("application", "jpg") + ElseIf attment.ToLower.EndsWith("docx") Then + attachment1.ContentType = New ContentType("application", "MS-word") + End If + oMessage.BodyParts.Add(attachment1) + Else + _logger.Warn($"Attachment {attment.ToString} is not existing!") End If - message.BodyParts.Add(attachment1) End If - End If - Dim client As SmtpClient - Try - client = New SmtpClient(mailsmtp, mailport) - Catch ex As Exception - Logger.Warn("clsEmail.SendMail(Create Client): " & ex.Message) - _error = True - Continue For - End Try - Try - client.Connect() - Catch ex As Exception - Logger.Warn("clsEmail.SendMail(Client.Connect): " & ex.Message) - _error = True - Continue For - End Try - Logger.Info("Connected to Client!") - If AUTH_TYPE = "SSL" Then - client.EnableSsl = True - client.ValidateRemoteCertificate = True - Logger.Info("Authentification via SSL.") - ElseIf AUTH_TYPE = "TLS" Then + Dim oEmailCient As SmtpClient Try - client.EnableSsl = False - Logger.Info("Authentification via TLS. SSL enabled") - 'client.StartTls() + oEmailCient = New SmtpClient(mailsmtp, mailport) Catch ex As Exception - Logger.Warn("clsEmail.SendMail(Client.StartTls): " & ex.Message) - _error = True + _logger.Warn("clsEmail.Create Client: " & ex.Message) + oError = True Continue For End Try + Try + oEmailCient.Connect() + Catch ex As Exception + _logger.Warn("clsEmail.Client.Connect: " & ex.Message) + oError = True + ' Continue For + End Try + _logger.Info("Connected to Client!") + If AUTH_TYPE = "SSL" Then + oEmailCient.EnableSsl = True + 'client.ValidateRemoteCertificate = True + _logger.Info("Authentification via SSL.") + ElseIf AUTH_TYPE = "TLS" Then + ' client.ValidateRemoteCertificate = False + oEmailCient.StartTls() + oEmailCient.EnableSsl = False + _logger.Info("Authentification via TLS. SSL disabled") + Else + oEmailCient.EnableSsl = False + _logger.Info("Authentification NONE. SSL disabled") + End If + Try + + oEmailCient.Connect() + Catch ex As Exception + _logger.Warn("clsEmail.Client.Connect: " & ex.Message) + oError = True + ' Continue For + End Try + Try + If mailsmtp.Contains("office365.com") Then + oEmailCient.Login(mailUser, mailPW, AuthenticationType.None) + Else + oEmailCient.Login(mailUser, mailPW) + End If + + _logger.Info("Logged in!") + Catch ex As Exception + Try + If mailsmtp.Contains("office365.com") Then + oEmailCient.Login(mailUser, mailPW, AuthenticationType.Login) + Else + oEmailCient.Login(mailUser, mailPW, AuthenticationType.Anonymous) + End If + + Catch ex1 As Exception + Try + oEmailCient.Login(mailUser, mailPW, AuthenticationType.Login) + Catch ex2 As Exception + _logger.Warn("clsEmail.Client.Login: " & ex.Message) + oError = True + oEmailCient.Disconnect() + Continue For + End Try + End Try + End Try + Try + oEmailCient.Send(oMessage) + _logger.Info("Message to " & oMailempfaenger & " has been send.") + oError = False + Catch ex As Exception + _logger.Warn("clsEmail.Client.Send: " & ex.Message) + oError = True + oEmailCient.Disconnect() + Continue For + End Try + oEmailCient.Disconnect() - End If - Try - client.Login(mailUser, mailPW) - Logger.Info("Logged in!") - Catch ex As Exception - Logger.Warn("clsEmail.SendMail(Client.Login): " & ex.Message) - _error = True - client.Disconnect() - Continue For - End Try - Try - client.Send(message) - Logger.Info("Message to " & _mailempfaenger & " has been send.") Catch ex As Exception - Logger.Warn("clsEmail.SendMail(Client.Send): " & ex.Message) - _error = True - client.Disconnect() - Continue For + _logger.Error(ex) + oError = True End Try - client.Disconnect() - Catch ex As Exception - Logger.Error(ex) - _error = True - End Try - Next - If _error = True Then + Next + + If oError = True Then + Return False + Else + Return True + End If + Catch ex As Exception + _logger.Error(ex) Return False - Else - Return True - End If + End Try End Function End Class diff --git a/Message/Messaging.vbproj b/Message/Messaging.vbproj index 30f0e002..afeeb152 100644 --- a/Message/Messaging.vbproj +++ b/Message/Messaging.vbproj @@ -43,12 +43,15 @@ On + + ..\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll + P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Email .NET\Bin\Independentsoft.Email.dll - - ..\packages\NLog.4.5.10\lib\net45\NLog.dll + + ..\Modules.Logging\bin\Debug\NLog.dll diff --git a/Modules.Database/Database.vbproj b/Modules.Database/Database.vbproj index c57a5456..4a66b0cb 100644 --- a/Modules.Database/Database.vbproj +++ b/Modules.Database/Database.vbproj @@ -59,7 +59,8 @@ - ..\packages\NLog.4.5.10\lib\net45\NLog.dll + False + ..\Modules.Logging\bin\Debug\NLog.dll P:\Visual Studio Projekte\Bibliotheken\Oracle.ManagedDataAccess.dll diff --git a/Modules.Database/Firebird.vb b/Modules.Database/Firebird.vb index 386a9f91..989368fe 100644 --- a/Modules.Database/Firebird.vb +++ b/Modules.Database/Firebird.vb @@ -53,6 +53,7 @@ Public Class Firebird Private _connectionUsername As String Private _connectionPassword As String Private _connectionString As String + Public _DBInitialized As Boolean = False Public Enum TransactionMode NoTransaction @@ -104,6 +105,8 @@ Public Class Firebird If oConnection Is Nothing Then Throw New Exceptions.DatabaseException() + Else + _DBInitialized = True End If _logger.Debug("Connection sucessfully established!") diff --git a/Modules.Windream/Windream2.vb b/Modules.Windream/Windream2.vb index b9ab51af..692a8395 100644 --- a/Modules.Windream/Windream2.vb +++ b/Modules.Windream/Windream2.vb @@ -972,7 +972,120 @@ Public Class Windream2 Return False End Try End Function + Public Function Export_WMFile(WMPath As String, Exportpath As String) + Try + If Not Exportpath.EndsWith("\") Then + Exportpath &= "\" + End If + + Dim oWMObject As WMObject = GetFileByPath(WMPath) + + _logger.Debug("Working on file: " & oWMObject.aName) + + Dim ExportFileIO = New WMOTOOLLib.WMFileIO ' CreateObject("WMOTOOLLib.WMFileIO") ' New WMOTOOLLib.WMFileIO + _logger.Debug("ExportFileIO created...") + ' Stream Interface bereitstellen + oWMObject.LockFor(WMObjectEditModeFileSystem) + Try + If Not oWMObject.aLocked Then + oWMObject.lock() + End If + Catch ex As Exception + _logger.Error(ex) + Return False + End Try + + Dim oWMStream = oWMObject.OpenStream("BinaryObject", WMObjectEditModeTypedData) + '### VERSIONIERUNG ### + Dim version As Integer = 2 + 'Dim Stammname As String = System.IO.Path.GetFileNameWithoutExtension(Quelle) + Dim Filename = oWMObject.aName.Substring(0, oWMObject.aName.LastIndexOf(".")) + Dim Extension = oWMObject.aName.Substring(oWMObject.aName.LastIndexOf(".")) + Dim tempFilename As String = Exportpath & Filename & Extension + 'Überprüfen ob File existiert + Do While IO.File.Exists(tempFilename) = True + tempFilename = Exportpath & Filename & "_" & version & Extension + version = version + 1 + Loop + _logger.Debug("Exportfilename is: " & tempFilename) + ' den Dateiinhalt der neuen Datei zuweisen + ExportFileIO.aWMStream = oWMStream + ExportFileIO.bstrOriginalFileName = tempFilename + 'Das eigentliche kopieren + ExportFileIO.ExportOriginal(True) + ' close the windream file stream + oWMStream.Close() + oWMObject.Save() + oWMObject.unlock() + _logger.Info($"WMFile has been exported to {tempFilename} ") + + Return True + Catch ex As Exception + _logger.Error(ex) + Return False + End Try + End Function + Public Function Export_WMFile_DocID(WMPath As String, Exportpath As String, DocId As Integer) + Try + If Not Exportpath.EndsWith("\") Then + Exportpath &= "\" + End If + + Dim oWMObject As WMObject = GetFileByPath(WMPath) + Try + _logger.Info("Working on file: " & oWMObject.aName) + Catch ex As Exception + _logger.Error(ex) + _logger.Warn("No object created: " & WMPath) + Return False + End Try + Dim ExportFileIO = New WMOTOOLLib.WMFileIO ' CreateObject("WMOTOOLLib.WMFileIO") ' New WMOTOOLLib.WMFileIO + _logger.Debug("ExportFileIO created...") + ' Stream Interface bereitstellen + 'Try + ' oWMObject.LockFor(WMObjectEditModeMoveReadOnly) 'WMObjectEditModeFileSystem) + 'Catch ex As Exception + ' If Not oWMObject.aLocked Then + ' Try + ' oWMObject.lock() + ' Catch ex1 As Exception + ' _logger.Warn($"{ex1.Message} Could not lock document - DocID: {DocId}") + ' Return False + ' End Try + + ' End If + ' '_logger.(ex) + + 'End Try + + Dim oWMStream = oWMObject.OpenStream("BinaryObject", 1) + '### VERSIONIERUNG ### + Dim version As Integer = 2 + Dim Extension = oWMObject.aName.Substring(oWMObject.aName.LastIndexOf(".")) + Dim tempFilename As String = Exportpath & DocId & Extension + 'Überprüfen ob File existiert + Do While IO.File.Exists(tempFilename) = True + tempFilename = Exportpath & DocId & "_" & version & Extension + version = version + 1 + Loop + _logger.Debug("Exportfilename is: " & tempFilename) + ' den Dateiinhalt der neuen Datei zuweisen + ExportFileIO.aWMStream = oWMStream + ExportFileIO.bstrOriginalFileName = tempFilename + 'Das eigentliche kopieren + ExportFileIO.ExportOriginal(True) + ' close the windream file stream + oWMStream.Close() + _logger.Info($"WMFile DocID {DocId} has been exported to {tempFilename} ") + + Return True + Catch ex As Exception + _logger.Error(ex) + _logger.Info("Unexpected error in Export_WMFile: " & ex.Message) + Return False + End Try + End Function Public Function TestFolderExists(Path As String) As Boolean Return TestObjectExists(GetNormalizedPath(Path), WMEntityFolder) End Function diff --git a/TestGUI/ApplicationEvents.vb b/TestGUI/ApplicationEvents.vb index bc254e28..c97c7e7e 100644 --- a/TestGUI/ApplicationEvents.vb +++ b/TestGUI/ApplicationEvents.vb @@ -1,4 +1,7 @@ -Namespace My +Imports DigitalData.Modules.Logging +Imports Microsoft.VisualBasic.ApplicationServices + +Namespace My ' Für MyApplication sind folgende Ereignisse verfügbar: ' Startup: Wird beim Starten der Anwendung noch vor dem Erstellen des Startformulars ausgelöst. ' Shutdown: Wird nach dem Schließen aller Anwendungsformulare ausgelöst. Dieses Ereignis wird nicht ausgelöst, wenn die Anwendung mit einem Fehler beendet wird. @@ -6,5 +9,8 @@ ' StartupNextInstance: Wird beim Starten einer Einzelinstanzanwendung ausgelöst, wenn die Anwendung bereits aktiv ist. ' NetworkAvailabilityChanged: Wird beim Herstellen oder Trennen der Netzwerkverbindung ausgelöst. Partial Friend Class MyApplication + Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup + + End Sub End Class End Namespace