This commit is contained in:
SchreiberM 2022-12-01 13:26:11 +01:00
commit 673aa6bf95
49 changed files with 410 additions and 399 deletions

View File

@ -92,8 +92,8 @@
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
</packages>

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
# Visual Studio Version 17
VisualStudioVersion = 17.4.33103.184
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUIs", "GUIs", "{8FFE925E-8B84-45F1-93CB-32B1C96F41EB}"
EndProject

View File

@ -90,8 +90,8 @@
<HintPath>..\..\DDModules\ZooFlow\bin\Debug\DigitalData.Modules.ZooFlow.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />

View File

@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("ClipboardWatcher")>
<Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("1.5.1.0")>
<Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.0.0")>
<Assembly: AssemblyFileVersion("1.5.0.0")>
<Assembly: AssemblyVersion("1.5.1.0")>
<Assembly: AssemblyFileVersion("1.5.1.0")>

View File

@ -12,10 +12,10 @@ Imports DigitalData.Modules.ZooFlow.Params
Public Class ProfileSearches
Inherits BaseClass
Private _Environment As Environment
Private _Client As Client
Private _ClipboardContents As String
Private ReadOnly _Environment As Environment
Private ReadOnly _Client As Client
Private ReadOnly _ClipboardContents As String
Private ReadOnly _ClientIsOnline As Boolean = False
Public Class Search
Public Guid As Integer
@ -31,8 +31,10 @@ Public Class ProfileSearches
_Environment = pEnvironment
_ClipboardContents = pClipboardContents
_ClientIsOnline = _Environment.Service.Client IsNot Nothing AndAlso _Environment.Service.Client.IsOnline = True
Try
If _Environment.Service.Client.IsOnline = True Then
If _ClientIsOnline Then
Try
Dim oSplit() As String = _Environment.Service.Address.Split(":")
Dim oAppServerAddress As String = oSplit(0)
@ -50,6 +52,8 @@ Public Class ProfileSearches
Logger.Warn($"Could not initialize the AppServer: {ex.Message}")
Logger.Error(ex)
End Try
Else
Logger.Debug("No client found in Env.")
End If
Catch ex As Exception
Logger.Error(ex)
@ -82,15 +86,14 @@ Public Class ProfileSearches
End Function
Public Async Function LoadDocumentSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search))
Return Await Task.Run(Function()
Return DoLoadDocumentSearches(ProfileId)
End Function)
Return Await Task.Run(Function() DoLoadDocumentSearches(ProfileId))
End Function
Private Function DoLoadDocumentSearches(ProfileId As Integer) As List(Of Search)
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
Dim oSearchesDataTable As DataTable
If _Environment.Service.Client.IsOnline = True Then
If _ClientIsOnline Then
Dim oTableResult As TableResult = _Client.GetDatatableByName("TBCW_PROF_DOC_SEARCH", $"PROFILE_ID = {ProfileId} AND ACTIVE = 1", "TAB_INDEX")
oSearchesDataTable = oTableResult.Table
If oSearchesDataTable Is Nothing Then
@ -100,6 +103,7 @@ Public Class ProfileSearches
Else
oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
End If
Dim oDocSearches As New List(Of Search)
If Not IsNothing(oSearchesDataTable) Then
Dim oCounter As Integer = 0
@ -146,9 +150,7 @@ Public Class ProfileSearches
End Function
Public Async Function LoadDataSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search))
Return Await Task.Run(Function()
Return DoLoadDataSearches(ProfileId)
End Function)
Return Await Task.Run(Function() DoLoadDataSearches(ProfileId))
End Function
Private Function DoLoadDataSearches(ProfileId As Integer) As List(Of Search)
@ -157,7 +159,7 @@ Public Class ProfileSearches
Try
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
Dim oSearchesDataTable As DataTable
If _Environment.Service.Client.IsOnline = True Then
If _ClientIsOnline Then
Dim oTableResult As TableResult = _Client.GetDatatableByName("TBCW_PROF_DATA_SEARCH", $"PROFILE_ID = {ProfileId} AND ACTIVE = 1", "TAB_INDEX")
oSearchesDataTable = oTableResult.Table
If oSearchesDataTable Is Nothing Then

View File

@ -51,6 +51,10 @@
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
</packages>

View File

@ -98,8 +98,8 @@
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />

View File

