Files
rm-ventas/backend/src/Ventas.Infrastructure/Repositories/CotizacionRepository.cs
T
Nurfog 1b1baaf6bf fix: complete repository layer and refactor services
- Added ContratoRepository, CotizacionRepository, AlumnoRepository, UsuarioRepository (Infrastructure)
- Added IInformeRepository + InformeRepository for report SPs
- Refactored ContratoService, CotizacionService, AlumnoService, UsuarioService to use repos via DI
- Refactored InformeService, EmpresaReportService to use IInformeRepository
- Updated Program.cs DI to wire repos correctly with connection string factory
- Build: 0 errors
2026-07-08 10:16:12 -04:00

45 lines
1.7 KiB
C#

using Dapper;
using Npgsql;
using Ventas.Core.Interfaces;
namespace Ventas.Infrastructure.Repositories;
public class CotizacionRepository : ICotizacionRepository
{
private readonly string _connectionString;
public CotizacionRepository(string connectionString)
{
_connectionString = connectionString;
}
public async Task<string> PersonaIngresarAsync(string apoderado, string vendedor, int solicitudDescuento, int descuento, int tipoDescuento, string fecha, int alumnos, int curso, int monto, string validez, int leadId)
{
using var connection = new NpgsqlConnection(_connectionString);
return await connection.QuerySingleOrDefaultAsync<string>(
"sige_sam_v3.IngresarCotizacionLead",
new { apoderado, vendedor, solicituddescuento = solicitudDescuento, desctoid = descuento, tipodesctoid = tipoDescuento, fecha, alumno = alumnos, cantidad = curso, monto, validez, leadnum = leadId },
commandType: System.Data.CommandType.StoredProcedure) ?? "ok";
}
public async Task<string> PersonaPagarAsync(int cotizacionId)
{
using var connection = new NpgsqlConnection(_connectionString);
await connection.ExecuteAsync(
"sige_sam_v3.PagarCotizacion",
new { cotizacionid = cotizacionId },
commandType: System.Data.CommandType.StoredProcedure);
return "ok";
}
public async Task<string> DesactivarAsync(int cotizacionId)
{
using var connection = new NpgsqlConnection(_connectionString);
await connection.ExecuteAsync(
"sige_sam_v3.DesactivarCotizacion",
new { cotizacionid = cotizacionId },
commandType: System.Data.CommandType.StoredProcedure);
return "ok";
}
}