using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using QMSDAL.DTO; using QMSDAL.Query.PcsAnalytics; namespace QMSDAL.CustomCode.PcsAnalytics { public class PcsAnalyticsDAL : IPcsAnalyticsDAL { private readonly IQueryExecutor _QueryExecutor; public PcsAnalyticsDAL(IQueryExecutor queryExecutor) { _QueryExecutor = queryExecutor; } public async Task GetKpiAsync( int ouId, int periodId, LoginDTO login, CancellationToken ct = default) { try { var param = new { OuId = ouId, PeriodId = periodId, TenantId = login.ClientId}; var result = await _QueryExecutor .QuerySingleAsync(login, PcsAnalyticsQB.GET_PCS_KPI, param, cancellationToken: ct) .ConfigureAwait(false); return result ?? new PcsKpiDTO(); } catch (Exception) { throw; } } public async Task> GetBottleneckAsync( int ouId, int periodId, LoginDTO login, CancellationToken ct = default) { try { var param = new { OuId = ouId, PeriodId = periodId, TenantId = login.ClientId }; var result = await _QueryExecutor .QueryAsync(login, PcsAnalyticsQB.GET_BOTTLENECK, param, cancellationToken: ct) .ConfigureAwait(false); return result ?? Enumerable.Empty(); } catch (Exception) { throw; } } public async Task> GetMaterialTraceAsync( int ouId, int periodId, LoginDTO login, CancellationToken ct = default) { try { var param = new { OuId = ouId, PeriodId = periodId, TenantId = login.ClientId }; var result = await _QueryExecutor .QueryAsync(login, PcsAnalyticsQB.GET_MATERIAL_TRACE, param, cancellationToken: ct) .ConfigureAwait(false); return result ?? Enumerable.Empty(); } catch (Exception) { throw; } } } }