using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using SwDAL.DTO.RefDataSource; using SwDAL.Query.RefDataSource; namespace SwDAL.CustomCode.RefDataSource; public class RefDataSourceDAL : IRefDataSourceDAL { private readonly IQueryExecutor _QueryExecutor; public RefDataSourceDAL(IQueryExecutor queryExecutor) => _QueryExecutor = queryExecutor; public async Task GetById(int refDataSourceId, LoginDTO loginDTO, CancellationToken ct) => await _QueryExecutor.QuerySingleAsync( loginDTO, RefDataSourceQB.GET_BY_ID, new { RefDataSourceId = refDataSourceId, TenantId = loginDTO.ClientId }, cancellationToken: ct) .ConfigureAwait(false); public async Task> GetByDbModel(int dbModelId, LoginDTO loginDTO, CancellationToken ct) => await _QueryExecutor.QueryAsync( loginDTO, RefDataSourceQB.GET_BY_DBMODEL, new { DbModelId = dbModelId, TenantId = loginDTO.ClientId }, cancellationToken: ct) .ConfigureAwait(false); public async Task Insert(RefDataSourceDTO dto, LoginDTO loginDTO, CancellationToken ct) => await _QueryExecutor.ExecuteAsync(loginDTO, RefDataSourceQB.INSERT, dto, cancellationToken: ct) .ConfigureAwait(false); public async Task Update(RefDataSourceDTO dto, LoginDTO loginDTO, CancellationToken ct) => await _QueryExecutor.ExecuteAsync(loginDTO, RefDataSourceQB.UPDATE, dto, cancellationToken: ct) .ConfigureAwait(false); public async Task Delete(int refDataSourceId, LoginDTO loginDTO, CancellationToken ct) => await _QueryExecutor.ExecuteAsync( loginDTO, RefDataSourceQB.DELETE, new { RefDataSourceId = refDataSourceId, ModifiedById = loginDTO.UserId, ModifiedOn = DateTime.UtcNow, TenantId = loginDTO.ClientId }, cancellationToken: ct) .ConfigureAwait(false); }