Arreglos paso a Git
This commit is contained in:
@@ -28,34 +28,37 @@ namespace SwaggerAntifraude.Controllers
|
||||
/// <param name="FechaEmision">Fecha de emisión del formulario</param>
|
||||
/// <param name="Extra">Campo extra opcional, según el tipo de formulario</param>
|
||||
/// <returns>Archivo PDF resultante</returns>
|
||||
[HttpGet("GenerarFormulario")]
|
||||
[Authorize(Policy = "LecturaPolicy")]
|
||||
public IActionResult GenerarFormulario(
|
||||
[FromQuery] string claveFormulario,
|
||||
[FromQuery] string idPersona,
|
||||
[FromQuery] string Motivo,
|
||||
[FromQuery] string texto1,
|
||||
[FromQuery] string texto2,
|
||||
[FromQuery] string FechaEfecto,
|
||||
[FromQuery] string Organo,
|
||||
[FromQuery] string FechaEmision,
|
||||
[FromQuery] string Extra)
|
||||
{
|
||||
var pdfBytes = _servicioFormularios.GenerarFormulario(
|
||||
claveFormulario,
|
||||
idPersona,
|
||||
Motivo,
|
||||
texto1,
|
||||
texto2,
|
||||
FechaEfecto,
|
||||
Organo,
|
||||
FechaEmision,
|
||||
Extra);
|
||||
///
|
||||
|
||||
if (pdfBytes == null || pdfBytes.Length == 0)
|
||||
return NotFound("No se pudo generar el formulario.");
|
||||
|
||||
return File(pdfBytes, "application/pdf", "formulario.pdf");
|
||||
}
|
||||
}
|
||||
//[HttpGet("GenerarFormulario")]
|
||||
//[Authorize(Policy = "LecturaPolicy")]
|
||||
//public IActionResult GenerarFormulario(
|
||||
// [FromQuery] string claveFormulario,
|
||||
// [FromQuery] string idPersona,
|
||||
// [FromQuery] string Motivo,
|
||||
// [FromQuery] string texto1,
|
||||
// [FromQuery] string texto2,
|
||||
// [FromQuery] string FechaEfecto,
|
||||
// [FromQuery] string Organo,
|
||||
// [FromQuery] string FechaEmision,
|
||||
// [FromQuery] string Extra)
|
||||
//{
|
||||
// var pdfBytes = _servicioFormularios.GenerarFormulario(
|
||||
// claveFormulario,
|
||||
// idPersona,
|
||||
// Motivo,
|
||||
// texto1,
|
||||
// texto2,
|
||||
// FechaEfecto,
|
||||
// Organo,
|
||||
// FechaEmision,
|
||||
// Extra);
|
||||
|
||||
// if (pdfBytes == null || pdfBytes.Length == 0)
|
||||
// return NotFound("No se pudo generar el formulario.");
|
||||
|
||||
// return File(pdfBytes, "application/pdf", "formulario.pdf");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
39
Antifraude.Net/SwaggerAntifraude/Servicios/tsXtraReport.cs
Normal file
39
Antifraude.Net/SwaggerAntifraude/Servicios/tsXtraReport.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using DevExpress.Data.Extensions;
|
||||
using DevExpress.DataProcessing.InMemoryDataProcessor;
|
||||
using System.Linq;
|
||||
using DevExpress.XtraReports.Parameters;
|
||||
namespace SwaggerAntifraude.Servicios
|
||||
{
|
||||
public class tsXtraReport
|
||||
{
|
||||
public static void ExportarAPDF(byte[] Plantilla, object Datos, string FicheroPDF)
|
||||
{
|
||||
DevExpress.XtraReports.UI.XtraReport xr;
|
||||
string s = System.Text.Encoding.UTF8.GetString(Plantilla);
|
||||
using (StreamWriter sw = new StreamWriter(new MemoryStream()))
|
||||
{
|
||||
sw.Write(s);
|
||||
sw.Flush();
|
||||
|
||||
xr = DevExpress.XtraReports.UI.XtraReport.FromStream(sw.BaseStream, true);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
var pr = xr.Parameters.Cast<DevExpress.XtraReports.Parameters.Parameter>()
|
||||
.FirstOrDefault(p => p.Name == "Fecha");
|
||||
|
||||
|
||||
pr.Value = DateTime.Now;
|
||||
pr.Visible = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
xr.DataSource = Datos;
|
||||
xr.CreateDocument();
|
||||
xr.ExportToPdf(FicheroPDF);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DevExpress.Document.Processor.es" Version="23.2.3" />
|
||||
<PackageReference Include="DevExpress.Printing.Core.es" Version="23.2.3" />
|
||||
<PackageReference Include="DevExpress.Reporting.Core" Version="23.2.3" />
|
||||
<PackageReference Include="DevExpress.Reporting.Core.es" Version="23.2.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
|
||||
<PackageReference Include="Serialize.Linq" Version="3.1.160" />
|
||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||
@@ -21,6 +25,8 @@
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.1" />
|
||||
<PackageReference Include="System.Linq" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.6" />
|
||||
<PackageReference Include="System.Linq.Expressions" Version="4.3.0" />
|
||||
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -31,9 +37,6 @@
|
||||
<Reference Include="tsUtilidades">
|
||||
<HintPath>..\..\..\..\Comun\tsUtilidades\bin\Debug\net8.0\tsUtilidades.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="tsWPFCore">
|
||||
<HintPath>..\..\..\..\Comun\tsWPFCore\bin\Debug\net8.0-windows\tsWPFCore.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user