15-12-2022 ~ 2

This commit is contained in:
Jonathan Jenne
2022-12-15 15:59:38 +01:00
parent e4c5658c13
commit 63edd9e542
30 changed files with 331 additions and 214 deletions

View File

@@ -122,14 +122,6 @@
<Compile Include="Config.vb" />
<Compile Include="Constants.vb" />
<Compile Include="LogProvider.vb" />
<Compile Include="Models\Jobs\JobDefinition.vb" />
<Compile Include="Models\Jobs\JobType.vb" />
<Compile Include="Models\Jobs\HistoryItem.vb" />
<Compile Include="Models\Jobs\StatusItem.vb" />
<Compile Include="Models\Profiles\ImportFile.vb" />
<Compile Include="Models\Profiles\ImportProfile.vb" />
<Compile Include="Models\Profiles\ImportProfileStep.vb" />
<Compile Include="Models\Windream\ObjectType.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>

View File

@@ -1,22 +0,0 @@
Public Class HistoryItem
Public Property JobName As String
Public Property CreatedAt As DateTime
Public Property Successful As Boolean
Public Property ErrorMessage As String
Public Property Message As String
Public Property Steps As List(Of HistoryStep)
Public Class HistoryStep
Public Property Created As Date = Now
Public Property Message As String
Public Property Level As StepLevel
End Class
Public Enum StepLevel
Debug
Info
Warning
[Error]
End Enum
End Class

View File

@@ -1,20 +0,0 @@
Imports System.ComponentModel.DataAnnotations
Public Class JobDefinition
<Required>
Public Id As Integer = -1
<Required>
Public TypeId As Integer
Public Type As JobType
<Required>
<StringLength(250)>
Public Name As String
<Required>
<StringLength(250)>
Public CronSchedule As String
Public Active As Boolean
End Class

View File

@@ -1,5 +0,0 @@
Public Class JobType
Public Id As Integer
Public Name As String
Public Active As Boolean
End Class

View File

@@ -1,14 +0,0 @@
Public Class StatusItem
Public Const PROGRESS_CURRENT = "__Progress_Current"
Public Const PROGRESS_TOTAL = "__Progress_Total"
Public Id As String
Public Name As String
Public ExecutionTime As TimeSpan
Public ProgressCurrent As Integer
Public ProgressTotal As Integer
Public Executing As Boolean = False
Public StartTime As Date
Public CompleteTime As Date
End Class

View File

@@ -1,19 +0,0 @@
Public Class ImportFile
Public Property FilePath As String
Public Property FilePathOriginal As String
Public Property FilePathWindream As String
Public Property FileInfo As IO.FileInfo
Public Property IndexValues As New List(Of IndexItem)
Public Class IndexItem
Public Value As String
Public IndexName As String
End Class
Public Sub New(pFilePath As String)
_FilePathOriginal = pFilePath
_FilePath = pFilePath
_FileInfo = New IO.FileInfo(pFilePath)
End Sub
End Class

View File

@@ -1,18 +0,0 @@
Imports System.ComponentModel.DataAnnotations
Public Class ImportProfile
Public Property Job As New JobDefinition
Public Property Active As Boolean
Public Property Id As Integer
Public Property JobId As Integer
Public Property ObjectTypeName As String
Public Property ObjectType As ObjectType
Public Property SourceFolder As String
Public Property TargetFolder As String
Public Property BackupFolder As String
Public Property SubfolderDateFormat As String
Public Property FileExcludeRegex As String
Public Property DeleteFiles As Boolean
Public Property IncludeSubfolders As Boolean
Public Property Steps As New List(Of ImportProfileStep)
End Class

View File

@@ -1,17 +0,0 @@
Imports System.Runtime.Serialization
Public Class ImportProfileStep
Public Property Active As Boolean
Public Property Id As Integer
Public Property ProfileId As Integer
Public Property IndexName As String
Public Property Scope As String
Public Property Method As String
Public Property Argument1 As String
Public Property Argument2 As String
Public Property Argument3 As String
End Class

