You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
1.4 KiB

using DealerSelection.Api.CommonUtil;
using DealerSelection.Api.Infrastructure.BatchJob;
using DealerSelection.Api.Infrastructure.Mulesoft;
using DealerSelection.Api.Interface;
using DealerSelection.Api.Models.Enum;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
public class BatchJobApi : IBatchJobApi
{
private readonly ILogger _logger;
private DealerSelection.Api.Infrastructure.BatchJob.IRepository Repository { get; }
private IMulesoftApi MulesoftApi { get; }
public BatchJobApi(DealerSelection.Api.Infrastructure.BatchJob.IRepository repository, ILogger<MulesoftApi> logger, IMulesoftApi mulesoftApi)
{
Repository = repository;
_logger = logger;
MulesoftApi = mulesoftApi;
}
public async Task Process24HrOldRecords()
{
try
{
List<MulesoftCustomerInfoDto> customerInfo = await Repository.Get24HrOldRecordsForJobProcessing();
foreach (var item in customerInfo)
{
CustomCfg cfg = CustomCfg.GetCustomCfg(item.BuId);
item.DealerCode = cfg.DeafaultDealerCode;
item.DealerSelectedMode = DealerSelectedMode.Dummy.ToString();
await MulesoftApi.InsertLSQData(item);
}
}
catch (Exception ex)
{
_logger.LogError($"DS Api:-Api:- BatchJob:- " + ex.StackTrace.ToString());
}
}
}