using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using Newtonsoft.Json; using TMSDAL.DTO.TxSkillUpgrade; using TMSDAL.Query.TxSkillUpgrade; namespace TMSDAL.CustomCode.TxSkillUpgrade { public class TxSkillUpgradeDAL : ITxSkillUpgradeDAL { private readonly IQueryExecutor _QueryExecutor; public TxSkillUpgradeDAL(IQueryExecutor QueryExecutor) { _QueryExecutor = QueryExecutor; } public async Task GetTxSkillUpgrade(int txSkillUpgradeId, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _QueryExecutor.QuerySingleAsync( loginDTO, TxSkillUpgradeQB.GET_TXSKILLUPGRADE, new { txskillupgradeid = txSkillUpgradeId, tenantid = loginDTO.ClientId }, cancellationToken: ct).ConfigureAwait(false); return JsonConvert.SerializeObject(result); } catch (Exception) { throw; } } public async Task GetTxSkillUpgradeList(int upgradeStatus, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _QueryExecutor.QueryAsync( loginDTO, TxSkillUpgradeQB.GET_TXSKILLUPGRADE_LIST, new { upgradestatus = upgradeStatus, tenantid = loginDTO.ClientId }, cancellationToken: ct).ConfigureAwait(false); return JsonConvert.SerializeObject(result); } catch (Exception) { throw; } } public async Task SaveTxSkillUpgrade(TxSkillUpgradeDTO dto, LoginDTO loginDTO, CancellationToken ct) { try { return await _QueryExecutor.ExecuteAsync( loginDTO, TxSkillUpgradeQB.SAVE_TXSKILLUPGRADE, dto, cancellationToken: ct).ConfigureAwait(false); } catch (Exception) { throw; } } public async Task GetSelectListTxSkillUpgrade(CriteriaDTO criteriaDTO, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _QueryExecutor.QueryWithCriteriaAsync( loginDTO, TxSkillUpgradeQB.GET_SELECTLIST_TXSKILLUPGRADE, new { TenantId = loginDTO.ClientId }, criteriaDTO, ct).ConfigureAwait(false); return JsonConvert.SerializeObject(result); } catch (Exception) { throw; } } public async Task UpdateTxSkillUpgrade(TxSkillUpgradeDTO dto, LoginDTO loginDTO, CancellationToken ct) { try { return await _QueryExecutor.ExecuteAsync( loginDTO, TxSkillUpgradeQB.UPDATE_TXSKILLUPGRADE, dto, cancellationToken: ct).ConfigureAwait(false); } catch (Exception) { throw; } } public async Task DeleteTxSkillUpgrade(int txSkillUpgradeId, LoginDTO loginDTO, CancellationToken ct) { try { return await _QueryExecutor.ExecuteAsync( loginDTO, TxSkillUpgradeQB.DELETE_TXSKILLUPGRADE, new { TxSkillUpgradeId = txSkillUpgradeId, TenantId = loginDTO.ClientId }, cancellationToken: ct).ConfigureAwait(false); } catch (Exception) { throw; } } public async Task ReviewTxSkillUpgrade(TxSkillUpgradeDTO dto, LoginDTO loginDTO, CancellationToken ct) { try { return await _QueryExecutor.ExecuteAsync( loginDTO, TxSkillUpgradeQB.REVIEW_TXSKILLUPGRADE, dto, cancellationToken: ct).ConfigureAwait(false); } catch (Exception) { throw; } } public async Task GetEmployeeIdForUpgrade(int txSkillUpgradeId, LoginDTO loginDTO, CancellationToken ct) { try { return await _QueryExecutor.QuerySingleAsync( loginDTO, TxSkillUpgradeQB.GET_TXSKILLUPGRADE_EMPLOYEEID, new { txskillupgradeid = txSkillUpgradeId, tenantid = loginDTO.ClientId }, cancellationToken: ct).ConfigureAwait(false); } catch (Exception) { throw; } } public async Task GetEmployeeIdByEnrollment(int enrollmentId, LoginDTO loginDTO, CancellationToken ct) { try { return await _QueryExecutor.QuerySingleAsync( loginDTO, TxSkillUpgradeQB.GET_EMPLOYEEID_BY_ENROLLMENT, new { enrollmentid = enrollmentId, tenantid = loginDTO.ClientId }, cancellationToken: ct).ConfigureAwait(false); } catch (Exception) { throw; } } } }