diff --git a/root/ContrattoSEI/GestorePDF.Logic/GestorePDF.Logic.csproj b/root/ContrattoSEI/GestorePDF.Logic/GestorePDF.Logic.csproj
index 58a7947..40eba0a 100644
--- a/root/ContrattoSEI/GestorePDF.Logic/GestorePDF.Logic.csproj
+++ b/root/ContrattoSEI/GestorePDF.Logic/GestorePDF.Logic.csproj
@@ -56,6 +56,9 @@
MinimumRecommendedRules.ruleset
+
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
..\GestoreTrimestrale\packages\NLog.4.2.3\lib\net45\NLog.dll
True
diff --git a/root/ContrattoSEI/GestorePDF.Logic/GestoreThread.cs b/root/ContrattoSEI/GestorePDF.Logic/GestoreThread.cs
index cffcd1a..a5e7d67 100644
--- a/root/ContrattoSEI/GestorePDF.Logic/GestoreThread.cs
+++ b/root/ContrattoSEI/GestorePDF.Logic/GestoreThread.cs
@@ -1,23 +1,24 @@
+using Amib.Threading;
+using DataAccessLayer;
+using PDFGenerator;
+using PDFGenerator.BusinessLayer;
using System;
-using System.Text;
-using System.IO;
+using System.Collections.Generic;
+using System.Collections.Specialized;
using System.Configuration;
using System.Data;
-using System.Diagnostics;
-using System.Collections.Specialized;
-using System.Collections.Generic;
using System.Data.SqlClient;
-using Amib.Threading;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
using System.Threading;
-using PDFGenerator.BusinessLayer;
-using PDFGenerator;
-
-
-using DataAccessLayer;
namespace GestorePDF.Logic
{
+ using Newtonsoft.Json;
using NLog;
+ using System.Xml;
+
public class GestoreThread
{
diff --git a/root/ContrattoSEI/GestorePDF.Logic/packages.config b/root/ContrattoSEI/GestorePDF.Logic/packages.config
index 3badae8..60731aa 100644
--- a/root/ContrattoSEI/GestorePDF.Logic/packages.config
+++ b/root/ContrattoSEI/GestorePDF.Logic/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/root/ContrattoSEI/PDFGenerator/BusinessLayer/Json/JsonExporter.cs b/root/ContrattoSEI/PDFGenerator/BusinessLayer/Json/JsonExporter.cs
new file mode 100644
index 0000000..e41cd39
--- /dev/null
+++ b/root/ContrattoSEI/PDFGenerator/BusinessLayer/Json/JsonExporter.cs
@@ -0,0 +1,55 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDFGenerator.BusinessLayer.Json
+{
+ public class JsonExporter
+ {
+ private static string ExecutionTimestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
+ public static void ExportForJasperReport(DataThread dataThread, string codice)
+ {
+ string fileName = $"{codice}.json";
+ string directory = Path.Combine(CACHE.SavePDFtoDISK_Folder, ExecutionTimestamp);
+
+ // Crea la directory se non esiste
+ Directory.CreateDirectory(directory);
+
+ string fullPath = Path.Combine(directory, fileName);
+ ExportToJson(dataThread, fullPath);
+
+ Console.WriteLine($"Data source per Jasper creato: {fileName}");
+ }
+
+ private static void ExportToJson(DataThread dataThread, string filePath)
+ {
+ try
+ {
+ // Serializza l'oggetto in JSON con formattazione
+ string json = JsonConvert.SerializeObject(dataThread, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings
+ {
+ // Gestisce le referenze circolari se presenti
+ ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+ // Include proprietà null
+ NullValueHandling = NullValueHandling.Include,
+ // Formato data personalizzato
+ DateFormatString = "yyyy-MM-dd HH:mm:ss"
+ });
+
+ // Scrive il JSON nel file
+ File.WriteAllText(filePath, json);
+
+ Console.WriteLine($"DataThread esportato con successo in: {filePath}");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Errore durante l'esportazione: {ex.Message}");
+ throw;
+ }
+ }
+ }
+}
diff --git a/root/ContrattoSEI/PDFGenerator/BusinessLayer/SezioneReport.cs b/root/ContrattoSEI/PDFGenerator/BusinessLayer/SezioneReport.cs
index ec89e35..3f81c1d 100644
--- a/root/ContrattoSEI/PDFGenerator/BusinessLayer/SezioneReport.cs
+++ b/root/ContrattoSEI/PDFGenerator/BusinessLayer/SezioneReport.cs
@@ -5,6 +5,7 @@ using PDFGenerator.Presentation.Section;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.Presentation.TemplateGenerator;
+using PDFGenerator.BusinessLayer.Json;
namespace PDFGenerator.BusinessLayer
@@ -449,6 +450,8 @@ namespace PDFGenerator.BusinessLayer
if (notsez.Equals(_codice)) data.Esito = 0;
}
+ //QUI
+ JsonExporter.ExportForJasperReport(_dataThread, this.Codice);
if (data!=null && data.Esito > 0)
{
diff --git a/root/ContrattoSEI/PDFGenerator/DocumentPDF.cs b/root/ContrattoSEI/PDFGenerator/DocumentPDF.cs
index 9fe9f85..e4be1bd 100644
--- a/root/ContrattoSEI/PDFGenerator/DocumentPDF.cs
+++ b/root/ContrattoSEI/PDFGenerator/DocumentPDF.cs
@@ -796,7 +796,7 @@ namespace PDFGenerator
if (string.IsNullOrWhiteSpace(_dataThread.NomeFilePdf))
{
logger.Info("_dataThread.NomeFilePdf è vuoto");
- _dataThread.NomeFilePdf = "Test";
+ _dataThread.NomeFilePdf = DateTime.Now.ToString("yyyyMMdd_HHmmss");
}
// Percorso completo della cartella
diff --git a/root/ContrattoSEI/PDFGenerator/PDFGenerator.csproj b/root/ContrattoSEI/PDFGenerator/PDFGenerator.csproj
index 2fee7ab..ddc7036 100644
--- a/root/ContrattoSEI/PDFGenerator/PDFGenerator.csproj
+++ b/root/ContrattoSEI/PDFGenerator/PDFGenerator.csproj
@@ -96,6 +96,9 @@
..\DLLesterne\Microsoft.Practices.ObjectBuilder.dll
+
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
..\GestoreTrimestrale\packages\NLog.4.2.3\lib\net40\NLog.dll
True
@@ -857,6 +860,7 @@
+
diff --git a/root/ContrattoSEI/PDFGenerator/packages.config b/root/ContrattoSEI/PDFGenerator/packages.config
index 6645420..5d3b018 100644
--- a/root/ContrattoSEI/PDFGenerator/packages.config
+++ b/root/ContrattoSEI/PDFGenerator/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file