using System.Data.Common; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; namespace DXPDAL.Kyc; public class PartyKycDAL : IPartyKycDAL { private readonly IQueryExecutor _QueryExecutor; public PartyKycDAL(IQueryExecutor queryExecutor) { _QueryExecutor = queryExecutor; } public async Task GetByIdAsync(int dxpPartyKycProfileId, LoginDTO login, CancellationToken ct) { return await _QueryExecutor.QuerySingleAsync( login, PartyKycQB.GET_BY_ID, new { DxpPartyKycProfileId = dxpPartyKycProfileId }, cancellationToken: ct).ConfigureAwait(false); } public async Task GetActiveByBranchLinkAsync(int dxpPartyBranchLinkId, LoginDTO login, CancellationToken ct) { return await _QueryExecutor.QuerySingleAsync( login, PartyKycQB.GET_ACTIVE_BY_BRANCH_LINK, new { DxpPartyBranchLinkId = dxpPartyBranchLinkId }, cancellationToken: ct).ConfigureAwait(false); } public async Task SaveAsync(PartyKycProfileDTO dto, LoginDTO login, DbTransaction tx, CancellationToken ct) { await _QueryExecutor.ExecuteAsync( login, PartyKycQB.INSERT, dto, tx, cancellationToken: ct).ConfigureAwait(false); } public async Task SupersedeAsync(int dxpPartyKycProfileId, LoginDTO login, DbTransaction tx, CancellationToken ct) { var param = new { DxpPartyKycProfileId = dxpPartyKycProfileId, ModifiedById = login.UserId, ModifiedOn = DateTime.UtcNow }; await _QueryExecutor.ExecuteAsync( login, PartyKycQB.SUPERSEDE, param, tx, cancellationToken: ct).ConfigureAwait(false); } public async Task VerifyAsync(PartyKycProfileDTO dto, LoginDTO login, DbTransaction tx, CancellationToken ct) { await _QueryExecutor.ExecuteAsync( login, PartyKycQB.VERIFY, dto, tx, cancellationToken: ct).ConfigureAwait(false); } }