@ -55,6 +55,8 @@ Public Class frmDocumentResultList
Private Property ResultLists As List(Of DocumentResult)
Private IsLoading As Boolean = True
Private ClientIsOnline As Boolean = False
Private _DragBoxFromMouseDown As Rectangle
Private _ScreenOffset As Point
Private _CurrentDocument As DocumentResultList.Document = Nothing
@ -125,18 +127,29 @@ Public Class frmDocumentResultList
End Sub
Private Function GetOperationMode() As OperationMode
Dim oOperationMode As OperationMode
Dim oOperationMode As OperationMode = OperationMode.NoAppServer
If Environment.Service IsNot Nothing AndAlso Environment.Service.Client.IsOnline AndAlso Environment.Service.Address <> String.Empty Then
Try
If Environment.Service.Client IsNot Nothing AndAlso Environment.Service.Client.IsOnline Then
oOperationMode = OperationMode.WithAppServer
Else
oOperationMode = OperationMode.NoAppServer
End If
Logger.Debug("OperationMode set to [{0}]", oOperationMode)
If Params.OperationModeOverride <> OperationMode.None Then
Logger.Debug("Overriding OperationMode with [{0}]", Params.OperationModeOverride)
oOperationMode = Params.OperationModeOverride
End If
Logger.Debug("OperationMode is now [{0}]", oOperationMode)
Catch ex As Exception
Logger.Error(ex)
Logger.Warn("Error while determining OperationMode. Setting to [{0}]", oOperationMode)
End Try
Return oOperationMode
End Function

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Common")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyTrademark("2.4.1.0")>
<Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.0.0")>
<Assembly: AssemblyFileVersion("2.4.0.0")>
<Assembly: AssemblyVersion("2.4.1.0")>
<Assembly: AssemblyFileVersion("2.4.1.0")>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
</packages>

View File

@ -62,8 +62,8 @@
<HintPath>..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
</packages>

View File

@ -105,11 +105,11 @@
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.3.2.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.3.2\lib\net472\Quartz.dll</HintPath>
<Reference Include="Quartz, Version=3.5.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.5.0\lib\net472\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net461" />
<package id="NLog" version="4.7.10" targetFramework="net472" />
<package id="Quartz" version="3.3.2" targetFramework="net472" />
<package id="NLog" version="5.0.5" targetFramework="net472" />
<package id="Quartz" version="3.5.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net461" />
<package id="System.Memory" version="4.5.4" targetFramework="net461" />

View File

@ -33,6 +33,6 @@
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
</configuration>

View File

@ -7,14 +7,14 @@ Public MustInherit Class BaseMethod
Friend ReadOnly DatabaseIDB As MSSQLServer
Friend ReadOnly DatabaseECM As MSSQLServer
Friend ReadOnly Helpers As Helpers
Friend ReadOnly Helpers As IDB.Helpers
Friend ReadOnly GlobalState As GlobalState
Public Sub New(pLogConfig As LogConfig, pDatabaseIDB As MSSQLServer, pDatabaseECM As MSSQLServer, pGlobalState As GlobalState)
MyBase.New(pLogConfig)
DatabaseIDB = pDatabaseIDB
DatabaseECM = pDatabaseECM
Helpers = New Helpers(pLogConfig, pDatabaseIDB)
Helpers = New IDB.Helpers(pLogConfig, pDatabaseIDB)
GlobalState = pGlobalState
End Sub
End Class

View File

@ -11,7 +11,7 @@
<AssemblyName>EDMIService</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Console</MyType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
@ -100,11 +100,11 @@
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.3.2.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.3.2\lib\net472\Quartz.dll</HintPath>
<Reference Include="Quartz, Version=3.5.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.5.0\lib\net462\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@ -235,6 +235,7 @@
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>

View File

