This commit is contained in:
Digital Data - Marlon Schreiber 2019-04-29 16:35:27 +02:00
commit 0addf8940c
59 changed files with 1814 additions and 735 deletions

View File

@ -21,10 +21,6 @@ Public Class RepositoryItemLookupControl2
Public Const CustomEditName As String = "LookupControl2"
Public Sub New()
End Sub
Public Overrides ReadOnly Property EditorTypeName As String
Get
Return CustomEditName
@ -59,34 +55,71 @@ Public Class LookupControl2
Public Property PreventDuplicates As Boolean
Public Property DataSource As DataTable
Public Property SelectedValues As List(Of String)
Get
Return _SelectedValues
End Get
Set(value As List(Of String))
_SelectedValues = value
UpdateSelectedValues(value)
End Set
End Property
Private LookupFormButton As EditorButton
Private DropdownButton As EditorButton
Private Const TAG_BUTTON_LOOKUP_FORM = "openLookupForm"
Private Const TEXT_NO_RECORDS = "Keine Datensätze ausgewählt"
Private Const TEXT_ONE_RECORD = "Ein Datensatz ausgewählt"
Private Const TEXT_N_RECORDS = "{0} Datensätze ausgewählt"
Private _SelectedValues As List(Of String)
Shared Sub New()
RepositoryItemLookupControl2.RegisterLookupControl2()
End Sub
Public Sub New()
Properties.Buttons.Add(New EditorButton() With {
MyClass.New(MultiSelect:=False)
End Sub
Public Sub New(MultiSelect As Boolean)
LookupFormButton = New EditorButton() With {
.Kind = ButtonPredefines.Ellipsis,
.Tag = TAG_BUTTON_LOOKUP_FORM
})
}
Properties.Buttons.AddRange({LookupFormButton})
AddHandler ButtonClick, AddressOf HandleButtonClick
AddHandler EditValueChanging, AddressOf HandleEditValueChanging
AddHandler QueryPopUp, AddressOf HandleQueryPopup
End Sub
Private Sub HandleEditValueChanging(sender As Object, e As ChangingEventArgs)
''' <summary>
''' Prevents popup from opening when multiselect is false
''' </summary>
Private Sub HandleQueryPopup(sender As Object, e As CancelEventArgs)
If MultiSelect = False Then
e.Cancel = True
End If
End Sub
Private Sub HandleButtonClick(sender As Object, e As ButtonPressedEventArgs)
If e.Button.Tag <> TAG_BUTTON_LOOKUP_FORM Then
Exit Sub
''' <summary>
''' Prevents Editvalue changing when multiselect is true
''' </summary>
Private Sub HandleEditValueChanging(sender As Object, e As ChangingEventArgs)
If MultiSelect Then
e.Cancel = True
End If
End Sub
''' <summary>
''' Handles opening frmLookup when ellipsis button is clicked
''' </summary>
Private Sub HandleButtonClick(sender As Object, e As ButtonPressedEventArgs)
Select Case e.Button.Tag
Case TAG_BUTTON_LOOKUP_FORM
Dim oForm As frmLookupGrid = GetLookupForm()
Dim oResult = oForm.ShowDialog()
@ -94,19 +127,38 @@ Public Class LookupControl2
Dim oValues = oForm.SelectedValues
UpdateSelectedValues(oValues)
SelectedValues = oValues
ElseIf oResult = Windows.Forms.DialogResult.Cancel Then
Dim oValues = New List(Of String)
UpdateSelectedValues(oValues)
SelectedValues = oValues
End If
oForm.Dispose()
End Select
End Sub
Private Sub UpdateSelectedValues(Values As List(Of String))
If Values Is Nothing Then
Exit Sub
End If
If MultiSelect = True Then
Properties.DataSource = Values
Properties.NullText = IIf(Values.Count = 0, TEXT_NO_RECORDS, String.Format(TEXT_N_RECORDS, Values.Count))
Select Case Values.Count
Case 0
Properties.NullText = TEXT_NO_RECORDS
Case 1
Properties.NullText = TEXT_ONE_RECORD
Case Else
Properties.NullText = String.Format(TEXT_N_RECORDS, Values.Count)
End Select
Else
Properties.NullText = Values.FirstOrDefault()
Text = Values.FirstOrDefault()
EditValue = Nothing
End If
End Sub

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyVersion("0.0.1.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -17,6 +17,7 @@ Public Class frmLookupGrid
view = viewLookup
grid = gridLookup
If DataSource Is Nothing Then
Exit Sub
End If
@ -136,7 +137,7 @@ Public Class frmLookupGrid
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
SelectedValues.Clear()
SelectedValues = New List(Of String)
DialogResult = DialogResult.Cancel
Close()

View File

@ -69,10 +69,12 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "License", "Modules.License\
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ADSyncTest", "GUIs.Test.ADSyncTest\ADSyncTest.vbproj", "{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JobRunner", "JobRunner\JobRunner.vbproj", "{59461E98-A5AF-438C-A651-5021ACAE82AD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUIs.Test", "GUIs.Test", "{CC368D6A-6AC4-4EB9-A092-14700FABEF7A}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JobRunner", "Service.JobRunner\JobRunner.vbproj", "{926E6474-5613-4373-BB99-B101158B91EF}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "LookupControlGui", "LookupControlGui\LookupControlGui.vbproj", "{B65E24B3-D334-455D-A0BF-B33B8358B013}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -175,10 +177,14 @@ Global
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E}.Release|Any CPU.Build.0 = Release|Any CPU
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59461E98-A5AF-438C-A651-5021ACAE82AD}.Release|Any CPU.Build.0 = Release|Any CPU
{926E6474-5613-4373-BB99-B101158B91EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{926E6474-5613-4373-BB99-B101158B91EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{926E6474-5613-4373-BB99-B101158B91EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{926E6474-5613-4373-BB99-B101158B91EF}.Release|Any CPU.Build.0 = Release|Any CPU
{B65E24B3-D334-455D-A0BF-B33B8358B013}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B65E24B3-D334-455D-A0BF-B33B8358B013}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B65E24B3-D334-455D-A0BF-B33B8358B013}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B65E24B3-D334-455D-A0BF-B33B8358B013}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -208,7 +214,8 @@ Global
{CBE9322E-67A1-4CC5-B25F-4A1B4C9FC55C} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
{5EBACBFA-F11A-4BBF-8D02-91461F2293ED} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
{7386AB04-DF8D-4DFB-809D-1FAC8212CB7E} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
{59461E98-A5AF-438C-A651-5021ACAE82AD} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
{926E6474-5613-4373-BB99-B101158B91EF} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
{B65E24B3-D334-455D-A0BF-B33B8358B013} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}

View File

@ -1,4 +1,5 @@
Imports System.ServiceModel
Imports System.Xml
Public Class Channel
Public Shared Function GetBinding() As NetTcpBinding
@ -13,7 +14,7 @@ Public Class Channel
.ClientCredentialType = TcpClientCredentialType.Windows
}
},
.ReaderQuotas = New Xml.XmlDictionaryReaderQuotas() With {
.ReaderQuotas = New XmlDictionaryReaderQuotas() With {
.MaxArrayLength = Constants.MAX_ARRAY_LENGTH,
.MaxStringContentLength = Constants.MAX_STRING_CONTENT_LENGTH
}

View File

@ -8,6 +8,12 @@ Public Class Document
Private _logConfig As LogConfig
Private _channelFactory As ChannelFactory(Of IEDMServiceChannel)
Private _channel As IEDMServiceChannel
''' <summary>
''' Creates a new EDMIAPI object
''' </summary>
''' <param name="LogConfig">LogConfig object</param>
''' <param name="ServiceAdress">The full service url to connect to</param>
Public Sub New(LogConfig As LogConfig, ServiceAdress As String)
_logger = LogConfig.GetLogger()
_logConfig = LogConfig
@ -15,30 +21,32 @@ Public Class Document
Try
Dim oBinding = Channel.GetBinding()
Dim oAddress = New EndpointAddress(ServiceAdress)
_channelFactory = New ChannelFactory(Of IEDMServiceChannel)(oBinding, oAddress)
Connect2NetService()
Dim oFactory = New ChannelFactory(Of IEDMServiceChannel)(oBinding, oAddress)
_channelFactory = oFactory
Catch ex As Exception
_logger.Error(ex)
End Try
End Sub
Private Function Connect2NetService()
''' <summary>
''' Connect to the service
''' </summary>
''' <returns>True if connection was successful, false otherwise</returns>
Public Function Connect()
Try
_channel = Nothing
_channel = _channelFactory.CreateChannel()
_logger.Info("Successfully connected to EDM_Network Service")
AddHandler _channel.Faulted, AddressOf Reconnect
_channel = GetChannel()
_logger.Debug("Opening channel..")
_channel.Open()
_logger.Info("Connection to Service established!")
Return True
Catch ex As Exception
_logger.Error(ex)
Return True
Return False
End Try
End Function
Private Sub Reconnect()
_channel.Abort()
Connect2NetService()
End Sub
''' <summary>
''' Imports a file by filename
@ -120,59 +128,36 @@ Public Class Document
End Try
End Function
'Public Async Function New_EDMI_File(oFILENAME As String, oUserName As String) As Task(Of String)
' Try
' Dim oFileGUID As DocumentResult = Await CreateDocument(oFILENAME)
' Dim oFileRecordID = Nothing
' If Not IsNothing(oFileGUID) Then
' Dim oSQL = $"SELECT FNEDMI_SET_RECORD(""TBEDMI_ADRESSE"",""{oUserName}"",FALSE,NULL,"""",'{oFileGUID._ContainerId}') FROM rdb$database;"
' oFileRecordID = Await New_EDMIFile_CreateDB_Record(oSQL)
' End If
' Return oFileRecordID
' Catch ex As Exception
' _logger.Error(ex)
' Return Nothing
' End Try
'End Function
''' <summary>
''' Aborts the channel and creates a new connection
''' </summary>
Private Sub Reconnect()
_logger.Warn("Connection faulted. Trying to reconnect..")
'Private Async Function New_EDMIFile_CreateDB_Record(FBCommand As String) As Task(Of String)
' Try
' Dim oTimeTotal As TimeSpan
' Dim oStopwatch As New Stopwatch()
' oStopwatch.Start()
' Dim oRecord_ID As String
' Dim oRequestName = Await _channel.CreateDatabaseRequestAsync("CreateEDMFileRecord", True)
' Dim oResult = Await _channel.ReturnScalarAsync(FBCommand)
Try
_channel.Abort()
_channel = GetChannel()
_channel.Open()
Catch ex As Exception
_logger.Error(ex)
End Try
End Sub
' oTimeTotal = oStopwatch.Elapsed
' oStopwatch.Reset()
''' <summary>
''' Creates a channel and adds a Faulted-Handler
''' </summary>
''' <returns>A channel object</returns>
Private Function GetChannel() As IEDMServiceChannel
Try
_logger.Debug("Creating channel..")
Dim oChannel = _channelFactory.CreateChannel()
' Await _channel.CloseDatabaseRequestAsync()
AddHandler oChannel.Faulted, AddressOf Reconnect
' If Not oResult.OK Then
' _logger.Warn($"Unexpected error while executing command: {oResult.ErrorMessage}")
' Else
' oRecord_ID = oResult.Scalar
' _logger.Debug($"SCALAR (SERVICE) {FBCommand} - TIME: {(oTimeTotal.ToString)}")
' End If
' Return oRecord_ID
' Catch ex As Exception
' _logger.Error(ex)
' Return Nothing
' End Try
'End Function
'Public Async Function Load_EDMIFile_2TempPath(oEDMIFile_GUID As String) As Task(Of String)
'Try
' Dim oResult As EDMIServiceReference.ContainerResult = Await _channel.GetFileAsync(oEDMIFile_GUID)
' Dim oTempPath = Path.Combine(Path.GetTempPath(), "EDMI_FileContainer")
' Directory.CreateDirectory(oTempPath)
' Dim oFilePath = Path.Combine(oTempPath, $"{oResult.Container.FileId}.{oResult.Container.Extension}")
' File.WriteAllBytes(oFilePath, oResult.Container.Contents)
' ' Process.Start(oTempPath)
' Return oTempPath
'Catch ex As Exception
' _logger.Error(ex)
' Return Nothing
'End Try
'End Function
Return oChannel
Catch ex As Exception
_logger.Error(ex)
Throw ex
End Try
End Function
End Class

View File

@ -8,10 +8,10 @@ Imports System.Runtime.InteropServices
' Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("EDMI_FILE_OPs")>
<Assembly: AssemblyTitle("EDMIAPI")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("EDMI_FILE_OPs")>
<Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("EDMIAPI")>
<Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyTrademark("")>
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyVersion("0.0.0.2")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -9,7 +9,7 @@ Public Class frmFileTest
Private Sub frmFileTest_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
_fileOp = New Document(My.LogConfig, My.Settings.EDM_NetworkService_Adress)
_fileOp.Connect()
Catch ex As Exception
Logger.Warn($"Unexpected error in frmFileTest_Load: {ex.Message}")
End Try
@ -37,7 +37,7 @@ Public Class frmFileTest
listboxLog.Items.Add($"Filename: {oResult.Document.FileName}")
listboxLog.Items.Add($"----------------------------------------------------------")
Catch ex As Exception
MsgBox(ex.Message)
ShowErrorMessage(ex)
Logger.Error(ex)
End Try
End Sub

View File

@ -27,6 +27,12 @@ Partial Class Form1
Me.ListBox2 = New System.Windows.Forms.ListBox()
Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.txtJobConfigString = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.TextBox3 = New System.Windows.Forms.TextBox()
Me.TextBox4 = New System.Windows.Forms.TextBox()
Me.btnParseConfig = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'Button1
@ -72,11 +78,64 @@ Partial Class Form1
Me.Button3.Text = "List Users for selected Group"
Me.Button3.UseVisualStyleBackColor = True
'
'txtJobConfigString
'
Me.txtJobConfigString.Location = New System.Drawing.Point(12, 250)
Me.txtJobConfigString.Name = "txtJobConfigString"
Me.txtJobConfigString.Size = New System.Drawing.Size(227, 20)
Me.txtJobConfigString.TabIndex = 5
Me.txtJobConfigString.Text = "True|* 0/5 * * * ?|Arg1::Foo,Arg2::Bar"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(12, 321)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(227, 20)
Me.TextBox2.TabIndex = 6
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(12, 347)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(227, 20)
Me.TextBox3.TabIndex = 7
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(12, 373)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(227, 20)
Me.TextBox4.TabIndex = 8
'
'btnParseConfig
'
Me.btnParseConfig.Location = New System.Drawing.Point(12, 399)
Me.btnParseConfig.Name = "btnParseConfig"
Me.btnParseConfig.Size = New System.Drawing.Size(227, 33)
Me.btnParseConfig.TabIndex = 9
Me.btnParseConfig.Text = "Parse Config"
Me.btnParseConfig.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(9, 234)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(67, 13)
Me.Label1.TabIndex = 10
Me.Label1.Text = "ConfigString:"
'
'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.Label1)
Me.Controls.Add(Me.btnParseConfig)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.txtJobConfigString)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.ListBox2)
@ -85,6 +144,7 @@ Partial Class Form1
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
@ -93,4 +153,10 @@ Partial Class Form1
Friend WithEvents ListBox2 As ListBox
Friend WithEvents Button2 As Button
Friend WithEvents Button3 As Button
Friend WithEvents txtJobConfigString As TextBox
Friend WithEvents TextBox2 As TextBox
Friend WithEvents TextBox3 As TextBox
Friend WithEvents TextBox4 As TextBox
Friend WithEvents btnParseConfig As Button
Friend WithEvents Label1 As Label
End Class

View File

@ -2,6 +2,7 @@
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Jobs
Public Class Form1
Private _sync As ActiveDirectoryInterface
@ -20,8 +21,6 @@ Public Class Form1
_sync = New ActiveDirectoryInterface(_logConfig, Nothing, _sql)
_sync.Authenticate()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
@ -70,5 +69,7 @@ Public Class Form1
Return oAttributeMappings
End Function
Private Sub btnParseConfig_Click(sender As Object, e As EventArgs) Handles btnParseConfig.Click
Dim oConfig = JobConfigParser.ParseConfig(txtJobConfigString.Text)
End Sub
End Class

View File

@ -12,7 +12,6 @@ Public Class ConfigTest
End Sub
Public Class Config
<SinceVersion("0.0.0.1")>
Public Property StringEntry As String = "TEST"
Public Property BoolEntry As Boolean = True
Public Property IntEntry As Integer = 123

View File

@ -22,7 +22,6 @@ Partial Class Form1
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Me.Button1 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
@ -44,8 +43,6 @@ Partial Class Form1
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.Button4 = New System.Windows.Forms.Button()
Me.LookupControl1 = New DigitalData.Controls.LookupGrid.LookupControl()
Me.Button6 = New System.Windows.Forms.Button()
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
@ -231,34 +228,11 @@ Partial Class Form1
Me.Button4.Text = "Test Background Worker Logging"
Me.Button4.UseVisualStyleBackColor = True
'
'LookupControl1
'
Me.LookupControl1.AutoSize = True
Me.LookupControl1.BackColor = System.Drawing.Color.Transparent
Me.LookupControl1.DataSource = Nothing
Me.LookupControl1.Location = New System.Drawing.Point(695, 214)
Me.LookupControl1.MultiSelect = True
Me.LookupControl1.Name = "LookupControl1"
Me.LookupControl1.SelectedValues = CType(resources.GetObject("LookupControl1.SelectedValues"), System.Collections.Generic.List(Of String))
Me.LookupControl1.Size = New System.Drawing.Size(270, 23)
Me.LookupControl1.TabIndex = 23
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(764, 308)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(75, 23)
Me.Button6.TabIndex = 24
Me.Button6.Text = "Button6"
Me.Button6.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1050, 487)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.LookupControl1)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.TextBox1)
@ -310,6 +284,4 @@ Partial Class Form1
Friend WithEvents TextBox1 As TextBox
Friend WithEvents Label6 As Label
Friend WithEvents Button4 As Button
Friend WithEvents LookupControl1 As DigitalData.Controls.LookupGrid.LookupControl
Friend WithEvents Button6 As Button
End Class

View File

@ -117,13 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="LookupControl1.SelectedValues" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
</value>
</data>
</root>

View File

@ -79,11 +79,6 @@ Public Class Form1
datatable.Rows.Add(dr)
datatable.Rows.Add(dr2)
datatable.Rows.Add(dr3)
LookupControl1.DataSource = datatable
LookupControl1.SelectedValues = New List(Of String) From {"foo"}
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles GetValue.Click

View File

@ -176,10 +176,6 @@
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
<Name>Filesystem</Name>
</ProjectReference>
<ProjectReference Include="..\Controls.LookupGrid\LookupControl.vbproj">
<Project>{3dcd6d1a-c830-4241-b7e4-27430e7ea483}</Project>
<Name>LookupControl</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
<Name>Logging</Name>

View File

@ -1,83 +0,0 @@
Imports System.ComponentModel
Imports System.Timers
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Jobs
Imports DigitalData.Modules.Logging
Public Class JobRunner
Private WithEvents _workerThread As BackgroundWorker
Private WithEvents _workerTimer As Timer
Private ReadOnly _interval As Long
Private ReadOnly _logConfig As LogConfig
Private ReadOnly _logger As Logger
Private ReadOnly _mssql As MSSQLServer
Private ReadOnly _firebird As Firebird
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, MSSQL As MSSQLServer, Interval As Long)
_logConfig = LogConfig
_logger = _logConfig.GetLogger()
_firebird = Firebird
_mssql = MSSQL
_interval = Interval
_workerTimer = New Timer()
_workerThread = New BackgroundWorker() With {
.WorkerReportsProgress = True,
.WorkerSupportsCancellation = True
}
End Sub
Public Sub Start()
_workerTimer.Interval = _interval * 1000
_workerTimer.Start()
_logger.Debug("JobRunner started with {0}s Interval.", _interval)
End Sub
Public Sub [Stop]()
Try
_logger.Debug("Stopping Background worker...")
If _workerThread.IsBusy Then
_workerThread.CancelAsync()
_logger.Debug("Background Worker cancelled.")
End If
_workerTimer.Stop()
_logger.Debug("Background Worker stopped.")
Catch ex As Exception
_logger.Error(ex)
End Try
End Sub
Private Sub TimerElapsed(sender As Object, e As ElapsedEventArgs) Handles _workerTimer.Elapsed
If Not _workerThread.IsBusy Then
_workerThread.RunWorkerAsync()
Else
_logger.Warn("Background Worker is busy. Waiting for next interval.")
End If
End Sub
Private Sub DoWork(sender As Object, e As DoWorkEventArgs) Handles _workerThread.DoWork
_logger.Debug("Background worker running..")
Dim args As WorkerArgs = e.Argument
Dim oJob As New ADSyncJob(_logConfig, _firebird, _mssql)
Dim oArgs As New ADSyncArgs() With {
.Enabled = My.Settings.JOB_ADSYNC_ENABLED,
.Interval = My.Settings.JOB_ADSYNC_INTERVAL,
.RootPath = My.Settings.JOB_ADSYNC_ROOT_PATH
}
If oJob.ShouldStart(oArgs) Then
oJob.Start(oArgs)
End If
End Sub
Private Sub WorkCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles _workerThread.RunWorkerCompleted
If e.Error Is Nothing Then
_logger.Debug("Background worker completed!")
Else
_logger.Warn("Background worker failed!")
_logger.Error(e.Error)
End If
End Sub
End Class

View File

@ -1,113 +0,0 @@
Imports System.Collections.Specialized
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Jobs
Imports DigitalData.Modules.Logging
Imports Quartz
Imports Quartz.Impl
Imports Quartz.Logging
Public Class JobRunner2
Private _LogConfig As LogConfig
Private _Logger As Modules.Logging.Logger
Private _firebird As Firebird
Private _mssql As MSSQLServer
Private _Props As New NameValueCollection From {
{"quartz.serializer.type", "binary"}
}
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
End Sub
Public Async Sub Start()
Logging.LogProvider.SetCurrentLogProvider(New LogProvider(_Logger))
Dim oProps As New NameValueCollection From {
{"quartz.serializer.type", "binary"}
}
_factory = New StdSchedulerFactory(oProps)
_scheduler = Await _factory.GetScheduler()
Await _scheduler.Start()
Dim oJobData As New JobDataMap From {
{"LogConfig", _LogConfig},
{"Firebird", _firebird},
{"MSSQL", _mssql},
{"RootPath", My.Settings.JOB_ADSYNC_ROOT_PATH}
}
Dim oJobDetail = JobBuilder.Create(Of ADJob)().
WithIdentity("activedirectory-sync").
UsingJobData(oJobData).
Build()
Dim oTrigger = TriggerBuilder.Create().
WithIdentity("activedirectory-sync-trigger").
StartNow().
WithCronSchedule("1 0 * * *").
Build()
Await _scheduler.ScheduleJob(oJobDetail, oTrigger)
End Sub
Public Async Sub [Stop]()
Await _scheduler.Shutdown()
End Sub
Public Class ADJob
Implements Quartz.IJob
Public Async Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
Dim oJobData = context.MergedJobDataMap
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
Dim oFirebird As Firebird = oJobData.Item("Firebird")
Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL")
Dim oRootPath As String = oJobData.Item("RootPath")
Dim oADJobArgs = New ADSyncArgs() With {
.RootPath = oRootPath
}
Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL)
oADSyncJob.Start(oADJobArgs)
Await Task.CompletedTask
End Function
End Class
Private Class LogProvider
Implements ILogProvider
Private _Logger As Modules.Logging.Logger
Public Sub New(Logger As Modules.Logging.Logger)
MyBase.New()
_Logger = Logger
End Sub
Private Function GetLogger(name As String) As Logging.Logger Implements ILogProvider.GetLogger
Return Function(level, func, exception, parameters)
If level >= LogLevel.Info AndAlso func IsNot Nothing Then
_Logger.Info(func())
End If
Return True
End Function
End Function
Private Function OpenNestedContext(message As String) As IDisposable Implements ILogProvider.OpenNestedContext
Throw New NotImplementedException()
End Function
Private Function OpenMappedContext(key As String, value As String) As IDisposable Implements ILogProvider.OpenMappedContext
Throw New NotImplementedException()
End Function
End Class
End Class

View File

@ -1,39 +0,0 @@
<?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">
<Profiles />
<Settings>
<Setting Name="SERVICE_NAME" Type="System.String" Scope="Application">
<Value Profile="(Default)">DDJobRunner</Value>
</Setting>
<Setting Name="SERVICE_DISPLAY_NAME" Type="System.String" Scope="Application">
<Value Profile="(Default)">Digital Data Job Runner</Value>
</Setting>
<Setting Name="JOB_ADSYNC_ENABLED" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="DB_DATASOURCE" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="DB_DATABASE" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="DB_USER" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="DB_PASSWORD" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="JOB_INTERVAL" Type="System.Int64" Scope="Application">
<Value Profile="(Default)">120</Value>
</Setting>
<Setting Name="JOB_ADSYNC_INTERVAL" Type="System.Int64" Scope="Application">
<Value Profile="(Default)">120</Value>
</Setting>
<Setting Name="JOB_ADSYNC_ROOT_PATH" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="DB_CONNECTIONSTRING" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -1,24 +0,0 @@
Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.ServiceProcess
<RunInstaller(True)>
Public Class ProjectInstaller
Inherits Installer
Private ReadOnly process As ServiceProcessInstaller
Private ReadOnly components As IContainer
Private ReadOnly service As ServiceInstaller
Public Sub New()
process = New ServiceProcessInstaller With {
.Account = ServiceAccount.LocalSystem
}
service = New ServiceInstaller With {
.ServiceName = My.Settings.SERVICE_NAME,
.DisplayName = My.Settings.SERVICE_DISPLAY_NAME
}
Installers.Add(process)
Installers.Add(service)
End Sub
End Class

View File

@ -1,48 +0,0 @@
Imports System.IO
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging.LogConfig
Public Class WindowsService
Private _logConfig As LogConfig
Private _logger As Logger
Private _firebird As Firebird
Private _mssql As MSSQLServer
Private _jobRunner As JobRunner2
Protected Overrides Sub OnStart(ByVal args() As String)
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"))
_logConfig.Debug = True
_logger = _logConfig.GetLogger()
_logger.Info($"{My.Settings.SERVICE_NAME} is starting.")
Dim oDataSource As String = My.Settings.DB_DATASOURCE
Dim oDatabase As String = My.Settings.DB_DATABASE
Dim oUser As String = My.Settings.DB_USER
Dim oPassword As String = My.Settings.DB_PASSWORD
Dim oInterval As Long = My.Settings.JOB_INTERVAL
_firebird = New Firebird(_logConfig, oDataSource, oDatabase, oUser, oPassword)
_mssql = New MSSQLServer(_logConfig, My.Settings.DB_CONNECTIONSTRING)
Try
_jobRunner = New JobRunner2(_logConfig, _mssql, _firebird)
_jobRunner.Start()
Catch ex As Exception
_logger.Error(ex)
End Try
'Try
' _jobRunner = New JobRunner(_logConfig, _firebird, oInterval)
' _jobRunner.Start()
'Catch ex As Exception
' _logger.Error(ex)
'End Try
End Sub
Protected Overrides Sub OnStop()
_jobRunner.Stop()
_logger.Info($"{My.Settings.SERVICE_NAME} is stopping.")
End Sub
End Class

View File

@ -13,9 +13,12 @@ Public Class ADSyncJob
End Sub
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).Start
Dim oSync = New ActiveDirectoryInterface(_LogConfig, _Firebird, _MSSQL, Arguments.RootPath)
Dim oJobName As String = [GetType]().Name
Try
Dim oSync = New ActiveDirectoryInterface(_LogConfig, _Firebird, _MSSQL, Arguments.RootPath)
_Logger.Info("Running job {0}", oJobName)
If oSync.Authenticate() = False Then
@ -33,13 +36,16 @@ Public Class ADSyncJob
If oSyncedUsers Is Nothing Then
_Logger.Warn("Group {0} could not be synced!", oGroup)
Else
_Logger.Debug("Group {0} synced", oGroup)
_Logger.Debug("Synced {0} users", oSyncedUsers.Count)
ElseIf oSyncedUsers.Count > 0 Then
_Logger.Info("Synced {0} users for group {1}", oSyncedUsers.Count, oGroup)
End If
Next
_Logger.Info("Job {0} completed!", oJobName)
Catch ex As Exception
_Logger.Warn("Job {0} failed!", oJobName)
_Logger.Error(ex)
End Try
End Sub
Public Function ShouldStart(Arguments As ADSyncArgs) As Boolean Implements IJob(Of ADSyncArgs).ShouldStart

7
Jobs/JobConfig.vb Normal file
View File

@ -0,0 +1,7 @@
Imports System.Collections.Generic
Public Class JobConfig
Public Enabled As Boolean
Public CronExpression As String
Public Arguments As Dictionary(Of String, String)
End Class

62
Jobs/JobConfigParser.vb Normal file
View File

@ -0,0 +1,62 @@
Imports System.Collections.Generic
Imports System.Text.RegularExpressions
Public Class JobConfigParser
Private Shared JobOptionsRegex As New Regex("(?<enabled>True|False)\|(?<cron>[\w\d\s,\?*-/]*)(?:\|(?<args>(?:\w*::[^,\n]+,?)*))?")
Private Shared JobArgumentsRegex As New Regex("(?:(?:\w+::[^,\n]+,?)?)+")
Private Const ARGS_ITEM_DELIMITER As String = ","
Private Const ARGS_KEYVALUE_DELIMITER As String = "::"
Private Const ARGS_LIST_DELIMITER As String = "|"
''' <summary>
''' Parse a job config string. ex: True|* 0/3 * * * ?|Arg1=Foo
''' </summary>
''' <param name="ConfigString"></param>
''' <returns>A populated JobConfig object</returns>
Public Shared Function ParseConfig(ConfigString As String) As JobConfig
If JobOptionsRegex.IsMatch(ConfigString) Then
Dim oMatches = JobOptionsRegex.Matches(ConfigString)
Dim oOptions As New JobConfig
Dim oSplitOptions As String() = ConfigString.Split(ARGS_LIST_DELIMITER)
If oSplitOptions.Length = 3 Then
oOptions.Enabled = CBool(oSplitOptions(0))
oOptions.CronExpression = oSplitOptions(1)
oOptions.Arguments = ParseOptionalArguments(oSplitOptions(2))
ElseIf oSplitOptions.Length = 2 Then
oOptions.Enabled = CBool(oSplitOptions(0))
oOptions.CronExpression = oSplitOptions(1)
oOptions.Arguments = New Dictionary(Of String, String)
Else
Throw New ArgumentException("Config Malformed")
End If
Return oOptions
Else
Throw New ArgumentException("Config Malformed")
End If
End Function
Private Shared Function ParseOptionalArguments(ArgsString As String) As Dictionary(Of String, String)
Dim oArgsDictionary As New Dictionary(Of String, String)
If JobArgumentsRegex.IsMatch(ArgsString) Then
Dim oArgs As String() = ArgsString.Split(ARGS_ITEM_DELIMITER)
For Each oArg In oArgs
Dim oDelimiter As String() = New String() {ARGS_KEYVALUE_DELIMITER}
Dim oArgSplit = oArg.Split(oDelimiter, StringSplitOptions.RemoveEmptyEntries)
Regex.Split(oArg, "::")
If oArgSplit.Length = 2 Then
oArgsDictionary.Add(oArgSplit(0), oArgSplit(1))
Else
Throw New ArgumentException("Config Malformed")
End If
Next
End If
Return oArgsDictionary
End Function
End Class

