using FrameworkDAL.DTO.EIPConversation; using FrameworkDAL.Query.ActionProcessor; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace FrameworkDAL.CustomCode.ActionProcessor { public class EventActionRunAdminDAL : IEventActionRunAdminDAL { private readonly IQueryExecutor _qe; private readonly ILogger _logger; public EventActionRunAdminDAL(IQueryExecutor qe, ILogger logger) { _qe = qe ?? throw new ArgumentNullException(nameof(qe)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); } public async Task> GetRunListAsync( int? runStatus, string? actionCode, DateTime? fromDate, DateTime? toDate, LoginDTO login, CancellationToken ct = default) { ct.ThrowIfCancellationRequested(); try { _logger.LogInformation( "DAL | GetRunList | Tenant={TenantId} | RunStatus={RunStatus} | ActionCode={ActionCode}", login.ClientId, runStatus, actionCode); var result = await _qe.QueryAsync( login, EventActionRunAdminQB.GET_RUN_LIST, new { TenantId = login.ClientId, RunStatus = runStatus, ActionCode = actionCode, FromDate = fromDate, ToDate = toDate }, cancellationToken: ct).ConfigureAwait(false); return result ?? []; } catch (OperationCanceledException) { _logger.LogWarning("DAL | GetRunList | Cancelled | Tenant={TenantId}", login.ClientId); throw; } catch (Exception ex) { _logger.LogError(ex, "DAL | GetRunList | Error | Tenant={TenantId}", login.ClientId); throw; } } } }