458 lines
18 KiB
C#
458 lines
18 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.IO;
|
|
|
|
public partial class ReportGeneratorWs : System.Web.UI.Page
|
|
{
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
using (StreamWriter outputFile = new StreamWriter(@"c:\Logs\logFile.txt", true))
|
|
{
|
|
outputFile.WriteLine(System.DateTime.Now + " - Chiave Cliente Pb : ");
|
|
outputFile.WriteLine(" - Start GeneratorWS ");
|
|
outputFile.WriteLine(" - Start GeneratorWS step 1");
|
|
}
|
|
SessionGeneratorPdf spdf = null;
|
|
try { spdf = new SessionGeneratorPdf(); }
|
|
catch (Exception ex) {
|
|
using (StreamWriter outputFile = new StreamWriter(@"c:\Logs\logFile.txt", true))
|
|
{
|
|
|
|
outputFile.WriteLine(" - fine SessionGeneratorPdf ");
|
|
|
|
|
|
}
|
|
|
|
throw new Exception("ReportGeneratorWs.Page_Load.SessionGeneratorPdf " + ex.Message);
|
|
|
|
}
|
|
|
|
|
|
string tipoPdf = "";
|
|
try { tipoPdf = spdf.tipoPdf; }
|
|
catch (Exception ex) {
|
|
|
|
using (StreamWriter outputFile = new StreamWriter(@"c:\Logs\logFile.txt", true))
|
|
{
|
|
|
|
outputFile.WriteLine(" - fine spdf " + ex.Message);
|
|
|
|
|
|
}
|
|
|
|
throw new Exception("ReportGeneratorWs.Page_Load.spdf.tipoPdf " + ex.Message); }
|
|
|
|
|
|
|
|
|
|
List<int> idSezione = new List<int>();
|
|
try { foreach (var fdsf in Page.Request.QueryString["s"].ToString().Split(',')) idSezione.Add(int.Parse(fdsf)); }
|
|
catch (Exception ex) {
|
|
using (StreamWriter outputFile = new StreamWriter(@"c:\Logs\logFile.txt", true))
|
|
{
|
|
|
|
outputFile.WriteLine(" - fine foreach " + ex.Message);
|
|
|
|
|
|
}
|
|
|
|
throw new Exception("ReportGeneratorWs.Page_Load.spdf.idSezione[] " + ex.Message); }
|
|
|
|
byte[] b = null;
|
|
|
|
using (StreamWriter outputFile = new StreamWriter(@"c:\Logs\logFile.txt", true))
|
|
{
|
|
switch (tipoPdf)
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
case "Immobiliare":
|
|
outputFile.WriteLine(" - Call Immobiliare");
|
|
b = Immobiliare(spdf, idSezione);
|
|
break;
|
|
|
|
case "ImmobiliareNucleo":
|
|
b = ImmobiliareNucleo(spdf, idSezione);
|
|
break;
|
|
case "mappatura":
|
|
outputFile.WriteLine(" - Call Mappatura");
|
|
b = Mappatura(spdf, idSezione);
|
|
break;
|
|
case "finalità":
|
|
b = finaità(spdf, idSezione);
|
|
break;
|
|
case "immobiliareunica":
|
|
b = ImmobiliareCu(spdf, idSezione);
|
|
break;
|
|
case "nucleounica":
|
|
b = ImmobiliareNucleoCU(spdf, idSezione);
|
|
break;
|
|
case "mappaturaunica":
|
|
b = MappaturaCU(spdf, idSezione);
|
|
break;
|
|
case "finalitaunica":
|
|
b = finaitàCU(spdf, idSezione);
|
|
break;
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
Response.Clear();
|
|
Response.ContentType = "application/pdf";
|
|
Response.BinaryWrite(b);
|
|
Response.Flush();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Page_Load.BinaryWrite(b) " + ex.Message); };
|
|
|
|
|
|
|
|
using (StreamWriter outputFile = new StreamWriter(@"c:\Logs\logFile.txt", true))
|
|
{
|
|
outputFile.WriteLine(" - fine PageLoad ReportGeneratorWS " + e.Message);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
private byte[] ImmobiliareCu(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
idSezione.Add(42);
|
|
int chiaveClientePB = 0;
|
|
try
|
|
{
|
|
chiaveClientePB = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.ImmobiliareCu(SessionGeneratorPdf.chiaveClientePB " + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
// Replace del carattere § per sanare anomalie catastali : BRUTTO MA FUNZIONA
|
|
|
|
|
|
//if (Page.Request.QueryString["ic"] != null) //old
|
|
if (!System.String.IsNullOrEmpty(Page.Request.QueryString["ic"]))
|
|
{
|
|
string sIdCatasto = Page.Request.QueryString["ic"].ToString();
|
|
sIdCatasto = sIdCatasto.Replace("§", ".");
|
|
idImmobileCatasto = sIdCatasto.Split(','); //Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Immobiliare(SessionGeneratorPdf.idImmobileCatasto[] " + ex.Message); };
|
|
return GeneratorImmobiliareCu(chiaveClientePB, idSezione.ToArray(), idImmobileCatasto);
|
|
}
|
|
private byte[] GeneratorImmobiliareCu(int chiaveClientePB, int[] idSezione, string[] idImmobileCatasto)
|
|
{
|
|
byte[] b = new byte[0];
|
|
wsImmobiliareUnica.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new wsImmobiliareUnica.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_ImmobiliareCU(chiaveClientePB, idImmobileCatasto, idSezione);
|
|
}
|
|
catch (Exception ex) {
|
|
|
|
string pathLog = WebConfigParameter.getParameter("LogPath");
|
|
using (StreamWriter outputFile = new StreamWriter(@"D:\SEIReportConsulenzaEvoluta\Logs\logFile.txt", true))
|
|
{
|
|
outputFile.WriteLine(System.DateTime.Now + " - Chiave Cliente Pb : " + chiaveClientePB);
|
|
outputFile.WriteLine(" - " + ex.ToString());
|
|
}
|
|
|
|
throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.CreaReport_Immobiliare() " + ex.Message);
|
|
|
|
};
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.b is null "); };
|
|
return b;
|
|
}
|
|
private byte[] Immobiliare(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
idSezione.Add(42);
|
|
int chiaveClientePB = 0;
|
|
try
|
|
{
|
|
chiaveClientePB = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Immobiliare(SessionGeneratorPdf.chiaveClientePB " + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
if (Page.Request.QueryString["ic"] != null)
|
|
idImmobileCatasto = Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Immobiliare(SessionGeneratorPdf.idImmobileCatasto[] " + ex.Message); };
|
|
return GeneratorImmobiliare(chiaveClientePB, idSezione.ToArray(), idImmobileCatasto);
|
|
}
|
|
private byte[] GeneratorImmobiliare(int chiaveClientePB, int[] idSezione, string[] idImmobileCatasto)
|
|
{
|
|
byte[] b = new byte[0];
|
|
consulenza.immobiliare.service.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new consulenza.immobiliare.service.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_Immobiliare(chiaveClientePB, idImmobileCatasto, idSezione);
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.CreaReport_Immobiliare() " + ex.Message); };
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.b is null "); };
|
|
return b;
|
|
}
|
|
|
|
|
|
private byte[] finaità(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
idSezione.Add(148);
|
|
int chiaveClientePB = 0;
|
|
try
|
|
{
|
|
chiaveClientePB = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Immobiliare(SessionGeneratorPdf.chiaveClientePB " + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
if (Page.Request.QueryString["ic"] != null)
|
|
idImmobileCatasto = Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Immobiliare(SessionGeneratorPdf.idImmobileCatasto[] " + ex.Message); };
|
|
return Generatorfinaità(chiaveClientePB, idSezione.ToArray(), idImmobileCatasto);
|
|
}
|
|
private byte[] Generatorfinaità(int chiaveClientePB, int[] idSezione, string[] idImmobileCatasto)
|
|
{
|
|
byte[] b = new byte[0];
|
|
consulenza.immobiliare.service.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new consulenza.immobiliare.service.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_FinalitaImmobiliare(chiaveClientePB, idImmobileCatasto, idSezione);
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.CreaReport_FinalitaImmobiliare() " + ex.Message); };
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.CreaReport_FinalitaImmobiliare.b is null "); };
|
|
return b;
|
|
}
|
|
private byte[] finaitàCU(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
idSezione.Add(148);
|
|
int chiaveClientePB = 0;
|
|
try
|
|
{
|
|
chiaveClientePB = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Immobiliare(SessionGeneratorPdf.chiaveClientePB " + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
if (Page.Request.QueryString["ic"] != null)
|
|
idImmobileCatasto = Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Immobiliare(SessionGeneratorPdf.idImmobileCatasto[] " + ex.Message); };
|
|
return GeneratorfinaitàCU(chiaveClientePB, idSezione.ToArray(), idImmobileCatasto);
|
|
}
|
|
private byte[] GeneratorfinaitàCU(int chiaveClientePB, int[] idSezione, string[] idImmobileCatasto)
|
|
{
|
|
byte[] b = new byte[0];
|
|
wsImmobiliareUnica.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new wsImmobiliareUnica.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_FinalitaImmobiliareCU(chiaveClientePB, idImmobileCatasto, idSezione);
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliare.CreaReport_FinalitaImmobiliare() " + ex.Message); };
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.CreaReport_FinalitaImmobiliare.b is null "); };
|
|
return b;
|
|
}
|
|
|
|
private byte[] ImmobiliareNucleo(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
idSezione.Add(42);
|
|
int chiaveNucleo = 0;
|
|
try
|
|
{
|
|
chiaveNucleo = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.ImmobiliareNucleo" + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
if (Page.Request.QueryString["ic"] != null)
|
|
idImmobileCatasto = Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.ImmobiliareNucleo.idImmobileCatasto[] " + ex.Message); };
|
|
|
|
List<long> chiaveClientePb = new List<long>();
|
|
if (Page.Request.QueryString["ccpb"] != null)
|
|
{
|
|
try { foreach (var fdsf in Page.Request.QueryString["ccpb"].ToString().Split(',')) chiaveClientePb.Add(int.Parse(fdsf)); }
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.ImmobiliareNucleo.chiaveClientePb[] " + ex.Message); };
|
|
}
|
|
return GeneratorImmobiliareNucleo(chiaveNucleo, idSezione.ToArray(), idImmobileCatasto, chiaveClientePb.ToArray());
|
|
}
|
|
private byte[] GeneratorImmobiliareNucleo(long chiaveNucleo, int[] idSezione, string[] idImmobileCatasto, long[] chiaveClientePb)
|
|
{
|
|
byte[] b = new byte[0];
|
|
consulenza.immobiliare.service.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new consulenza.immobiliare.service.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliareNucleo.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_NucleiImmobiliare(chiaveNucleo, idImmobileCatasto, chiaveClientePb, idSezione);
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliareNucleo.CreaReport_Immobiliare() " + ex.Message); };
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.GeneratorImmobiliareNucleo.b is null "); };
|
|
return b;
|
|
}
|
|
private byte[] ImmobiliareNucleoCU(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
idSezione.Add(42);
|
|
int chiaveNucleo = 0;
|
|
try
|
|
{
|
|
chiaveNucleo = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.ImmobiliareNucleoCU" + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
if (Page.Request.QueryString["ic"] != null)
|
|
idImmobileCatasto = Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.ImmobiliareNucleo.idImmobileCatasto[] " + ex.Message); };
|
|
|
|
List<long> chiaveClientePb = new List<long>();
|
|
if (Page.Request.QueryString["ccpb"] != null)
|
|
{
|
|
try { foreach (var fdsf in Page.Request.QueryString["ccpb"].ToString().Split(',')) chiaveClientePb.Add(int.Parse(fdsf)); }
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.ImmobiliareNucleo.chiaveClientePb[] " + ex.Message); };
|
|
}
|
|
return GeneratorImmobiliareNucleoCU(chiaveNucleo, idSezione.ToArray(), idImmobileCatasto, chiaveClientePb.ToArray());
|
|
}
|
|
private byte[] GeneratorImmobiliareNucleoCU(long chiaveNucleo, int[] idSezione, string[] idImmobileCatasto, long[] chiaveClientePb)
|
|
{
|
|
byte[] b = new byte[0];
|
|
wsImmobiliareUnica.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new wsImmobiliareUnica.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliareNucleo.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_NucleiImmobiliareCU(chiaveNucleo, idImmobileCatasto, chiaveClientePb, idSezione);
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorImmobiliareNucleo.CreaReport_Immobiliare() " + ex.Message); };
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.GeneratorImmobiliareNucleo.b is null "); };
|
|
return b;
|
|
}
|
|
private byte[] Mappatura(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
//idSezione.Add(42);
|
|
int chiaveClientePB = 0;
|
|
try
|
|
{
|
|
chiaveClientePB = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Mappatura" + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
if (Page.Request.QueryString["ic"] != null)
|
|
idImmobileCatasto = Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Mappatura.idImmobileCatasto[] " + ex.Message); };
|
|
|
|
|
|
return GeneratorMappatura(chiaveClientePB, idSezione.ToArray(), idImmobileCatasto);
|
|
}
|
|
private byte[] GeneratorMappatura(long chiaveCliente, int[] idSezione, string[] idImmobileCatasto)
|
|
{
|
|
byte[] b = new byte[0];
|
|
consulenza.immobiliare.service.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new consulenza.immobiliare.service.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorMappatura.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_MappaturaPreliminare(chiaveCliente, idImmobileCatasto, idSezione);
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorMappatura.CreaReport_MappaturaPreliminare() " + ex.Message); };
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.GeneratorMappatura.b is null "); };
|
|
return b;
|
|
}
|
|
|
|
private byte[] MappaturaCU(SessionGeneratorPdf spdf, List<int> idSezione)
|
|
{
|
|
//idSezione.Add(42);
|
|
int chiaveClientePB = 0;
|
|
try
|
|
{
|
|
chiaveClientePB = int.Parse(spdf.keyPdf.ToString());
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Mappatura" + ex.Message); };
|
|
string[] idImmobileCatasto = new string[0];
|
|
try
|
|
{
|
|
if (Page.Request.QueryString["ic"] != null)
|
|
idImmobileCatasto = Page.Request.QueryString["ic"].ToString().Split(',');
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.Mappatura.idImmobileCatasto[] " + ex.Message); };
|
|
|
|
|
|
return GeneratorMappaturaCU(chiaveClientePB, idSezione.ToArray(), idImmobileCatasto);
|
|
}
|
|
private byte[] GeneratorMappaturaCU(long chiaveCliente, int[] idSezione, string[] idImmobileCatasto)
|
|
{
|
|
byte[] b = new byte[0];
|
|
wsImmobiliareUnica.WSImmobiliare i = null;
|
|
try
|
|
{
|
|
i = new wsImmobiliareUnica.WSImmobiliare();
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorMappatura.WSImmobiliare " + ex.Message); };
|
|
try
|
|
{
|
|
b = i.CreaReport_MappaturaPreliminareCU(chiaveCliente, idImmobileCatasto, idSezione);
|
|
}
|
|
catch (Exception ex) { throw new Exception("ReportGeneratorWs.GeneratorMappatura.CreaReport_MappaturaPreliminare() " + ex.Message); };
|
|
if (b == null || b.Length == 0)
|
|
{ throw new Exception("ReportGeneratorWs.GeneratorMappatura.b is null "); };
|
|
return b;
|
|
}
|
|
} |