View File

@ -93,6 +93,8 @@
<Compile Include="JobInterface.vb" />
<Compile Include="JobBase.vb" />
<Compile Include="JobArgs.vb" />
<Compile Include="JobConfig.vb" />
<Compile Include="JobConfigParser.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

89
LookupControlGui/Form1.Designer.vb generated Normal file
View File

@ -0,0 +1,89 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class Form1
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()>
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.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim EditorButtonImageOptions1 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions()
Dim SerializableAppearanceObject1 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject2 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject3 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject4 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim EditorButtonImageOptions2 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions()
Dim SerializableAppearanceObject5 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject6 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject7 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject8 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Me.Button1 = New System.Windows.Forms.Button()
Me.LookupControl = New DigitalData.Controls.LookupGrid.LookupControl2()
Me.LookupControl21View = New DevExpress.XtraGrid.Views.Grid.GridView()
CType(Me.LookupControl.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LookupControl21View, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(12, 12)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(94, 23)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Get Text"
Me.Button1.UseVisualStyleBackColor = True
'
'LookupControl
'
Me.LookupControl.AllowAddNewValues = False
Me.LookupControl.DataSource = Nothing
Me.LookupControl.Location = New System.Drawing.Point(393, 31)
Me.LookupControl.MultiSelect = True
Me.LookupControl.Name = "LookupControl"
Me.LookupControl.PreventDuplicates = False
Me.LookupControl.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions2, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject5, SerializableAppearanceObject6, SerializableAppearanceObject7, SerializableAppearanceObject8, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
Me.LookupControl.Properties.PopupView = Me.LookupControl21View
Me.LookupControl.SelectedValues = Nothing
Me.LookupControl.Size = New System.Drawing.Size(342, 20)
Me.LookupControl.TabIndex = 3
'
'LookupControl21View
'
Me.LookupControl21View.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus
Me.LookupControl21View.Name = "LookupControl21View"
Me.LookupControl21View.OptionsSelection.EnableAppearanceFocusedCell = False
Me.LookupControl21View.OptionsView.ShowGroupPanel = False
'
'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.LookupControl)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.LookupControl.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LookupControl21View, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As Button
Friend WithEvents LookupControl As DigitalData.Controls.LookupGrid.LookupControl2
Friend WithEvents LookupControl21View As DevExpress.XtraGrid.Views.Grid.GridView
End Class

120
LookupControlGui/Form1.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

37
LookupControlGui/Form1.vb Normal file
View File

@ -0,0 +1,37 @@

Public Class Form1
Private _Datasource As New List(Of String) From {"Foo", "bar", "baz", "quux"}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oDatatable = GetDatatable()
Dim oSelectedValues = _Datasource.Take(1).ToList()
LookupControl.DataSource = oDatatable
LookupControl.SelectedValues = oSelectedValues
End Sub
Private Function GetDatatable() As DataTable
Dim oDatatable As New DataTable
Dim oColumns As New List(Of DataColumn) From {
New DataColumn("Col1", GetType(String))
}
oDatatable.Columns.AddRange(oColumns.ToArray)
For Each Item In _Datasource
Dim oRow = oDatatable.NewRow()
oRow.Item("Col1") = Item
oDatatable.Rows.Add(oRow)
Next
Return oDatatable
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MsgBox(LookupControl.SelectedValues.Count)
End Sub
End Class

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B65E24B3-D334-455D-A0BF-B33B8358B013}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>LookupControlGui.My.MyApplication</StartupObject>
<RootNamespace>LookupControlGui</RootNamespace>
<AssemblyName>LookupControlGui</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>LookupControlGui.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>LookupControlGui.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.vb">
<DependentUpon>Form1.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Controls.LookupGrid\LookupControl.vbproj">
<Project>{3dcd6d1a-c830-4241-b7e4-27430e7ea483}</Project>
<Name>LookupControl</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
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
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
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
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.LookupControlGui.Form1
End Sub
End Class
End Namespace

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@ -8,17 +8,17 @@ Imports System.Runtime.InteropServices
' Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("JobRunner")>
<Assembly: AssemblyTitle("LookupControlGui")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("JobRunner")>
<Assembly: AssemblyProduct("LookupControlGui")>
<Assembly: AssemblyCopyright("Copyright © 2019")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("5d2eb259-f8bd-4e9b-a121-afbb3fe90d13")>
<Assembly: Guid("85fe9368-9af6-433e-b9d3-a4855acd900a")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'

