1b1baaf6bf
- 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
45 lines
1.7 KiB
C#
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";
|
|
}
|
|
}
|