using FrameworkDAL.DTO.ActionRunMonitor; using FrameworkDAL.Query.ActionRunMonitor; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace FrameworkDAL.CustomCode.ActionRunMonitor { public sealed class ActionRunMonitorDAL : IActionRunMonitorDAL { private readonly IQueryExecutor _qe; public ActionRunMonitorDAL(IQueryExecutor qe) => _qe = qe; public async Task> GetHistoryAsync( int? runStatus, DateTime? dateFrom, DateTime? dateTo, int pageOffset, int pageSize, LoginDTO login, CancellationToken ct = default) => (await _qe.QueryAsync( login, ActionRunMonitorQB.GET_HISTORY, new { TenantId = login.ClientId, RunStatus = runStatus, DateFrom = dateFrom, DateTo = dateTo, PageOffset = pageOffset, PageSize = pageSize }, cancellationToken: ct).ConfigureAwait(false)).ToList(); public async Task> GetByCorrelationAsync( string correlationKey, LoginDTO login, CancellationToken ct = default) => (await _qe.QueryAsync( login, ActionRunMonitorQB.GET_BY_CORRELATION, new { TenantId = login.ClientId, CorrelationKey = correlationKey }, cancellationToken: ct).ConfigureAwait(false)).ToList(); } }