123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using EVCB_OCPP.TaskScheduler.Services;
- using Quartz;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EVCB_OCPP.TaskScheduler.Jobs
- {
- [DisallowConcurrentExecution]
- public class ExecutionCmdReportJob : IJob
- {
- private NLog.ILogger logger = NLog.LogManager.GetCurrentClassLogger();
- public ExecutionCmdReportJob()
- {
- }
- public async Task Execute(IJobExecutionContext context)
- {
- await Console.Out.WriteLineAsync(this.ToString() + " :Starting........");
- List<Task> tList = new List<Task>();
- ICustomerService cs = new CommonCustomerService();
- var cList = cs.GetCallPartnerCustomers();
- foreach (var customerId in cList)
- {
- ICustomerService s = CustomerBackendFactory.Create(customerId);
- tList.Add(Task.Run(() => DoMainTask(customerId)));
- }
- Task.WaitAll(tList.ToArray());
- await Console.Out.WriteLineAsync(this.ToString() + " :Finished........");
- }
- private void DoMainTask(Guid customerId)
- {
- ICustomerService _service = CustomerBackendFactory.Create(customerId);
- _service.ReportExecutionofRemoteCommand().Wait();
- }
- }
- }
|