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.
 
 
 

37 lines
1.3 KiB

using Dapper;
using DealerSelection.Api.Infrastructure.Mulesoft;
using DealerSelection.Api.Models;
using DealerSelection.Common.Data.Dapper;
using Microsoft.Extensions.Logging;
using System.Data;
using System.Data.SqlClient;
namespace DealerSelection.Api.Infrastructure.BatchJob;
public class Repository : RepositoryBaseDapperAsync, IRepository
{
private readonly ILogger _logger;
public Repository(string cxnName, ILogger<Repository> logger) : base(cxnName)
{
_logger = logger;
}
public async Task<List<MulesoftCustomerInfoDto>> Get24HrOldRecordsForJobProcessing()
{
try
{
using (SqlConnection cxn = await OpenCxnAsync())
{
IEnumerable<MulesoftCustomerInfoDto> cusotmerInfo = await cxn.QueryAsync<MulesoftCustomerInfoDto>(Procedure.Get24HrOldRecordsForJobProcessing,
commandType: CommandType.StoredProcedure);
return cusotmerInfo.ToList();
}
}
catch (Exception ex)
{
_logger.LogError($"DS Repo:-Error at Repository:BatchJob in Get24HrOldRecordsForJobProcessing.", ex.StackTrace);
throw new UnexpectedDataException("Error at Repository:BatchJob in Get24HrOldRecordsForJobProcessing.", ex);
}
}
}