View File

@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
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.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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("LookupControlGui.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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

View File

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' 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.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.LookupControlGui.My.MySettings
Get
Return Global.LookupControlGui.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -4,73 +4,67 @@ Imports DigitalData.Modules.Logging
Public Class MSSQLServer
Public DBInitialized As Boolean = False
Public CurrentSQLConnectionString As String = ""
Private CurrentSQLConnection As SqlConnection
Private _Logger As Logger
Public Sub New(LogConfig As LogConfig, ConnectionString As String)
_Logger = LogConfig.GetLogger()
Try
Dim oSQLconnect As New SqlConnection
oSQLconnect.ConnectionString = ConnectionString
oSQLconnect.Open()
oSQLconnect.Close()
CurrentSQLConnectionString = ConnectionString
DBInitialized = True
Try
DBInitialized = TestCanConnect()
Catch ex As Exception
DBInitialized = False
_Logger.Error(ex)
End Try
End Sub
Private Function GetSQLConnection()
Private Function TestCanConnect() As Boolean
Try
If IsNothing(CurrentSQLConnection) Then
Dim oSQLconnect As New SqlClient.SqlConnection
oSQLconnect.ConnectionString = CurrentSQLConnectionString
CurrentSQLConnection = oSQLconnect
CurrentSQLConnection.Open()
Else
If CurrentSQLConnection.State <> ConnectionState.Open Then
_Logger.Warn($"Actual ConnectionState is: '{CurrentSQLConnection.State.ToString}'")
Try
CurrentSQLConnection.Open()
Return True
Catch ex As Exception
_Logger.Warn("Could not reconnect to database!")
Return False
End Try
End If
End If
Dim oConnection As New SqlConnection(CurrentSQLConnectionString)
oConnection.Open()
oConnection.Close()
Return True
Catch ex As Exception
_Logger.Error(ex)
Return False
End Try
End Function
Private Function GetSQLConnection() As SqlConnection
Try
Dim oConnection As New SqlConnection(CurrentSQLConnectionString)
oConnection.Open()
Return oConnection
Catch ex As Exception
_Logger.Error(ex)
Return Nothing
End Try
End Function
''' <summary>
''' Returns a datatable for a sql-statement
''' </summary>
''' <param name="sqlcommand">sqlcommand for datatable (select XYZ from TableORView)</param>
''' <param name="commandtimeout">Optional Timeout</param>
''' <param name="Timeout">Optional Timeout</param>
''' <returns>Returns a datatable</returns>
''' <remarks></remarks>
Public Function GetDatatable(sqlcommand As String, Optional commandtimeout As Integer = 120) As DataTable
Public Function GetDatatable(sqlcommand As String, Optional Timeout As Integer = 120) As DataTable
Try
Dim dt As DataTable = New DataTable()
If GetSQLConnection() = False Then
If TestCanConnect() = False Then
Return Nothing
End If
Dim oSQLCOmmand As SqlCommand
oSQLCOmmand = CurrentSQLConnection.CreateCommand()
Using oConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = sqlcommand
oSQLCOmmand.CommandTimeout = commandtimeout
Dim adapter1 As SqlDataAdapter = New SqlDataAdapter(oSQLCOmmand)
adapter1.Fill(dt)
oSQLCOmmand.CommandTimeout = Timeout
Dim dt As DataTable = New DataTable()
Dim oAdapter As SqlDataAdapter = New SqlDataAdapter(oSQLCOmmand)
oAdapter.Fill(dt)
Return dt
End Using
End Using
Catch ex As Exception
_Logger.Error(ex)
_Logger.Debug("sqlcommand: " & sqlcommand)
@ -81,29 +75,58 @@ Public Class MSSQLServer
''' Executes the passed sql-statement
''' </summary>
''' <param name="executeStatement">the sql statement</param>
''' <param name="commandtimeout">Optional Timeout</param>
''' <param name="Timeout">Optional Timeout</param>
''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks>
Public Function NewExecutenonQuery(executeStatement As String, Optional commandtimeout As Integer = 120) As Boolean
Public Function NewExecutenonQuery(executeStatement As String, Optional Timeout As Integer = 120) As Boolean
Try
If GetSQLConnection() = False Then
If TestCanConnect() = False Then
Return Nothing
End If
'Dim oSQLconnect As New SqlClient.SqlConnection
Dim oSQLCOmmand As SqlCommand
oSQLCOmmand = CurrentSQLConnection.CreateCommand()
Using oConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout
oSQLCOmmand.CommandTimeout = Timeout
oSQLCOmmand.ExecuteNonQuery()
oSQLCOmmand.Dispose()
Return True
End Using
End Using
Catch ex As Exception
_Logger.Error(ex)
_Logger.Debug("executeStatement: " & executeStatement)
Return False
End Try
End Function
''' <summary>
''' Executes the passed sql-statement as Scalar
''' </summary>
''' <param name="ScalarSQL">the sql statement</param>
''' <param name="Timeout">Optional Timeout</param>
''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks>
Public Function NewExecuteScalar(ScalarSQL As String, Optional Timeout As Integer = 120) As Object
Try
If TestCanConnect() = False Then
Return Nothing
End If
Using oConnection As SqlConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = ScalarSQL
oSQLCOmmand.CommandTimeout = Timeout
Dim oResult As Object = oSQLCOmmand.ExecuteScalar()
Return oResult
End Using
End Using
Catch ex As Exception
_Logger.Error(ex)
_Logger.Debug("executeStatement: " & ScalarSQL)
Return Nothing
End Try
End Function
''' <summary>
''' Executes the passed sql-statement in asyncmode
''' </summary>
@ -111,18 +134,20 @@ Public Class MSSQLServer
''' <param name="commandtimeout">Optional Timeout</param>
''' <remarks></remarks>
Public Sub NewExecuteNonQueryAsync(executeStatement As String, Optional commandtimeout As Integer = 120)
If GetSQLConnection() = False Then
If TestCanConnect() = False Then
Exit Sub
End If
Dim oSQLCOmmand As SqlCommand
Dim callback As New AsyncCallback(AddressOf NewExecuteNonQueryAsync_Callback)
Try
oSQLCOmmand = CurrentSQLConnection.CreateCommand()
Dim oCallback As New AsyncCallback(AddressOf NewExecuteNonQueryAsync_Callback)
Using oConnection As SqlConnection = GetSQLConnection()
Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout
oSQLCOmmand.BeginExecuteNonQuery(callback, oSQLCOmmand)
oSQLCOmmand.Dispose()
oSQLCOmmand.BeginExecuteNonQuery(oCallback, oSQLCOmmand)
End Using
End Using
Catch ex As Exception
_Logger.Error(ex)
_Logger.Debug("executeStatement: " & executeStatement)
@ -132,33 +157,6 @@ Public Class MSSQLServer
Private Sub NewExecuteNonQueryAsync_Callback(ByVal result As IAsyncResult)
Dim command As SqlCommand = CType(result.AsyncState, SqlCommand)
Dim res = command.EndExecuteNonQuery(result)
_Logger.Info(String.Format("Finished executing Async database operation: {0}", command.CommandText))
_Logger.Info("Finished executing Async database operation: {0}", command.CommandText)
End Sub
''' <summary>
''' Executes the passed sql-statement as Scalar
''' </summary>
''' <param name="executeStatement">the sql statement</param>
''' <param name="commandtimeout">Optional Timeout</param>
''' <returns>Returns true if properly executed, else false</returns>
''' <remarks></remarks>
Public Function NewExecuteScalar(executeStatement As String, Optional commandtimeout As Integer = 120)
Dim result
Try
If GetSQLConnection() = False Then
Return Nothing
End If
Dim oSQLCOmmand As SqlClient.SqlCommand
oSQLCOmmand = CurrentSQLConnection.CreateCommand()
oSQLCOmmand.CommandText = executeStatement
oSQLCOmmand.CommandTimeout = commandtimeout
result = oSQLCOmmand.ExecuteScalar()
oSQLCOmmand.Dispose()
Return result
Catch ex As Exception
_Logger.Error(ex)
_Logger.Debug("executeStatement: " & executeStatement)
Return Nothing
End Try
End Function
End Class

View File

@ -34,10 +34,17 @@ Public Class ActiveDirectoryInterface
Else
_rootPath = RootPath
End If
_logger.Info("Using RootPath {0}", _rootPath)
End Sub
Public Function SyncUsersForGroup(GroupName As String) As List(Of ADUser)
Try
Return SyncUsersForGroup(GroupName, New List(Of AttributeMapping))
Catch ex As Exception
_logger.Error(ex)
Return Nothing
End Try
End Function
Public Function SyncUsersForGroup(GroupName As String, AttributeMappings As List(Of AttributeMapping)) As List(Of ADUser)
@ -45,8 +52,8 @@ Public Class ActiveDirectoryInterface
Dim oSyncedUsers As New List(Of ADUser)
Dim oGroupId As Int64 = Nothing
Dim oFirebirdSync As New SyncUsers.Firebird(_logConfig, _firebird)
Dim oSQLSync As New SyncUsers.MSSQL(_logConfig, _mssql)
Dim oFirebirdSync As New SyncUsers.SyncUsersFirebird(_logConfig, _firebird)
Dim oSQLSync As New SyncUsers.SyncUsersMSSQL(_logConfig, _mssql)
Dim oSyncedUsersFirebird, oSyncedUsersMSSQL As List(Of ADUser)
Try
@ -66,14 +73,18 @@ Public Class ActiveDirectoryInterface
' Do the actual sync into firebird
If _firebird IsNot Nothing Then
oSyncedUsersFirebird = oFirebirdSync.SyncUsers(GroupName, oUsers, AttributeMappings)
If oSyncedUsersFirebird.Count > 0 Then
_logger.Info("Synced {0} users to Firebird", oSyncedUsersFirebird.Count)
End If
End If
' Do the actual sync into MSSQL
If _mssql IsNot Nothing Then
oSyncedUsersMSSQL = oSQLSync.SyncUsers(GroupName, oUsers, AttributeMappings)
If oSyncedUsersMSSQL.Count > 0 Then
_logger.Info("Synced {0} users to MSSQLServer", oSyncedUsersMSSQL.Count)
End If
End If
Return oUsers
End Function
@ -139,17 +150,22 @@ Public Class ActiveDirectoryInterface
Using oContext As New PrincipalContext(ContextType.Domain)
Using oGroupPrincipal As GroupPrincipal = GroupPrincipal.FindByIdentity(oContext, IdentityType.Name, GroupName)
If oGroupPrincipal Is Nothing Then
_logger.Warn("Group {0} does not exist.", GroupName)
_logger.Debug("Group {0} does not exist.", GroupName)
Return oUsers
End If
_logger.Debug("Listing members of Group {0}", GroupName)
Using oMembers = oGroupPrincipal.GetMembers(True)
For Each oMember As Principal In oMembers
Try
If TypeOf oMember Is UserPrincipal Then
Dim oUser As UserPrincipal = DirectCast(oMember, UserPrincipal)
Dim oUserEx As UserPrincipalEx = UserPrincipalEx.FindByIdentity(oContext, oUser.SamAccountName)
Dim oCustomAttributes As New List(Of ADUser.CustomAttribute)
' TODO: Figure out why oUserEx can be nothing for certain users
If oUserEx IsNot Nothing Then
For Each oMap As AttributeMapping In AttributeMappings
Dim oAttributeValue = oUserEx.GetAttributeValue(oMap.AttributeName)
@ -164,18 +180,27 @@ Public Class ActiveDirectoryInterface
})
End If
Next
oUsers.Add(New ADUser() With {
.GUID = oUserEx.Guid,
.SId = oUserEx.Sid,
.samAccountName = oUserEx.SamAccountName,
.Surname = oUserEx.Surname,
.Middlename = oUserEx.MiddleName,
.GivenName = oUserEx.GivenName,
.Email = oUserEx.EmailAddress,
.CustomAttributes = oCustomAttributes
})
Else
_logger.Debug("Could not fetch CustomAttributes for user {0}", oUser)
End If
_logger.Debug("Trying to add User {0} to user list", oUser)
Dim oNewUser As New ADUser With {
.SId = oUser.Sid,
.samAccountName = oUser.SamAccountName,
.Middlename = oUser.MiddleName,
.GivenName = oUser.GivenName,
.Email = oUser.EmailAddress,
.CustomAttributes = oCustomAttributes
}
oUsers.Add(oNewUser)
End If
Catch ex As Exception
_logger.Warn("User could not be processed")
_logger.Error(ex)
End Try
Next
End Using
End Using
@ -184,7 +209,7 @@ Public Class ActiveDirectoryInterface
Return oUsers
Catch ex As Exception
_logger.Error(ex)
Throw ex
Return oUsers
End Try
End Function
@ -229,7 +254,7 @@ Public Class ActiveDirectoryInterface
Try
Return Result.Properties.Item(PropertyName).Item(0)
Catch ex As Exception
_logger.Warn("Property {0} not found")
_logger.Warn("Property {0} not found", PropertyName)
Return String.Empty
End Try
End Function

