* Fixed New Task creation

* Change Scheduler view
This commit is contained in:
2025-02-14 19:46:34 +01:00
parent c0fed5b3ec
commit d35955b461
5 changed files with 33 additions and 17 deletions

View File

@@ -88,21 +88,24 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
{
var tasks = await service.GetTaskSchedulers();
// foreach (TaskSchedulerDto taskSchedulerDto in tasks)
// {
// taskSchedulerDto.JobDetails = GetJob(taskSchedulerDto.Name);
// }
foreach (TaskSchedulerDto taskSchedulerDto in tasks)
{
var job = GetJob(taskSchedulerDto.Name);
taskSchedulerDto.LastExecution = job?.LastExecution;
taskSchedulerDto.NextExecution = job?.NextExecution;
}
return Ok(tasks);
}
private JobData? GetJob(string jobId)
private RecurringJobDto? GetJob(string jobId)
{
using IStorageConnection? connection = jobStorage.GetConnection();
return connection.GetJobData(jobId);
IList<RecurringJobDto>? recurringJobs = connection.GetRecurringJobs();
return recurringJobs.FirstOrDefault(x => x.Id == jobId);
}
private void RunConsoleApplication(string pathToApp)
public void RunConsoleApplication(string pathToApp)
{
try
{

View File

@@ -11,7 +11,7 @@ public class ScheduleJobService(IEmailService emailService, IServiceScopeFactory
using var scope = scopeFactory.CreateScope();
IEdiCustomerOrderService ediCustomerOrderService = scope.ServiceProvider.GetRequiredService<IEdiCustomerOrderService>();
IEnumerable<EdiCustomerOrderTranslateDto> missingOrders =
(await ediCustomerOrderService.FindMissingOrders(new DateTime(2025, 2, 5))).ToList();
(await ediCustomerOrderService.FindMissingOrders(DateTime.Now.AddDays(-1))).ToList();
if (missingOrders.Any())
{