View File

@@ -1,4 +0,0 @@
Public Class ObjectType
Public Name As String
Public Indexes As New List(Of String)
End Class

View File

@@ -2,6 +2,7 @@
Imports DigitalData.Modules.Logging
Imports Quartz
Imports Quartz.Listener
Imports ECM.JobRunner.Common
Namespace Scheduler
Public Class JobListener

View File

@@ -1,4 +1,6 @@
Public Class JobResult
Imports ECM.JobRunner.Common
Public Class JobResult
Public Property Successful As Boolean
Public Property Description As String
Public Property Steps As List(Of HistoryItem.HistoryStep)

View File

@@ -2,6 +2,7 @@
Imports Quartz
Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Filesystem
Imports ECM.JobRunner.Common
Namespace Scheduler.Jobs

View File

@@ -4,6 +4,7 @@ Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language
Imports ECM.JobRunner.Windows.Scheduler
Imports DigitalData.Modules.Windream
Imports ECM.JobRunner.Common
Public Class State
Inherits BaseClass

View File

@@ -1,5 +1,6 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language
Imports ECM.JobRunner.Common
Imports ECM.JobRunner.Windows.Scheduler
@@ -121,9 +122,9 @@ Public Class UpdateProfile
oCommand.Parameters.Add("WM_OBJECTTYPE", SqlDbType.NVarChar, 100).Value = oProfile.ObjectTypeName
oCommand.Parameters.Add("SOURCE_FOLDER", SqlDbType.NVarChar, 500).Value = oProfile.SourceFolder
oCommand.Parameters.Add("TARGET_FOLDER", SqlDbType.NVarChar, 500).Value = oProfile.TargetFolder
oCommand.Parameters.Add("BACKUP_FOLDER", SqlDbType.NVarChar, 500).Value = oProfile.BackupFolder
oCommand.Parameters.Add("EXCLUDE_REGEX", SqlDbType.NVarChar, 5000).Value = oProfile.FileExcludeRegex
oCommand.Parameters.Add("SF_DATE_FORMAT", SqlDbType.NVarChar, 50).Value = oProfile.SubfolderDateFormat
oCommand.Parameters.Add("BACKUP_FOLDER", SqlDbType.NVarChar, 500).Value = Utils.NotNull(oProfile.BackupFolder, String.Empty)
oCommand.Parameters.Add("EXCLUDE_REGEX", SqlDbType.NVarChar, 5000).Value = Utils.NotNull(oProfile.FileExcludeRegex, String.Empty)
oCommand.Parameters.Add("SF_DATE_FORMAT", SqlDbType.NVarChar, 50).Value = Utils.NotNull(oProfile.SubfolderDateFormat, String.Empty)
oCommand.Parameters.Add("DEL_FILE_SUCCESS", SqlDbType.Bit).Value = oProfile.DeleteFiles
oCommand.Parameters.Add("INCL_SUBFOLDER", SqlDbType.Bit).Value = oProfile.IncludeSubfolders
oCommand.Parameters.Add("ACTIVE", SqlDbType.Bit).Value = oProfile.Active
@@ -213,9 +214,9 @@ Public Class UpdateProfile
oCommand.Parameters.Add("IDX_NAME", SqlDbType.NVarChar, 100).Value = oStep.IndexName
oCommand.Parameters.Add("METHOD", SqlDbType.NVarChar, 100).Value = oStep.Method
oCommand.Parameters.Add("ARGUMENT1", SqlDbType.NVarChar, 500).Value = oStep.Argument1
oCommand.Parameters.Add("ARGUMENT2", SqlDbType.NVarChar, 500).Value = oStep.Argument2
oCommand.Parameters.Add("ARGUMENT3", SqlDbType.NVarChar, 500).Value = oStep.Argument3
oCommand.Parameters.Add("ARGUMENT1", SqlDbType.NVarChar, 500).Value = Utils.NotNull(oStep.Argument1, String.Empty)
oCommand.Parameters.Add("ARGUMENT2", SqlDbType.NVarChar, 500).Value = Utils.NotNull(oStep.Argument2, String.Empty)
oCommand.Parameters.Add("ARGUMENT3", SqlDbType.NVarChar, 500).Value = Utils.NotNull(oStep.Argument3, String.Empty)
oCommand.Parameters.Add("SCOPE", SqlDbType.NVarChar, 50).Value = oStep.Scope
oCommand.Parameters.Add("ACTIVE", SqlDbType.Bit).Value = oStep.Active
oCommand.Parameters.Add("GUID", SqlDbType.Int).Value = oStep.Id
@@ -232,9 +233,11 @@ Public Class UpdateProfile
Private Function DoCreateImportProfileSteps(pData As UpdateProfileRequest, pIdList As List(Of Integer)) As Boolean
Dim oProfile = pData.ImportProfile
Dim oSQL As String = "INSERT INTO TBECM_JR_FIW_STEP
(PROFILE_ID, IDX_NAME, METHOD, ARGUMENT1, ARGUMENT2, ARGUMENT3, SCOPE, ACTIVE) VALUES
(@PROFILE_ID, @IDX_NAME, @METHOD, @ARGUMENT1, @ARGUMENT2, @ARGUMENT3, @SCOPE, @ACTIVE)"
Dim oSQL As String = "INSERT INTO TBECM_JR_FIW_STEP (
PROFILE_ID, IDX_NAME, METHOD, ARGUMENT1, ARGUMENT2, ARGUMENT3, SCOPE, ACTIVE
) VALUES (
@PROFILE_ID, @IDX_NAME, @METHOD, @ARGUMENT1, @ARGUMENT2, @ARGUMENT3, @SCOPE, @ACTIVE
)"
Dim oResults As New List(Of Boolean)
@@ -246,9 +249,9 @@ Public Class UpdateProfile
oCommand.Parameters.Add("PROFILE_ID", SqlDbType.Int).Value = oStep.ProfileId
oCommand.Parameters.Add("IDX_NAME", SqlDbType.NVarChar, 100).Value = oStep.IndexName
oCommand.Parameters.Add("METHOD", SqlDbType.NVarChar, 100).Value = oStep.Method
oCommand.Parameters.Add("ARGUMENT1", SqlDbType.NVarChar, 500).Value = oStep.Argument1
oCommand.Parameters.Add("ARGUMENT2", SqlDbType.NVarChar, 500).Value = oStep.Argument2
oCommand.Parameters.Add("ARGUMENT3", SqlDbType.NVarChar, 500).Value = oStep.Argument3
oCommand.Parameters.Add("ARGUMENT1", SqlDbType.NVarChar, 500).Value = Utils.NotNull(oStep.Argument1, String.Empty)
oCommand.Parameters.Add("ARGUMENT2", SqlDbType.NVarChar, 500).Value = Utils.NotNull(oStep.Argument2, String.Empty)
oCommand.Parameters.Add("ARGUMENT3", SqlDbType.NVarChar, 500).Value = Utils.NotNull(oStep.Argument3, String.Empty)
oCommand.Parameters.Add("SCOPE", SqlDbType.NVarChar, 50).Value = oStep.Scope
oCommand.Parameters.Add("ACTIVE", SqlDbType.Bit).Value = oStep.Active
@@ -270,11 +273,12 @@ Public Class UpdateProfile
For Each oId In pIdList
Try
Dim oStep = pData.ImportProfile.Steps.Where(Function(s) s.Id = oId).SingleOrDefault()
Logger.Debug("Preparing to delete Step [{0}]", oId)
Dim oCommand As New SqlClient.SqlCommand(oSQL)
oCommand.Parameters.Add("GUID", SqlDbType.Int).Value = oStep.Id
oCommand.Parameters.Add("GUID", SqlDbType.Int).Value = oId
Logger.Debug("Deleting Step [{0}]..", oId)
oResults.Add(Database.ExecuteNonQuery(oCommand))
Catch ex As Exception
oResults.Add(False)