using System.Runtime.CompilerServices; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using RecruitmentDAL.DTO.Reports; using RecruitmentDAL.Query.Reports; namespace RecruitmentDAL.CustomeCode.Reports.ApplicationCycleTime { public class ApplicationCycleTimeDAL : IApplicationCycleTimeDAL { private readonly IQueryExecutor _QueryExecutor; public ApplicationCycleTimeDAL(IQueryExecutor queryExecutor) { _QueryExecutor = queryExecutor; } public async Task> GetApplicationCycleTime( int firstNumber, int maxResult, int? jobRequisitionId, LoginDTO login, CancellationToken ct) { var parameters = new { TenantId = login.ClientId, JobRequisitionId = jobRequisitionId, Offset = Math.Max(0, firstNumber - 1), PageSize = maxResult > 0 ? maxResult : 500 }; // NOTE: IQueryExecutor.QueryPagedAsync has no CancellationToken parameter (confirmed // against ~40 real call sites, e.g. CandidateDAL.GetSelectListCandidate) — ct is // deliberately not forwarded into this call. return await _QueryExecutor .QueryPagedAsync(login, ApplicationCycleTimeQB.GET_APPLICATION_CYCLE_TIME_PAGED, parameters) .ConfigureAwait(false); } public async IAsyncEnumerable GetApplicationCycleTimeStream( int? jobRequisitionId, LoginDTO login, [EnumeratorCancellation] CancellationToken ct) { var parameters = new { TenantId = login.ClientId, JobRequisitionId = jobRequisitionId }; await foreach (var row in _QueryExecutor .QueryStreamAsync(login, ApplicationCycleTimeQB.GET_APPLICATION_CYCLE_TIME, parameters, ct) .ConfigureAwait(false)) { yield return row; } } } }