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.
60 lines
2.1 KiB
60 lines
2.1 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);
|
|
}
|
|
}
|
|
|
|
public async Task<List<MulesoftCustomerInfoDto>> GetDataForLsqPush(int buId)
|
|
{
|
|
try
|
|
{
|
|
using (SqlConnection cxn = await OpenCxnAsync())
|
|
{
|
|
IEnumerable<MulesoftCustomerInfoDto> lsqDto = await cxn.QueryAsync<MulesoftCustomerInfoDto>(Procedure.GetDataForLsqPush,
|
|
new
|
|
{
|
|
buId
|
|
},
|
|
commandType: CommandType.StoredProcedure);
|
|
return lsqDto.ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError("BU:- " + buId.ToString() + "Error at Repository:Mulesoft in GetDataForLsqPush " + ex.Message.ToString());
|
|
throw new UnexpectedDataException($"Error at Repository:Mulesoft in GetDataForLsqPush for BuId: {buId}.", ex);
|
|
}
|
|
|
|
}
|
|
|
|
}
|