public static void InsertJobHistory(this ISchedulerOptions options, string batchId, string jobId, string clientIp = null, string connectionId = null) { using (var conn = options.CreateConnection()) { var currentDatetimeSql = options.GetCurrentDatetimeSql(); conn.Execute($"INSERT INTO scheduler_job_history (batchid, jobid, status,clientip,connectionid,creationtime,lastmodificationtime) values (@BatchId,@JobId,@Status,@ClientIp,@ConnectionId,{currentDatetimeSql},{currentDatetimeSql})", new { BatchId = batchId, JobId = jobId, Status = JobStatus.Fire, ClientIp = clientIp, ConnectionId = connectionId }); } }
public static void ChangeJobHistoryStatus(this ISchedulerOptions options, string batchId, string jobId, string clientIp, string connectionId, JobStatus status) { using (var conn = options.CreateConnection()) { conn.Execute($"UPDATE scheduler_job_history SET status = @Status, lastmodificationtime={options.GetCurrentDatetimeSql()} WHERE batchid=@BatchId AND jobid=@JobId AND clientip=@ClientIp AND connectionid=@ConnectionId", new { BatchId = batchId, JobId = jobId, Status = status, ClientIp = clientIp, ConnectionId = connectionId }); } }