View File

@ -8,6 +8,6 @@
Public ObjectCategory As String
Public Overrides Function ToString() As String
Return $"SAMAccountName={SAMAccountName}, ObjectClass={ObjectClass}, CN={CN}, Description={Description}, DistinguishedName={DistinguishedName}, Name={Name}, ObjectCategory={ObjectCategory}"
Return $"SAMAccountName={SAMAccountName}"
End Function
End Class

View File

@ -3,7 +3,7 @@ Imports DigitalData.Modules.Interfaces
Imports DigitalData.Modules.Logging
Namespace SyncUsers
Public Class Firebird
Public Class SyncUsersFirebird
Implements ISyncUsers
Private ReadOnly _logConfig As LogConfig
@ -25,7 +25,7 @@ Namespace SyncUsers
oGroupId = GetGroupId(GroupName)
If oGroupId = 0 Then
_logger.Warn("Group {0} does not exist in database. Exiting", GroupName)
_logger.Debug("Group {0} does not exist in database or is not enabled for sync.", GroupName)
Return oSyncedUsers
End If

View File

@ -2,14 +2,16 @@
Imports DigitalData.Modules.Logging
Namespace SyncUsers
Public Class MSSQL
Public Class SyncUsersMSSQL
Implements ISyncUsers
Private _logConfig As LogConfig
Private _logger As Logger
Private _mssql As MSSQLServer
Public Sub New(LogConfig As LogConfig, MSSQL As Database.MSSQLServer)
Private Const ADDED_WHO = "Active Directory Sync"
Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer)
_logConfig = LogConfig
_logger = LogConfig.GetLogger()
_mssql = MSSQL
@ -24,7 +26,7 @@ Namespace SyncUsers
oGroupId = GetGroupId(GroupName)
If oGroupId = 0 Then
_logger.Warn("Group {0} does not exist in database. Exiting", GroupName)
_logger.Debug("Group {0} does not exist in database. Exiting.", GroupName)
Return oSyncedUsers
End If
@ -43,10 +45,10 @@ Namespace SyncUsers
_logger.Debug("Checking if user {0} exists", oUser)
oUserId = GetUserId(oUser.samAccountName)
oUserExists = oUserId > 0
_logger.Debug("User {0} exists in database: ", oUser, oUserExists)
_logger.Debug("User {0} exists in database: {1}", oUser, oUserExists)
Catch ex As Exception
_logger.Error(ex)
_logger.Warn("Could not get UserId for user. Skipping")
_logger.Warn("Could not get UserId for user. Skipping.")
Continue For
End Try
@ -59,7 +61,7 @@ Namespace SyncUsers
End If
Catch ex As Exception
_logger.Error(ex)
_logger.Warn("Could not create user. Skipping")
_logger.Warn("Could not create user. Skipping.")
Continue For
End Try
@ -68,7 +70,7 @@ Namespace SyncUsers
AddCustomAttributesToUser(oUser, oUserId)
Catch ex As Exception
_logger.Error(ex)
_logger.Warn("Could not add custom attributes to user {0}. Continuing", oUser)
_logger.Debug("Could not add custom attributes to user {0}. Continuing.", oUser)
End Try
' Add the user to group
@ -76,7 +78,7 @@ Namespace SyncUsers
AddUserToGroup(oUserId, oGroupId)
Catch ex As Exception
_logger.Error(ex)
_logger.Warn("Could not add user {0} to group {1}. Skipping", oUser, GroupName)
_logger.Warn("Could not add user {0} to group {1}. Skipping.", oUser, GroupName)
Continue For
End Try
@ -88,7 +90,7 @@ Namespace SyncUsers
Private Sub AddUserToGroup(UserId As Integer, GroupId As Integer) Implements ISyncUsers.AddUserToGroup
Try
Dim oSQL As String = $"INSERT INTO TBDD_GROUPS_USER (USER_ID, GROUP_ID) VALUES ({UserId}, {GroupId})"
Dim oSQL As String = $"INSERT INTO TBDD_GROUPS_USER (USER_ID, GROUP_ID, ADDED_WHO) VALUES ({UserId}, {GroupId}, '{ADDED_WHO}')"
Dim oResult = _mssql.NewExecutenonQuery(oSQL)
If oResult = False Then
@ -102,11 +104,11 @@ Namespace SyncUsers
Private Function GetGroupId(GroupName As String) As Integer Implements ISyncUsers.GetGroupId
Try
Dim oSQL As String = $"SELECT GUID FROM TBDD_GROUPS WHERE NAME = '{GroupName}'"
Dim oSQL As String = $"SELECT GUID FROM TBDD_GROUPS WHERE NAME = '{GroupName}' AND AD_SYNC = 1 AND ACTIVE = 1"
Dim oGroupId = _mssql.NewExecuteScalar(oSQL)
If IsDBNull(oGroupId) OrElse oGroupId = 0 Then
_logger.Debug("Group {0} not found in database", GroupName)
_logger.Debug("Group {0} not found in database.", GroupName)
Return 0
End If
@ -135,7 +137,7 @@ Namespace SyncUsers
Private Function CreateUser(User As ADUser) As Integer Implements ISyncUsers.CreateUser
Try
Dim oSQL As String = $"INSERT INTO TBDD_USER (PRENAME, NAME, USERNAME, EMAIL) VALUES ('{User.GivenName}', '{User.Surname}', '{User.samAccountName}', '{User.Email}')"
Dim oSQL As String = $"INSERT INTO TBDD_USER (PRENAME, NAME, USERNAME, EMAIL, ADDED_WHO) VALUES ('{User.GivenName}', '{User.Surname}', '{User.samAccountName}', '{User.Email}', '{ADDED_WHO}')"
Dim oResult = _mssql.NewExecutenonQuery(oSQL)
If oResult = True Then
@ -154,11 +156,11 @@ Namespace SyncUsers
Dim oCustomAttributes = User.CustomAttributes
For Each oAttribute In oCustomAttributes
Dim oSQL As String = $"UPDATE TBDD_USER SET {oAttribute.MSSQLColumn} = '{oAttribute.Value}' WHERE GUID = {UserId}"
Dim oSQL As String = $"UPDATE TBDD_USER SET {oAttribute.MSSQLColumn} = '{oAttribute.Value}', CHANGED_WHO = '{ADDED_WHO}' WHERE GUID = {UserId}"
Dim oResult = _mssql.NewExecutenonQuery(oSQL)
If oResult = False Then
_logger.Warn("Custom Attribute {0} could not be added to user {1}", oAttribute.Name, User.samAccountName)
_logger.Debug("Custom Attribute {0} could not be added to user {1}", oAttribute.Name, User.samAccountName)
Continue For
End If
Next

