Adding
This commit is contained in:
+88
@@ -0,0 +1,88 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.ApiSecurity.Enums;
|
||||
using LCU.Library.Internal.ApiSecurity.Models;
|
||||
using LCU.Library.Internal.CoreApiWrapperLib.Configuration;
|
||||
using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities;
|
||||
using LCU.Library.Internal.CoreApiWrapperLib.Utilities;
|
||||
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests;
|
||||
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements;
|
||||
using LCU.Library.Internal.LcuHttpClient.HttpRequest;
|
||||
|
||||
namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess
|
||||
{
|
||||
public class AgreePersonDao : IAgreePersonDao
|
||||
{
|
||||
private readonly ICoreDbExecution _coreDbExecution;
|
||||
private readonly CoreSoapApiConfiguration _coreSoapApiConfiguration;
|
||||
private readonly ApiSecurityConfiguration _apiSecurityConfiguration;
|
||||
private readonly IPutRequest _putRequest;
|
||||
|
||||
private const string SoapClientKeyValue = "CoreSoapApiWrapper";
|
||||
|
||||
private const string AgreePersonByUserIdQuery = "AgreePerson/AgreePersonByUserIdQuery";
|
||||
private const string GetAgreePersonsQuery = "AgreePerson/GetAgreePersonsQuery";
|
||||
private const string AgreePersonsWithHyphenatedUserIdQuery = "AgreePerson/AgreePersonsWithHyphenatedUserIdQuery";
|
||||
private const string GetActiveCustodialAgreePersonNumbers = "AgreePerson/GetActiveCustodialAgreePersonNumbers";
|
||||
private const string GetActiveCustodialVruCardAgreementAgreePersons = "AgreePerson/GetActiveCustodialVruCardAgreementAgreePersons";
|
||||
|
||||
|
||||
public AgreePersonDao(ICoreDbExecution coreDbExecution,
|
||||
CoreConfiguration coreConfiguration,
|
||||
ApiSecurityConfiguration apiSecurityConfiguration,
|
||||
IPutRequest putRequest)
|
||||
{
|
||||
_coreDbExecution = coreDbExecution;
|
||||
_coreSoapApiConfiguration = coreConfiguration.CoreSoapApiConfiguration;
|
||||
_apiSecurityConfiguration = apiSecurityConfiguration;
|
||||
_putRequest = putRequest;
|
||||
}
|
||||
|
||||
public async Task<AgreePerson> FindByUserId(string userId)
|
||||
{
|
||||
var query = QueryUtilities.GetQuery(AgreePersonByUserIdQuery);
|
||||
var userIdParams = new { userId = userId };
|
||||
var result = await _coreDbExecution.ExecuteQuery<AgreePerson, object>(query, userIdParams);
|
||||
return result.FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AgreePerson>> FindAgreePersons(int fetchAmount)
|
||||
{
|
||||
var query = QueryUtilities.GetQuery(GetAgreePersonsQuery);
|
||||
var fectAmountParam = new { fetchAmount = fetchAmount };
|
||||
var result = await _coreDbExecution.ExecuteQuery<AgreePerson, object>(query, fectAmountParam);
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AgreePerson>> FindAgreePersonsWithHyphenatedUserId()
|
||||
{
|
||||
var query = QueryUtilities.GetQuery(AgreePersonsWithHyphenatedUserIdQuery);
|
||||
var result = await _coreDbExecution.ExecuteQuery<AgreePerson>(query);
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<string>> FindActiveCustodialAgreePersonNumbers()
|
||||
{
|
||||
var query = QueryUtilities.GetQuery(GetActiveCustodialAgreePersonNumbers);
|
||||
var result = await _coreDbExecution.ExecuteQuery<string>(query);
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AgreePerson>> FindActiveCustodialVruCardAgreementAgreePersons()
|
||||
{
|
||||
var query = QueryUtilities.GetQuery(GetActiveCustodialVruCardAgreementAgreePersons);
|
||||
var result = await _coreDbExecution.ExecuteQuery<AgreePerson>(query);
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<BasicResponse> UpdatePersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest)
|
||||
{
|
||||
var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutPersonAgreementsDetailTypes);
|
||||
var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet));
|
||||
|
||||
return await _putRequest.Async<PersonAgreementDetailTypeRequest, BasicResponse>(endpoint, personAgreementDetailTypeRequest, headers, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user