@ -22,7 +22,7 @@ Namespace My.Resources
'''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _

View File

@ -15,7 +15,7 @@ Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase

View File

@ -2,8 +2,8 @@
<packages>
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="NLog" version="4.7.10" targetFramework="net472" />
<package id="Quartz" version="3.3.2" targetFramework="net472" />
<package id="NLog" version="5.0.5" targetFramework="net472" />
<package id="Quartz" version="3.5.0" targetFramework="net462" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.4" targetFramework="net472" />

View File

@ -1,50 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DigitalData.Services.JobRunner.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<DigitalData.Services.JobRunner.My.MySettings>
<setting name="LOG_PATH" serializeAs="String">
<value />
</setting>
<setting name="SQL_CONNECTIONSTRING" serializeAs="String">
<value />
</setting>
<setting name="FIREBIRD_SERVER" serializeAs="String">
<value />
</setting>
<setting name="FIREBIRD_DATABASE" serializeAs="String">
<value />
</setting>
<setting name="FIREBIRD_USER" serializeAs="String">
<value />
</setting>
<setting name="FIREBIRD_PASSWORD" serializeAs="String">
<value />
</setting>
<setting name="LOG_DEBUG" serializeAs="String">
<value>False</value>
</setting>
<setting name="ADSYNC_CONFIG" serializeAs="String">
<value>False|0 0 0/1 * * ?|RootPath::LDAP://DIGITALDATA,UserFilter::(&amp;(samaccountname=@SAMACCOUNTNAME)),GroupFilter::(&amp;(samaccountname=*))</value>
</setting>
<setting name="TEST_CONFIG" serializeAs="String">
<value>False|10/0 * * * * ?|Foo::Bar</value>
</setting>
<setting name="GRAPHQL_CONFIG" serializeAs="String">
<value>False|0 0 0/1 * * ?|QueryConfigFolder::E:\JenneJ\GraphQL</value>
</setting>
</DigitalData.Services.JobRunner.My.MySettings>
</applicationSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0" />
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>

View File

@ -0,0 +1,25 @@
Imports DigitalData.Modules.Jobs
Public Class Config
Public Property Debug As Boolean = False
Public Property SQLConnectionString As String = ""
Public Property Firebird As New FirebirdConfig
Public Property Jobs As New List(Of JobConfig)
'Public Enum JobType
' ADSync
' GraphQL
' Test
'End Enum
Public Class FirebirdConfig
Public Property DataSource As String = "172.24.12.41"
Public Property Database As String = "172.24.12.41:E:\DB\Firebird\Databases\EDMI_TEMPLATE\EDMI_MASTER.FDB"
Public Property User As String = "sysdba"
Public Property Password As String = "dd"
End Class
End Class

View File

@ -1,44 +1,29 @@
Imports System.Collections.Specialized
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Jobs
Imports DigitalData.Modules.Logging
Imports DigitalData.Services.JobRunner.Config
Imports Quartz
Imports Quartz.Impl
Imports Quartz.Logging
Public Class JobRunner
Private _LogConfig As LogConfig
Private _Logger As DigitalData.Modules.Logging.Logger
Private _firebird As Firebird
Private _mssql As MSSQLServer
Private ReadOnly _LogConfig As LogConfig
Private ReadOnly _Logger As DigitalData.Modules.Logging.Logger
Private ReadOnly _firebird As Firebird
Private ReadOnly _mssql As MSSQLServer
Private ReadOnly _config As Config
Private _Props As New NameValueCollection From {
{"quartz.serializer.type", "binary"},
{"quartz.threadPool.threadCount", 10}
}
Private _factory As StdSchedulerFactory
Private _scheduler As IScheduler
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer, Firebird As Firebird)
_LogConfig = LogConfig
_Logger = LogConfig.GetLogger()
_firebird = Firebird
_mssql = MSSQL
Try
Dim directory As New IO.DirectoryInfo(_LogConfig.LogDirectory)
For Each file As IO.FileInfo In directory.GetFiles
If (Now - file.CreationTime).Days > 29 Then
file.Delete()
Else
Exit For
End If
Next
Catch ex As Exception
End Try
Public Sub New(pLogConfig As LogConfig, pConfig As Config, pMSSQL As MSSQLServer, pFirebird As Firebird)
_LogConfig = pLogConfig
_Logger = pLogConfig.GetLogger()
_firebird = pFirebird
_mssql = pMSSQL
_config = pConfig
End Sub
Public Async Sub Start()
@ -48,7 +33,8 @@ Public Class JobRunner
_Logger.Info("Starting JobRunner")
Dim oProps As New NameValueCollection From {
{"quartz.serializer.type", "binary"}
{"quartz.serializer.type", "binary"},
{"quartz.threadPool.threadCount", 10}
}
_factory = New StdSchedulerFactory(oProps)
_scheduler = Await _factory.GetScheduler()
@ -57,26 +43,30 @@ Public Class JobRunner
Await _scheduler.Start()
' [START] Job Scheduling
Await ScheduleJob(Of ADJob)("ADSync", My.Settings.ADSYNC_CONFIG)
Await ScheduleJob(Of TestJob)("TestJob", My.Settings.TEST_CONFIG)
Await ScheduleJob(Of GraphQLJob)("GraphQLJob", My.Settings.GRAPHQL_CONFIG)
Await ScheduleJob(Of ADJob)("ADSync", GetJobConfig(JobConfig.JobType.ADSync))
Await ScheduleJob(Of TestJob)("TestJob", GetJobConfig(JobConfig.JobType.Test))
Await ScheduleJob(Of GraphQLJob)("GraphQLJob", GetJobConfig(JobConfig.JobType.GraphQL))
' [END] Job Scheduling
Catch ex As Exception
_Logger.Warn("Job Failed.")
_Logger.Warn("Job Failed with message: [{0}].", ex.Message)
_Logger.Error(ex)
End Try
End Sub
Public Async Function ScheduleJob(Of T As Quartz.IJob)(JobName As String, JobConfigString As String) As Task
Public Function GetJobConfig(pName As JobConfig.JobType) As JobConfig
Return _config.Jobs.Where(Function(j) j.Name = pName).SingleOrDefault()
End Function
Public Async Function ScheduleJob(Of T As Quartz.IJob)(JobName As String, pJobConfig As JobConfig) As Task
Dim oJobIdentity As String = JobName
Dim oTriggerIdentity As String = JobName & "-Trigger"
Dim oJobConfig As JobConfig = JobConfigParser.ParseConfig(JobConfigString)
Dim oJobConfig As JobConfig = JobConfigParser.ParseConfig(pJobConfig)
Dim oJobData As New JobDataMap From {
{"LogConfig", _LogConfig},
{"Firebird", _firebird},
{"MSSQL", _mssql},
{"Args", oJobConfig.Arguments}
{"Args", oJobConfig.Args}
}
Dim oJob = JobBuilder.Create(Of T)().
@ -87,7 +77,7 @@ Public Class JobRunner
Dim oTrigger = TriggerBuilder.Create().
WithIdentity(oTriggerIdentity).
StartNow().
WithCronSchedule(oJobConfig.CronExpression).
WithCronSchedule(oJobConfig.CronSchedule).
Build()
If oJobConfig.Enabled Then
@ -98,8 +88,8 @@ Public Class JobRunner
_Logger.Info("Job {0} is disabled.", JobName)
End If
' If StartImmediately is True, start Job after 10 Seconds
If oJobConfig.StartImmediately Then
' If StartWithoutDelay is True, start Job after 10 Seconds
If oJobConfig.StartWithoutDelay Then
Dim oDebugJob = JobBuilder.Create(Of T)().
WithIdentity(oJobIdentity & "-DEBUG").
UsingJobData(oJobData).
@ -130,8 +120,6 @@ Public Class JobRunner
_Logger = Logger
End Sub
Private Function GetLogger(name As String) As Logging.Logger Implements ILogProvider.GetLogger
Return Function(level, func, exception, parameters)
If exception IsNot Nothing Then

View File

@ -11,8 +11,9 @@
<AssemblyName>DigitalData.Services.JobRunner</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Console</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -50,6 +51,10 @@
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="DigitalData.Modules.Config, Version=1.1.4.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\DDModules\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Database, Version=2.2.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
@ -66,11 +71,11 @@
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.3.2.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.3.2\lib\net461\Quartz.dll</HintPath>
<Reference Include="Quartz, Version=3.5.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.5.0\lib\net462\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
@ -101,6 +106,7 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Config.vb" />
<Compile Include="JobRunner.vb" />
<Compile Include="Jobs\GraphQLJob.vb" />
<Compile Include="Jobs\ADJob.vb" />
@ -108,6 +114,7 @@
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="JobRunnerService.vb">
<SubType>Component</SubType>

View File

@ -1,31 +1,37 @@
Imports DigitalData.Modules.Logging
Imports System.IO
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging.LogConfig
Imports DigitalData.Modules.Database
Imports DigitalData.Services.JobRunner
Imports DigitalData.Modules.Config
Public Class JobRunnerService
Private _logConfig As LogConfig
Private _logger As Logger
Private _config As ConfigManager(Of Config)
Private _mssql As MSSQLServer
Private _firebird As Firebird
Private _jobrunner As JobRunner
Protected Overrides Sub OnStart(ByVal args() As String)
_logConfig = New LogConfig(PathType.CustomPath, My.Settings.LOG_PATH) With {
.Debug = My.Settings.LOG_DEBUG
}
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log")) With {.Debug = True}
_logger = _logConfig.GetLogger()
Try
_logger.Info("Starting Service {0}", ServiceName)
_config = New ConfigManager(Of Config)(_logConfig, My.Application.Info.DirectoryPath)
_logConfig.Debug = _config.Config.Debug
Try
_mssql = New MSSQLServer(_logConfig, My.Settings.SQL_CONNECTIONSTRING)
_firebird = New Firebird(_logConfig, My.Settings.FIREBIRD_SERVER, My.Settings.FIREBIRD_DATABASE, My.Settings.FIREBIRD_USER, My.Settings.FIREBIRD_PASSWORD)
Catch ex As Exception
_logger.Error(ex)
End Try
Dim oFirebird = _config.Config.Firebird
Try
_jobrunner = New JobRunner(_logConfig, _mssql, _firebird)
_logger.Debug("Connecting to Database..")
_mssql = New MSSQLServer(_logConfig, _config.Config.SQLConnectionString)
_firebird = New Firebird(_logConfig, oFirebird.DataSource, oFirebird.Database, oFirebird.User, oFirebird.Password)
_logger.Debug("Starting Jobrunner..")
_jobrunner = New JobRunner(_logConfig, _config.Config, _mssql, _firebird)
_jobrunner.Start()
Catch ex As Exception
_logger.Error(ex)

View File

@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Service.JobRunner")>
<Assembly: AssemblyCopyright("Copyright © 2020")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("2.1.0.0")>
<Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.4.0")>
<Assembly: AssemblyVersion("2.1.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -22,7 +22,7 @@ Namespace My.Resources
'''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _

View File

@ -15,7 +15,7 @@ Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0"), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
@ -53,97 +53,6 @@ Namespace My
Return defaultInstance
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property LOG_PATH() As String
Get
Return CType(Me("LOG_PATH"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property SQL_CONNECTIONSTRING() As String
Get
Return CType(Me("SQL_CONNECTIONSTRING"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property FIREBIRD_SERVER() As String
Get
Return CType(Me("FIREBIRD_SERVER"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property FIREBIRD_DATABASE() As String
Get
Return CType(Me("FIREBIRD_DATABASE"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property FIREBIRD_USER() As String
Get
Return CType(Me("FIREBIRD_USER"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property FIREBIRD_PASSWORD() As String
Get
Return CType(Me("FIREBIRD_PASSWORD"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Public ReadOnly Property LOG_DEBUG() As Boolean
Get
Return CType(Me("LOG_DEBUG"),Boolean)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True|10/0 * * * * ?|Foo::Bar")> _
Public ReadOnly Property TEST_CONFIG() As String
Get
Return CType(Me("TEST_CONFIG"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False|0 0 0/1 * * ?|QueryConfigFolder::E:\JenneJ\GraphQL")> _
Public ReadOnly Property GRAPHQL_CONFIG() As String
Get
Return CType(Me("GRAPHQL_CONFIG"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False|0 0 0/1 * * ?|RootPath::LDAP://DIGITALDATA,UserFilter::(&(samaccountname=@S"& _
"AMACCOUNTNAME)),GroupFilter::(&(samaccountname=*))")> _
Public ReadOnly Property ADSYNC_CONFIG() As String
Get
Return CType(Me("ADSYNC_CONFIG"),String)
End Get
End Property
End Class
End Namespace

View File

@ -1,36 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="LOG_PATH" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SQL_CONNECTIONSTRING" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="FIREBIRD_SERVER" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="FIREBIRD_DATABASE" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="FIREBIRD_USER" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="FIREBIRD_PASSWORD" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="LOG_DEBUG" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="ADSYNC_CONFIG" Type="System.String" Scope="Application">
<Value Profile="(Default)">False|0 0 0/1 * * ?|RootPath::LDAP://DIGITALDATA,UserFilter::(&amp;(samaccountname=@SAMACCOUNTNAME)),GroupFilter(&amp;(samaccountname=*))</Value>
</Setting>
<Setting Name="TEST_CONFIG" Type="System.String" Scope="Application">
<Value Profile="(Default)">True|10/0 * * * * ?|Foo::Bar</Value>
</Setting>
<Setting Name="GRAPHQL_CONFIG" Type="System.String" Scope="Application">
<Value Profile="(Default)">False|0 0 0/1 * * ?|QueryConfigFolder::E:\JenneJ\GraphQL</Value>
</Setting>
</Settings>
<Settings />
</SettingsFile>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net461" />
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="Quartz" version="3.3.2" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
<package id="Quartz" version="3.5.0" targetFramework="net462" />
</packages>

View File

@ -81,8 +81,8 @@
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />

View File

@ -308,10 +308,10 @@ Public Class EmailService
Select Case Database
Case DatabaseType.Firebird
oSQL = "SELECT * FROM TBEDM_EMAIL_QUEUE WHERE EMAIL_SENT IS NULL and EMAIL_TO <> '' ORDER BY EMAIL_ACCOUNT_ID, CREATEDWHEN DESC"
oSQL = "SELECT * FROM TBEDM_EMAIL_QUEUE WHERE EMAIL_SENT IS NULL and EMAIL_TO <> ''"
oEmailQueue = _Firebird.GetDatatable(oSQL)
Case DatabaseType.MSSQL
oSQL = "SELECT * FROM TBEMLP_EMAIL_OUT WHERE EMAIL_SENT IS NULL and EMAIL_ADRESS <> '' ORDER BY SENDING_PROFILE, ADDED_WHEN DESC"
oSQL = "SELECT * FROM TBEMLP_EMAIL_OUT WHERE EMAIL_SENT IS NULL and EMAIL_ADRESS <> ''"
oEmailQueue = MSSQLInstance.GetDatatable(oSQL)
End Select
@ -337,9 +337,9 @@ Public Class EmailService
Select Case Database
Case DatabaseType.Firebird
oAccountQueue = oEmailQueue.Select($"EMAIL_ACCOUNT_ID = {oAccount.Guid}")
oAccountQueue = oEmailQueue.Select($"EMAIL_ACCOUNT_ID = {oAccount.Guid}", "GUID ASC")
Case Else
oAccountQueue = oEmailQueue.Select($"SENDING_PROFILE = {oAccount.Guid}")
oAccountQueue = oEmailQueue.Select($"SENDING_PROFILE = {oAccount.Guid}", "GUID ASC")
End Select
' No mails for this profile

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("DDEmailService")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("")>
<Assembly: AssemblyTrademark("1.5.1.0")>
<Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.0.0")>
<Assembly: AssemblyFileVersion("1.5.0.0")>
<Assembly: AssemblyVersion("1.5.1.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" />
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
</packages>

View File

@ -56,8 +56,8 @@
<HintPath>..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
</packages>

View File

@ -34,6 +34,10 @@
Public Property RejectionTransferEnabled As Boolean = True
Public Property RejectionTransferTimeUnit As String = "HOUR"
Public Property RejectionTransferTimeValue As Integer = 12
Public Property AllowFacturX As Boolean = True
Public Property AllowXRechnung As Boolean = True
End Class
Public Class FirebirdConfig

View File

@ -71,8 +71,8 @@
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("DDZUGFeRDService")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("2.1.2.1")>
<Assembly: AssemblyTrademark("2.2.0.0")>
<Assembly: ComVisible(False)>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.1.2.1")>
<Assembly: AssemblyFileVersion("2.1.2.1")>
<Assembly: AssemblyVersion("2.2.0.0")>
<Assembly: AssemblyFileVersion("2.2.0.0")>

View File

@ -50,8 +50,12 @@ Public Class ThreadRunner
.ExceptionEmailAddress = _config.Config.ExceptionEmailAddress,
.IgnoreRejectionStatus = _config.Config.Custom.IgnoreRejectionStatus,
.MaxAttachmentSizeInMegaBytes = _config.Config.Custom.MaxAttachmentSizeInMegaBytes,
.NamePortal = _config.Config.PORTAL_NAME
.NamePortal = _config.Config.PORTAL_NAME,
.EmailOutProfileId = _config.Config.MSSQLEmailOutAccountID,
.AllowFacturX = _config.Config.Custom.AllowFacturX,
.AllowXRechnung = _config.Config.Custom.AllowXRechnung
}
oArgs = LoadFolderConfig(oArgs)
oArgs = LoadPropertyMapFor(oArgs, "DEFAULT")
@ -191,7 +195,7 @@ Public Class ThreadRunner
Dim oArgs As WorkerArgs = e.Argument
_logger.Debug("Background worker running..")
Dim oJob As New ImportZUGFeRDFiles(_logConfig, _firebird, _config.Config.MSSQLEmailOutAccountID, _config.Config.PORTAL_NAME, _mssql)
Dim oJob As New ImportZUGFeRDFiles(_logConfig, _firebird, _mssql)
oJob.Start(oArgs)
Catch ex As Exception
_logger.Warn("Background worker failed!")

View File

@ -18,19 +18,6 @@ Public Class ZUGFeRDService
_config = New ConfigManager(Of Config)(_logConfig, My.Application.Info.DirectoryPath)
_logConfig.Debug = _config.Config.Debug
_logger = _logConfig.GetLogger()
Try
Dim directory As New IO.DirectoryInfo(_logConfig.LogDirectory)
For Each file As IO.FileInfo In directory.GetFiles
If (Now - file.CreationTime).Days > 29 Then
file.Delete()
Else
Exit For
End If
Next
Catch ex As Exception
End Try
_logger.Info($"{Constants.SERVICE_NAME} is starting.")
Dim oDataSource As String = _config.Config.Firebird.DataSource

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" />
<package id="NLog" version="4.7.10" targetFramework="net461" />
<package id="NLog" version="5.0.5" targetFramework="net461" />
</packages>

View File

@ -1,15 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ZUGFeRDRESTService
namespace ZUGFeRDRESTService
{
public class Config
{
public string Name { get; set; }
public string LogPath { get; set; }
public string MSSQLConnectionString { get; set; }
public FirebirdConfig Firebird { get; set; }
}
public class FirebirdConfig
{
public string Datasource { get; set; }
public string Database { get; set; }
public string Username { get; set; }
public string Password { get; set; }
}
}

View File

@ -1,15 +1,14 @@
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using DigitalData.Modules.Interfaces;
using DigitalData.Modules.Logging;
using static DigitalData.Modules.Interfaces.Exceptions;
using static DigitalData.Modules.Interfaces.ZUGFeRDInterface;
using static DigitalData.Modules.Interfaces.PropertyValues;
using System.Data.SqlClient;
namespace ZUGFeRDRESTService.Controllers
{
@ -17,8 +16,11 @@ namespace ZUGFeRDRESTService.Controllers
[ApiController]
public class ValidationController : ControllerBase
{
public static string RESPONSE_OK = "OK";
public static string RESPONSE_ERROR = "ERROR";
public const string RESPONSE_OK = "OK";
public const string RESPONSE_ERROR = "ERROR";
public const string ADDED_WHO = "ZUGFeRD REST Service";
public const string MESSAGEID_DOMAIN = "test.wisag.de";
private readonly ZUGFeRDInterface _zugferd;
private readonly IDatabase _database;
@ -29,34 +31,6 @@ namespace ZUGFeRDRESTService.Controllers
private readonly PropertyValues _props;
private readonly Dictionary<String, XmlItemProperty> _propertyMap;
public class ValidationResponse
{
public string status;
public string message;
public List<string> errors;
public ValidationResponse()
{
status = RESPONSE_OK;
message = string.Empty;
errors = new List<string>();
}
public ValidationResponse(string Status, string Message)
{
status = Status;
message = Message;
errors = new List<string>();
}
public ValidationResponse(string Status, string Message, List<String> Errors)
{
status = Status;
message = Message;
errors = Errors;
}
}
public ValidationController(ILogging logging, IDatabase database)
{
_logConfig = logging.LogConfig;
@ -79,11 +53,12 @@ namespace ZUGFeRDRESTService.Controllers
/// <summary>
/// POST: /api/validation
/// </summary>
/// <param name="files">This parameter's name needs to correspond to the html form's file-input name</param>
/// <param name="file">This parameter's name needs to correspond to the html form's file-input name</param>
/// <param name="user_id">This is the email address which the user supplied</param>
[HttpPost]
public async Task<ValidationResponse> Post(IFormFile file, string user_id)
public ValidationResponse Post(IFormFile file, string user_id)
{
_logger.Debug("Start processing request to ValidationController");
_logger.Info("Start processing request to ValidationController");
object oDocument;
PropertyValues.CheckPropertyValuesResult oResult = new PropertyValues.CheckPropertyValuesResult();
@ -92,40 +67,63 @@ namespace ZUGFeRDRESTService.Controllers
{
using Stream oStream = file.OpenReadStream();
{
_logger.Debug("Extracting ZUGFeRD Data from file [{0}]", file.FileName);
_logger.Info("Extracting ZUGFeRD Data from file [{0}]", file.FileName);
oDocument = _zugferd.ExtractZUGFeRDFileWithGDPicture(oStream);
_logger.Debug("Checking ZUGFeRD Data against the database");
_logger.Info("Starting structural check against the database.");
oResult = _props.CheckPropertyValues(oDocument, _propertyMap, "MESSAGEID");
var oRequiredProperties = _propertyMap.
Where(prop => {return prop.Value.IsRequired == true;}).
Where(prop => { return prop.Value.IsRequired == true; }).
Select(prop => { return prop.Value.Description; })
.ToList();
_logger.Debug("Found [{0}] required properties", oRequiredProperties.Count);
_logger.Debug(String.Join(",", oRequiredProperties.ToArray()));
_logger.Debug(string.Join(",", oRequiredProperties.ToArray()));
_logger.Debug("Result of checking against the database: {0} valid properties, {1} missing properties",
_logger.Info("Result of checking against the database: {0} valid properties, {1} missing properties",
oResult.ValidProperties.Count, oResult.MissingProperties.Count);
if (oResult.MissingProperties.Count > 0)
{
throw new ZUGFeRDExecption(ZUGFeRDInterface.ErrorType.MissingProperties,
throw new ZUGFeRDExecption(ErrorType.MissingProperties,
"Die hochgeladene Datei ist eine gültige ZUGFeRD-Rechnung, allerdings fehlen benötigte Daten.");
}
Tuple<bool, string> oValidateResult = ValidateBuyerOrderReference(oResult.ValidProperties);
if (oValidateResult.Item1 == false)
{
throw new ZUGFeRDExecption(ErrorType.UnknownError, "Die hochgeladene Datei kann nicht validiert werden, weil ein unbekannter Fehler aufgetreten ist.");
}
string oValidateResultString = oValidateResult.Item2;
if (oValidateResultString == "ALL REFERENCES CHECKED POSITIVE")
{
string oMessage = "Die hochgeladene Datei ist eine gültige-ZUGFeRD Rechnung";
_logger.Debug($"Replying with: [{oMessage}]");
_logger.Info($"Responding with message: [{oMessage}]");
return new ValidationResponse()
{
status = RESPONSE_OK,
message = oMessage
};
} else
{
string oMessage = oValidateResultString;
_logger.Info($"Responding with message: [{oMessage}]");
return new ValidationResponse()
{
status = RESPONSE_ERROR,
message = oMessage
};
}
};
}
catch (ZUGFeRDExecption ex)
@ -150,7 +148,7 @@ namespace ZUGFeRDRESTService.Controllers
_ => new List<string>()
};
_logger.Debug($"Replying with: [{oMessage}]");
_logger.Info($"Responding with message: [{oMessage}]");
return new ValidationResponse()
{
@ -165,7 +163,7 @@ namespace ZUGFeRDRESTService.Controllers
string oMessage = "Die hochgeladene Datei kann nicht validiert werden, weil ein unbekannter Fehler aufgetreten ist.";
_logger.Debug($"Replying with: [{oMessage}]");
_logger.Info($"Responding with message: [{oMessage}]");
return new ValidationResponse()
{
@ -174,5 +172,87 @@ namespace ZUGFeRDRESTService.Controllers
};
}
}
private Tuple<bool, string> ValidateBuyerOrderReference(List<ValidProperty> pProperties)
{
var oMessageId = GetMessageId();
_logger.Debug("Created new MessageId: [{0}]", oMessageId);
_logger.Debug("Inserting properties into database.");
foreach (var oItem in pProperties)
{
var oResult = InsertPropertyMap(oItem, oMessageId);
if (oResult == false)
{
_logger.Warn("Error while inserting the Property [{0}] into the Database!", oItem.Description);
}
}
_logger.Debug("Calling validation prodecure.");
try
{
using SqlCommand oCommand = new SqlCommand("PRCUST_INV_CHECK_FROM_PORTAL");
oCommand.CommandType = System.Data.CommandType.StoredProcedure;
oCommand.Parameters.Clear();
oCommand.Parameters.Add("@REF_GUID", System.Data.SqlDbType.VarChar, 250).Value = oMessageId;
oCommand.Parameters.Add("@MSG_OUTPUT", System.Data.SqlDbType.VarChar, 500).Direction = System.Data.ParameterDirection.Output;
if (_database.MSSQL.ExecuteNonQuery(oCommand))
{
string oReturnValue = (string)oCommand.Parameters["@MSG_OUTPUT"].Value;
return new Tuple<bool, string>(true, oReturnValue);
}
else
{
return new Tuple<bool, string>(false, string.Empty);
}
}
catch (Exception e)
{
_logger.Error(e);
return new Tuple<bool, string>(false, string.Empty);
}
}
public string GetMessageId()
{
return $"{Guid.NewGuid()}@{MESSAGEID_DOMAIN}";
}
public bool InsertPropertyMap(ValidProperty pProperty, string pMessageId)
{
try
{
var oSql = $"INSERT INTO {pProperty.TableName} " +
"(REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, CREATEDWHO, SPEC_NAME, GROUP_COUNTER, IS_REQUIRED) VALUES " +
"(@REFERENCE_GUID, @ITEM_DESCRIPTION, @ITEM_VALUE, @CREATEDWHO, @SPEC_NAME, @GROUP_COUNTER, @IS_REQUIRED)";
var oParams = new SqlParameter[]
{
new SqlParameter("@REFERENCE_GUID", pMessageId),
new SqlParameter("@ITEM_DESCRIPTION", pProperty.Description),
new SqlParameter("@ITEM_VALUE", pProperty.Value),
new SqlParameter("@CREATEDWHO", ADDED_WHO),
new SqlParameter("@GROUP_COUNTER", pProperty.GroupCounter),
new SqlParameter("@SPEC_NAME", pProperty.TableColumn),
new SqlParameter("@IS_REQUIRED", pProperty.ISRequired)
};
var oCommand = new SqlCommand(oSql);
oCommand.Parameters.AddRange(oParams);
return _database.MSSQL.ExecuteNonQuery(oCommand);
}
catch (Exception ex)
{
_logger.Error(ex);
return false;
}
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
namespace ZUGFeRDRESTService.Controllers
{
public class ValidationResponse
{
public string status;
public string message;
public List<string> errors;
public ValidationResponse()
{
status = ValidationController.RESPONSE_OK;
message = string.Empty;
errors = new List<string>();
}
public ValidationResponse(string Status, string Message)
{
status = Status;
message = Message;
errors = new List<string>();
}
public ValidationResponse(string Status, string Message, List<String> Errors)
{
status = Status;
message = Message;
errors = Errors;
}
}
}

View File

@ -1,18 +1,21 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using DigitalData.Modules.Database;
using DigitalData.Modules.Interfaces;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
namespace ZUGFeRDRESTService
{
public class Database: IDatabase
{
private string _gdPictureKey = null;
private Dictionary<String, XmlItemProperty> _propertyMap = null;
private Dictionary<string, XmlItemProperty> _propertyMap = null;
private const string QUERY_GET_GDPICTURE_KEY = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'";
private const string QUERY_GET_PROPERTY_MAP = "SELECT * FROM TBEDM_XML_ITEMS WHERE SPECIFICATION = '{0}' AND ACTIVE = True ORDER BY XML_PATH";
@ -22,16 +25,23 @@ namespace ZUGFeRDRESTService
public Database(ILogging Logging, IConfiguration Config)
{
var LogConfig = Logging.LogConfig;
var Logger = Logging.LogConfig.GetLogger();
var AppConfig = Config.GetSection("Config");
var FBConfig = AppConfig.GetSection("Firebird");
var oLogConfig = Logging.LogConfig;
var oLogger = Logging.LogConfig.GetLogger();
var oAppConfig = Config.GetSection("Config");
var oFirebirdConfig = oAppConfig.GetSection("Firebird");
MSSQL = new MSSQLServer(LogConfig, AppConfig["MSSQLConnectionString"]);
Firebird = new Firebird(LogConfig, FBConfig["Datasource"], FBConfig["Database"], FBConfig["Username"], FBConfig["Password"]);
oLogger.Debug("Establishing MSSQL Database connection..");
MSSQL = new MSSQLServer(oLogConfig, oAppConfig["MSSQLConnectionString"]);
Logger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString);
Logger.Debug("Firebird Connection: [{0}]", Firebird.ConnectionString);
oLogger.Debug("Establishing Firebird Database connection..");
Firebird = new Firebird(oLogConfig,
oFirebirdConfig["Datasource"],
oFirebirdConfig["Database"],
oFirebirdConfig["Username"],
oFirebirdConfig["Password"]);
oLogger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString);
oLogger.Debug("Firebird Connection: [{0}]", Firebird.ConnectionString);
}
public string GetGDPictureKey()

View File

@ -9,9 +9,9 @@
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="7.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
<PackageReference Include="NLog" Version="4.7.10" />
<PackageReference Include="NLog" Version="5.0.5" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.12.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
<ItemGroup>