View File

@ -5,43 +5,34 @@
<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>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<applicationSettings>
<DigitalData.Services.JobRunner.My.MySettings>
<setting name="SERVICE_NAME" serializeAs="String">
<value>DDJobRunner</value>
<setting name="LOG_PATH" serializeAs="String">
<value />
</setting>
<setting name="SERVICE_DISPLAY_NAME" serializeAs="String">
<value>Digital Data Job Runner</value>
<setting name="SQL_CONNECTIONSTRING" serializeAs="String">
<value />
</setting>
<setting name="JOB_ADSYNC_ENABLED" serializeAs="String">
<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="DB_DATASOURCE" serializeAs="String">
<setting name="ADSYNC_CONFIG" serializeAs="String">
<value />
</setting>
<setting name="DB_DATABASE" serializeAs="String">
<value />
</setting>
<setting name="DB_USER" serializeAs="String">
<value />
</setting>
<setting name="DB_PASSWORD" serializeAs="String">
<value />
</setting>
<setting name="JOB_INTERVAL" serializeAs="String">
<value>120</value>
</setting>
<setting name="JOB_ADSYNC_INTERVAL" serializeAs="String">
<value>120</value>
</setting>
<setting name="JOB_ADSYNC_ROOT_PATH" serializeAs="String">
<value />
</setting>
<setting name="DB_CONNECTIONSTRING" serializeAs="String">
<value />
<setting name="TEST_CONFIG" serializeAs="String">
<value>False|10/0 * * * * ?|Foo:Bar</value>
</setting>
</DigitalData.Services.JobRunner.My.MySettings>
</applicationSettings>

