using System.Runtime.CompilerServices; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using RecruitmentDAL.DTO.Reports; using RecruitmentDAL.Query.Reports; namespace RecruitmentDAL.CustomeCode.Reports.DeiSourcingReport { public class DeiSourcingReportDAL : IDeiSourcingReportDAL { private readonly IQueryExecutor _QueryExecutor; public DeiSourcingReportDAL(IQueryExecutor queryExecutor) { _QueryExecutor = queryExecutor; } // Bounded aggregate (5 dimensions x a handful of values x <=6 Source values per tenant — // same bounded-cardinality shape as CandidateSourceQualityQB) — no real SQL-level // OFFSET/FETCH, matching that report's own precedent/doc comment. Offset/PageSize are // intentionally not added to the parameter set: the SQL text never references them. public async Task> GetDeiSourcingReportRaw( int firstNumber, int maxResult, LoginDTO login, CancellationToken ct) { var parameters = BuildParameters(login); return await _QueryExecutor .QueryPagedAsync(login, DeiSourcingReportQB.GET_DEI_SOURCING_REPORT, parameters) .ConfigureAwait(false); } public async IAsyncEnumerable GetDeiSourcingReportRawStream( LoginDTO login, [EnumeratorCancellation] CancellationToken ct) { var parameters = BuildParameters(login); await foreach (var row in _QueryExecutor .QueryStreamAsync(login, DeiSourcingReportQB.GET_DEI_SOURCING_REPORT, parameters, ct) .ConfigureAwait(false)) { yield return row; } } private static Dapper.DynamicParameters BuildParameters(LoginDTO login) { var p = new Dapper.DynamicParameters(); p.Add("TenantId", login.ClientId); return p; } } }