06-12-2022
This commit is contained in:
@@ -18,8 +18,6 @@ Public Class GetJobConfig
|
||||
.JobDefinitions = State.JobDefinitions
|
||||
}
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Public Class GetJobConfigResponse
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports ECM.JobRunner.Common
|
||||
Imports System.Runtime.Serialization
|
||||
|
||||
Public Class GetJobHistory
|
||||
Public Class GetJobHistoryMethod
|
||||
Inherits Base.BaseMethod
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pState As State)
|
||||
MyBase.New(pLogConfig, pDatabase, pState)
|
||||
End Sub
|
||||
|
||||
Public Function Run() As GetJobHistoryResponse
|
||||
Return New GetJobHistoryResponse With {.Items = State.JobHistory.Entries}
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Class GetJobHistoryResponse
|
||||
Inherits Base.BaseResponse
|
||||
|
||||
<DataMember>
|
||||
Public Property Items As List(Of HistoryItem)
|
||||
End Class
|
||||
End Class
|
||||
37
ECM.JobRunner.Windows/WCF/Methods/GetJobStatus.vb
Normal file
37
ECM.JobRunner.Windows/WCF/Methods/GetJobStatus.vb
Normal file
@@ -0,0 +1,37 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Runtime.Serialization
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports ECM.JobRunner.Common
|
||||
Imports ECM.JobRunner.Windows.Scheduler
|
||||
|
||||
Public Class GetJobStatus
|
||||
Public Class GetJobStatusMethod
|
||||
Inherits Base.BaseMethod
|
||||
|
||||
Private ReadOnly Scheduler As JobScheduler
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pState As State, pScheduler As JobScheduler)
|
||||
MyBase.New(pLogConfig, pDatabase, pState)
|
||||
Scheduler = pScheduler
|
||||
End Sub
|
||||
|
||||
Public Function Run() As GetJobStatusResponse
|
||||
Return New GetJobStatusResponse With {
|
||||
.HistoryItems = State.JobHistory.Entries,
|
||||
.StatusItems = State.JobStatus.Entries
|
||||
}
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Public Class GetJobStatusResponse
|
||||
Inherits Base.BaseResponse
|
||||
|
||||
<DataMember>
|
||||
Public Property HistoryItems As List(Of HistoryItem)
|
||||
|
||||
<DataMember>
|
||||
Public Property StatusItems As List(Of StatusItem)
|
||||
End Class
|
||||
End Class
|
||||
93
ECM.JobRunner.Windows/WCF/Methods/UpdateJob.vb
Normal file
93
ECM.JobRunner.Windows/WCF/Methods/UpdateJob.vb
Normal file
@@ -0,0 +1,93 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports ECM.JobRunner.Common
|
||||
Imports ECM.JobRunner.Windows.Scheduler
|
||||
|
||||
Public Class UpdateJob
|
||||
Public Class UpdateJobMethod
|
||||
Inherits Base.BaseMethod
|
||||
|
||||
Private ReadOnly Scheduler As JobScheduler
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pState As State, pScheduler As JobScheduler)
|
||||
MyBase.New(pLogConfig, pDatabase, pState)
|
||||
Scheduler = pScheduler
|
||||
End Sub
|
||||
|
||||
Public Function Run(pData As UpdateJobRequest) As UpdateJobResponse
|
||||
Dim oResponse As Boolean = False
|
||||
|
||||
Select Case pData.Action
|
||||
Case UpdateJobRequest.UpdateJobAction.Update
|
||||
oResponse = DoUpdateJob(pData)
|
||||
|
||||
Case UpdateJobRequest.UpdateJobAction.Create
|
||||
oResponse = DoCreateJob(pData)
|
||||
|
||||
Case UpdateJobRequest.UpdateJobAction.Delete
|
||||
oResponse = DoDeleteJob(pData)
|
||||
|
||||
End Select
|
||||
|
||||
If oResponse Then
|
||||
Scheduler.Reload()
|
||||
End If
|
||||
|
||||
Return New UpdateJobResponse With {.OK = oResponse}
|
||||
End Function
|
||||
|
||||
Private Function DoUpdateJob(pData As UpdateJobRequest) As Boolean
|
||||
Dim oJob = pData.Job
|
||||
Dim oSQL As String = "UPDATE TBECM_JR_JOB SET TITLE = @TITLE, QUARTZ_DEF = @CRON, JOB_TYPE_ID = @TYPE_ID, ACTIVE = @ACTIVE WHERE GUID = @GUID"
|
||||
Dim oCommand As New SqlClient.SqlCommand(oSQL)
|
||||
|
||||
oCommand.Parameters.Add("TITLE", SqlDbType.NVarChar, 250).Value = oJob.Name
|
||||
oCommand.Parameters.Add("CRON", SqlDbType.NVarChar, 250).Value = oJob.CronSchedule
|
||||
oCommand.Parameters.Add("TYPE_ID", SqlDbType.Int).Value = oJob.TypeId
|
||||
oCommand.Parameters.Add("ACTIVE", SqlDbType.Bit).Value = oJob.Active
|
||||
oCommand.Parameters.Add("GUID", SqlDbType.Int).Value = oJob.Id
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand)
|
||||
End Function
|
||||
|
||||
Private Function DoCreateJob(pData As UpdateJobRequest) As Boolean
|
||||
Dim oJob = pData.Job
|
||||
Dim oSQL As String = "INSERT INTO TBECM_JR_JOB (TITLE, QUARTZ_DEF, JOB_TYPE_ID, ACTIVE) VALUES (@TITLE, @CRON, @TYPE_ID, @ACTIVE)"
|
||||
Dim oCommand As New SqlClient.SqlCommand(oSQL)
|
||||
|
||||
oCommand.Parameters.Add("TITLE", SqlDbType.NVarChar, 250).Value = oJob.Name
|
||||
oCommand.Parameters.Add("CRON", SqlDbType.NVarChar, 250).Value = oJob.CronSchedule
|
||||
oCommand.Parameters.Add("TYPE_ID", SqlDbType.Int).Value = oJob.TypeId
|
||||
oCommand.Parameters.Add("ACTIVE", SqlDbType.Bit).Value = oJob.Active
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand)
|
||||
End Function
|
||||
|
||||
Private Function DoDeleteJob(pData As UpdateJobRequest) As Boolean
|
||||
Dim oJob = pData.Job
|
||||
Dim oSQL As String = "DELETE FROM TBECM_JR_JOB WHERE GUID = @GUID"
|
||||
Dim oCommand As New SqlClient.SqlCommand(oSQL)
|
||||
|
||||
oCommand.Parameters.Add("GUID", SqlDbType.Int).Value = oJob.Id
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Public Class UpdateJobRequest
|
||||
Public Enum UpdateJobAction
|
||||
Create
|
||||
Update
|
||||
Delete
|
||||
End Enum
|
||||
|
||||
Public Action As UpdateJobAction
|
||||
Public Job As JobRunnerReference.JobDefinition
|
||||
End Class
|
||||
|
||||
Public Class UpdateJobResponse
|
||||
Inherits Base.BaseResponse
|
||||
End Class
|
||||
End Class
|
||||
Reference in New Issue
Block a user