View File

@ -0,0 +1,169 @@
Imports System.Collections.Specialized
Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Jobs
Imports DigitalData.Modules.Logging
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 _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
End Sub
Public Async Sub Start()
Try
Logging.LogProvider.SetCurrentLogProvider(New LogProvider(_Logger))
_Logger.Info("Starting JobRunner")
Dim oProps As New NameValueCollection From {
{"quartz.serializer.type", "binary"}
}
_factory = New StdSchedulerFactory(oProps)
_scheduler = Await _factory.GetScheduler()
_Logger.Info("Starting Scheduler..")
Await _scheduler.Start()
' [START] Job Scheduling
' ADSync
Await ScheduleJob(Of ADJob)("ADSync", My.Settings.ADSYNC_CONFIG)
' Test Job
Await ScheduleJob(Of TestJob)("TestJob", My.Settings.TEST_CONFIG)
' [END] Job Scheduling
Catch ex As Exception
_Logger.Warn("Job Failed.")
_Logger.Error(ex)
End Try
End Sub
Public Async Function ScheduleJob(Of T As Quartz.IJob)(JobName As String, JobConfigString As String) As Task
Dim oJobIdentity As String = JobName
Dim oTriggerIdentity As String = JobName & "-Trigger"
Dim oJobConfig As JobConfig = JobConfigParser.ParseConfig(JobConfigString)
Dim oJobData As New JobDataMap From {
{"LogConfig", _LogConfig},
{"Firebird", _firebird},
{"MSSQL", _mssql},
{"Args", oJobConfig.Arguments}
}
Dim oJobDetail = JobBuilder.Create(Of T)().
WithIdentity(oJobIdentity).
UsingJobData(oJobData).
Build()
Dim oTrigger = TriggerBuilder.Create().
WithIdentity(oTriggerIdentity).
StartNow().
WithCronSchedule(oJobConfig.CronExpression).
Build()
If oJobConfig.Enabled Then
Await _scheduler.ScheduleJob(oJobDetail, oTrigger)
_Logger.Info("Job {0} started.", JobName)
Else
_Logger.Info("Job {0} is disabled.", JobName)
End If
End Function
Public Async Sub [Stop]()
_Logger.Info("Stopping JobRunner")
Await _scheduler.Shutdown()
End Sub
Public Class ADJob
Implements Quartz.IJob
Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
Dim oJobData = context.MergedJobDataMap
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
Dim oFirebird As Firebird = oJobData.Item("Firebird")
Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL")
Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args")
Dim oADJobArgs = New ADSyncArgs()
If oArgs.ContainsKey("RootPath") Then
oADJobArgs.RootPath = oArgs.Item("RootPath")
End If
Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL)
oADSyncJob.Start(oADJobArgs)
Return Task.FromResult(True)
End Function
End Class
Public Class TestJob
Implements Quartz.IJob
Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute
Dim oJobData = context.MergedJobDataMap
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
Dim oLogger = oLogConfig.GetLogger()
Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args")
If oArgs.ContainsKey("Arg1") Then
Dim oArg1 As String = oArgs.Item("Arg1")
oLogger.Info("Running Test Job With Arg1: {0}", oArg1)
Else
oLogger.Warn("Running Test Job With missing Arg1 :/")
End If
Return Task.FromResult(True)
End Function
End Class
Private Class LogProvider
Implements ILogProvider
Private _Logger As DigitalData.Modules.Logging.Logger
Public Sub New(Logger As DigitalData.Modules.Logging.Logger)
MyBase.New()
_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
_Logger.Error(exception)
ElseIf level >= LogLevel.Debug AndAlso func IsNot Nothing Then
_Logger.Debug(func(), parameters)
ElseIf level >= LogLevel.Info AndAlso func IsNot Nothing Then
_Logger.Info(func(), parameters)
End If
Return True
End Function
End Function
Private Function OpenNestedContext(message As String) As IDisposable Implements ILogProvider.OpenNestedContext
_Logger.Warn("OpenNestedContext is not implemented")
Throw New NotImplementedException()
End Function
Private Function OpenMappedContext(key As String, value As String) As IDisposable Implements ILogProvider.OpenMappedContext
_Logger.Warn("OpenMappedContext is not implemented")
Throw New NotImplementedException()
End Function
End Class
End Class

