using ComplianceDAL.DTO.GSTRegistration; using ComplianceDAL.Query.GSTRegistration; using GB5Shared.DTO.Framework.Login; using GB5Shared.QueryExecutor; using Newtonsoft.Json; namespace ComplianceDAL.CustomCode.GSTRegistration; public class GSTRegistrationDAL : IGSTRegistrationDAL { private readonly IQueryExecutor _queryExecutor; public GSTRegistrationDAL(IQueryExecutor queryExecutor) => _queryExecutor = queryExecutor; public async Task GetGSTRegistration(int gstRegistrationId, LoginDTO login, CancellationToken ct) { var result = await _queryExecutor.QuerySingleAsync( login, GSTRegistrationQB.GET_GST_REGISTRATION, new { GSTRegistrationId = gstRegistrationId }).ConfigureAwait(false); return JsonConvert.SerializeObject(result); } public async Task GetGSTRegistrationList(LoginDTO login, CancellationToken ct) { var result = await _queryExecutor.QueryAsync( login, GSTRegistrationQB.GET_GST_REGISTRATION_LIST, new { }, cancellationToken: ct).ConfigureAwait(false); return JsonConvert.SerializeObject(result); } public async Task GetSelectListGSTRegistration(LoginDTO login, CancellationToken ct) { var result = await _queryExecutor.QueryAsync( login, GSTRegistrationQB.GET_GST_REGISTRATION_SELECT_LIST, new { }, cancellationToken: ct).ConfigureAwait(false); return JsonConvert.SerializeObject(result); } public async Task SaveGSTRegistration(GSTRegistrationDTO dto, LoginDTO login, CancellationToken ct) { await _queryExecutor.ExecuteAsync( login, GSTRegistrationQB.SAVE_GST_REGISTRATION, new { dto.GSTRegistrationId, dto.GSTIN, dto.LegalName, dto.TradeName, dto.StateCode, dto.StateName, dto.RegistrationType, dto.OUId, dto.OUName, dto.IsActive, dto.CreatedById, login.ClientId, login.DatabaseName }, cancellationToken: ct).ConfigureAwait(false); } public async Task UpdateGSTRegistration(GSTRegistrationDTO dto, LoginDTO login, CancellationToken ct) { await _queryExecutor.ExecuteAsync( login, GSTRegistrationQB.UPDATE_GST_REGISTRATION, new { dto.GSTRegistrationId, dto.GSTIN, dto.LegalName, dto.TradeName, dto.StateCode, dto.StateName, dto.RegistrationType, dto.OUId, dto.OUName, dto.IsActive, dto.ModifiedById, login.ClientId, login.DatabaseName }, cancellationToken: ct).ConfigureAwait(false); } public async Task DeleteGSTRegistration(int gstRegistrationId, int modifiedById, LoginDTO login, CancellationToken ct) { await _queryExecutor.ExecuteAsync( login, GSTRegistrationQB.DELETE_GST_REGISTRATION, new { GSTRegistrationId = gstRegistrationId, ModifiedById = modifiedById, login.ClientId, login.DatabaseName }, cancellationToken: ct).ConfigureAwait(false); } }