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; using static iTextSharp.text.pdf.AcroFields; 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 logger, IMulesoftApi mulesoftApi) { Repository = repository; _logger = logger; MulesoftApi = mulesoftApi; } public async Task Process24HrOldRecords() { try { List 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()); } } public async Task LeadCreateApiCall(int buId) { try { List lsqCustomerDataList = await Repository.GetDataForLsqPush(buId); foreach (var lsqCustomerData in lsqCustomerDataList) { await MulesoftApi.InsertLSQData(lsqCustomerData); // await MulesoftApi.CallBookingApi(buId, lsqCustomerData); } } catch (Exception ex) { _logger.LogError("PendingStatusUpdateApi LeadCreateApiCall " + ex.Message.ToString()); } } }