View File

@ -4,9 +4,9 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{59461E98-A5AF-438C-A651-5021ACAE82AD}</ProjectGuid>
<ProjectGuid>{926E6474-5613-4373-BB99-B101158B91EF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>DigitalData.Services.JobRunner.WindowsService</StartupObject>
<StartupObject>DigitalData.Services.JobRunner.JobRunnerService</StartupObject>
<RootNamespace>DigitalData.Services.JobRunner</RootNamespace>
<AssemblyName>DigitalData.Services.JobRunner</AssemblyName>
<FileAlignment>512</FileAlignment>
@ -46,10 +46,13 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.5.11\lib\net45\NLog.dll</HintPath>
<HintPath>..\packages\NLog.4.6.2\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>
@ -59,14 +62,12 @@
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -86,19 +87,15 @@
</ItemGroup>
<ItemGroup>
<Compile Include="JobRunner.vb" />
<Compile Include="JobRunner2.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="ProjectInstaller.vb">
<Compile Include="JobRunnerService.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="WindowsService.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="WindowsService.Designer.vb">
<DependentUpon>WindowsService.vb</DependentUpon>
<Compile Include="JobRunnerService.Designer.vb">
<DependentUpon>JobRunnerService.vb</DependentUpon>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Resources.Designer.vb">
@ -111,19 +108,29 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="ProjectInstaller.Designer.vb">
<DependentUpon>ProjectInstaller.vb</DependentUpon>
</Compile>
<Compile Include="ProjectInstaller.vb">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="JobRunnerService.resx">
<DependentUpon>JobRunnerService.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="WindowsService.resx">
<DependentUpon>WindowsService.vb</DependentUpon>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.vb</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\app.manifest" />
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
@ -138,7 +145,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Jobs\Jobs.vbproj">
<Project>{39ec839a-3c30-4922-a41e-6b09d1dde5c3}</Project>
<Project>{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}</Project>
<Name>Jobs</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Database\Database.vbproj">

View File

@ -1,11 +1,11 @@
Imports System.ServiceProcess
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class WindowsService
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class JobRunnerService
Inherits System.ServiceProcess.ServiceBase
'UserService überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()>
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
@ -17,8 +17,8 @@ Partial Class WindowsService
End Sub
' Der Haupteinstiegspunkt für den Prozess
<MTAThread()>
<System.Diagnostics.DebuggerNonUserCode()>
<MTAThread()> _
<System.Diagnostics.DebuggerNonUserCode()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
@ -28,7 +28,7 @@ Partial Class WindowsService
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New WindowsService}
ServicesToRun = New System.ServiceProcess.ServiceBase() {New JobRunnerService}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub
@ -39,12 +39,14 @@ Partial Class WindowsService
' 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.
<System.Diagnostics.DebuggerStepThrough()>
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
'
'Service1
'JobRunnerService
'
Me.ServiceName = "Service1"
Me.CanShutdown = True
Me.ServiceName = "DDJobRunner"
End Sub
End Class

