Much stuff
This commit is contained in:
parent
7ebd07cf14
commit
9010ad4139
@ -129,6 +129,14 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jobs\Jobs.vbproj">
|
||||
<Project>{39ec839a-3c30-4922-a41e-6b09d1dde5c3}</Project>
|
||||
<Name>Jobs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
||||
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Interfaces\Interfaces.vbproj">
|
||||
<Project>{AB6F09BF-E794-4F6A-94BB-C97C0BA84D64}</Project>
|
||||
<Name>Interfaces</Name>
|
||||
|
||||
37
ADSyncTest/Form1.Designer.vb
generated
37
ADSyncTest/Form1.Designer.vb
generated
@ -24,6 +24,9 @@ Partial Class Form1
|
||||
Private Sub InitializeComponent()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.ListBox1 = New System.Windows.Forms.ListBox()
|
||||
Me.ListBox2 = New System.Windows.Forms.ListBox()
|
||||
Me.Button2 = New System.Windows.Forms.Button()
|
||||
Me.Button3 = New System.Windows.Forms.Button()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Button1
|
||||
@ -40,14 +43,43 @@ Partial Class Form1
|
||||
Me.ListBox1.FormattingEnabled = True
|
||||
Me.ListBox1.Location = New System.Drawing.Point(245, 12)
|
||||
Me.ListBox1.Name = "ListBox1"
|
||||
Me.ListBox1.Size = New System.Drawing.Size(543, 420)
|
||||
Me.ListBox1.Size = New System.Drawing.Size(244, 420)
|
||||
Me.ListBox1.TabIndex = 1
|
||||
'
|
||||
'ListBox2
|
||||
'
|
||||
Me.ListBox2.FormattingEnabled = True
|
||||
Me.ListBox2.Location = New System.Drawing.Point(495, 12)
|
||||
Me.ListBox2.Name = "ListBox2"
|
||||
Me.ListBox2.Size = New System.Drawing.Size(266, 420)
|
||||
Me.ListBox2.TabIndex = 2
|
||||
'
|
||||
'Button2
|
||||
'
|
||||
Me.Button2.Location = New System.Drawing.Point(12, 70)
|
||||
Me.Button2.Name = "Button2"
|
||||
Me.Button2.Size = New System.Drawing.Size(227, 38)
|
||||
Me.Button2.TabIndex = 3
|
||||
Me.Button2.Text = "List Groups"
|
||||
Me.Button2.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Button3
|
||||
'
|
||||
Me.Button3.Location = New System.Drawing.Point(12, 114)
|
||||
Me.Button3.Name = "Button3"
|
||||
Me.Button3.Size = New System.Drawing.Size(227, 35)
|
||||
Me.Button3.TabIndex = 4
|
||||
Me.Button3.Text = "List Users for selected Group"
|
||||
Me.Button3.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(800, 450)
|
||||
Me.Controls.Add(Me.Button3)
|
||||
Me.Controls.Add(Me.Button2)
|
||||
Me.Controls.Add(Me.ListBox2)
|
||||
Me.Controls.Add(Me.ListBox1)
|
||||
Me.Controls.Add(Me.Button1)
|
||||
Me.Name = "Form1"
|
||||
@ -58,4 +90,7 @@ Partial Class Form1
|
||||
|
||||
Friend WithEvents Button1 As Button
|
||||
Friend WithEvents ListBox1 As ListBox
|
||||
Friend WithEvents ListBox2 As ListBox
|
||||
Friend WithEvents Button2 As Button
|
||||
Friend WithEvents Button3 As Button
|
||||
End Class
|
||||
|
||||
@ -1,21 +1,85 @@
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Interfaces.ActiveDirectoryInterface
|
||||
Imports DigitalData.Modules.Database
|
||||
|
||||
Public Class Form1
|
||||
Private _sync As ActiveDirectoryInterface
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _firebird As Firebird
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
_logConfig = New LogConfig(LogConfig.PathType.CurrentDirectory)
|
||||
_logConfig.Debug = True
|
||||
_logger = _logConfig.GetLogger()
|
||||
_sync = New ActiveDirectoryInterface(_logConfig)
|
||||
_firebird = New Firebird(_logConfig, "172.24.12.41", "172.24.12.41:E:\DB\Firebird\Databases\DD_ICM.fdb", "sysdba", "dd")
|
||||
|
||||
_sync = New ActiveDirectoryInterface(_logConfig, _firebird)
|
||||
_sync.Authenticate()
|
||||
|
||||
Dim oType As Type = Type.GetType("DigitalData.Modules.Jobs.ADSyncJob")
|
||||
Activator.CreateInstance(oType)
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Dim oGroup As String = ListBox1.SelectedItem
|
||||
_sync.SyncUsersForGroup(oGroup)
|
||||
|
||||
'' STEP 1: Get all Groups that have AD_SYNC enabled
|
||||
'Dim oSQL As String = $"SELECT RECORD_ID, GROUP_NAME FROM VWICM_GROUP WHERE AD_SYNC = 1"
|
||||
'Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
|
||||
|
||||
|
||||
'For Each oRow As DataRow In oResult.Rows
|
||||
' Dim oGroupName As String = oRow.Item("GROUP_NAME")
|
||||
' Dim oGroupId As Int64 = oRow.Item("RECORD_ID")
|
||||
|
||||
' ' STEP 2: List all Users for that Group
|
||||
' Dim oUsers As List(Of ADUser) = _sync.ListUsers(oGroupName)
|
||||
|
||||
' For Each oUser In oUsers
|
||||
' ' STEP 3: Check if user exists in DB
|
||||
' oSQL = $"SELECT FNICM_GET_RECORD4SYSKEY('{oUser.samAccountName}','001-USRNAME') from RDB$DATABASE"
|
||||
' Dim oResult2 = _firebird.GetScalarValue(oSQL)
|
||||
' Dim oUserId
|
||||
|
||||
' ' STEP 3.A: If user does not exists, create and add to group
|
||||
' If IsDBNull(oResult2) Then
|
||||
' 'Create user
|
||||
' oSQL = $"SELECT FNICM_RADM_NEW_USER('{oUser.GivenName}', '{oUser.Surname}', '{oUser.samAccountName}', 'AD-Sync') from RDB$DATABASE"
|
||||
' Dim oResult3 = _firebird.GetScalarValue(oSQL)
|
||||
' oUserId = oResult3
|
||||
' Else
|
||||
' oUserId = oResult2
|
||||
' End If
|
||||
|
||||
' ' STEP 4: Add user to group
|
||||
' oSQL = $"SELECT FNICM_RADM_NEW_USER2GROUP({oUserId}, {oGroupId}, 'AD-Sync') from RDB$DATABASE"
|
||||
' Dim oResult4 = _firebird.GetScalarValue(oSQL)
|
||||
' Next
|
||||
'Next
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
Dim oGroups = _sync.ListGroups()
|
||||
|
||||
For Each oGroup In oGroups
|
||||
ListBox1.Items.Add(oGroup.SAMAccountName)
|
||||
ListBox1.Items.Add(oGroup.Name)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
Dim oGroup As String = ListBox1.SelectedItem
|
||||
Dim oUsers = _sync.ListUsers(oGroup)
|
||||
|
||||
ListBox2.Items.Clear()
|
||||
For Each oUser In oUsers
|
||||
ListBox2.Items.Add(oUser.samAccountName)
|
||||
Next
|
||||
|
||||
If oUsers.Count = 0 Then
|
||||
ListBox2.Items.Add("No users found ¯\_(ツ)_/¯")
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@ -69,6 +69,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "License", "Modules.License\
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ADSyncTest", "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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -171,6 +173,10 @@ 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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -200,6 +206,7 @@ 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} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB}
|
||||
{59461E98-A5AF-438C-A651-5021ACAE82AD} = {7AF3F9C2-C939-4A08-95C1-0453207E298A}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Logging.LogConfig
|
||||
|
||||
Public Class ZUGFeRDService
|
||||
Private _logConfig As LogConfig
|
||||
@ -10,7 +11,7 @@ Public Class ZUGFeRDService
|
||||
Private _threadRunner As ThreadRunner
|
||||
|
||||
Protected Overrides Sub OnStart(ByVal args() As String)
|
||||
_logConfig = New LogConfig(LogConfig.PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"))
|
||||
_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.")
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Imports System.ServiceModel
|
||||
Imports System.ServiceModel.Channels
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMIFileOps.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMIAPI.EDMIServiceReference
|
||||
Imports DigitalData.GUIs.ClientSuite.Base
|
||||
|
||||
Public Class ClassService
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
Imports System.Threading
|
||||
Imports System.Timers
|
||||
Imports DigitalData.GUIs.ClientSuite.Base
|
||||
Imports DigitalData.Modules.EDMIFileOps.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMIAPI.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ClassTimer
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMIFileOps.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMIAPI.EDMIServiceReference
|
||||
|
||||
Public Class ClassCommonCommands
|
||||
Private _LogConfig As LogConfig
|
||||
|
||||
@ -126,7 +126,7 @@ Public Class frmFormDesigner
|
||||
|
||||
Dim oLayoutItem As LayoutControlItem = DirectCast(sender, LayoutControlItem)
|
||||
Dim oSelectedControl As BaseEdit = oLayoutItem.Control
|
||||
Dim oMetadata As Metadata
|
||||
Dim oMetadata As New Metadata
|
||||
|
||||
' Don't load properties for layout items like splitters, separators, etc.
|
||||
If oLayoutItem.Control Is Nothing Then
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMIFileOps.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMIAPI.EDMIServiceReference
|
||||
|
||||
Namespace My
|
||||
''' <summary>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.EDMIFileOps
|
||||
Imports DigitalData.Modules.EDMIAPI
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
Imports System.ServiceModel
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMIFileOps.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMIAPI.EDMIServiceReference
|
||||
|
||||
Public NotInheritable Class frmSplash
|
||||
Private _Worker As New BackgroundWorker()
|
||||
|
||||
@ -6,5 +6,5 @@
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="DocumentResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMIFileOps.EDMIServiceReference.DocumentResult, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
<TypeInfo>DigitalData.Modules.EDMIAPI.EDMIServiceReference.DocumentResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@ -6,5 +6,5 @@
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="IndexResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMIFileOps.EDMIServiceReference.IndexResult, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
<TypeInfo>DigitalData.Modules.EDMIAPI.EDMIServiceReference.IndexResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@ -6,5 +6,5 @@
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="NonQueryResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMIFileOps.EDMIServiceReference.NonQueryResult, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
<TypeInfo>DigitalData.Modules.EDMIAPI.EDMIServiceReference.NonQueryResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@ -6,5 +6,5 @@
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="ScalarResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMIFileOps.EDMIServiceReference.ScalarResult, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
<TypeInfo>DigitalData.Modules.EDMIAPI.EDMIServiceReference.ScalarResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@ -6,5 +6,5 @@
|
||||
cause the file to be unrecognizable by the program.
|
||||
-->
|
||||
<GenericObjectDataSource DisplayName="TableResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TypeInfo>DigitalData.Modules.EDMIFileOps.EDMIServiceReference.TableResult, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
|
||||
<TypeInfo>DigitalData.Modules.EDMIAPI.EDMIServiceReference.TableResult</TypeInfo>
|
||||
</GenericObjectDataSource>
|
||||
@ -1,5 +1,5 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMIFileOps.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMIAPI.EDMIServiceReference
|
||||
Imports System.ServiceModel
|
||||
Imports System.IO
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5B1171DC-FFFE-4813-A20D-786AAE47B320}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DigitalData.Modules.EDMIFileOps</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.EDMIFileOps</AssemblyName>
|
||||
<RootNamespace>DigitalData.Modules.EDMIAPI</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.EDMIAPI</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
@ -18,7 +18,7 @@
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.EDMIFileOps.xml</DocumentationFile>
|
||||
<DocumentationFile>DigitalData.Modules.EDMIAPI.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
@ -27,7 +27,7 @@
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.EDMIFileOps.xml</DocumentationFile>
|
||||
<DocumentationFile>DigitalData.Modules.EDMIAPI.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
@ -106,19 +106,19 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIFileOps.EDMIServiceReference.DocumentResult.datasource">
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIAPI.EDMIServiceReference.DocumentResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIFileOps.EDMIServiceReference.IndexResult.datasource">
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIAPI.EDMIServiceReference.IndexResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIFileOps.EDMIServiceReference.NonQueryResult.datasource">
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIAPI.EDMIServiceReference.NonQueryResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIFileOps.EDMIServiceReference.ScalarResult.datasource">
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIAPI.EDMIServiceReference.ScalarResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIFileOps.EDMIServiceReference.TableResult.datasource">
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMIAPI.EDMIServiceReference.TableResult.datasource">
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</None>
|
||||
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.Filesystem.xsd">
|
||||
|
||||
2
EDMI_FILE_OPs/My Project/Resources.Designer.vb
generated
2
EDMI_FILE_OPs/My Project/Resources.Designer.vb
generated
@ -39,7 +39,7 @@ Namespace My.Resources
|
||||
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("DigitalData.Modules.EDMIFileOps.Resources", GetType(Resources).Assembly)
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Modules.EDMIAPI.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
|
||||
4
EDMI_FILE_OPs/My Project/Settings.Designer.vb
generated
4
EDMI_FILE_OPs/My Project/Settings.Designer.vb
generated
@ -64,9 +64,9 @@ Namespace My
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.DigitalData.Modules.EDMIFileOps.My.MySettings
|
||||
Friend ReadOnly Property Settings() As Global.DigitalData.Modules.EDMIAPI.My.MySettings
|
||||
Get
|
||||
Return Global.DigitalData.Modules.EDMIFileOps.My.MySettings.Default
|
||||
Return Global.DigitalData.Modules.EDMIAPI.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
|
||||
42
JobRunner/App.config
Normal file
42
JobRunner/App.config
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="DigitalData.Services.JobRunner.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<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>
|
||||
<setting name="SERVICE_DISPLAY_NAME" serializeAs="String">
|
||||
<value>Digital Data Job Runner</value>
|
||||
</setting>
|
||||
<setting name="JOB_ADSYNC_ENABLED" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="JOB_ADSYNC_INTERVAL" serializeAs="String">
|
||||
<value>1,2,3,4,5,6,7,8,9,10</value>
|
||||
</setting>
|
||||
<setting name="DB_DATASOURCE" 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>
|
||||
</DigitalData.Services.JobRunner.My.MySettings>
|
||||
</applicationSettings>
|
||||
</configuration>
|
||||
74
JobRunner/JobRunner.vb
Normal file
74
JobRunner/JobRunner.vb
Normal file
@ -0,0 +1,74 @@
|
||||
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 _interval As Long
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _firebird As Firebird
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, Interval As Long)
|
||||
_logConfig = LogConfig
|
||||
_logger = _logConfig.GetLogger()
|
||||
_firebird = Firebird
|
||||
_interval = Interval
|
||||
|
||||
_workerTimer = New Timer()
|
||||
_workerThread = New BackgroundWorker() With {
|
||||
.WorkerReportsProgress = False,
|
||||
.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
|
||||
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")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DoWork(sender As Object, e As DoWorkEventArgs) Handles _workerThread.DoWork
|
||||
Try
|
||||
Dim args As WorkerArgs = e.Argument
|
||||
|
||||
_logger.Debug("Background worker running..")
|
||||
|
||||
' TODO: WORK
|
||||
'Dim job As New ImportZUGFeRDFiles(_logConfig, _firebird)
|
||||
'job.Start(args)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Background worker failed!")
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub WorkCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles _workerThread.RunWorkerCompleted
|
||||
_logger.Debug("Background worker completed!")
|
||||
End Sub
|
||||
End Class
|
||||
156
JobRunner/JobRunner.vbproj
Normal file
156
JobRunner/JobRunner.vbproj
Normal file
@ -0,0 +1,156 @@
|
||||
<?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>{59461E98-A5AF-438C-A651-5021ACAE82AD}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>DigitalData.Services.JobRunner.WindowsService</StartupObject>
|
||||
<RootNamespace>DigitalData.Services.JobRunner</RootNamespace>
|
||||
<AssemblyName>DigitalData.Services.JobRunner</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Console</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>DigitalData.Services.JobRunner.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>DigitalData.Services.JobRunner.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="DigitalData.Controls.LookupGrid">
|
||||
<HintPath>..\LookupGrid\obj\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.5.11\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<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.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" />
|
||||
<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.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="JobRunner.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ProjectInstaller.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WindowsService.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WindowsService.Designer.vb">
|
||||
<DependentUpon>WindowsService.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<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="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>
|
||||
</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" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jobs\Jobs.vbproj">
|
||||
<Project>{39ec839a-3c30-4922-a41e-6b09d1dde5c3}</Project>
|
||||
<Name>Jobs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
||||
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
13
JobRunner/My Project/Application.Designer.vb
generated
Normal file
13
JobRunner/My Project/Application.Designer.vb
generated
Normal file
@ -0,0 +1,13 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
10
JobRunner/My Project/Application.myapp
Normal file
10
JobRunner/My Project/Application.myapp
Normal file
@ -0,0 +1,10 @@
|
||||
<?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>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>3</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
35
JobRunner/My Project/AssemblyInfo.vb
Normal file
35
JobRunner/My Project/AssemblyInfo.vb
Normal 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("JobRunner")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("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("5d2eb259-f8bd-4e9b-a121-afbb3fe90d13")>
|
||||
|
||||
' 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")>
|
||||
63
JobRunner/My Project/Resources.Designer.vb
generated
Normal file
63
JobRunner/My Project/Resources.Designer.vb
generated
Normal file
@ -0,0 +1,63 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
'''<summary>
|
||||
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
|
||||
Global.System.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>
|
||||
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
'''</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("DigitalData.Services.JobRunner.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
JobRunner/My Project/Resources.resx
Normal file
117
JobRunner/My Project/Resources.resx
Normal 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>
|
||||
154
JobRunner/My Project/Settings.Designer.vb
generated
Normal file
154
JobRunner/My Project/Settings.Designer.vb
generated
Normal file
@ -0,0 +1,154 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </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", "15.7.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 "Automatische My.Settings-Speicherfunktion"
|
||||
#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(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("DDJobRunner")> _
|
||||
Public ReadOnly Property SERVICE_NAME() As String
|
||||
Get
|
||||
Return CType(Me("SERVICE_NAME"),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
|
||||
Get
|
||||
Return CType(Me("SERVICE_DISPLAY_NAME"),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
|
||||
Get
|
||||
Return CType(Me("JOB_ADSYNC_ENABLED"),Boolean)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("1,2,3,4,5,6,7,8,9,10")> _
|
||||
Public ReadOnly Property JOB_ADSYNC_INTERVAL() As String
|
||||
Get
|
||||
Return CType(Me("JOB_ADSYNC_INTERVAL"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public ReadOnly Property DB_DATASOURCE() As String
|
||||
Get
|
||||
Return CType(Me("DB_DATASOURCE"),String)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Configuration.DefaultSettingValueAttribute("")> _
|
||||
Public ReadOnly Property DB_DATABASE() 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
|
||||
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.DigitalData.Services.JobRunner.My.MySettings
|
||||
Get
|
||||
Return Global.DigitalData.Services.JobRunner.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
33
JobRunner/My Project/Settings.settings
Normal file
33
JobRunner/My Project/Settings.settings
Normal 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="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="JOB_ADSYNC_INTERVAL" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">1,2,3,4,5,6,7,8,9,10</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>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
24
JobRunner/ProjectInstaller.vb
Normal file
24
JobRunner/ProjectInstaller.vb
Normal file
@ -0,0 +1,24 @@
|
||||
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
|
||||
50
JobRunner/WindowsService.Designer.vb
generated
Normal file
50
JobRunner/WindowsService.Designer.vb
generated
Normal file
@ -0,0 +1,50 @@
|
||||
Imports System.ServiceProcess
|
||||
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
||||
Partial Class WindowsService
|
||||
Inherits System.ServiceProcess.ServiceBase
|
||||
|
||||
'UserService ü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
|
||||
|
||||
' Der Haupteinstiegspunkt für den Prozess
|
||||
<MTAThread()>
|
||||
<System.Diagnostics.DebuggerNonUserCode()>
|
||||
Shared Sub Main()
|
||||
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
|
||||
|
||||
' Innerhalb eines Prozesses können mehrere NT-Dienste ausgeführt werden. Um einen
|
||||
' weiteren Dienst zu diesem Prozess hinzuzufügen, ändern Sie die folgende Zeile,
|
||||
' um ein zweites Dienstobjekt zu erstellen. Zum Beispiel
|
||||
'
|
||||
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
|
||||
'
|
||||
ServicesToRun = New System.ServiceProcess.ServiceBase() {New WindowsService}
|
||||
|
||||
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
|
||||
End Sub
|
||||
|
||||
'Wird vom Komponenten-Designer benötigt.
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
' Hinweis: Die folgende Prozedur ist für den Komponenten-Designer erforderlich.
|
||||
' Das Bearbeiten ist mit dem Komponenten-Designer möglich.
|
||||
' Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
'
|
||||
'Service1
|
||||
'
|
||||
Me.ServiceName = "Service1"
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
123
JobRunner/WindowsService.resx
Normal file
123
JobRunner/WindowsService.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?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="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
38
JobRunner/WindowsService.vb
Normal file
38
JobRunner/WindowsService.vb
Normal file
@ -0,0 +1,38 @@
|
||||
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 _jobRunner As JobRunner
|
||||
|
||||
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)
|
||||
|
||||
Try
|
||||
_jobRunner = New JobRunner(_logConfig, _firebird, oInterval)
|
||||
_jobRunner.Start()
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnStop()
|
||||
_logger.Info($"{My.Settings.SERVICE_NAME} is stopping.")
|
||||
End Sub
|
||||
End Class
|
||||
4
JobRunner/packages.config
Normal file
4
JobRunner/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.5.11" targetFramework="net461" />
|
||||
</packages>
|
||||
3
Jobs/EDMI/ADSync/ADSyncArgs.vb
Normal file
3
Jobs/EDMI/ADSync/ADSyncArgs.vb
Normal file
@ -0,0 +1,3 @@
|
||||
Public Class ADSyncArgs
|
||||
|
||||
End Class
|
||||
9
Jobs/EDMI/ADSync/ADSyncJob.vb
Normal file
9
Jobs/EDMI/ADSync/ADSyncJob.vb
Normal file
@ -0,0 +1,9 @@
|
||||
Imports DigitalData.Modules.Jobs
|
||||
|
||||
Public Class ADSyncJob
|
||||
Implements IJob(Of ADSyncArgs)
|
||||
|
||||
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).Start
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
5
Jobs/EDMI/ZUGFeRD/EmailData.vb
Normal file
5
Jobs/EDMI/ZUGFeRD/EmailData.vb
Normal file
@ -0,0 +1,5 @@
|
||||
Public Class EmailData
|
||||
Public Attachment As String
|
||||
Public Subject As String
|
||||
Public From As String
|
||||
End Class
|
||||
@ -5,6 +5,7 @@ Imports System.Linq
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Jobs
|
||||
Imports DigitalData.Modules.Jobs.Exceptions
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports FirebirdSql.Data.FirebirdClient
|
||||
@ -24,36 +25,6 @@ Public Class ImportZUGFeRDFiles
|
||||
Private _firebird As Firebird
|
||||
Private _filesystem As Filesystem.File
|
||||
|
||||
Public Class WorkerArgs
|
||||
Public WatchDirectories As List(Of String)
|
||||
Public SuccessDirectory As String
|
||||
Public ErrorDirectory As String
|
||||
Public OriginalEmailDirectory As String
|
||||
Public RejectedEmailDirectory As String
|
||||
Public PropertyMap As Dictionary(Of String, XmlItemProperty)
|
||||
|
||||
Public Sub New()
|
||||
WatchDirectories = New List(Of String)
|
||||
SuccessDirectory = Nothing
|
||||
ErrorDirectory = Nothing
|
||||
OriginalEmailDirectory = Nothing
|
||||
RejectedEmailDirectory = Nothing
|
||||
PropertyMap = New Dictionary(Of String, XmlItemProperty)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class EmailData
|
||||
Public Attachment As String
|
||||
Public Subject As String
|
||||
Public From As String
|
||||
End Class
|
||||
|
||||
Public Class XmlItemProperty
|
||||
Public TableName As String
|
||||
Public Description As String
|
||||
Public IsRequired As Boolean
|
||||
End Class
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird)
|
||||
_logConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
|
||||
19
Jobs/EDMI/ZUGFeRD/WorkerArgs.vb
Normal file
19
Jobs/EDMI/ZUGFeRD/WorkerArgs.vb
Normal file
@ -0,0 +1,19 @@
|
||||
Imports System.Collections.Generic
|
||||
|
||||
Public Class WorkerArgs
|
||||
Public WatchDirectories As List(Of String)
|
||||
Public SuccessDirectory As String
|
||||
Public ErrorDirectory As String
|
||||
Public OriginalEmailDirectory As String
|
||||
Public RejectedEmailDirectory As String
|
||||
Public PropertyMap As Dictionary(Of String, XmlItemProperty)
|
||||
|
||||
Public Sub New()
|
||||
WatchDirectories = New List(Of String)
|
||||
SuccessDirectory = Nothing
|
||||
ErrorDirectory = Nothing
|
||||
OriginalEmailDirectory = Nothing
|
||||
RejectedEmailDirectory = Nothing
|
||||
PropertyMap = New Dictionary(Of String, XmlItemProperty)
|
||||
End Sub
|
||||
End Class
|
||||
5
Jobs/EDMI/ZUGFeRD/XmlItemProperty.vb
Normal file
5
Jobs/EDMI/ZUGFeRD/XmlItemProperty.vb
Normal file
@ -0,0 +1,5 @@
|
||||
Public Class XmlItemProperty
|
||||
Public TableName As String
|
||||
Public Description As String
|
||||
Public IsRequired As Boolean
|
||||
End Class
|
||||
@ -1,3 +1,7 @@
|
||||
Public Interface IJob
|
||||
Sub Start(Arguments As Object)
|
||||
End Interface
|
||||
|
||||
Public Interface IJob(Of T)
|
||||
Sub Start(Arguments As T)
|
||||
End Interface
|
||||
|
||||
@ -57,6 +57,10 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -78,11 +82,21 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="EDMI\ADSync\ADSyncArgs.vb" />
|
||||
<Compile Include="EDMI\ADSync\ADSyncJob.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\EmailData.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\ImportZUGFeRDFiles.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\PropertyValues.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\WorkerArgs.vb" />
|
||||
<Compile Include="EDMI\ZUGFeRD\XmlItemProperty.vb" />
|
||||
<Compile Include="Exceptions.vb" />
|
||||
<Compile Include="IJob.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FirebirdSql.Data.FirebirdClient, Version=6.4.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
|
||||
|
||||
71
Jobs/My Project/Settings.Designer.vb
generated
Normal file
71
Jobs/My Project/Settings.Designer.vb
generated
Normal file
@ -0,0 +1,71 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class Settings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As Settings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()),Settings)
|
||||
|
||||
#Region "Automatische My.Settings-Speicherfunktion"
|
||||
#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(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As Settings
|
||||
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
|
||||
|
||||
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.DigitalData.Modules.Jobs.Settings
|
||||
Get
|
||||
Return Global.DigitalData.Modules.Jobs.Settings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
0
Jobs/My Project/Settings.settings
Normal file
0
Jobs/My Project/Settings.settings
Normal file
@ -1,9 +1,12 @@
|
||||
Imports System.DirectoryServices
|
||||
Imports System.DirectoryServices.AccountManagement
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ActiveDirectoryInterface
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
Private _firebird As Firebird
|
||||
|
||||
Private _rootPath As String
|
||||
Private _rootNode As DirectoryEntry
|
||||
@ -18,9 +21,11 @@ Public Class ActiveDirectoryInterface
|
||||
Private Const NAME = "name"
|
||||
Private Const OBJECTCATEGORY = "objectCategory"
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Optional RootPath As String = Nothing)
|
||||
Public Sub New(LogConfig As LogConfig, Firebird As Firebird, Optional RootPath As String = Nothing)
|
||||
_logConfig = LogConfig
|
||||
_logger = _logConfig.GetLogger()
|
||||
_firebird = Firebird
|
||||
|
||||
If RootPath Is Nothing Then
|
||||
_rootPath = $"LDAP://{Environment.UserDomainName}"
|
||||
Else
|
||||
@ -28,25 +33,86 @@ Public Class ActiveDirectoryInterface
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function GetRootNode() As DirectoryEntry
|
||||
Dim oEntry As New DirectoryEntry(_rootPath) With {
|
||||
.AuthenticationType = AuthenticationTypes.Secure,
|
||||
.Password = Nothing,
|
||||
.Username = Nothing
|
||||
}
|
||||
Public Function SyncUsersForGroup(GroupName As String) As List(Of ADUser)
|
||||
Dim oUsers As New List(Of ADUser)
|
||||
Dim oSyncedUsers As New List(Of ADUser)
|
||||
Dim oGroupId As Int64 = Nothing
|
||||
|
||||
Return oEntry
|
||||
End Function
|
||||
Private Function GetRootNode(Username As String, Password As String) As DirectoryEntry
|
||||
Dim oEntry As New DirectoryEntry(_rootPath) With {
|
||||
.AuthenticationType = AuthenticationTypes.Secure,
|
||||
.Password = Username,
|
||||
.Username = Password
|
||||
}
|
||||
Try
|
||||
_logger.Debug("Fetching users from ActiveDirectory")
|
||||
oUsers = ListUsers(GroupName)
|
||||
_logger.Debug("Found {0} users", oUsers.Count)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
Return oEntry
|
||||
If oUsers.Count = 0 Then
|
||||
_logger.Debug("Group {0} does not contain any users.", GroupName)
|
||||
Return oSyncedUsers
|
||||
End If
|
||||
|
||||
Try
|
||||
_logger.Debug("Getting group Id for group {0}", GroupName)
|
||||
oGroupId = GetGroupId(GroupName)
|
||||
|
||||
|
||||
If oGroupId = 0 Then
|
||||
_logger.Warn("Group {0} does not exist in database. Exiting", GroupName)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
_logger.Debug("Using group Id {0}", oGroupId)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
For Each oUser In oUsers
|
||||
Dim oUserId As Int64
|
||||
Dim oUserExists As Boolean = False
|
||||
|
||||
' Check if user already exists
|
||||
Try
|
||||
_logger.Debug("Checking if user {0} exists", oUser)
|
||||
oUserId = GetUserId(oUser.samAccountName)
|
||||
oUserExists = Not IsNothing(oUserId)
|
||||
_logger.Debug("User {0} exists in database: ", oUser, oUserExists)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Could not get UserId for user. Skipping")
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
' I user does not exist, create a new user
|
||||
Try
|
||||
If Not oUserExists Then
|
||||
_logger.Debug("Creating new user for {0}", oUser)
|
||||
oUserId = CreateUser(oUser)
|
||||
_logger.Debug("User created with Id {0}", oUserId)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Could not create user. Skipping")
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
' Add the user to group
|
||||
Try
|
||||
AddUserToGroup(oUserId, oGroupId)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Could not add user to group. Skipping")
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
oSyncedUsers.Add(oUser)
|
||||
Next
|
||||
|
||||
Return oSyncedUsers
|
||||
End Function
|
||||
|
||||
|
||||
Public Sub Authenticate()
|
||||
Try
|
||||
Dim oEntry = GetRootNode()
|
||||
@ -70,19 +136,17 @@ Public Class ActiveDirectoryInterface
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Function ListGroups() As List(Of ADGroup)
|
||||
Return ListGroups(_rootNode)
|
||||
Public Function ListGroups(Optional Query As String = "(&(objectClass=group) (samAccountName=*))") As List(Of ADGroup)
|
||||
Return ListGroups(_rootNode, Query)
|
||||
End Function
|
||||
|
||||
Public Function ListGroups(RootNode As DirectoryEntry) As List(Of ADGroup)
|
||||
Public Function ListGroups(RootNode As DirectoryEntry, Optional Query As String = "(&(objectClass=group) (samAccountName=*))") As List(Of ADGroup)
|
||||
Dim oGroups As New List(Of ADGroup)
|
||||
|
||||
Try
|
||||
Dim oFilterQuery As String = "(&(objectClass=group) (samAccountName=*))"
|
||||
Dim oDirectorySearcher As New DirectorySearcher(RootNode) With {
|
||||
.SearchScope = SearchScope.Subtree,
|
||||
.SizeLimit = SEARCH_LIMIT,
|
||||
.Filter = oFilterQuery
|
||||
.Filter = Query
|
||||
}
|
||||
Dim oResults As SearchResultCollection = oDirectorySearcher.FindAll()
|
||||
|
||||
@ -95,6 +159,144 @@ Public Class ActiveDirectoryInterface
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ListUsers(GroupName As String) As List(Of ADUser)
|
||||
Dim oUsers As New List(Of ADUser)
|
||||
|
||||
Try
|
||||
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)
|
||||
Return oUsers
|
||||
End If
|
||||
|
||||
Using oMembers = oGroupPrincipal.GetMembers(True)
|
||||
For Each oMember As Principal In oMembers
|
||||
If TypeOf oMember Is UserPrincipal Then
|
||||
Dim oUser As UserPrincipal = DirectCast(oMember, UserPrincipal)
|
||||
|
||||
oUsers.Add(New ADUser() With {
|
||||
.GUID = oUser.Guid,
|
||||
.SId = oUser.Sid,
|
||||
.samAccountName = oUser.SamAccountName,
|
||||
.Surname = oUser.Surname,
|
||||
.Middlename = oUser.MiddleName,
|
||||
.GivenName = oUser.GivenName,
|
||||
.Email = oUser.EmailAddress
|
||||
})
|
||||
End If
|
||||
Next
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return oUsers
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Public Function ListUsers(GroupNames As List(Of String)) As List(Of ADUser)
|
||||
Try
|
||||
Dim oUsers As New List(Of ADUser)
|
||||
Dim oComparer As New UserEqualityComparer()
|
||||
|
||||
For Each oGroup In GroupNames
|
||||
Dim oGroupUsers = ListUsers(oGroup)
|
||||
Dim oNewUsers = oGroupUsers.
|
||||
Except(oUsers, oComparer).
|
||||
ToList()
|
||||
oUsers.AddRange(oNewUsers)
|
||||
Next
|
||||
|
||||
Return oUsers
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetGroupId(GroupName As String) As Integer
|
||||
Try
|
||||
Dim oSQL As String = $"SELECT FNICM_GET_RECORD4SYSKEY('{GroupName}','002-NAME') from RDB$DATABASE"
|
||||
Dim oGroupId = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
If IsDBNull(oGroupId) OrElse oGroupId = 0 Then
|
||||
_logger.Debug("Group {0} not found in database", GroupName)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return oGroupId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetUserId(UserName As String) As Integer
|
||||
Try
|
||||
Dim oSQL As String = $"SELECT FNICM_GET_RECORD4SYSKEY('{UserName}','001-USRNAME') from RDB$DATABASE"
|
||||
Dim oResult = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
If IsDBNull(oResult) Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function CreateUser(User As ADUser) As Int64
|
||||
Try
|
||||
Dim oSQL = $"SELECT FNICM_RADM_NEW_USER('{User.GivenName}', '{User.Surname}', '{User.samAccountName}', 'AD-Sync') from RDB$DATABASE"
|
||||
Dim oUserId As Integer = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
Return oUserId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function AddUserToGroup(UserId As Integer, GroupId As Integer) As Int64
|
||||
Try
|
||||
Dim oSQL = $"SELECT FNICM_RADM_NEW_USER2GROUP({UserId}, {GroupId}, 'AD-Sync') from RDB$DATABASE"
|
||||
Dim oRecordId = _firebird.GetScalarValue(oSQL)
|
||||
|
||||
If IsDBNull(oRecordId) Then
|
||||
_logger.Warn("UserId {0} - GroupId {1} relation already exists.", UserId, GroupId)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return oRecordId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetRootNode() As DirectoryEntry
|
||||
Dim oEntry As New DirectoryEntry(_rootPath) With {
|
||||
.AuthenticationType = AuthenticationTypes.Secure,
|
||||
.Password = Nothing,
|
||||
.Username = Nothing
|
||||
}
|
||||
|
||||
Return oEntry
|
||||
End Function
|
||||
Private Function GetRootNode(Username As String, Password As String) As DirectoryEntry
|
||||
Dim oEntry As New DirectoryEntry(_rootPath) With {
|
||||
.AuthenticationType = AuthenticationTypes.Secure,
|
||||
.Password = Username,
|
||||
.Username = Password
|
||||
}
|
||||
|
||||
Return oEntry
|
||||
End Function
|
||||
|
||||
Private Function GroupResultsToList(Results As SearchResultCollection) As List(Of ADGroup)
|
||||
Dim oGroups As New List(Of ADGroup)
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
Imports System.Security.Principal
|
||||
|
||||
Public Class ADUser
|
||||
Public GUID As Guid
|
||||
Public SId As SecurityIdentifier
|
||||
Public samAccountName As String
|
||||
Public Surname As String
|
||||
Public GivenName As String
|
||||
Public Middlename As String
|
||||
Public Email As String
|
||||
|
||||
Public Overrides Function Equals(obj As Object) As Boolean
|
||||
Return DirectCast(obj, ADUser).samAccountName
|
||||
End Function
|
||||
Public Overrides Function ToString() As String
|
||||
Return samAccountName
|
||||
End Function
|
||||
End Class
|
||||
@ -0,0 +1,19 @@
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
|
||||
Public Class UserEqualityComparer
|
||||
Implements IEqualityComparer(Of ADUser)
|
||||
|
||||
Public Overloads Function Equals(x As ADUser, y As ADUser) As Boolean Implements IEqualityComparer(Of ADUser).Equals
|
||||
If ReferenceEquals(x, y) Then Return True
|
||||
If x Is Nothing Or y Is Nothing Then Return False
|
||||
|
||||
Return x.SId = y.SId
|
||||
End Function
|
||||
|
||||
Public Overloads Function GetHashCode(obj As ADUser) As Integer Implements IEqualityComparer(Of ADUser).GetHashCode
|
||||
If obj Is Nothing Then Return 0
|
||||
|
||||
Dim oHashCode = obj.SId.GetHashCode()
|
||||
Return oHashCode
|
||||
End Function
|
||||
End Class
|
||||
@ -51,6 +51,7 @@
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.DirectoryServices.AccountManagement" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
@ -75,6 +76,8 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="ActiveDirectoryInterface.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\ActiveDirectoryGroup.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\ActiveDirectoryUser.vb" />
|
||||
<Compile Include="ActiveDirectoryInterface\UserEqualityComparer.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Exceptions.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
@ -118,6 +121,10 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
||||
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
|
||||
<Name>Logging</Name>
|
||||
|
||||
@ -146,7 +146,7 @@ Public Class EDMService
|
||||
Dim oExtension As String = Path.GetExtension(FileName).Substring(1)
|
||||
_logger.Debug("File extension of file {0} is {1}", FileName, oExtension)
|
||||
|
||||
Dim oSQL = $"SELECT FNICM_NEW_DOC('{FileName}','{oExtension}','{oContainerId}','{GetContainerName(oContainerId)}','{_username}') FROM RDB$DATABASE;"
|
||||
Dim oSQL = $"SELECT FNICM_NEW_DOC('010', '{oContainerId}', '{GetContainerName(oContainerId)}', '{FileName}', '{oExtension}', '{_username}') FROM RDB$DATABASE;"
|
||||
Dim oDocId As Int64 = Database.GetScalarValue(oSQL)
|
||||
|
||||
If oDocId = -1 Then
|
||||
|
||||
@ -5,6 +5,7 @@ Imports System.Xml
|
||||
Imports DigitalData.Modules
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Jobs
|
||||
Imports DigitalData.Modules.Jobs.ImportZUGFeRDFiles
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user