View File

@ -0,0 +1,39 @@
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging.LogConfig
Imports DigitalData.Modules.Database
Imports DigitalData.Services.JobRunner
Public Class JobRunnerService
Private _logConfig As LogConfig
Private _logger As Logger
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
}
_logger = _logConfig.GetLogger()
_logger.Info("Starting Service {0}", ServiceName)
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
Try
_jobrunner = New JobRunner(_logConfig, _mssql, _firebird)
_jobrunner.Start()
Catch ex As Exception
_logger.Error(ex)
End Try
End Sub
Protected Overrides Sub OnStop()
_jobrunner.Stop()
_logger.Info("Stopping Service {0}", ServiceName)
End Sub
End Class

View File

@ -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
<Assembly: AssemblyTitle("Service.JobRunner")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Service.JobRunner")>
<Assembly: AssemblyCopyright("Copyright © 2019")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("01496bb6-b3df-4dca-995c-33fcc0b773e2")>
' 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:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -56,100 +56,82 @@ Namespace My
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("DDJobRunner")> _
Public ReadOnly Property SERVICE_NAME() As String
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property LOG_PATH() As String
Get
Return CType(Me("SERVICE_NAME"),String)
Return CType(Me("LOG_PATH"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("Digital Data Job Runner")> _
Public ReadOnly Property SERVICE_DISPLAY_NAME() As String
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property SQL_CONNECTIONSTRING() As String
Get
Return CType(Me("SERVICE_DISPLAY_NAME"),String)
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 JOB_ADSYNC_ENABLED() As Boolean
Public ReadOnly Property LOG_DEBUG() As Boolean
Get
Return CType(Me("JOB_ADSYNC_ENABLED"),Boolean)
Return CType(Me("LOG_DEBUG"),Boolean)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property DB_DATASOURCE() As String
Public ReadOnly Property ADSYNC_CONFIG() As String
Get
Return CType(Me("DB_DATASOURCE"),String)
Return CType(Me("ADSYNC_CONFIG"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property DB_DATABASE() As String
Global.System.Configuration.DefaultSettingValueAttribute("False|10/0 * * * * ?|Foo:Bar")> _
Public ReadOnly Property TEST_CONFIG() As String
Get
Return CType(Me("DB_DATABASE"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property DB_USER() As String
Get
Return CType(Me("DB_USER"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property DB_PASSWORD() As String
Get
Return CType(Me("DB_PASSWORD"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("120")> _
Public ReadOnly Property JOB_INTERVAL() As Long
Get
Return CType(Me("JOB_INTERVAL"),Long)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("120")> _
Public ReadOnly Property JOB_ADSYNC_INTERVAL() As Long
Get
Return CType(Me("JOB_ADSYNC_INTERVAL"),Long)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property JOB_ADSYNC_ROOT_PATH() As String
Get
Return CType(Me("JOB_ADSYNC_ROOT_PATH"),String)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public ReadOnly Property DB_CONNECTIONSTRING() As String
Get
Return CType(Me("DB_CONNECTIONSTRING"),String)
Return CType(Me("TEST_CONFIG"),String)
End Get
End Property
End Class

View File

@ -0,0 +1,33 @@
<?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">
<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)" />
</Setting>
<Setting Name="TEST_CONFIG" Type="System.String" Scope="Application">
<Value Profile="(Default)">False|10/0 * * * * ?|Foo:Bar</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC-Manifestoptionen
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
Knoten "requestedExecutionLevel" wie folgt.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
für die Anwendung erforderlich ist.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel und müssen sich nicht
anmelden. Für Windows Forms-Anwendungen für .NET Framework 4.6, die sich für diese Einstellung anmelden, muss
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der "app.config" auf "true" festgelegt werden. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@ -0,0 +1,47 @@
<System.ComponentModel.RunInstaller(True)> Partial Class ProjectInstaller
Inherits System.Configuration.Install.Installer
'Installer überschreibt den Löschvorgang zum Bereinigen der Komponentenliste.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.ServiceProcessInstaller = New System.ServiceProcess.ServiceProcessInstaller()
Me.ServiceInstaller = New System.ServiceProcess.ServiceInstaller()
'
'ServiceProcessInstaller
'
Me.ServiceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem
Me.ServiceProcessInstaller.Password = Nothing
Me.ServiceProcessInstaller.Username = Nothing
'
'ServiceInstaller
'
Me.ServiceInstaller.DelayedAutoStart = True
Me.ServiceInstaller.DisplayName = "Digital Data Job Runner"
Me.ServiceInstaller.ServiceName = "DDJobRunner"
'
'ProjectInstaller
'
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller, Me.ServiceInstaller})
End Sub
Friend WithEvents ServiceProcessInstaller As ServiceProcess.ServiceProcessInstaller
Friend WithEvents ServiceInstaller As ServiceProcess.ServiceInstaller
End Class

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ServiceProcessInstaller.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>22, 17</value>
</metadata>
<metadata name="ServiceInstaller.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>197, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.5.11" targetFramework="net461" />
<package id="NLog" version="4.6.2" targetFramework="net461" />
<package id="Quartz" version="3.0.7" targetFramework="net461" />
</packages>