3485 lines
139 KiB
C#
3485 lines
139 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.IO;
|
||
using System.Web;
|
||
using System.Xml;
|
||
using ReportVS;
|
||
using ConsulenzaEvoluta;
|
||
using bancafideuram.nac.traceoperation;
|
||
|
||
|
||
public partial class Generator : System.Web.UI.Page
|
||
{
|
||
public string caller;
|
||
public string codiceFiscale;
|
||
public string codicePB;
|
||
public string codiceRete;
|
||
public int idReport;
|
||
public int keyProposta = 0;
|
||
//public string checkPrivacy;
|
||
private bool privacy = false;
|
||
private int chiaveNucleo;
|
||
|
||
private string query = "";
|
||
private bool QuerySection = false;
|
||
private string Intermediario = "";
|
||
private DocumentPDF _docPDF;
|
||
DataSectionParameter dsParam;
|
||
DatiMonitoraggio dsDatiMonitoraggio;
|
||
public XmlDocument docIN = new XmlDocument();
|
||
private DataTable tableIntermediari;
|
||
private DataTable dt;
|
||
private string tipoReport;
|
||
//private string sUtente;
|
||
DatiComuni _datiComuni;
|
||
private DataTable dtArea;
|
||
private DataTable dtProgetto;
|
||
|
||
private bool hasSelectedDistribuzioneAssetClass;
|
||
private bool hasSelectedPoliticaInv;
|
||
|
||
private int numberOfQUERYtagsRis = 0;
|
||
|
||
public string token;
|
||
string codiceUtenteQueryString;
|
||
private string _Area = "";
|
||
|
||
private bool _issolounintermediario;
|
||
private bool _patrimoniobfpresente = false;
|
||
private bool _patrimonioterzipresente = false;
|
||
|
||
private DataSet dsAreeBisognoProgetto = new DataSet();
|
||
//private bool isnew = false;
|
||
|
||
/// <summary>
|
||
/// Punto di inizio della stampa del report.
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
DateTime inizioCreazioneReport = DateTime.Now;
|
||
|
||
bool monitoraggio_con_alberatura = false;
|
||
if (!string.IsNullOrEmpty(Request.QueryString.Get("monitoraggio_con_alberatura")))
|
||
monitoraggio_con_alberatura = bool.Parse(Request.QueryString.Get("monitoraggio_con_alberatura"));
|
||
|
||
bool proposta_validata = false;
|
||
if (!string.IsNullOrEmpty(Request.QueryString.Get("validata")))
|
||
proposta_validata = bool.Parse(Request.QueryString.Get("validata"));
|
||
|
||
//if (Request.QueryString.Get("isnew") != null && Request.QueryString.Get("isnew").Equals("1"))
|
||
// isnew = true;
|
||
|
||
caller = Request.QueryString.Get("action");
|
||
codiceFiscale = Request.QueryString.Get("codiceFiscale");
|
||
codicePB = Request.QueryString.Get("codicePB");
|
||
codiceRete = Request.QueryString.Get("codiceRete");
|
||
token = Request.QueryString.Get("token");
|
||
privacy = bool.Parse(Request.QueryString.Get("checkPrivacy"));
|
||
idReport = Convert.ToInt32(Request.QueryString.Get("idReport"));
|
||
tipoReport = Request.QueryString.Get("tipoReport");
|
||
chiaveNucleo = Convert.ToInt32(Request.QueryString.Get("chiaveNucleo"));
|
||
|
||
if (!string.IsNullOrEmpty(Request.QueryString.Get("idProposta")))
|
||
keyProposta = Convert.ToInt32(Request.QueryString.Get("idProposta"));
|
||
|
||
// Valorizzo il codice PB
|
||
codiceUtenteQueryString = codiceRete.ToUpper().Trim() + codicePB.ToUpper().Trim();
|
||
|
||
if (token == null || token == "")
|
||
{
|
||
HttpCookie ck_token = new HttpCookie("token");
|
||
ck_token = System.Web.HttpContext.Current.Request.Cookies["token"];
|
||
if (ck_token != null) token = ck_token.Value.ToString();
|
||
}
|
||
|
||
Cliente cliente = null;
|
||
Nucleo nucleo = null;
|
||
|
||
|
||
#region Imposto l'oggetto DataSectionParameter
|
||
|
||
dsParam = new DataSectionParameter();
|
||
|
||
if (tipoReport.ToUpper().Equals("NUCLEO"))
|
||
{
|
||
nucleo = Nucleo.getNucleo(chiaveNucleo);
|
||
dsParam.Nucleo = nucleo;
|
||
}
|
||
else
|
||
{
|
||
cliente = Cliente.getCliente(codiceRete + codicePB, codiceFiscale);
|
||
dsParam.ChiaveClientePB = cliente.ChiaveClientePB;
|
||
}
|
||
|
||
dsParam.CodiceCliente = codiceFiscale;
|
||
dsParam.CodicePB = codicePB;
|
||
dsParam.CodiceRete = codiceRete;
|
||
dsParam.CodiceApplicazione = WebConfigParameter.getParameter("CODICEAPPLICAZIONE");
|
||
dsParam.TipoIndirizzo = "1";
|
||
dsParam.VersioneDataBaseSIMPB = string.IsNullOrEmpty(token) ? 0 : Convert.ToInt32(token);
|
||
|
||
// Recupoero le Proposte se sto richiedendo un report di Proposta
|
||
if (tipoReport == "PROPOSTA")
|
||
{
|
||
// Imposta le Proposte in stato Completa o Accettata del cliente.
|
||
dsParam.Proposte = LoadProposte(dsParam.ChiaveClientePB);
|
||
|
||
// Imposta la Proposta corrente se <20> richiesta la stampa del report di proposta. (se keyProposta <20> valorizzata sto stampando una proposta)
|
||
if (keyProposta > 0)
|
||
{
|
||
dsParam.Proposta = dsParam.Proposte.GetByChiaveProposta(keyProposta);
|
||
Session.Add("PropostaEnabled", dsParam.Proposta); // metto in sessione l'oggetto perche non ho modo di recuperarlo in setPageFooterNomeCliente dell'oggetto documentPDF
|
||
}
|
||
}
|
||
|
||
dsParam.modalit<EFBFBD>Anonima = privacy ? false : true;
|
||
|
||
#endregion
|
||
|
||
#region Gestione Autorizzazione Utenti
|
||
|
||
if (WebConfigParameter.getParameter("Ambiente") == "esterno")
|
||
{
|
||
#region UTENTE
|
||
|
||
if (Session["UtenteImpersonificatoDiSessione"] != null)
|
||
{
|
||
Utente utente = Utente.DeserializeMessage(Session["UtenteImpersonificatoDiSessione"].ToString());
|
||
dsParam.Utente = utente;
|
||
}
|
||
else
|
||
Response.Redirect("error.aspx");
|
||
|
||
#endregion
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region MULTITHREADING
|
||
|
||
#region inizio log per multithreading
|
||
//DateTime dataInizioMonitoraggio = DateTime.Now;
|
||
//int multiT = int.Parse(WebConfigParameter.getParameter("multiThreading"));
|
||
//DBTimeManager.setTimeEnd("MONITORAGGIO", "INIZIO MULTITHREADING " + multiT.ToString(), DateTime.Now, "", "", "");
|
||
#endregion
|
||
|
||
#region Chiamata Multithreading
|
||
|
||
//if (multiT.Equals(1))
|
||
//{
|
||
// StringCollection queries = new StringCollection();
|
||
// DataTable sezioniLetteOrdinatePerQuery = getQueryPerMultiThreading();
|
||
// if (sezioniLetteOrdinatePerQuery.Rows.Count > 0)
|
||
// {
|
||
// foreach (DataRow rigaSLO in sezioniLetteOrdinatePerQuery.Rows)
|
||
// {
|
||
// string queriesOracleSezione = rigaSLO["queryOracleSezione"].ToString();
|
||
// if (queriesOracleSezione.ToString() != string.Empty)
|
||
// {
|
||
// foreach (string query in queriesOracleSezione.Split(';'))
|
||
// {
|
||
// queries.Add(query);
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// if (queries.Count > 0)
|
||
// {
|
||
// List<SessionStruct> tabelleSessione = SessionForMultiThread.getSession(queries);
|
||
// string pathFilesSql = Server.MapPath(WebConfigParameter.getParameter("PATH_FILE_ORACLE_SQL"));
|
||
// ThreadsManager threads = new ThreadsManager(pathFilesSql, tabelleSessione, queries, dsParam);
|
||
// threads.startThreads();
|
||
// threads.endThreads();
|
||
// SessionForMultiThread.setSession(tabelleSessione);
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
#endregion Chiamata Multithreading
|
||
|
||
#region inizio log per multithreading
|
||
//DateTime dataIniziodopoMonitoraggio = DateTime.Now;
|
||
//DBTimeManager.setTimeEnd("MONITORAGGIO", "FINE MULTITHREADING ", dataIniziodopoMonitoraggio, "", "", "");
|
||
#endregion
|
||
|
||
#region inizio log per multithreading dopo
|
||
//DateTime dataInizioDopoMonitoraggio = DateTime.Now;
|
||
//DBTimeManager.setTimeEnd("MONITORAGGIO", "INIZIO DOPO MULTITHREADING " + multiT.ToString(), DateTime.Now, "", "", "");
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region Creazione Dati Comuni
|
||
|
||
_datiComuni = new DatiComuni(caller, dsParam);
|
||
dsParam.DatiComuni = _datiComuni.datiComuni;
|
||
|
||
// Patrimonio Complessivo
|
||
dsParam.PatrimonioComplessivo = _datiComuni.PatrimonioComplessivo;
|
||
dsParam.PatrimonioComplessivoConRisorseNonAllocate = _datiComuni.PatrimonioComplessivoConRisorseNonAllocate;
|
||
|
||
// Patrimonio Casa
|
||
dsParam.PatrimonioCasa = _datiComuni.PatrimonioCasa;
|
||
dsParam.PatrimonioCasaConRisorseNonAllocate_Totale_CC = _datiComuni.PatrimonioCasaConRisorseNonAllocate_Totale_CC;
|
||
dsParam.PatrimonioCasaConRisorseNonAllocate_CC_Casa_Positivi = _datiComuni.PatrimonioCasaConRisorseNonAllocate_CC_Casa_Positivi;
|
||
dsParam.PatrimonioCasaDettaglioProgettiInvestimento = _datiComuni.PatrimonioCasaDettaglioProgettiInvestimento;
|
||
|
||
// Patrimonio Terzi
|
||
dsParam.PatrimonioTerzi = _datiComuni.PatrimonioTerzi;
|
||
|
||
// SONO DA VERIFICARE I NOMI
|
||
dsParam.DettaglioProdottiIntermediario = _datiComuni.DettaglioProdottiIntermediario;
|
||
|
||
dsDatiMonitoraggio = _datiComuni.DatiMonitoraggio;
|
||
|
||
#endregion
|
||
|
||
int versTempPdf = 0;
|
||
if (proposta_validata && tipoReport.ToUpper().ToString().Equals("PROPOSTA"))
|
||
versTempPdf = 2;
|
||
|
||
if (tipoReport.ToUpper().Equals("NUCLEO"))
|
||
{
|
||
_docPDF = new DocumentPDF("REPORT " + tipoReport, codiceRete, "report", versTempPdf, string.Empty, nucleo.IdCliente_SEIReport, idReport, nucleo.CodiceRete + nucleo.CodicePB);
|
||
_docPDF.Modalit<EFBFBD>Anonima = 0; // Sempre nominativo
|
||
_docPDF.AggiungiClienteAlFooter(dsParam.Nucleo.Nome, string.Empty);
|
||
}
|
||
else
|
||
{
|
||
_docPDF = new DocumentPDF("REPORT " + tipoReport, codiceRete, "report", versTempPdf, codiceFiscale, cliente.IdCliente_SEIReport, idReport, cliente.CodiceRete + cliente.CodicePB);
|
||
_docPDF.Modalit<EFBFBD>Anonima = dsParam.modalit<EFBFBD>Anonima ? 1 : 0;
|
||
_docPDF.AggiungiClienteAlFooter(cliente.Nome, cliente.Cognome);
|
||
}
|
||
|
||
if (dsParam.Utente != null)
|
||
_docPDF.setUtenteSession(dsParam.Utente);
|
||
|
||
#region Stampa del documento PDF
|
||
|
||
bool bCreaReport;
|
||
//PARTENZA GENERATOR
|
||
if (tipoReport.ToUpper() == "MONITORAGGIO")
|
||
{
|
||
if (monitoraggio_con_alberatura)
|
||
bCreaReport = this.createReport(_docPDF, TipoReport.MONITORAGGIO_CON_ALBERATURA); // gestione del monitoraggio con alberatura.
|
||
else
|
||
bCreaReport = this.createReport(_docPDF, TipoReport.MONITORAGGIO); // gestione del monitoraggio senza albero di selezione. modello fisso r6_s_generator 4,11
|
||
}
|
||
else if (tipoReport.ToUpper() == "DIAGNOSI")
|
||
bCreaReport = this.createReport(_docPDF, TipoReport.DIAGNOSI);
|
||
else if (tipoReport.ToUpper() == "PROPOSTA")
|
||
{
|
||
if (proposta_validata)
|
||
bCreaReport = this.createReport(_docPDF, TipoReport.PROPOSTA_VALIDATA);
|
||
else
|
||
bCreaReport = this.createReport(_docPDF, TipoReport.PROPOSTA);
|
||
}
|
||
else if (tipoReport.ToUpper() == "RISCHIO")
|
||
bCreaReport = this.createReport(_docPDF, TipoReport.RISCHIO);
|
||
else if (tipoReport.ToUpper() == "NUCLEO")
|
||
bCreaReport = this.createReport(_docPDF, TipoReport.NUCLEO);
|
||
else
|
||
bCreaReport = this.createReport(_docPDF, tipoReport);
|
||
|
||
#endregion
|
||
|
||
if (bCreaReport)
|
||
{
|
||
#region Log TraceOperation
|
||
|
||
if (WebConfigParameter.getParameter("Ambiente").ToUpper() == "ESTERNO")
|
||
{
|
||
try
|
||
{
|
||
TraceOperation operation = new TraceOperation();
|
||
operation.Url = WebConfigParameter.getParameter("WSTRACEOPERATION").ToString();
|
||
|
||
string codiceUtenteWindows = "0000000";
|
||
if (User.Identity.Name.Length > 0)
|
||
{
|
||
int pos = User.Identity.Name.IndexOf("\\") + 1;
|
||
codiceUtenteWindows = User.Identity.Name.Substring(pos, User.Identity.Name.Length - pos).ToUpper();
|
||
}
|
||
|
||
operation.WriteLog(new LogDataTypeWS()
|
||
{
|
||
Acronimo = WebConfigParameter.getParameter("CODICEAPPLICAZIONE").ToString(),
|
||
CodFiscalePiva = codiceFiscale,
|
||
CodIban = null,
|
||
CodNdg = null,
|
||
CodRapporto = null,
|
||
CodSndg = null,
|
||
CodTerminale = Request.Url.Host,
|
||
CodTipoRichiesta = "S",
|
||
DataRichiesta = DateTime.Now.ToString("yyyyMMddHHmmss"),
|
||
DesRichiesta = Request.Url.ToString().Length > 4000 ? Request.Url.ToString().Substring(0, 4000) : Request.Url.ToString(),
|
||
IdInput = "0",
|
||
MatricolaUtente = codiceUtenteWindows
|
||
});
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
#region Scrivo l'errore nella tabella REP_Errori di CE.
|
||
|
||
List<Parametro> parametri = new List<Parametro>();
|
||
Parametro parametro = new Parametro();
|
||
parametro.DbType = DbType.String;
|
||
parametro.Value = User.Identity.Name;
|
||
parametro.ParameterName = "utentewindows";
|
||
parametri.Add(parametro);
|
||
|
||
parametro = new Parametro();
|
||
parametro.DbType = DbType.String;
|
||
parametro.Value = string.Format("{0}{1} {2}", "TraceOperation.", User.Identity.Name, ex.Message);
|
||
parametro.ParameterName = "errore";
|
||
parametri.Add(parametro);
|
||
|
||
parametro = new Parametro();
|
||
parametro.DbType = DbType.String;
|
||
parametro.Value = string.Format("{0}{1} {2}", "TraceOperation.", User.Identity.Name, ex.Message);
|
||
parametro.ParameterName = "errorebreve";
|
||
parametri.Add(parametro);
|
||
|
||
BusinessManager.ExecuteStoredProcedure_ConsulenzaEvoluta("REP_TracciaErrore", parametri);
|
||
|
||
#endregion
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
///Faccio saltare il caso del MONITORAGGIO !!!MODIFICARE
|
||
///V Se non <20> anonimo lo salvo nel db
|
||
|
||
/***************************
|
||
* INSERISCI NELLA TABELLA *
|
||
****************************/
|
||
|
||
if (tipoReport.ToUpper().Equals("NUCLEO"))
|
||
{
|
||
// 04/06/2014 : Dallo sviluppo del Report Nucleo <20> stata introdotta la nuova gestione di archiviazione del PDF e relativo Log
|
||
// Il report Nucleo non ha la gestione della "Modalit<69>Anonima", viene sempre salvato nell'archivio documenti
|
||
SessionNucleo sessionNucleo = new SessionNucleo(dsParam.Nucleo.ChiaveNucleo, dsParam.Nucleo.ChiaviClientePB, _docPDF.getPDF());
|
||
//Log.Write("M", 8, "D", dsParam.CodicePB, dsParam.CodiceRete, 0, string.Empty, _docPDF.getPDF(), dsParam.Nucleo.ChiaveNucleo, dsParam.Nucleo.ChiaviClientePB);
|
||
|
||
Response.Cookies.Add(new HttpCookie("endOfJob", "2"));
|
||
}
|
||
else
|
||
{
|
||
if (_docPDF.Modalit<EFBFBD>Anonima == 0) // nn <20> anonima
|
||
{
|
||
int identificativo = _docPDF.InsertIntoDB(idReport, cliente.IdCliente_SEIReport, codiceRete + codicePB);
|
||
|
||
if (identificativo != 0)
|
||
{
|
||
HttpCookie ck_Identificativo = new HttpCookie("identificativo");
|
||
ck_Identificativo.Value = identificativo.ToString();
|
||
Response.Cookies.Add(ck_Identificativo);
|
||
Log.InsertIntoDB("DocPDF inserito in archivio.", "PB: " + codicePB + "; CF: " + codiceFiscale + "; Rete:" + codiceRete, HttpContext.Current.Request.UserHostName, HttpContext.Current.Request.Url.AbsolutePath);
|
||
}
|
||
|
||
//abilito il cookie che segnala la possibilita' di mostrare la pagina di inserimento note (reportStampa.aspx)
|
||
HttpCookie ck_endOfJob = new HttpCookie("endOfJob");
|
||
ck_endOfJob.Value = "1";
|
||
Response.Cookies.Add(ck_endOfJob);
|
||
//V
|
||
_docPDF.aggiornaLogGenerazioneReport(identificativo, codiceFiscale, codicePB, User.Identity.Name, false);
|
||
//
|
||
}
|
||
else
|
||
{
|
||
//abilito il cookie che segnala la possibilita' di mostrare la pagina di inserimento note (reportStampa.aspx)
|
||
HttpCookie ck_endOfJob = new HttpCookie("endOfJob");
|
||
ck_endOfJob.Value = "2";
|
||
Response.Cookies.Add(ck_endOfJob);
|
||
//V
|
||
//Nel caso di stampa anonima come idreport viene passato un valore fake
|
||
_docPDF.aggiornaLogGenerazioneReport(-1, codiceFiscale, codicePB, User.Identity.Name, true);
|
||
//
|
||
}
|
||
}
|
||
|
||
DateTime fineCreazioneReport = DateTime.Now;
|
||
|
||
#region Tempo impiegato alla produzione del report
|
||
|
||
TimeSpan tempoCreazioneReport = fineCreazioneReport.Subtract(inizioCreazioneReport);
|
||
|
||
if (WebConfigParameter.getParameter("TEMPO_STAMPA_REPORT") == "1")
|
||
{
|
||
_docPDF.addPage();
|
||
_docPDF.setSezHeader("Report prodotto in m:s:ms" + tempoCreazioneReport.Minutes + " : " + tempoCreazioneReport.Seconds + " : " + tempoCreazioneReport.Milliseconds);
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
_docPDF.renderPDF();
|
||
}
|
||
|
||
#region fine log per multithreading dopo
|
||
//DBTimeManager.setTimeEnd("MONITORAGGIO", "FINE DOPO MULTITHREADING ", dataIniziodopoMonitoraggio, "", "", "");
|
||
#endregion
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Recupera i dati riguardanti le proposte del cliente in stato Accettata o Completa dalla DatiComuniProposta (dalla vista v_all_proposta) e
|
||
/// popola la collezione Proposte dell'oggetto DataSectionParameter.
|
||
/// </summary>
|
||
/// <param name="param"></param>
|
||
private PropostaCollection LoadProposte(int chiaveClientePB)
|
||
{
|
||
PropostaCollection listaProposte = new PropostaCollection();
|
||
|
||
//DataTable dt = SectionManager.GetDataSection("DatiComuniProposta", reteagente, codicecliente); //d.lisena #ConsulenzaEvoluta OLD
|
||
DataTable dt = BusinessManager.GetDataTableFromStoredProcedure_ConsulenzaEvoluta("REP_Prop_ElencoProposte", chiaveClientePB); //d.lisena #ConsulenzaEvoluta NEW
|
||
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
Proposta propostaToAdd = new Proposta();
|
||
|
||
// Nome
|
||
propostaToAdd.Nome = row["nome_proposta"] == DBNull.Value ? string.Empty : row["nome_proposta"].ToString();
|
||
|
||
// Chiave
|
||
propostaToAdd.Chiave = Convert.ToInt32(row["chiave_proposta"]);
|
||
|
||
// Data Creazione
|
||
propostaToAdd.DataCreazione = row["data_creazione_proposta"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["data_creazione_proposta"]);
|
||
propostaToAdd.DataCreazioneString = propostaToAdd.DataCreazione.HasValue ? propostaToAdd.DataCreazione.Value.ToLongDateString() : "n.d.";
|
||
|
||
// Data Scadenza
|
||
propostaToAdd.DataScadenza = row["data_scadenza_proposta"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["data_scadenza_proposta"]);
|
||
propostaToAdd.DataScadenzaString = propostaToAdd.DataScadenza.HasValue ? propostaToAdd.DataScadenza.Value.ToLongDateString() : "n.d.";
|
||
|
||
|
||
// Stato della Proposta
|
||
switch (row["stato_proposta"].ToString().Trim().ToLower())
|
||
{
|
||
case "accettata":
|
||
propostaToAdd.Stato = TipologiaStatoProposta.ACCETTATA;
|
||
break;
|
||
case "completa":
|
||
propostaToAdd.Stato = TipologiaStatoProposta.COMPLETA;
|
||
break;
|
||
}
|
||
|
||
|
||
// Aggiungo la nuova proposta alla collezione
|
||
listaProposte.Add(propostaToAdd);
|
||
|
||
}
|
||
|
||
return listaProposte;
|
||
}
|
||
|
||
///// <summary>
|
||
///// Ritorna la lista delle query che vanno lanciate in MultiThreading necessarie alla stampa del report.
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//private DataTable getQueryPerMultiThreading()
|
||
//{
|
||
// List<Parametro> parametri = new List<Parametro>();
|
||
// Parametro parametro = new Parametro();
|
||
// parametro.ParameterName = "idReport";
|
||
// parametro.DbType = DbType.Int32;
|
||
// parametro.Value = getIdReport(tipoReport);
|
||
// parametri.Add(parametro);
|
||
|
||
// parametro = new Parametro();
|
||
// parametro.ParameterName = "idModello";
|
||
// parametro.DbType = DbType.Int32;
|
||
// parametro.Value = idReport;
|
||
// parametri.Add(parametro);
|
||
|
||
// return DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "R6_S_QuerySezioni", parametri);
|
||
//}
|
||
|
||
/// <summary>
|
||
/// Lancia la R6_S_Generator e recupera le sezioni che andranno stampate sul report.
|
||
/// Usata per i report che hanno una struttura ad albero. Esempio: DIAGNOSI, MONITORAGGIO...
|
||
/// </summary>
|
||
/// <param name="IdReport"></param>
|
||
/// <param name="IdModello"></param>
|
||
/// <returns></returns>
|
||
private DataTable getData(int IdReport, int IdModello)
|
||
{
|
||
List<Parametro> parametri = new List<Parametro>();
|
||
Parametro parametro = new Parametro();
|
||
parametro.ParameterName = "idReport";
|
||
parametro.DbType = DbType.Int32;
|
||
parametro.Value = IdReport;
|
||
parametri.Add(parametro);
|
||
|
||
parametro = new Parametro();
|
||
parametro.ParameterName = "idModello";
|
||
parametro.DbType = DbType.Int32;
|
||
parametro.Value = IdModello;
|
||
parametri.Add(parametro);
|
||
|
||
return DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "R6_S_Generator", parametri);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Lancia la R6_S_Generator_Rischio e recupera le sezioni che andranno stampate sul report di rischio.
|
||
/// Usata per i report che hanno una struttura a scheda. Esempio: RISCHIO, NUCLEO
|
||
/// </summary>
|
||
/// <param name="IdReport"></param>
|
||
/// <param name="IdModello"></param>
|
||
/// <returns></returns>
|
||
private DataTable getData_Schede(int IdReport, int IdModello)
|
||
{
|
||
List<Parametro> parametri = new List<Parametro>();
|
||
Parametro parametro = new Parametro();
|
||
parametro.ParameterName = "idReport";
|
||
parametro.DbType = DbType.Int32;
|
||
parametro.Value = IdReport;
|
||
parametri.Add(parametro);
|
||
|
||
parametro = new Parametro();
|
||
parametro.ParameterName = "idModello";
|
||
parametro.DbType = DbType.Int32;
|
||
parametro.Value = IdModello;
|
||
parametri.Add(parametro);
|
||
|
||
return DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "R6_S_Generator_Rischio", parametri);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Lancia la R6_S_Vincoli e recupera i vincoli di tutte le sezioni
|
||
/// </summary>
|
||
/// <param name="IdModello"></param>
|
||
/// <returns></returns>
|
||
private static DataTable getDataVincoli(int IdModello)
|
||
{
|
||
List<Parametro> parametri = new List<Parametro>();
|
||
Parametro parametro = new Parametro();
|
||
parametro.ParameterName = "idModello";
|
||
parametro.DbType = DbType.Int32;
|
||
parametro.Value = IdModello;
|
||
parametri.Add(parametro);
|
||
|
||
|
||
try
|
||
{
|
||
return DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "R6_S_Vincoli", parametri);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return null;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Crea il report.
|
||
/// Crea una struttura gerarchica :
|
||
/// REPORT
|
||
/// --> CAPITOLO
|
||
/// --> PARAGRAFO
|
||
/// --> SEZIONE
|
||
/// Viene chiamata la R6_S_Generator dalla quale si recuperano tutte le informazioni
|
||
/// a livello di capitolo, paragrafo e sezione.
|
||
/// Ad ogni sezione vengono aggiunti i vincoli di visualizzazione che sono definiti a livello database:
|
||
/// la stored R6_S_Vincoli si occupa di recuperarli.
|
||
/// </summary>
|
||
/// <param name="doc">Documento PDF necesario al disegno del report</param>
|
||
/// <param name="tipologiaReport">Tipo di report da stampare.</param>
|
||
/// <returns></returns>
|
||
private bool createReport(DocumentPDF doc, TipoReport tipologiaReport)
|
||
{
|
||
#region Info su Intermediaio per vincolo colonna intermediario S91
|
||
|
||
if (tipologiaReport != TipoReport.NUCLEO)
|
||
{
|
||
CTable ct = new CTable();
|
||
ct.LoadDati(codiceFiscale, codicePB, codiceRete);
|
||
|
||
_issolounintermediario = ct.Diagnosi_CustomerHaPatrimonioTerziEdHaUnSoloIntermediario();
|
||
_patrimoniobfpresente = ct.Diagnosi_CustomerHasBFWallet();
|
||
_patrimonioterzipresente = ct.Diagnosi_CustomerHaPatrimonioTerzi();
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
// Creo l'oggetto REPORT al quale aggiungero i Capitoli
|
||
Report report = new Report(tipologiaReport);
|
||
|
||
// l'oggetto ParametriReport conterr<72> gli oggetti che vanno mantenuti per convenzione
|
||
// come il DataSectionParameter
|
||
ParametriReport ParametriReport = new ParametriReport(doc);
|
||
ParametriReport.TipoReport = tipologiaReport;
|
||
|
||
#region Settaggio parametri in base al report da stampare
|
||
switch (report.Tipo)
|
||
{
|
||
case TipoReport.DIAGNOSI:
|
||
ParametriReport.DataSectionParameter = dsParam;
|
||
|
||
break;
|
||
case TipoReport.PROPOSTA:
|
||
case TipoReport.PROPOSTA_VALIDATA:
|
||
case TipoReport.PROPOSTA_VALIDATA_WSFMS:
|
||
// Se sto stampando il report di PROPOSTA devo conoscere le aree di bisogno per ciascuna
|
||
// delle quali verr<72> ripetuta la stampa della S70.
|
||
// Recupero le eventuali aree di bisogno.
|
||
dsAreeBisognoProgetto = getAreeBisognoProgetti_Proposta();
|
||
ParametriReport.DataSectionParameter = dsParam;
|
||
|
||
break;
|
||
case TipoReport.PIANIFICAZIONE:
|
||
break;
|
||
case TipoReport.MONITORAGGIO:
|
||
case TipoReport.MONITORAGGIO_CON_ALBERATURA:
|
||
ParametriReport.DatiMonitoraggio = dsDatiMonitoraggio;
|
||
ParametriReport.DataSectionParameter = dsParam;
|
||
if (!string.IsNullOrEmpty(Request.QueryString["rifPianificazione"]))
|
||
{
|
||
if (int.Parse(Request.QueryString["rifPianificazione"]) == 1)
|
||
ParametriReport.RiferimentoPianificazione = true;
|
||
}
|
||
break;
|
||
case TipoReport.RISCHIO:
|
||
case TipoReport.NUCLEO:
|
||
ParametriReport.DatiMonitoraggio = dsDatiMonitoraggio;
|
||
ParametriReport.DataSectionParameter = dsParam;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
#endregion
|
||
|
||
// Associo l'oggetto DocumentPDF gi<67> creato alla propriet<65> DocumentPDF del Report.
|
||
report.DocumentPDF = doc;
|
||
|
||
//Recupero tutti i dati sia dei capitoli, sia dei paragrafi che delle sezioni
|
||
int idModello = 0;
|
||
|
||
DataTable tabellaDati;
|
||
switch (ParametriReport.TipoReport)
|
||
{
|
||
case TipoReport.PROPOSTA_VALIDATA_WSFMS:
|
||
idModello = 14;
|
||
tabellaDati = getData(report.Id, idModello);
|
||
break;
|
||
case TipoReport.RISCHIO:
|
||
case TipoReport.NUCLEO:
|
||
idModello = idReport;
|
||
tabellaDati = getData_Schede(report.Id, idModello);
|
||
break;
|
||
|
||
default:
|
||
idModello = idReport;
|
||
tabellaDati = getData(report.Id, idModello);
|
||
break;
|
||
}
|
||
|
||
ParametriReport.Schema = tabellaDati;
|
||
|
||
#region Copertina, Indice, Glossario
|
||
//recupero se l'utente ha richiesto di stampare la copertina e l'indice.
|
||
//questa informazioen serve perche copertina e indice sono soggetti a vincoli.
|
||
|
||
DataView dwCopertina = new DataView(tabellaDati);
|
||
DataTable dtCopertina = new DataTable("COPERTINA");
|
||
dwCopertina.RowFilter = "CodiceSezione='COPERTINA'";
|
||
dtCopertina = dwCopertina.ToTable();
|
||
if (dtCopertina.Rows.Count > 0)
|
||
report.HasCopertina = true;
|
||
|
||
|
||
DataView dwIndice = new DataView(tabellaDati);
|
||
DataTable dtIndice = new DataTable("INDICE");
|
||
dwIndice.RowFilter = "CodiceSezione='INDICE'";
|
||
dtIndice = dwIndice.ToTable();
|
||
if (dtIndice.Rows.Count > 0)
|
||
report.HasIndice = true;
|
||
|
||
|
||
DataView dwGlossario = new DataView(tabellaDati);
|
||
DataTable dtGlossario = new DataTable("GLOSSARIO");
|
||
dwGlossario.RowFilter = "CodiceSezione='GLOSSARIO'";
|
||
dtGlossario = dwGlossario.ToTable();
|
||
if (dtGlossario.Rows.Count > 0)
|
||
report.HasGlossario = true;
|
||
|
||
#endregion
|
||
|
||
//Recupero tutti i vincoli delle sezioni
|
||
DataTable tabellaVincoli = getDataVincoli(idModello);
|
||
|
||
#region Aggiunta dei capitoli al report
|
||
|
||
//Recupero i capitoli.
|
||
DataView viewCapitoli = new DataView(tabellaDati);
|
||
DataTable tabellaCapitoli = viewCapitoli.ToTable(true, "idCapitolo", "titoloCapitolo", "testoCapitolo", "testoCapitoloAlternativo", "queryOracleCapitolo", "nuovaPaginaCapitolo", "indicizzatoCapitolo");
|
||
|
||
//Aggiungo tutti i capitoli al report.
|
||
int idCapitolo = -1;
|
||
foreach (DataRow rowCapitoli in tabellaCapitoli.Rows)
|
||
{
|
||
CapitoloReport capitolo;
|
||
idCapitolo = Convert.ToInt32(rowCapitoli["idCapitolo"]);
|
||
|
||
if (rowCapitoli["queryOracleCapitolo"].ToString().ToLower() == "intermediario") //duplica il capitolo per ciascun intermediario
|
||
{
|
||
string vincolisuintemediari = getVincoliSuIntermediari(tabellaVincoli, "intermediario");
|
||
// Get vincolo visualizzazione intermediari
|
||
if ((vincolisuintemediari == "TUTTIINTERMEDIARI") && dsParam.Intermediari.Rows.Count != 1)
|
||
{
|
||
capitolo = new CapitoloReport(idCapitolo, rowCapitoli);
|
||
|
||
DataView viewVincoli = new DataView(tabellaVincoli);
|
||
viewVincoli.RowFilter = ("SezioneFisica = '" + idCapitolo.ToString().Replace("'", "''") + "'");
|
||
DataTable datatableVincoli = viewVincoli.ToTable("datatableVincoli");
|
||
capitolo.ImpostaVincoli(datatableVincoli);
|
||
|
||
capitolo.Intermediario = string.Empty;
|
||
AddParagrafiToCapitolo(capitolo, tabellaDati, tabellaVincoli, dsAreeBisognoProgetto);
|
||
// aggiunge il capitolo al report
|
||
report.Add(capitolo);
|
||
}
|
||
else
|
||
{
|
||
foreach (DataRow rIntermediari in dsParam.Intermediari.Rows)
|
||
{
|
||
capitolo = new CapitoloReport(idCapitolo, rowCapitoli);
|
||
|
||
DataView viewVincoli = new DataView(tabellaVincoli);
|
||
viewVincoli.RowFilter = ("SezioneFisica = 'C" + idCapitolo.ToString().Replace("'", "''") + "'");
|
||
DataTable datatableVincoli = viewVincoli.ToTable("datatableVincoli");
|
||
|
||
|
||
capitolo.ImpostaVincoli(datatableVincoli);
|
||
// se c'e' un solo intermediario devo rimpiazzare il titolo
|
||
//if (dtIntermediari.Rows.Count == 1)
|
||
//{
|
||
// capitolo.Titolo = Resources.GlobalResource.Vincolo_Singolo_Intermediario_Titolo_Capitolo;
|
||
// capitolo.TestoIntroduttivo = Resources.GlobalResource.Vincolo_Singolo_Intermediario_Testo_Capitolo;
|
||
//}
|
||
capitolo.Intermediario = rIntermediari["Descrizione"].ToString();
|
||
AddParagrafiToCapitolo(capitolo, tabellaDati, tabellaVincoli, dsAreeBisognoProgetto);
|
||
// aggiunge il capitolo al report
|
||
report.Add(capitolo);
|
||
}
|
||
}
|
||
}
|
||
else if ((rowCapitoli["queryOracleCapitolo"].ToString().ToLower() == "approfondimentorischio")) // duplica i capitoli per ogni perimetro di approfondimento
|
||
{
|
||
#region Recupero i perimetri di approfondimento.
|
||
|
||
DataTable dtPerimetri = new DataTable();
|
||
dtPerimetri.Columns.Add("Perimetro", typeof(string));
|
||
|
||
dtPerimetri.Rows.Add("PERIMETRO_CASA");
|
||
dtPerimetri.Rows.Add("PERIMETRO_TERZI");
|
||
dtPerimetri.Rows.Add("PERIMETRO_COMPLESSIVO");
|
||
|
||
#endregion
|
||
|
||
foreach (DataRow drPerimetro in dtPerimetri.Rows)
|
||
{
|
||
capitolo = new CapitoloReport(idCapitolo, rowCapitoli);
|
||
|
||
capitolo.Intermediario = drPerimetro["Perimetro"].ToString();
|
||
AddParagrafiToCapitolo(capitolo, tabellaDati, tabellaVincoli, dsAreeBisognoProgetto);
|
||
|
||
// aggiunge il capitolo al report
|
||
report.Add(capitolo);
|
||
}
|
||
|
||
}
|
||
else if (rowCapitoli["queryOracleCapitolo"].ToString() == string.Empty)
|
||
{
|
||
capitolo = new CapitoloReport(idCapitolo, rowCapitoli);
|
||
// Uso l'impostazione dei vincoli della sezione anche per i capitoli
|
||
DataView viewVincoli = new DataView(tabellaVincoli);
|
||
viewVincoli.RowFilter = ("SezioneFisica = 'C" + idCapitolo.ToString().Replace("'", "''") + "'");
|
||
DataTable datatableVincoli = viewVincoli.ToTable("datatableVincoli");
|
||
|
||
capitolo.ImpostaVincoli(datatableVincoli);
|
||
capitolo.Intermediario = string.Empty;
|
||
AddParagrafiToCapitolo(capitolo, tabellaDati, tabellaVincoli, dsAreeBisognoProgetto);
|
||
// aggiunge il capitolo al report
|
||
report.Add(capitolo);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
// Disegno il Report.
|
||
report.Disegna(ParametriReport);
|
||
|
||
return true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Ritorna un datatable contenente i vincoli impostati sugli intermediari
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private string getVincoliSuIntermediari(DataTable dt, string chiaveFiltro)
|
||
{
|
||
DataRow[] drArray = dt.Select(" SezioneFisica = '" + chiaveFiltro.Replace("'", "''") + "'");
|
||
|
||
if (drArray.Length > 0)
|
||
return drArray[0]["CodiceVincoloApplicativo"].ToString();
|
||
else
|
||
return "";
|
||
}
|
||
|
||
/// <summary>
|
||
/// Aggiunge i paragrafi al capitolo.
|
||
/// </summary>
|
||
/// <param name="capitolo"></param>
|
||
/// <param name="tabellaDati"></param>
|
||
/// <param name="tabellaVincoli"></param>
|
||
/// <param name="dsAreeBisognoProgetto"></param>
|
||
private void AddParagrafiToCapitolo(CapitoloReport capitolo, DataTable tabellaDati, DataTable tabellaVincoli, DataSet dsAreeBisognoProgetto)
|
||
{
|
||
//Recupero i paragrafi per ogni capitolo.
|
||
DataView viewParagrafo = new DataView(tabellaDati);
|
||
|
||
viewParagrafo.RowFilter = "idCapitolo = " + capitolo.Id.ToString();
|
||
DataTable tabellaParagrafi = viewParagrafo.ToTable(true, "idParagrafo", "ordineParagrafo", "titoloParagrafo", "sottoTitoloParagrafo", "testoParagrafo", "queryOracleParagrafo", "indicizzatoParagrafo", "SpazioNecessarioSezioneSuccessiva");
|
||
|
||
ParagrafoReport paragrafo = null;
|
||
|
||
int idParagrafo = -1;
|
||
|
||
foreach (DataRow rowParagrafi in tabellaParagrafi.Rows)
|
||
{
|
||
idParagrafo = Convert.ToInt32(rowParagrafi["idParagrafo"]);
|
||
paragrafo = new ParagrafoReport(idParagrafo, rowParagrafi);
|
||
paragrafo.SpazioNecessarioSezioneSuccessiva = rowParagrafi["SpazioNecessarioSezioneSuccessiva"] == DBNull.Value ? 0 : Convert.ToInt32(rowParagrafi["SpazioNecessarioSezioneSuccessiva"]);
|
||
|
||
DataView viewVincoliParagrafo = new DataView(tabellaVincoli);
|
||
viewVincoliParagrafo.RowFilter = ("SezioneFisica = 'P" + idParagrafo.ToString().Replace("'", "''") + "'");
|
||
DataTable datatableVincoliParagrafo = viewVincoliParagrafo.ToTable("datatableVincoli");
|
||
|
||
paragrafo.ImpostaVincoli(datatableVincoliParagrafo);
|
||
|
||
|
||
if ((rowParagrafi["queryOracleParagrafo"].ToString().ToLower() == "areaprogetto")) // duplica i paragrafi in base ad ogni area/progetto
|
||
{
|
||
if (paragrafo.CheckStampaElemento)
|
||
{
|
||
int countPrev = 0;
|
||
foreach (DataRow r in dsAreeBisognoProgetto.Tables["TabellaAreeBisogno"].Rows)
|
||
{
|
||
paragrafo.AreaProgettoDescrizione = r["Need_Estesa"].ToString();
|
||
paragrafo.AreaProgettoCodice = r["Need_Breve"].ToString();
|
||
|
||
if (r["Need_Breve"].ToString().ToLower() == "inv") // <20> un area di investimento quindi mi recupero tutti i progetti.
|
||
{
|
||
int iProgettoInvestimento = 0;
|
||
foreach (DataRow rInvestimento in dsAreeBisognoProgetto.Tables["TabellaProgetti"].Rows)
|
||
{
|
||
paragrafo.NomeProgetto = rInvestimento["Nome_Progetto_Investimento"].ToString();
|
||
if (iProgettoInvestimento == 0)
|
||
paragrafo.NomeProgettoDaIndicizzare = rInvestimento["Nome_Progetto_Investimento"].ToString();
|
||
|
||
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
iProgettoInvestimento++;
|
||
}
|
||
}
|
||
else if (r["Need_Breve"].ToString().ToLower() == "pre1"
|
||
|| r["Need_Breve"].ToString().ToLower() == "pre2") //e' un'area previdenza (essenziale o accessoria)
|
||
{
|
||
paragrafo.AreaProgettoDescrizione = "Previdenza";
|
||
paragrafo.AreaProgettoCodice = "Pre";
|
||
|
||
if (countPrev == 0)
|
||
paragrafo.NomePrevidenzaDaIndicizzare = r["Need_Estesa"].ToString();
|
||
|
||
paragrafo.NomeProgetto = r["Need_Estesa"].ToString();
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
|
||
countPrev++;
|
||
}
|
||
else // e' un'area priva di sottosezioni progetti o investimenti
|
||
{
|
||
|
||
paragrafo.NomeProgetto = string.Empty;
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
}
|
||
|
||
}
|
||
|
||
paragrafo.CheckStampaElemento = false;
|
||
// aggiunge il paragrafo al capitolo
|
||
capitolo.Add(paragrafo);
|
||
}
|
||
}
|
||
else if ((rowParagrafi["queryOracleParagrafo"].ToString().ToLower() == "areemonitorate")) // duplica i paragrafi per ogni area monitorata.
|
||
{
|
||
int numeroProgettiInvestimento = 0;
|
||
DataTable dtAreeMonitorate = new DataTable("AreeMonitorate");
|
||
dtAreeMonitorate = dsDatiMonitoraggio.AreeMonitorate.Copy();
|
||
|
||
#region Aggiungo al datatatable delle areemonitorate anche la riga relativa ai cc negativi e linea self , se presenti.
|
||
|
||
if (dsParam.ContiCorrenti.GetContiCorrentiNegativi_CC_Casa().Count > 0)
|
||
{
|
||
// Riga fittizia che permette di stampare il paragrafo dei cc negativi.
|
||
// Imposto 55 come ordine di areasortorderMonitoraggioFase2 perche questo dettaglio va inserito tra l'ultima area monitorata (extrarendimento = 50) e il dettaglio delle risorse non allocate (na = 60)
|
||
// Imposto 1 come AREAPROGETTOSOTTOMONITORAGGIO altrimenti secondo logica stamperebbe la S43 e non la S43BIS
|
||
dtAreeMonitorate.Rows.Add("CCNegativi", "Conti Correnti Negativi", DBNull.Value, string.Empty, 0, 0, 0, 55, 1);
|
||
}
|
||
|
||
if (dsParam.LineeSelf.SelfNegativa())
|
||
{
|
||
// Riga fittizia che permette di stampare il paragrafo dei cc negativi.
|
||
// Imposto 57 come ordine di areasortorderMonitoraggioFase2 perche questo dettaglio va inserito tra CCNegativi (55) e il dettaglio delle risorse non allocate (na = 60)
|
||
// Imposto 1 come AREAPROGETTOSOTTOMONITORAGGIO altrimenti secondo logica stamperebbe la S43 e non la S43BIS
|
||
dtAreeMonitorate.Rows.Add("LineaSelf", "Liquidit<69> negativa ''Linea GP Self Fond''", DBNull.Value, string.Empty, 0, 0, 0, 57, 1);
|
||
}
|
||
|
||
#endregion
|
||
|
||
// sort del datatable AreeMonitorate
|
||
DataView view = dtAreeMonitorate.DefaultView;
|
||
view.Sort = "areasortorderMonitoraggioFase2";
|
||
dtAreeMonitorate = view.ToTable();
|
||
|
||
|
||
DataRow[] drTotaleProgettiInvestimento = dtAreeMonitorate.Select(" Need_Area = 'Inv'");
|
||
int totaleProgettiInvestimento = drTotaleProgettiInvestimento.Length;
|
||
|
||
bool stampaAreaBisogno = false;
|
||
bool monitoraggio_con_alberatura = false;
|
||
if (!string.IsNullOrEmpty(Request.QueryString.Get("monitoraggio_con_alberatura")))
|
||
monitoraggio_con_alberatura = bool.Parse(Request.QueryString.Get("monitoraggio_con_alberatura"));
|
||
|
||
foreach (DataRow rAreeeMonitorate in dtAreeMonitorate.Rows)
|
||
{
|
||
#region Verifica aree di bisogno da stampare in base a selezione utente sul report di monitoraggio personalizzabile
|
||
|
||
if (monitoraggio_con_alberatura)
|
||
{
|
||
stampaAreaBisogno = false;
|
||
|
||
// VERIFICO SE L'UTENTE HA SCELTO DI STAMPARE L'AREA DI BISOGNO CORRENTE.
|
||
// Solamente l'area Na, CCnegativi e LineaSelf vanno sempre stampate a prescidere dalle selezioni
|
||
if (rAreeeMonitorate["Need_Area"].ToString().ToLower() == "na" ||
|
||
rAreeeMonitorate["Need_Area"].ToString().ToLower() == "ccnegativi" ||
|
||
rAreeeMonitorate["Need_Area"].ToString().ToLower() == "lineaself")
|
||
|
||
stampaAreaBisogno = true;
|
||
else
|
||
{
|
||
DataRow[] drAreaBisognoStampabile = tabellaVincoli.Select(" codicevincoloapplicativo = 'STAMPA_AREA_BISOGNO' AND SEZIONEFISICA = '" + rAreeeMonitorate["Need_Area"].ToString().ToUpper() + "'");
|
||
if (drAreaBisognoStampabile.Length > 0)
|
||
stampaAreaBisogno = true;
|
||
}
|
||
}
|
||
else
|
||
stampaAreaBisogno = true;
|
||
|
||
#endregion
|
||
|
||
if (stampaAreaBisogno)
|
||
{
|
||
paragrafo = new ParagrafoReport(idParagrafo, rowParagrafi);
|
||
paragrafo.Titolo = rAreeeMonitorate["Need_Estesa"].ToString();
|
||
paragrafo.AreaProgettoDescrizione = rAreeeMonitorate["Need_Estesa"].ToString();
|
||
paragrafo.AreaProgettoCodice = rAreeeMonitorate["Need_Area"].ToString();
|
||
paragrafo.AreaProgettoSottoMonitoraggio = rAreeeMonitorate["areaprogettosottomonitoraggio"] == DBNull.Value ? false : Convert.ToBoolean(rAreeeMonitorate["areaprogettosottomonitoraggio"]);
|
||
|
||
if (rAreeeMonitorate["Need_Area"].ToString().ToLower() != "inv")
|
||
paragrafo.NomeProgetto = string.Empty;
|
||
else // <20> un area di investimento quindi mi recupero il nome del progetto.
|
||
{
|
||
paragrafo.NomeProgetto = rAreeeMonitorate["Nome_Progetto"].ToString();
|
||
|
||
if (totaleProgettiInvestimento == 1 && rAreeeMonitorate["Nome_Progetto"].ToString().ToLower() == "progetto investimento")
|
||
paragrafo.SottoTitolo = string.Empty;
|
||
else
|
||
paragrafo.SottoTitolo = rAreeeMonitorate["Nome_Progetto"].ToString();
|
||
|
||
paragrafo.NumeroProgettiInvestimento = drTotaleProgettiInvestimento.Length;
|
||
|
||
// va indicizzato solo il primo dei paragrafi di investimento nel caso ci siano + progetti.
|
||
// ogni progetto di investimento <20> considerato un paragrafo nuovo.
|
||
if (numeroProgettiInvestimento > 0)
|
||
paragrafo.Indicizzato = false;
|
||
|
||
numeroProgettiInvestimento++;
|
||
}
|
||
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
paragrafo.RipetiStampaElemento = true;
|
||
|
||
// aggiunge il paragrafo al capitolo
|
||
capitolo.Add(paragrafo);
|
||
}
|
||
}
|
||
}
|
||
else if ((rowParagrafi["queryOracleParagrafo"].ToString().ToLower() == "approfondimentorischio")) // duplica i paragrafi per ogni perimetro di approfondimento (vedi albero diagnosi sul capitolo analisi rischio).
|
||
{
|
||
#region Recupero dai vincoli le sezioni fatte dall'utente per quanto riguarda i perimetri di approfondimento.
|
||
|
||
DataTable dtPerimetri = new DataTable();
|
||
dtPerimetri.Columns.Add("Perimetro", typeof(string));
|
||
|
||
|
||
if (tabellaVincoli.Select("CodiceVincoloApplicativo='PERIMETRO_COMPLESSIVO'").Length > 0)
|
||
dtPerimetri.Rows.Add("PERIMETRO_COMPLESSIVO");
|
||
|
||
if (tabellaVincoli.Select("CodiceVincoloApplicativo='PERIMETRO_CASA'").Length > 0)
|
||
dtPerimetri.Rows.Add("PERIMETRO_CASA");
|
||
|
||
if (tabellaVincoli.Select("CodiceVincoloApplicativo='PERIMETRO_TERZI'").Length > 0)
|
||
dtPerimetri.Rows.Add("PERIMETRO_TERZI");
|
||
|
||
|
||
#endregion
|
||
|
||
//CTable tbl = new CTable();
|
||
//tbl.LoadDatixMenu(codiceFiscale, codicePB, codiceRete, "DIAGNOSI");
|
||
//bool CustomerHaBFWallet = tbl.Diagnosi_CustomerHasBFWallet(codiceFiscale, codiceRete + codicePB);
|
||
//bool CustomerHaPatrimonioTerzi = tbl.Diagnosi_CustomerHaPatrimonioTerzi(codiceFiscale, codiceRete + codicePB);
|
||
|
||
string strIntermediario = string.Empty;
|
||
// ciclo sulle selezioni di permitro fatte dall'utente
|
||
foreach (DataRow drPerimetro in dtPerimetri.Rows)
|
||
{
|
||
if (drPerimetro["Perimetro"].ToString() != "PERIMETRO_TERZI")
|
||
{
|
||
// aggiungo il PERIMETRO_COMPLESSIVO solo se il cliente ha sia il PERIMETRO_CASA che il PERIMETRO_TERZI, ossia ha patrimonio BF (o SPI) e patrimonio Terzi
|
||
if (drPerimetro["Perimetro"].ToString() == "PERIMETRO_COMPLESSIVO")
|
||
{
|
||
if (_patrimoniobfpresente && _patrimonioterzipresente)
|
||
{
|
||
paragrafo.Intermediario = drPerimetro["Perimetro"].ToString(); // settiamo l'intermediaro per passarlo a livello di sezione
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
paragrafo.Intermediario = drPerimetro["Perimetro"].ToString(); // settiamo l'intermediaro per passarlo a livello di sezione
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
foreach (DataRow drIntermediari in dsParam.Intermediari.Rows)
|
||
{
|
||
paragrafo.Intermediario = drIntermediari["Descrizione"].ToString(); // settiamo l'intermediaro per passarlo a livello di sezione
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
// aggiunge il paragrafo al capitolo
|
||
capitolo.Add(paragrafo);
|
||
}
|
||
else
|
||
{
|
||
if (capitolo.Intermediario.Length > 0)
|
||
paragrafo.Intermediario = capitolo.Intermediario;
|
||
|
||
AddSezioniToParagrafo(capitolo, paragrafo, tabellaDati, tabellaVincoli);
|
||
// aggiunge il paragrafo al capitolo
|
||
capitolo.Add(paragrafo);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Aggiunge le sezioni al paragrafo.
|
||
/// Di ciascuna sezione recupera e imposta i vincoli settati a livello di database.
|
||
/// </summary>
|
||
/// <param name="capitolo"></param>
|
||
/// <param name="paragrafo"></param>
|
||
/// <param name="tabellaDati"></param>
|
||
/// <param name="tabellaVincoli"></param>
|
||
private void AddSezioniToParagrafo(CapitoloReport capitolo, ParagrafoReport paragrafo, DataTable tabellaDati, DataTable tabellaVincoli)
|
||
{
|
||
//Recupero le sezioni per ogni paragrafo
|
||
DataView viewSezioni = new DataView(tabellaDati);
|
||
viewSezioni.RowFilter = "idParagrafo = " + paragrafo.Id.ToString() + " AND idCapitolo= " + capitolo.Id.ToString(); // aggiungere il filtro del capitolo
|
||
DataTable tabellaSezioni =
|
||
viewSezioni.ToTable(true, "idSezione", "codiceSezione", "titoloSezione", "testoSezione",
|
||
"testoSezioneAlternativo", "notaSezione", "notaSezioneAlternativo", "queryOracleSezione",
|
||
"indicizzatoSezione", "filtroSezione");
|
||
foreach (DataRow rowSezioni in tabellaSezioni.Rows)
|
||
{
|
||
SezioneReport sezione;
|
||
sezione = new SezioneReport(rowSezioni["codiceSezione"].ToString(), rowSezioni);
|
||
sezione.FiltroSezione = rowSezioni["filtroSezione"].ToString();
|
||
|
||
sezione.AreaProgettoDescrizione = paragrafo.AreaProgettoDescrizione;
|
||
sezione.AreaProgettoCodice = paragrafo.AreaProgettoCodice;
|
||
sezione.NomeProgetto = paragrafo.NomeProgetto;
|
||
sezione.AreaProgettoSottoMonitoraggio = paragrafo.AreaProgettoSottoMonitoraggio;
|
||
sezione.NumeroProgettiInvestimento = paragrafo.NumeroProgettiInvestimento;
|
||
sezione.Intermediario = paragrafo.Intermediario;
|
||
|
||
// recupero i vincoli della sezione e setto la propriet<65> vincolo della stessa.
|
||
if (tabellaVincoli != null)
|
||
{
|
||
DataView viewVincoli = new DataView(tabellaVincoli);
|
||
viewVincoli.RowFilter = ("SezioneFisica = '" + sezione.Codice.Replace("'", "''") + "'");
|
||
DataTable datatableVincoli = viewVincoli.ToTable("datatableVincoli");
|
||
|
||
// Gestione vincolo sezione S91 Tabella Var Proxati
|
||
if (_issolounintermediario)
|
||
datatableVincoli.ExtendedProperties.Add("ISSOLOUNINTERMEDIARIO", "true");
|
||
else
|
||
datatableVincoli.ExtendedProperties.Add("ISSOLOUNINTERMEDIARIO", "false");
|
||
|
||
// Aggiungo i vincoli alla Sezione.
|
||
sezione.ImpostaVincoli(datatableVincoli);
|
||
}
|
||
|
||
// Gestione personalizzata per le aree di risorse non allocate e dei conti correnti a saldo negativi e linea self.
|
||
if (paragrafo.AreaProgettoCodice.ToLower() == "na" || paragrafo.AreaProgettoCodice.ToLower() == "ccnegativi" || paragrafo.AreaProgettoCodice.ToLower() == "lineaself")
|
||
{
|
||
if (paragrafo.AreaProgettoCodice.ToLower() == "na")
|
||
{
|
||
paragrafo.Titolo = "Risorse non allocate";
|
||
paragrafo.TestoIntroduttivo = "Nella tabella sono elencati i prodotti non ancora allocati sulle aree di bisogno.";
|
||
}
|
||
else if (paragrafo.AreaProgettoCodice.ToLower() == "ccnegativi")
|
||
{
|
||
paragrafo.Titolo = "Conti correnti a saldo negativo";
|
||
paragrafo.TestoIntroduttivo = string.Empty;
|
||
}
|
||
else if (paragrafo.AreaProgettoCodice.ToLower() == "lineaself")
|
||
{
|
||
paragrafo.Titolo = "Liquidit<69> negativa ''Linea GP Self Fond''";
|
||
paragrafo.TestoIntroduttivo = string.Empty;
|
||
}
|
||
|
||
if (sezione.Codice == "S43BIS")
|
||
{
|
||
sezione.Titolo = string.Empty;
|
||
paragrafo.Add(sezione);
|
||
}
|
||
}
|
||
else
|
||
paragrafo.Add(sezione);
|
||
|
||
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Recupera le aree di bisogno e popola AreeBisognoProgetto dell'oggetto DataSectionParameter
|
||
/// con la lista delle aree di bisogno/progetto per la singola proposta
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private DataSet getAreeBisognoProgetti_Proposta()
|
||
{
|
||
DataTable tableareeBisogno;
|
||
//tableareeBisogno = SectionManager.GetDataSection("Generator_getPropostaSpecs", dsParam);
|
||
tableareeBisogno = BusinessManager.GetDataTableFromStoredProcedure_ConsulenzaEvoluta("REP_Prop_AreeBisogno", dsParam.ChiaveClientePB, dsParam.Proposta.Chiave);
|
||
tableareeBisogno.TableName = "TabellaAreeBisogno";
|
||
dsAreeBisognoProgetto.Tables.Add(tableareeBisogno.Copy());
|
||
|
||
DataTable tableProgetti;
|
||
//tableProgetti = SectionManager.GetDataSection("Generator_setCliente_for", dsParam);
|
||
tableProgetti = BusinessManager.GetDataTableFromStoredProcedure_ConsulenzaEvoluta("REP_Prop_ProgettiInvestimento", dsParam.ChiaveClientePB, dsParam.Proposta.Chiave);
|
||
tableProgetti.TableName = "TabellaProgetti";
|
||
dsAreeBisognoProgetto.Tables.Add(tableProgetti.Copy());
|
||
|
||
return dsAreeBisognoProgetto;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Sostituisce le variabili presenti nel testo (inidcate con $/...../$ con il valore corrispondente
|
||
/// </summary>
|
||
/// <returns> La stringa modificata </returns>
|
||
private string loadVariabile(string testo)
|
||
{
|
||
string testoOriginale = testo;
|
||
char[] define = { '$', '/', ',', '.' };
|
||
|
||
const char Space = ' ';
|
||
|
||
char[] delimiters = new char[]
|
||
{
|
||
Space
|
||
};
|
||
|
||
// split the string and then iterate over the
|
||
// resulting array of strings
|
||
if (testo != " ")
|
||
foreach (string variabile in testo.Split(delimiters))
|
||
{
|
||
string app = variabile.TrimStart(define);
|
||
app = app.TrimEnd(define);
|
||
switch (app)
|
||
{
|
||
#region Area
|
||
case "Area":
|
||
app = dsParam.Area;
|
||
testoOriginale = testoOriginale.Replace("$/Area/$", dsParam.AreaEstesa);
|
||
break;
|
||
#endregion
|
||
|
||
#region AreaProgetto
|
||
case "AreaProgetto":
|
||
app = dsParam.Area;
|
||
if (app != "Inv")
|
||
testoOriginale = testoOriginale.Replace("$/AreaProgetto/$", dsParam.AreaEstesa);
|
||
else
|
||
testoOriginale = testoOriginale.Replace("$/AreaProgetto/$", dsParam.Progetto);
|
||
break;
|
||
#endregion
|
||
|
||
#region AreaProgettoA
|
||
case "AreaProgettoA":
|
||
app = dsParam.Area;
|
||
if (app != "Inv")
|
||
testoOriginale = testoOriginale.Replace("$/AreaProgettoA/$", "all<6C>area di " + dsParam.AreaEstesa);
|
||
else
|
||
testoOriginale = testoOriginale.Replace("$/AreaProgettoA/$", "al progetto " + dsParam.Progetto);
|
||
break;
|
||
#endregion
|
||
|
||
#region AreaProgettoD
|
||
case "AreaProgettoD":
|
||
app = dsParam.Area;
|
||
if (app != "Inv")
|
||
testoOriginale = testoOriginale.Replace("$/AreaProgettoD/$", "dell<6C>area di " + dsParam.AreaEstesa);
|
||
else
|
||
testoOriginale = testoOriginale.Replace("$/AreaProgettoD/$", "del progetto " + dsParam.Progetto);
|
||
break;
|
||
#endregion
|
||
|
||
#region Progetto
|
||
case "Progetto":
|
||
app = dsParam.Progetto;
|
||
testoOriginale = testoOriginale.Replace("$/Progetto/$", dsParam.Progetto);
|
||
break;
|
||
#endregion
|
||
|
||
#region Intermediario
|
||
case "Intermediario":
|
||
app = dsParam.Intermediario;
|
||
if (dsParam.Intermediario == "Altro")
|
||
testoOriginale = testoOriginale.Replace("$/Intermediario/$", "Altro intermediario");
|
||
else
|
||
testoOriginale = testoOriginale.Replace("$/Intermediario/$", dsParam.Intermediario);
|
||
break;
|
||
#endregion
|
||
|
||
#region Banca
|
||
case "Banca":
|
||
if (dsParam.CodiceRete == "F")
|
||
testoOriginale = testoOriginale.Replace("$/Banca/$", "Fideuram");
|
||
else
|
||
testoOriginale = testoOriginale.Replace("$/Banca/$", "Sanpaolo Invest");
|
||
break;
|
||
#endregion
|
||
|
||
#region DataPianificazione
|
||
case "DataPianificazione":
|
||
|
||
string dataPianificazioneString = dsParam.Pianificazione.DataPianificazione.HasValue ? dsParam.Pianificazione.DataPianificazione.Value.ToShortDateString() : "n.d.";
|
||
testoOriginale = testoOriginale.Replace("$/DataPianificazione/$", dataPianificazioneString);
|
||
break;
|
||
#endregion
|
||
|
||
#region DataProposta
|
||
//case "DataProposta":
|
||
// //app = dsParam.DataFineProposta;
|
||
// testoOriginale = testoOriginale.Replace("$/DataProposta/$", dsParam.Proposte.DataScadenzaString);
|
||
// break;
|
||
#endregion
|
||
|
||
#region FontSize
|
||
case "FontSize":
|
||
testoOriginale = testoOriginale.Replace("$/FontSize/$", "</font><font pointSize='6'>font size, </font>");
|
||
break;
|
||
#endregion
|
||
|
||
|
||
|
||
}
|
||
}
|
||
|
||
return testoOriginale;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Ritorna il nome esteso dell'area a seconda del codice area passato in input.
|
||
/// </summary>
|
||
/// <param name="codArea"></param>
|
||
/// <returns></returns>
|
||
private string getNomeArea(string codArea)
|
||
{
|
||
switch (codArea.ToUpper().Trim())
|
||
{
|
||
case "INV":
|
||
return "Investimento";
|
||
|
||
case "EXT":
|
||
return "ExtraRendimento";
|
||
|
||
case "RIS":
|
||
return "Riserva";
|
||
|
||
case "LIQ":
|
||
return "Liquidit<69>";
|
||
|
||
case "PRE":
|
||
return "Previdenza";
|
||
|
||
default:
|
||
return "";
|
||
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="tipoReport"></param>
|
||
/// <returns></returns>
|
||
private int getIdReport(string tipoReport)
|
||
{
|
||
switch (tipoReport.ToUpper().Trim())
|
||
{
|
||
case "DIAGNOSI":
|
||
return 1;
|
||
|
||
case "PIANIFICAZIONE":
|
||
return 2;
|
||
|
||
case "PROPOSTA":
|
||
return 3;
|
||
|
||
case "MONITORAGGIO":
|
||
{
|
||
if (Request.QueryString["monitoraggio_con_alberatura"] == "true")
|
||
return 5;
|
||
else
|
||
return 4;
|
||
}
|
||
|
||
default:
|
||
return 0;
|
||
|
||
}
|
||
}
|
||
|
||
#region Metodi usati solo dal Report di Pianificazione
|
||
|
||
|
||
/// <summary>
|
||
/// Crea il report.
|
||
/// Vecchia versione mantenuta per convenzione che si basa sull'XML.
|
||
/// Attualmente solo il report di Pianificazione viene generato da questo codice.
|
||
/// </summary>
|
||
/// <param name="doc"></param>
|
||
/// <param name="tipoReport"></param>
|
||
/// <returns></returns>
|
||
private bool createReport(DocumentPDF doc, string tipoReport)
|
||
{
|
||
int numberOfQUERYtags = 0;
|
||
int numberOfQUERYtagsDatiSintetici = 0;
|
||
int numberOfQUERYtagsInv = 0;
|
||
|
||
string path = "";
|
||
|
||
try
|
||
{
|
||
string xmlFilename = "";
|
||
bool status = true;
|
||
string sezione = "";
|
||
string combo = "";
|
||
bool flag = false;
|
||
string tipo = "";
|
||
string titolo = "";
|
||
string testo = string.Empty;
|
||
string ChapterTitolo = "";
|
||
string ChapterHeader = "";
|
||
XmlNode node;
|
||
int idx = 0;
|
||
int idy = 0;
|
||
int idz = 0;
|
||
//int indiceAreeBisogno = 0;
|
||
|
||
|
||
Queue qp = new Queue();
|
||
elementoStampa es = new elementoStampa();
|
||
attributiElementoStampa aes = new attributiElementoStampa();
|
||
|
||
switch (tipoReport)
|
||
{
|
||
case "PIANIFICAZIONE":
|
||
numberOfQUERYtagsInv = getPianificazioneSpecs();
|
||
xmlFilename = WebConfigParameter.getParameter("PIANIFICAZIONE");
|
||
break;
|
||
}
|
||
|
||
//ricaviamo le scelte del PB memorizzate nel DB e le inseriamo nell'opportuno template XML
|
||
bool rc = readXMLTemplate(xmlFilename);
|
||
if (!rc)
|
||
{
|
||
int rcode = loadReportToPrint(idReport);
|
||
if (rcode == 0)
|
||
{
|
||
fillTemplateWithValues();
|
||
}
|
||
}//a questo punto ho la struttura completa dell'XML con i valori scelti dal PB attraverso l'interfaccia Web
|
||
|
||
switch (tipoReport)
|
||
{
|
||
case "PIANIFICAZIONE":
|
||
//inserisco il "blocco" QUERY all'interno del preesistente XML di base
|
||
if (numberOfQUERYtagsInv > 1)
|
||
{
|
||
for (int i = 0; i < numberOfQUERYtagsInv - 1; i++)
|
||
{
|
||
insertQUERYblockIntoXml("[@Value='Progetto']");
|
||
}
|
||
}
|
||
else if (numberOfQUERYtagsInv == 0) deleteQUERYblockIntoXml("QUERY[@Value='Investimento']");
|
||
if (numberOfQUERYtagsRis == 0) deleteQUERYblockIntoXml("QUERY[@Value='Riserva']");
|
||
break;
|
||
|
||
}
|
||
|
||
Guid guid = Guid.NewGuid();
|
||
string initDir = WebConfigParameter.getParameter("Path");
|
||
path = initDir + WebConfigParameter.getParameter("XMLDIR") + guid + ".xml";
|
||
|
||
//salvataggio file temporaneo
|
||
docIN.Save(path);
|
||
|
||
//ORA possiamo iniziare il processo di STAMPA del report con le scelte desiderate dal PB
|
||
using (XmlReader reader = XmlReader.Create(path))
|
||
{
|
||
XmlNode root = docIN.DocumentElement;
|
||
|
||
while (reader.Read())
|
||
{
|
||
string nodeName = reader.LocalName;
|
||
switch (reader.NodeType)
|
||
{
|
||
case XmlNodeType.Element: // The node is an element.
|
||
|
||
switch (reader.Name)
|
||
{
|
||
case "SECTION":
|
||
combo = "";
|
||
while (reader.MoveToNextAttribute()) // Read the attributes.
|
||
switch (reader.Name)
|
||
{
|
||
case "Value":
|
||
sezione = reader.Value;
|
||
break;
|
||
case "Titolo":
|
||
titolo = reader.Value;
|
||
break;
|
||
case "combo":
|
||
combo = reader.Value;
|
||
break;
|
||
case "tipo":
|
||
tipo = reader.Value;
|
||
break;
|
||
case "testo":
|
||
testo = reader.Value;
|
||
break;
|
||
|
||
}
|
||
DatiSezione sec;
|
||
DataSectionResult data = new DataSectionResult();
|
||
sec = new DatiSezione(doc);
|
||
sec.Tipo = tipo;
|
||
|
||
if (combo != "")
|
||
{
|
||
int i = 0;
|
||
XmlNodeList nodeList = root.SelectNodes("descendant::" + combo);
|
||
while (i < nodeList.Count)
|
||
{
|
||
node = nodeList[i];
|
||
if (node != null && node.Attributes["flag"].Value == "1")
|
||
{
|
||
sec.Tipo = "combo";
|
||
}
|
||
i++;
|
||
}
|
||
}
|
||
|
||
sec.Sezione = sezione;
|
||
sec.Titolo = titolo;
|
||
|
||
data = loadDataSection(sec);
|
||
if (data.Esito > 0)
|
||
{
|
||
sec.SetDataSet(data.DatiSezione);
|
||
SvuotaCoda(qp, doc, sec);
|
||
status = loadSection(sec);
|
||
}
|
||
combo = "";
|
||
break;
|
||
|
||
case "COPERT":
|
||
while (reader.MoveToNextAttribute()) // Read the attributes.
|
||
switch (reader.Name)
|
||
{
|
||
case "flag":
|
||
if (reader.Value != "1")
|
||
reader.Skip();
|
||
else
|
||
flag = true;
|
||
break;
|
||
case "Titolo":
|
||
titolo = reader.Value;
|
||
break;
|
||
}
|
||
if (flag)
|
||
{
|
||
XmlNodeList nodeList = root.SelectNodes("descendant::" + "ESNOCL");
|
||
node = nodeList[0];
|
||
if (node != null && node.Attributes["flag"].Value == "1")
|
||
doc.creaCopertina(tipoReport, false);
|
||
else
|
||
doc.creaCopertina(tipoReport, true);
|
||
}
|
||
flag = false;
|
||
break;
|
||
|
||
case "INDICE":
|
||
while (reader.MoveToNextAttribute()) // Read the attributes.
|
||
switch (reader.Name)
|
||
{
|
||
case "flag":
|
||
if (reader.Value != "1")
|
||
reader.Skip();
|
||
else
|
||
flag = true;
|
||
break;
|
||
}
|
||
if (flag)
|
||
doc.creaIndice();
|
||
flag = false;
|
||
break;
|
||
|
||
case "GLOSSA":
|
||
while (reader.MoveToNextAttribute()) // Read the attributes.
|
||
switch (reader.Name)
|
||
{
|
||
case "flag":
|
||
if (reader.Value != "1")
|
||
reader.Skip();
|
||
else
|
||
flag = true;
|
||
break;
|
||
}
|
||
if (flag)
|
||
doc.Glossario = true;
|
||
break;
|
||
|
||
case "QUERY":
|
||
while (reader.MoveToNextAttribute()) // Read the attributes.
|
||
switch (reader.Name)
|
||
{
|
||
case "CodArea":
|
||
if (tipoReport.ToLower() == "monitoraggio")
|
||
{
|
||
_Area = reader.Value;
|
||
dsParam.Area = _Area;
|
||
dsParam.AreaEstesa = getNomeArea(_Area);
|
||
}
|
||
break;
|
||
case "Value": //N.B. In tal modo NON e' possibile avere "Value" con lo stesso nome su 2 o piu' XML...
|
||
query = reader.Value;
|
||
switch (query)
|
||
{
|
||
case "Intermediario": //x Diagnosi
|
||
if (tableIntermediari.Rows.Count > 0) dsParam.Intermediario = tableIntermediari.Rows[idx++][0].ToString();
|
||
break;
|
||
case "Progetto": //x Pianificazione, Proposta
|
||
if (tipoReport.ToLower() == "monitoraggio")
|
||
{
|
||
dsParam.Area = _Area;
|
||
dsParam.AreaEstesa = getNomeArea(_Area);
|
||
if (dsParam.Area == "Inv" && dtProgetto.Rows.Count > 0)
|
||
{
|
||
dsParam.Progetto = dtProgetto.Rows[idy]["nome_progetto"].ToString();
|
||
dsDatiMonitoraggio.NomeProgetto = dtProgetto.Rows[idy]["nome_progetto"].ToString();
|
||
idy += 1;
|
||
}
|
||
else
|
||
dsParam.Progetto = "";
|
||
}
|
||
else
|
||
{
|
||
if (dsParam.Area == "Inv" && dtProgetto.Rows.Count > 0)
|
||
{
|
||
dsParam.Progetto = dtProgetto.Rows[idy]["nome_progetto"].ToString();
|
||
dsDatiMonitoraggio.NomeProgetto = dtProgetto.Rows[idy]["nome_progetto"].ToString();
|
||
idy += 1;
|
||
}
|
||
else
|
||
dsParam.Progetto = "";
|
||
}
|
||
|
||
break;
|
||
case "Investimento": //x Pianificazione
|
||
dsParam.Area = "Inv";
|
||
dsParam.AreaEstesa = "Investimento";
|
||
break;
|
||
case "Riserva": //x Pianificazione
|
||
dsParam.Area = "Ris";
|
||
dsParam.Progetto = "";
|
||
dsParam.AreaEstesa = "Riserva";
|
||
break;
|
||
case "AreaBisogno": //x Proposta
|
||
if (dtArea.Rows.Count > 0)
|
||
{
|
||
if (tipoReport.ToLower() == "monitoraggio")
|
||
{
|
||
//if (indiceAreeBisogno <= numberOfQUERYtagsDatiSintetici - 1)
|
||
//{
|
||
dsDatiMonitoraggio.Area = _Area;// dtArea.Rows[indiceAreeBisogno]["need_area"].ToString();
|
||
dsParam.Area = dsDatiMonitoraggio.Area;
|
||
dsParam.AreaEstesa = getNomeArea(_Area);//dtArea.Rows[indiceAreeBisogno]["need_estesa"].ToString();
|
||
//indiceAreeBisogno += 1;
|
||
//}
|
||
}
|
||
else
|
||
{
|
||
dsParam.Area = dtArea.Rows[idz]["need_breve"].ToString();
|
||
dsParam.AreaEstesa = dtArea.Rows[idz]["need_estesa"].ToString();
|
||
idz += 1;
|
||
}
|
||
idy = 0;
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
}
|
||
break;
|
||
|
||
default:
|
||
|
||
//elimino gli elementi non stampati se trovo il tag di chiusura nell'XML
|
||
foreach (elementoStampa elem in qp)
|
||
{
|
||
if (elem.tagName == nodeName)
|
||
elem.alAttributi.Clear();
|
||
}
|
||
|
||
|
||
while (reader.MoveToNextAttribute()) // Read the attributes.
|
||
switch (reader.Name)
|
||
{
|
||
case "flag":
|
||
if (reader.Value != "1")
|
||
reader.Skip();
|
||
break;
|
||
case "Titolo":
|
||
titolo = reader.Value;
|
||
if (titolo != "")
|
||
{
|
||
if (QuerySection)
|
||
titolo += Intermediario;
|
||
aes.titolo = "Titolo";
|
||
aes.valore = loadVariabile(titolo);
|
||
es.tagName = nodeName;
|
||
es.alAttributi = new ArrayList();
|
||
es.alAttributi.Add(aes);
|
||
qp.Enqueue(es);
|
||
}
|
||
break;
|
||
case "titolo":
|
||
titolo = reader.Value;
|
||
if (titolo != "")
|
||
{
|
||
if (QuerySection)
|
||
titolo += Intermediario;
|
||
aes.titolo = "titolo";
|
||
aes.valore = loadVariabile(titolo);
|
||
es.tagName = nodeName;
|
||
es.alAttributi = new ArrayList();
|
||
es.alAttributi.Add(aes);
|
||
qp.Enqueue(es);
|
||
}
|
||
break;
|
||
|
||
|
||
|
||
case "SezTitolo":
|
||
titolo = reader.Value;
|
||
if (titolo != "")
|
||
{
|
||
if (QuerySection)
|
||
titolo += Intermediario;
|
||
aes.titolo = "SezTitolo";
|
||
aes.valore = loadVariabile(titolo);
|
||
es.tagName = nodeName;
|
||
es.alAttributi = new ArrayList();
|
||
es.alAttributi.Add(aes);
|
||
qp.Enqueue(es);
|
||
}
|
||
break;
|
||
|
||
|
||
case "ChapterTitolo":
|
||
ChapterTitolo = reader.Value;
|
||
if (ChapterTitolo != "")
|
||
{
|
||
if (QuerySection)
|
||
ChapterTitolo += Intermediario;
|
||
aes.titolo = "ChapterTitolo";
|
||
aes.valore = loadVariabile(ChapterTitolo);
|
||
es.tagName = nodeName;
|
||
es.alAttributi = new ArrayList();
|
||
es.alAttributi.Add(aes);
|
||
qp.Enqueue(es);
|
||
}
|
||
break;
|
||
|
||
case "testo":
|
||
case "ChapterHeader":
|
||
ChapterHeader = reader.Value;
|
||
if (ChapterHeader != "")
|
||
{
|
||
if (QuerySection)
|
||
ChapterHeader += Intermediario;
|
||
aes.titolo = "ChapterHeader";
|
||
aes.valore = loadVariabile(ChapterHeader);
|
||
es.tagName = nodeName;
|
||
es.alAttributi = new ArrayList();
|
||
es.alAttributi.Add(aes);
|
||
qp.Enqueue(es);
|
||
}
|
||
break;
|
||
|
||
case "ChapterHeaderVariable":
|
||
// valido SOLO per il report di MONITORAGGIO
|
||
ChapterHeader = reader.Value;
|
||
string _areaEstesa = string.Empty;
|
||
switch (_Area.ToUpper())
|
||
{
|
||
case "RIS":
|
||
_areaEstesa = "Riserva";
|
||
break;
|
||
case "INV":
|
||
_areaEstesa = "Investimento";
|
||
break;
|
||
case "LIQ":
|
||
_areaEstesa = "Liquidit<69>";
|
||
break;
|
||
case "EXT":
|
||
_areaEstesa = "ExtraRendimeno";
|
||
break;
|
||
default:
|
||
_areaEstesa = string.Empty;
|
||
break;
|
||
}
|
||
|
||
//DataTable dt =_datiComuni.DatiMonitoraggio.DatiSintetici.DataTableDatiSinteticiBIS;
|
||
|
||
if (_Area.ToUpper() == "RIS" || _Area.ToUpper() == "INV" & tipoReport.ToUpper() == "MONITORAGGIO")
|
||
ChapterHeader =
|
||
"Di seguito si riporta il valore complessivo dei prodotti attualmente destinati all'area " +
|
||
_areaEstesa +
|
||
" (controvalore attuale) ed il relativo valore di rischio (VaR attuale). Tali valori vengono quindi confrontati rispettivamente con il controvalore indicato in Piramide Modello e con il livello di rischio definito in sede di pianificazione.";
|
||
|
||
else
|
||
ChapterHeader =
|
||
"Di seguito si riporta il valore complessivo dei prodotti attualmente destinati all'area " +
|
||
_areaEstesa +
|
||
" (controvalore attuale) ed il relativo valore di rischio (VaR attuale). Tali valori vengono quindi confrontati rispettivamente con il controvalore indicato in Piramide Modello";
|
||
|
||
|
||
if (ChapterHeader != "")
|
||
{
|
||
if (QuerySection)
|
||
ChapterHeader += Intermediario;
|
||
aes.titolo = "ChapterHeader";
|
||
aes.valore = loadVariabile(ChapterHeader);
|
||
es.tagName = nodeName;
|
||
es.alAttributi = new ArrayList();
|
||
es.alAttributi.Add(aes);
|
||
qp.Enqueue(es);
|
||
}
|
||
break;
|
||
}
|
||
|
||
break;
|
||
}
|
||
break;
|
||
|
||
case XmlNodeType.Text: //Display the text in each element.
|
||
break;
|
||
|
||
case XmlNodeType.EndElement: //Display the end of the element.
|
||
foreach (elementoStampa elem in qp)
|
||
{
|
||
if (elem.tagName == nodeName)
|
||
elem.alAttributi.Clear();
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
return status;
|
||
}
|
||
|
||
|
||
finally
|
||
{
|
||
//cancellazione file temporaneo
|
||
if (File.Exists(path)) File.Delete(path);
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
/// <param name="qp"></param>
|
||
/// <param name="doc"></param>
|
||
/// <param name="sezione"></param>
|
||
private void SvuotaCoda(Queue qp, DocumentPDF doc, DatiSezione sezione)
|
||
{
|
||
while (qp.Count > 0)
|
||
{
|
||
elementoStampa es = (elementoStampa)qp.Dequeue();
|
||
attributiElementoStampa chapter = new attributiElementoStampa();
|
||
chapter.titolo = "ChapterHeader";
|
||
|
||
foreach (attributiElementoStampa aes in es.alAttributi)
|
||
switch (aes.titolo)
|
||
{
|
||
case "Titolo":
|
||
doc.setPageTitolo(aes.valore);
|
||
break;
|
||
case "titolo":
|
||
if (qp.Count != 0)
|
||
doc.setTitolo(aes.valore, this.loadMinimumHeight(sezione) + 50);
|
||
else
|
||
doc.setTitolo(aes.valore, this.loadMinimumHeight(sezione));
|
||
break;
|
||
case "SezTitolo":
|
||
if (qp.Count != 0)
|
||
doc.setSezTitolo(aes.valore, this.loadMinimumHeight(sezione) + 50);
|
||
else
|
||
doc.setSezTitolo(aes.valore, this.loadMinimumHeight(sezione));
|
||
break;
|
||
case "ChapterTitolo":
|
||
if (qp.Count != 0)
|
||
doc.setChapterTitolo(aes.valore, this.loadMinimumHeight(sezione) + 50);
|
||
else
|
||
doc.setChapterTitolo(aes.valore, this.loadMinimumHeight(sezione));
|
||
break;
|
||
case "ChapterHeader":
|
||
doc.setChapterHeader(aes.valore, this.loadMinimumHeight(sezione));
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// Disegna sul documento PDF la sezione selezionata
|
||
/// Attualmente sono utilizzate solo le sezioni per il report di pianificazione.
|
||
/// Le altre possono essere eliminate.
|
||
/// </summary>
|
||
/// <param name="sec"></param>
|
||
/// <returns></returns>
|
||
private bool loadSection(DatiSezione sec)
|
||
{
|
||
switch (sec.Sezione)
|
||
{
|
||
#region S1
|
||
case "S1":
|
||
sec.setCodiceRete(codiceRete);
|
||
sec.setParam(dsParam);
|
||
S1 sezione1 = new S1();
|
||
sezione1.setTitolo(sec.Titolo);
|
||
sezione1.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S2
|
||
case "S2":
|
||
sec.setParam(dsParam);
|
||
S2 sezione2 = new S2();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione2.HasSelectedPatrimNonRap = true;
|
||
|
||
sezione2.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione2.writeSezioneCombo(sec);
|
||
else
|
||
sezione2.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S3
|
||
case "S3":
|
||
sec.setParam(dsParam);
|
||
S3 sezione3 = new S3();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione3.HasSelectedPatrimNonRap = true;
|
||
|
||
if (sec.Tipo == "combo")
|
||
sezione3.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione3.setTitolo(sec.Titolo);
|
||
sezione3.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S4
|
||
case "S4":
|
||
sec.setParam(dsParam);
|
||
S4 sezione4 = new S4();
|
||
sezione4.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione4.writeSezioneCombo(sec);
|
||
else
|
||
sezione4.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S5
|
||
case "S5":
|
||
sec.setParam(dsParam);
|
||
S5 sezione5 = new S5();
|
||
if (sec.Tipo == "combo")
|
||
sezione5.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione5.setTitolo(sec.Titolo);
|
||
sezione5.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S6
|
||
case "S6":
|
||
sec.setParam(dsParam);
|
||
S6 sezione6 = new S6();
|
||
sezione6.setTitolo(sec.Titolo);
|
||
sezione6.TipologiaReport = TipoReport.PIANIFICAZIONE;
|
||
sezione6.writeSezioneIsto(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S10
|
||
case "S10":
|
||
sec.setParam(dsParam);
|
||
S10 sezione10 = new S10();
|
||
sezione10.setTitolo(sec.Titolo);
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione10.HasSelectedPatrimNonRap = true;
|
||
|
||
if (sec.Tipo == "combo")
|
||
sezione10.writeSezioneCombo(sec);
|
||
else
|
||
sezione10.writeSezione(sec);
|
||
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region S11
|
||
case "S11":
|
||
sec.setParam(dsParam);
|
||
S11 sezione11 = new S11();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione11.HasSelectedPatrimNonRap = true;
|
||
|
||
if (sec.Tipo == "combo")
|
||
sezione11.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione11.setTitolo(sec.Titolo);
|
||
sezione11.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S12
|
||
case "S12":
|
||
sec.setParam(dsParam);
|
||
S12 sezione12 = new S12();
|
||
sezione12.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione12.writeSezioneCombo(sec);
|
||
else
|
||
sezione12.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S13
|
||
case "S13":
|
||
sec.setParam(dsParam);
|
||
S13 sezione13 = new S13();
|
||
if (sec.Tipo == "combo")
|
||
sezione13.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione13.setTitolo(sec.Titolo);
|
||
sezione13.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S14
|
||
case "S14":
|
||
S14 sezione14 = new S14();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione14.HasSelectedPatrimNonRap = true;
|
||
|
||
if (hasSelectedPoliticaInv)
|
||
sezione14.HasSelectedPatrimNonRap = true;
|
||
|
||
sec.setParam(dsParam);
|
||
sezione14.setTitolo(sec.Titolo);
|
||
sezione14.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S15
|
||
case "S15":
|
||
S15 sezione15 = new S15();
|
||
sezione15.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione15.writeSezioneCombo(sec);
|
||
else
|
||
sezione15.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S15BIS
|
||
case "S15BIS":
|
||
S15BIS sezione15BIS = new S15BIS();
|
||
if (sec.Tipo == "combo")
|
||
sezione15BIS.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione15BIS.setTitolo(sec.Titolo);
|
||
sezione15BIS.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S16
|
||
case "S16":
|
||
S16 sezione16 = new S16();
|
||
sezione16.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione16.writeSezioneCombo(sec);
|
||
else
|
||
sezione16.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S17
|
||
case "S17":
|
||
S17 sezione17 = new S17();
|
||
if (sec.Tipo == "combo")
|
||
sezione17.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione17.setTitolo(sec.Titolo);
|
||
sezione17.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S18
|
||
case "S18":
|
||
sec.setParam(dsParam);
|
||
S18 sezione18 = new S18();
|
||
sezione18.setLegend();
|
||
sezione18.setIndice();
|
||
sezione18.setTitolo(sec.Titolo);
|
||
sezione18.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S19
|
||
case "S19":
|
||
S19 sezione19 = new S19();
|
||
sezione19.setTitolo(sec.Titolo);
|
||
sezione19.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S19BIS
|
||
case "S19BIS":
|
||
S19BIS sezione19BIS = new S19BIS();
|
||
sezione19BIS.setTitolo(sec.Titolo);
|
||
sezione19BIS.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S23
|
||
case "S23":
|
||
S23 sezione23 = new S23();
|
||
sezione23.setTitolo(sec.Titolo);
|
||
if (dsParam.ProfiloCliente.StatoProfilo == TipologiaStatoProfilo.ATTIVO)
|
||
sezione23.writeSezione(sec);
|
||
else
|
||
sezione23.writeSezioneSenzaProfilo(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S25
|
||
case "S25":
|
||
if (!dsParam.modalit<EFBFBD>Anonima)
|
||
{
|
||
S25 sezione25 = new S25();
|
||
sezione25.setTitolo(sec.Titolo);
|
||
sezione25.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S26
|
||
case "S26":
|
||
S26 sezione26 = new S26();
|
||
sezione26.setTitolo(sec.Titolo);
|
||
sezione26.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S27
|
||
case "S27":
|
||
S27 sezione27 = new S27();
|
||
sezione27.setTitolo(sec.Titolo);
|
||
sezione27.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S28
|
||
case "S28":
|
||
S28 sezione28 = new S28();
|
||
sezione28.setTitolo(sec.Titolo);
|
||
sezione28.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S29
|
||
case "S29":
|
||
S29 sezione29 = new S29();
|
||
sezione29.setTitolo(sec.Titolo);
|
||
sezione29.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S30
|
||
case "S30":
|
||
S30 sezione30 = new S30();
|
||
sezione30.setTitolo(sec.Titolo);
|
||
sezione30.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S31
|
||
case "S31":
|
||
S31 sezione31 = new S31();
|
||
sezione31.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "torta")
|
||
sezione31.writeSezioneTorta(sec);
|
||
else
|
||
sezione31.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S32
|
||
case "S32":
|
||
S32 sezione32 = new S32();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione32.HasSelectedPatrimNonRap = true;
|
||
|
||
sezione32.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione32.writeSezioneCombo(sec);
|
||
else
|
||
sezione32.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S33
|
||
case "S33":
|
||
S33 sezione33 = new S33();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione33.HasSelectedPatrimNonRap = true;
|
||
|
||
if (sec.Tipo == "combo")
|
||
sezione33.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione33.setTitolo(sec.Titolo);
|
||
sezione33.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S34
|
||
case "S34":
|
||
S34 sezione34 = new S34();
|
||
sezione34.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione34.writeSezioneCombo(sec);
|
||
else
|
||
sezione34.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S35
|
||
case "S35":
|
||
S35 sezione35 = new S35();
|
||
if (sec.Tipo == "combo")
|
||
sezione35.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione35.setTitolo(sec.Titolo);
|
||
sezione35.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S36
|
||
case "S36":
|
||
S36 sezione36 = new S36();
|
||
sec.setParam(dsParam);
|
||
sezione36.setTitolo(sec.Titolo);
|
||
sezione36.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S37
|
||
case "S37":
|
||
S37 sezione37 = new S37();
|
||
sezione37.setTitolo(sec.Titolo);
|
||
sezione37.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S38
|
||
case "S38":
|
||
S38 sezione38 = new S38();
|
||
sezione38.setTitolo(sec.Titolo);
|
||
sezione38.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S39
|
||
case "S39":
|
||
S39 sezione39 = new S39();
|
||
sezione39.setTitolo(sec.Titolo);
|
||
sezione39.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S40
|
||
case "S40":
|
||
S40 sezione40 = new S40();
|
||
sezione40.setTitolo(sec.Titolo);
|
||
sezione40.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S41
|
||
case "S41":
|
||
S41 sezione41 = new S41();
|
||
sezione41.setTitolo(sec.Titolo);
|
||
sezione41.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S42
|
||
case "S42":
|
||
S42 sezione42 = new S42();
|
||
sezione42.setTitolo(sec.Titolo);
|
||
sezione42.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S43
|
||
case "S43":
|
||
S43 sezione43 = new S43();
|
||
sezione43.TipologiaReport = TipoReport.PIANIFICAZIONE; // passa qui per il solo report di pianificazione.
|
||
sec.setParam(dsParam);
|
||
|
||
//switch (sec.Tipo)
|
||
//{
|
||
// case "combo": // significa che l'utente ha spuntato Inserisci Performance (da capire che significa combo..era difficile mettere una stringa piu parlante ?)
|
||
// sezione43.MostraRendimentoDaInizioAnno = true;
|
||
// sezione43.MostraRendimentoDaDataSottoscrizione = true;
|
||
// break;
|
||
//}
|
||
|
||
sezione43.VersatoNetto_UtilePerdita = true;
|
||
sezione43.setTitolo(sec.Titolo);
|
||
sezione43.writeSezione(sec);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region S44
|
||
case "S44":
|
||
S44 sezione44 = new S44();
|
||
sezione44.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
{
|
||
sezione44.MostraRendimentoDaDataSottoscrizione = true;
|
||
sezione44.MostraRendimentoDaInizioAnno = true;
|
||
}
|
||
|
||
|
||
switch (tipoReport.ToUpper())
|
||
{
|
||
case "MONITORAGGIO":
|
||
sezione44.TipologiaReport = TipoReport.MONITORAGGIO;
|
||
break;
|
||
case "PIANIFICAZIONE":
|
||
sezione44.TipologiaReport = TipoReport.PIANIFICAZIONE;
|
||
break;
|
||
case "PROPOSTA":
|
||
sezione44.TipologiaReport = TipoReport.PROPOSTA;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
sezione44.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S45
|
||
case "S45":
|
||
S45 sezione45 = new S45();
|
||
sezione45.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione45.VersatoNetto_UtilePerdita = true;
|
||
|
||
switch (tipoReport.ToUpper())
|
||
{
|
||
case "MONITORAGGIO":
|
||
sezione45.TipologiaReport = TipoReport.MONITORAGGIO;
|
||
break;
|
||
case "PIANIFICAZIONE":
|
||
sezione45.TipologiaReport = TipoReport.PIANIFICAZIONE;
|
||
break;
|
||
case "PROPOSTA":
|
||
sezione45.TipologiaReport = TipoReport.PROPOSTA;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
sezione45.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S46
|
||
case "S46":
|
||
S46 sezione46 = new S46();
|
||
sezione46.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione46.WithPerformance = true;
|
||
sezione46.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S47
|
||
case "S47":
|
||
sec.setParam(dsParam);
|
||
S47 sezione47 = new S47();
|
||
sezione47.Titolo = sec.Titolo;
|
||
sezione47.TipologiaReport = TipoReport.PIANIFICAZIONE; // se viene eseguito questo codice di sicuro si sta stampando il report di PIANIFICAZIONE
|
||
sezione47.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S48
|
||
case "S48":
|
||
sec.setParam(dsParam);
|
||
S48 sezione48 = new S48();
|
||
sezione48.setTitolo(sec.Titolo);
|
||
sezione48.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S49
|
||
case "S49":
|
||
sec.setParam(dsParam);
|
||
S49 sezione49 = new S49();
|
||
sezione49.setTitolo(sec.Titolo);
|
||
sezione49.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S50
|
||
case "S50":
|
||
sec.setParam(dsParam);
|
||
S50 sezione50 = new S50();
|
||
sezione50.setTitolo(sec.Titolo);
|
||
sezione50.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S51
|
||
case "S51":
|
||
sec.setParam(dsParam);
|
||
S51 sezione51 = new S51();
|
||
sezione51.setTitolo(sec.Titolo);
|
||
sezione51.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S56
|
||
case "S56":
|
||
sec.setParam(dsParam);
|
||
S56 sezione56 = new S56();
|
||
sezione56.setTitolo(sec.Titolo);
|
||
sezione56.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S57
|
||
case "S57":
|
||
//DataSetS57 ds57 = new DataSetS57();
|
||
//if (sec.getDataSet().GetType() == ds57.GetType())
|
||
//{
|
||
// S57 sezione57 = new S57();
|
||
// sezione57.setTitolo(sec.Titolo);
|
||
// sezione57.writeSezione(sec);
|
||
//}
|
||
//else
|
||
//{
|
||
// //NEL CASO IN CUI NON CI SONO I DATI PER LA S57
|
||
// sec.setParam(dsParam);
|
||
// sezione56 = new S56();
|
||
// sezione56.setTitolo("Piramide Attuale con rischio relativo");
|
||
// sezione56.writeSezione(sec);
|
||
//}
|
||
|
||
|
||
|
||
// 25/01/10 d.lisena.
|
||
// Hanno richiesto la stampa della S57BIS al posto della S57. Togliere i commenti alla parte sopra per ripristinare la vecchia situiazione
|
||
|
||
DataSetS57BIS ds57bis = new DataSetS57BIS();
|
||
if (sec.getDataSet().GetType() == ds57bis.GetType())
|
||
{
|
||
S57BIS sezione57BIS = new S57BIS();
|
||
//sezione57BIS.setTitolo(sec.Titolo);
|
||
sezione57BIS.TestoTitolo = sec.Titolo;
|
||
sezione57BIS.TestoIntroduttivo = Resources.GlobalResource.S57BIS_TestoIntroduttivo_Solo_Pianificazione;
|
||
sezione57BIS.writeSezione(sec);
|
||
}
|
||
else
|
||
{
|
||
//NEL CASO IN CUI NON CI SONO I DATI PER LA S57
|
||
sec.setParam(dsParam);
|
||
sezione56 = new S56();
|
||
sezione56.setTitolo("Piramide Attuale con rischio relativo");
|
||
sezione56.writeSezione(sec);
|
||
}
|
||
|
||
break;
|
||
#endregion
|
||
|
||
//#region S58
|
||
//case "S58":
|
||
// sec.setParam(dsParam);
|
||
// sec.setCodiceRete(codiceRete);
|
||
// S58 sezione58 = new S58();
|
||
// sezione58.setTitolo(sec.Titolo);
|
||
// sezione58.writeSezione(sec);
|
||
// break;
|
||
//#endregion
|
||
|
||
#region S59
|
||
case "S59":
|
||
sec.setCodiceRete(codiceRete);
|
||
//N59 nota59 = new N59();
|
||
//nota59.writeSezione(sec);
|
||
sec.setParam(dsParam);
|
||
S59 sezione59 = new S59();
|
||
sezione59.setTitolo(sec.Titolo);
|
||
sezione59.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S60
|
||
case "S60":
|
||
sec.setCodiceRete(codiceRete);
|
||
sec.setParam(dsParam);
|
||
N60 nota60 = new N60();
|
||
nota60.writeSezione(sec);
|
||
|
||
S60 sezione60 = new S60();
|
||
sezione60.setTitolo(sec.Titolo);
|
||
sezione60.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S61
|
||
case "S61":
|
||
sec.setCodiceRete(codiceRete);
|
||
sec.setParam(dsParam);
|
||
N61 nota61 = new N61();
|
||
nota61.writeSezione(sec);
|
||
|
||
S61 sezione61 = new S61();
|
||
sezione61.setTitolo(sec.Titolo);
|
||
sezione61.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S63
|
||
case "S63":
|
||
S63 sezione63 = new S63();
|
||
sezione63.setTitolo(sec.Titolo);
|
||
sezione63.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S64
|
||
case "S64":
|
||
S64 sezione64 = new S64();
|
||
sec.setParam(dsParam);
|
||
sezione64.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione64.IncludiScenarioMedio = true;
|
||
sezione64.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S65
|
||
case "S65":
|
||
S65 sezione65 = new S65();
|
||
sezione65.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione65.IncludiScenarioMedio = true;
|
||
sezione65.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S66
|
||
case "S66":
|
||
S66 sezione66 = new S66();
|
||
sezione66.setTitolo(sec.Titolo);
|
||
sezione66.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S67
|
||
case "S67":
|
||
S67 sezione67 = new S67();
|
||
sezione67.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione67.writeSezioneCombo(sec);
|
||
else
|
||
sezione67.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S68
|
||
case "S68":
|
||
S68 sezione68 = new S68();
|
||
sezione68.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione68.writeSezioneCombo(sec);
|
||
else
|
||
sezione68.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S70
|
||
case "S70":
|
||
sec.setParam(dsParam);
|
||
S70 sezione70 = new S70();
|
||
sezione70.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S71
|
||
case "S71":
|
||
S71 sezione71 = new S71();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione71.HasSelectedPatrimNonRap = true;
|
||
|
||
if (sec.Tipo == "confronto")
|
||
if (dsParam.Area == "Inv" || dsParam.Area == "Ris")
|
||
{
|
||
sezione71.setTitolo(sec.Titolo);
|
||
sezione71.writeSezioneModelloCombo(sec);
|
||
}
|
||
else
|
||
{
|
||
sezione71.setTitolo(sec.Titolo);
|
||
sezione71.writeSezione(sec);
|
||
}
|
||
else
|
||
{
|
||
sezione71.setTitolo(sec.Titolo);
|
||
if (sec.Tipo == "combo")
|
||
sezione71.writeSezioneCombo(sec);
|
||
else
|
||
sezione71.writeSezione(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S71mod
|
||
case "S71mod":
|
||
S71 sezione71mod = new S71();
|
||
if (dsParam.Area == "Inv" || dsParam.Area == "Ris")
|
||
{
|
||
if (tipoReport == "MONITORAGGIO")
|
||
sezione71mod.Header = sec.Testo;
|
||
sezione71mod.setTitolo(sec.Titolo);
|
||
sezione71mod.writeSezioneModello(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S71BIS
|
||
case "S71BIS":
|
||
S71BIS sezione71BIS = new S71BIS();
|
||
|
||
if (hasSelectedDistribuzioneAssetClass)
|
||
sezione71BIS.HasSelectedPatrimNonRap = true;
|
||
|
||
if (sec.Tipo == "confronto")
|
||
if (dsParam.Area == "Inv" || dsParam.Area == "Ris")
|
||
{
|
||
sezione71BIS.setTitolo(sec.Titolo);
|
||
sezione71BIS.writeSezioneCombo(sec);
|
||
}
|
||
else
|
||
{
|
||
sezione71BIS.setTitolo(sec.Titolo);
|
||
sezione71BIS.writeSezione(sec);
|
||
}
|
||
else
|
||
{
|
||
if (sec.Tipo == "combo")
|
||
sezione71BIS.writeSezioneCombo(sec);
|
||
else
|
||
{
|
||
sezione71BIS.setTitolo(sec.Titolo);
|
||
sezione71BIS.writeSezione(sec);
|
||
}
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
#region S71BISmod
|
||
case "S71BISmod":
|
||
S71BIS sezione71BISmod = new S71BIS();
|
||
if (dsParam.Area == "Inv" || dsParam.Area == "Ris")
|
||
{
|
||
if (tipoReport == "MONITORAGGIO")
|
||
sezione71BISmod.Header = sec.Testo;
|
||
sezione71BISmod.setTitolo(sec.Titolo);
|
||
sezione71BISmod.writeSezioneModello(sec);
|
||
}
|
||
break;
|
||
#endregion
|
||
|
||
//#region S72
|
||
//case "S72":
|
||
// sec.setParam(dsParam);
|
||
// S72 sezione72 = new S72();
|
||
// if (sec.Tipo == "combo")
|
||
// sezione72.includiRischio = true;
|
||
// sezione72.writeSezione(sec);
|
||
// break;
|
||
//#endregion
|
||
|
||
#region S73
|
||
case "S73":
|
||
S73 sezione73 = new S73();
|
||
sezione73.setTitolo(sec.Titolo);
|
||
sezione73.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S75
|
||
case "S75":
|
||
S75 sezione75 = new S75();
|
||
sezione75.setTitolo(sec.Titolo);
|
||
sec.setParam(dsParam);
|
||
if (sec.Tipo == "combo" || tipoReport != "DIAGNOSI")
|
||
sezione75.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
//#region S75BIS
|
||
//case "S75BIS":
|
||
// S75BIS sezione75BIS = new S75BIS();
|
||
// sec.setParam(dsParam);
|
||
// sezione75BIS.setTitolo(sec.Titolo);
|
||
// sezione75BIS.TestoSezione = "";
|
||
// sezione75BIS.writeSezione(sec);
|
||
// break;
|
||
//#endregion
|
||
|
||
#region S76
|
||
case "S76":
|
||
S76 sezione76 = new S76();
|
||
switch (tipoReport.ToUpper())
|
||
{
|
||
case "MONITORAGGIO":
|
||
sezione76.TipologiaReport = TipoReport.MONITORAGGIO;
|
||
break;
|
||
case "PIANIFICAZIONE":
|
||
sezione76.TipologiaReport = TipoReport.PIANIFICAZIONE;
|
||
break;
|
||
case "PROPOSTA":
|
||
sezione76.TipologiaReport = TipoReport.PROPOSTA;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
sezione76.setTitolo(sec.Titolo);
|
||
sezione76.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S76BIS
|
||
case "S76BIS":
|
||
S76 sezione76BIS = new S76(S76.EmodalitaRappresentazione.alternativa);
|
||
switch (tipoReport.ToUpper())
|
||
{
|
||
case "MONITORAGGIO":
|
||
sezione76BIS.TipologiaReport = TipoReport.MONITORAGGIO;
|
||
break;
|
||
case "PIANIFICAZIONE":
|
||
sezione76BIS.TipologiaReport = TipoReport.PIANIFICAZIONE;
|
||
break;
|
||
case "PROPOSTA":
|
||
sezione76BIS.TipologiaReport = TipoReport.PROPOSTA;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
sezione76BIS.setTitolo(sec.Titolo);
|
||
sezione76BIS.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S77
|
||
case "S77":
|
||
S77 sezione77 = new S77();
|
||
sezione77.setTitolo(sec.Titolo);
|
||
sezione77.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S77BIS
|
||
case "S77BIS":
|
||
S77 sezione77BIS = new S77(S77.EmodalitaRappresentazione.alternativa);
|
||
sezione77BIS.setTitolo(sec.Titolo);
|
||
sezione77BIS.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S78
|
||
case "S78":
|
||
S78 sezione78 = new S78();
|
||
sezione78.Titolo = sec.Titolo;
|
||
sezione78.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S79
|
||
case "S79":
|
||
S79 sezione79 = new S79();
|
||
sezione79.Titolo = sec.Titolo;
|
||
sezione79.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region S87
|
||
case "S87":
|
||
S87 sezione87 = new S87();
|
||
|
||
if (hasSelectedPoliticaInv)
|
||
sezione87.HasSelectedPatrimNonRap = true;
|
||
|
||
|
||
|
||
|
||
sezione87.setTitolo(sec.Titolo);
|
||
sezione87.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region NProposta
|
||
case "NProposta":
|
||
NProposta Nota = new NProposta();
|
||
Nota.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
#region NProgetti
|
||
case "NProgetti":
|
||
NProgetti NotaP = new NProgetti();
|
||
NotaP.writeSezione(sec);
|
||
break;
|
||
#endregion
|
||
|
||
default:
|
||
//return false;
|
||
break;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Carica i dati del datasect della sezione
|
||
/// Sono state lasciate qui solo le sezioni interessate dal report di pianificazione.
|
||
/// </summary>
|
||
/// <param name="sec">Nome della sezione da caricare</param>
|
||
/// <returns> </returns>
|
||
private DataSectionResult loadDataSection(DatiSezione sec)
|
||
{
|
||
DataSectionResult dsResult = new DataSectionResult();
|
||
|
||
|
||
switch ("DS" + sec.Sezione)
|
||
{
|
||
#region COPERTINA INDICE GLOSSARIO
|
||
case "DSCOPERTINA":
|
||
if (sec.Tipo == "ESNOC")
|
||
sec.getPDF().creaCopertina(tipoReport, false);
|
||
else
|
||
sec.getPDF().creaCopertina(tipoReport, true);
|
||
break;
|
||
|
||
case "DSINDICE":
|
||
sec.getPDF().creaIndice();
|
||
break;
|
||
|
||
case "DSGLOSSARIO":
|
||
sec.getPDF().Glossario = true;
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS1
|
||
case "DSS1":
|
||
IDataSection s1 = new DSS1PatrimonioComplessivo();
|
||
dsResult = s1.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS6
|
||
case "DSS6":
|
||
DSS6PatrimonioFinanziario s6 = new DSS6PatrimonioFinanziario();
|
||
dsResult = s6.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS18
|
||
case "DSS18":
|
||
DSS18PatrimonioFinanziarioRischio s18 = new DSS18PatrimonioFinanziarioRischio();
|
||
if (sec.Tipo == "onlyBF")
|
||
s18.onlyBF = true;
|
||
dsResult = s18.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS36
|
||
case "DSS36":
|
||
DSS36ProfiloRischio s36 = new DSS36ProfiloRischio();
|
||
dsResult = s36.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS43
|
||
case "DSS43":
|
||
DSS43ProdottiAreeBisogno s43 = new DSS43ProdottiAreeBisogno();
|
||
dsResult = s43.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS47
|
||
case "DSS47":
|
||
DSS47ContoCorrenteBF s47 = new DSS47ContoCorrenteBF();
|
||
dsResult = s47.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS56
|
||
case "DSS56":
|
||
DSS56PatrimonioBFAreeBisogno s56 = new DSS56PatrimonioBFAreeBisogno();
|
||
dsResult = s56.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS57
|
||
case "DSS57":
|
||
//DSS57ConfrontoPiramidi s57 = new DSS57ConfrontoPiramidi();
|
||
//dsResult = s57.getDataSection(dsParam);
|
||
//if (dsResult.Esito == 0)
|
||
//{
|
||
// //NEL CASO IN CUI NON CI SONO I DATI PER LA S57
|
||
// s56 = new DSS56PatrimonioBFAreeBisogno();
|
||
// dsResult = s56.getDataSection(dsParam);
|
||
//}
|
||
|
||
|
||
// 25/01/10 d.lisena.
|
||
// Hanno richiesto la stampa della S57BIS al posto della S57. Togliere i commenti alla parte sopra per ripristinare la vecchia situiazione
|
||
|
||
|
||
DSS57BISConfrontoPiramideAttualeModello s57bis = new DSS57BISConfrontoPiramideAttualeModello();
|
||
ParametriReport param = new ParametriReport(sec.getPDF());
|
||
param.DataSectionParameter = dsParam;
|
||
|
||
dsResult = s57bis.getDataSection(param);
|
||
if (dsResult.Esito == 0)
|
||
{
|
||
//NEL CASO IN CUI NON CI SONO I DATI PER LA S57
|
||
s56 = new DSS56PatrimonioBFAreeBisogno();
|
||
dsResult = s56.getDataSection(dsParam);
|
||
}
|
||
|
||
|
||
break;
|
||
#endregion
|
||
|
||
//#region DSS58
|
||
//case "DSS58":
|
||
// DSS58PatrimonioComplessivo s58 = new DSS58PatrimonioComplessivo();
|
||
// dsResult = s58.getDataSection(dsParam);
|
||
|
||
// break;
|
||
//#endregion
|
||
|
||
#region DSS59
|
||
case "DSS59":
|
||
DSS59PiramidePianificazione s59 = new DSS59PiramidePianificazione();
|
||
dsResult = s59.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS60
|
||
case "DSS60":
|
||
DSS60ConfrontoPiramidiModPian s60 = new DSS60ConfrontoPiramidiModPian();
|
||
dsResult = s60.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS61
|
||
case "DSS61":
|
||
DSS61ConfrontoPiramideAttualePian s61 = new DSS61ConfrontoPiramideAttualePian();
|
||
dsResult = s61.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS63
|
||
case "DSS63":
|
||
DSS63IndicatoriArea s63 = new DSS63IndicatoriArea();
|
||
dsResult = s63.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS64
|
||
case "DSS64":
|
||
DSS64ConoEvoluzioneRicchezza s64 = new DSS64ConoEvoluzioneRicchezza();
|
||
dsResult = s64.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS65
|
||
case "DSS65":
|
||
DSS65IndicatoriCrescita s65 = new DSS65IndicatoriCrescita();
|
||
dsResult = s65.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS66
|
||
case "DSS66":
|
||
DSS66Statistiche s66 = new DSS66Statistiche();
|
||
dsResult = s66.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS67
|
||
case "DSS67":
|
||
DSS67MacroAssetConsigliata s67 = new DSS67MacroAssetConsigliata();
|
||
dsResult = s67.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS68
|
||
case "DSS68":
|
||
DSS68DistribuzioneModello s68 = new DSS68DistribuzioneModello();
|
||
dsResult = s68.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSS75
|
||
case "DSS75":
|
||
DSS75GradoCopertura s75 = new DSS75GradoCopertura();
|
||
if (sec.Tipo == "combo" || tipoReport != "DIAGNOSI")
|
||
dsResult = s75.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
#region DSSProgetti
|
||
case "DSNProgetti":
|
||
DSSProgetti NProgetti = new DSSProgetti();
|
||
dsResult = NProgetti.getDataSection(dsParam);
|
||
|
||
break;
|
||
#endregion
|
||
|
||
default:
|
||
//return false;
|
||
break;
|
||
}
|
||
return dsResult;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Recupera l'altezza della sezione
|
||
/// Sono state lasciate qui solo le sezioni interessate dal report di pianificazione.
|
||
/// </summary>
|
||
/// <param name="sec">Nome della sezione</param>
|
||
/// <returns></returns>
|
||
private float loadMinimumHeight(DatiSezione sec)
|
||
{
|
||
float DimensionRow = 23;
|
||
float DimensioneTortaChart = 140;
|
||
float minimumHeight = 0;
|
||
|
||
switch (sec.Sezione)
|
||
{
|
||
|
||
#region S18
|
||
case "S18":
|
||
//Sezione a dimensione fissa
|
||
minimumHeight = 140;
|
||
break;
|
||
#endregion
|
||
|
||
#region S36
|
||
case "S36":
|
||
//SEZIONE A DIMENSIONE FISSA
|
||
minimumHeight = DimensionRow * 3;
|
||
break;
|
||
#endregion
|
||
|
||
#region S43
|
||
case "S43":
|
||
//SALTO PAGINA ALMENO 1 riga + header e cambio pagina
|
||
minimumHeight = 3 * DimensionRow;
|
||
break;
|
||
#endregion
|
||
|
||
#region S47
|
||
case "S47":
|
||
//SALTO PAGINA ALMENO 1 riga + header e cambio pagina
|
||
minimumHeight = 3 * DimensionRow;
|
||
break;
|
||
#endregion
|
||
|
||
#region S56
|
||
case "S56":
|
||
//LE PIRAMIDI HANNO 7 RIGHE DI DIMENSIONE 30 AGGIUNGO ULTERIORE SPAZIO PER NOTA
|
||
DimensionRow = 30;
|
||
DataSetS56 set56 = (DataSetS56)sec.getDataSet();
|
||
minimumHeight = DimensionRow * 7 + 50 + DimensionRow * (set56.ContoCorrente.Rows.Count + set56.RisorseNonAllocate.Rows.Count + set56.TotalePatrimonio.Rows.Count);
|
||
break;
|
||
#endregion
|
||
|
||
//#region S57
|
||
//case "S57":
|
||
// //LE PIRAMIDI HANNO 7 RIGHE DI DIMENSIONE 30 AGGIUNGO ULTERIORE SPAZIO PER NOTA
|
||
// DimensionRow = 30;
|
||
// DataSetS57 set57 = new DataSetS57();
|
||
// if (sec.getDataSet().GetType() == set57.GetType())
|
||
// {
|
||
// set57 = (DataSetS57)sec.getDataSet();
|
||
// minimumHeight = DimensionRow * 13 + 20 + 23 * (set57.ContoCorrente.Rows.Count + set57.RisorseNonAssociate.Rows.Count + set57.TotalePatrimonio.Rows.Count);
|
||
// }
|
||
// else
|
||
// {
|
||
// set56 = (DataSetS56)sec.getDataSet();
|
||
// minimumHeight = DimensionRow * 7 + 20 + DimensionRow * (set56.ContoCorrente.Rows.Count + set56.RisorseNonAllocate.Rows.Count + set56.TotalePatrimonio.Rows.Count);
|
||
// }
|
||
// break;
|
||
//#endregion
|
||
|
||
#region S58
|
||
case "S58":
|
||
//Ameno disegno il patrimonio complessivo
|
||
minimumHeight = DimensionRow * 3;
|
||
break;
|
||
#endregion
|
||
|
||
#region S59
|
||
case "S59":
|
||
//LE PIRAMIDI HANNO 7 RIGHE DI DIMENSIONE 30 AGGIUNGO ULTERIORE SPAZIO PER NOTA
|
||
DimensionRow = 30;
|
||
minimumHeight = DimensionRow * 7;
|
||
break;
|
||
#endregion
|
||
|
||
#region S60
|
||
case "S60":
|
||
//LE PIRAMIDI HANNO 7 RIGHE DI DIMENSIONE 30 AGGIUNGO ULTERIORE SPAZIO PER NOTA
|
||
DimensionRow = 30;
|
||
minimumHeight = DimensionRow * 14 + 50;
|
||
break;
|
||
#endregion
|
||
|
||
#region S61
|
||
case "S61":
|
||
//LE PIRAMIDI HANNO 7 RIGHE DI DIMENSIONE 30 AGGIUNGO ULTERIORE SPAZIO PER NOTA
|
||
DimensionRow = 30;
|
||
minimumHeight = DimensionRow * 14 + 50;
|
||
break;
|
||
#endregion
|
||
|
||
#region S63
|
||
case "S63":
|
||
//SEZIONE A DIMENSIONE FISSA
|
||
minimumHeight = DimensionRow * 2;
|
||
break;
|
||
#endregion
|
||
|
||
#region S64
|
||
case "S64":
|
||
//aggiungo spazio per la nota
|
||
minimumHeight = DimensioneTortaChart + 30;
|
||
break;
|
||
#endregion
|
||
|
||
#region S65
|
||
case "S65":
|
||
//SEZIONE A DIMENSIONE FISSA
|
||
if (sec.Tipo == "combo")
|
||
minimumHeight = DimensionRow * 3;
|
||
else
|
||
minimumHeight = DimensionRow * 4;
|
||
break;
|
||
#endregion
|
||
|
||
#region S66
|
||
case "S66":
|
||
//SEZIONE A DIMENSIONE FISSA
|
||
minimumHeight = DimensionRow * 3;
|
||
break;
|
||
#endregion
|
||
|
||
#region S67
|
||
case "S67":
|
||
if (sec.Tipo == "combo")
|
||
//Almeno devo poter disegnare il grafico pi<70> considero uno spazio 20 tra tabella e grafico e 3 righe di tabella (1 riga pi<70> header e totale, o 1 riga pi<70> header e cambio pagina)
|
||
minimumHeight = DimensioneTortaChart + 20 + DimensionRow * 2;
|
||
else
|
||
//Almeno devo poter disegnare il grafico
|
||
minimumHeight = DimensioneTortaChart;
|
||
break;
|
||
#endregion
|
||
|
||
#region S68
|
||
case "S68":
|
||
if (sec.Tipo == "combo")
|
||
//Almeno devo poter disegnare il grafico pi<70> considero uno spazio 20 tra tabella e grafico e 3 righe di tabella (1 riga pi<70> header e totale, o 1 riga pi<70> header e cambio pagina)
|
||
minimumHeight = DimensioneTortaChart + 20 + DimensionRow * 2;
|
||
else
|
||
//Almeno devo poter disegnare il grafico
|
||
minimumHeight = DimensioneTortaChart;
|
||
break;
|
||
#endregion
|
||
|
||
#region S75
|
||
case "S75":
|
||
//SEZIONE A DIMENSIONE FISSA + 50 per la nota
|
||
minimumHeight = DimensionRow * 2 + 50;
|
||
break;
|
||
#endregion
|
||
|
||
#region S75BIS
|
||
case "S75BIS":
|
||
//SEZIONE A DIMENSIONE FISSA + 50 per la nota
|
||
minimumHeight = DimensionRow * 4 + 70 + 150;
|
||
break;
|
||
#endregion
|
||
|
||
#region NProposta
|
||
case "NProposta":
|
||
break;
|
||
#endregion
|
||
|
||
#region NProgetti
|
||
case "NProgetti":
|
||
break;
|
||
#endregion
|
||
|
||
default:
|
||
minimumHeight = DimensionRow * 3;
|
||
break;
|
||
}
|
||
|
||
//Spazio aggiuntivo titolo sezione
|
||
minimumHeight += 30;
|
||
|
||
return minimumHeight;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
/// <param name="report"></param>
|
||
/// <returns></returns>
|
||
private int loadReportToPrint(int report)
|
||
{
|
||
List<Parametro> parametri = new List<Parametro>();
|
||
Parametro idReport = new Parametro();
|
||
idReport.DbType = DbType.Int32;
|
||
idReport.Value = report;
|
||
idReport.ParameterName = "pidReport";
|
||
parametri.Add(idReport);
|
||
|
||
dt = DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "sp_getSezioniPersToPrint_ByIdReport", parametri);
|
||
return 0;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
private void fillTemplateWithValues()
|
||
{
|
||
XmlNode root;
|
||
XmlNode node;
|
||
|
||
string internalSectionCode;
|
||
XmlNodeList nodeList;
|
||
|
||
root = docIN.DocumentElement; //pointer alla root del template xml da restituire una volta riempito con le info a run-time
|
||
//relative al report da stampare
|
||
|
||
foreach (DataRow dr in dt.Rows) //lettura dei records relativi al report da stampare
|
||
{
|
||
internalSectionCode = dr["internalSectionCode"].ToString();
|
||
|
||
|
||
// ********Gestione Vecchia Diagnosi e proposta
|
||
setSelectedSezioniCapitoloPatNonRap(internalSectionCode);
|
||
|
||
if (internalSectionCode != null && internalSectionCode != "")
|
||
{
|
||
//riempimento del template XML (per ogni record)
|
||
nodeList = root.SelectNodes("descendant::" + internalSectionCode);
|
||
node = nodeList[0];
|
||
if (node != null)
|
||
{
|
||
//se ho selezionato il figlio ANCHE il nodo PADRE deve essere SELEZIONATO
|
||
//if (node.ParentNode != null && node.ParentNode.Attributes["flag"].InnerText != "1") //primo livello
|
||
if (node.ParentNode != null) //primo livello
|
||
{
|
||
node.ParentNode.Attributes["flag"].InnerText = "1";
|
||
if (node.ParentNode.ParentNode != null && node.ParentNode.ParentNode.NodeType != XmlNodeType.Document) //secondo livello
|
||
{
|
||
node.ParentNode.ParentNode.Attributes["flag"].InnerText = "1";
|
||
if (node.ParentNode.ParentNode.ParentNode != null && node.ParentNode.ParentNode.ParentNode.NodeType != XmlNodeType.Document) //terzo livello
|
||
{
|
||
node.ParentNode.ParentNode.ParentNode.Attributes["flag"].InnerText = "1";
|
||
}
|
||
}
|
||
}
|
||
if (node.Attributes["flag"] != null)
|
||
{
|
||
node.Attributes["flag"].InnerText = "1"; //..e comunque il nodo prescelto va abilitato.
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
/// <param name="internalSectioncode"></param>
|
||
private void setSelectedSezioniCapitoloPatNonRap(string internalSectioncode)
|
||
{
|
||
switch (internalSectioncode.ToUpper())
|
||
{
|
||
#region Diagnosi e Proposta
|
||
case "PTNRAS":
|
||
// Distribuzione per asset class
|
||
hasSelectedDistribuzioneAssetClass = true;
|
||
break;
|
||
case "PTNRPI":
|
||
// Distribuzione per politica di investimento
|
||
hasSelectedPoliticaInv = true;
|
||
break;
|
||
#endregion
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
/// <param name="xmlTemplateName"></param>
|
||
/// <returns></returns>
|
||
public bool readXMLTemplate(string xmlTemplateName)
|
||
{
|
||
bool rc = false;
|
||
string initDir = WebConfigParameter.getParameter("Path");
|
||
string path = initDir + xmlTemplateName;
|
||
|
||
docIN.Load(path);
|
||
return rc;
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
private void insertQUERYblockIntoXml(string value)
|
||
{
|
||
|
||
XmlNodeList nodeList;
|
||
XmlNode node;
|
||
XmlNode parentNode;
|
||
XmlNode cloned;
|
||
XmlNode root = docIN.DocumentElement;
|
||
|
||
nodeList = root.SelectNodes("descendant::QUERY" + value);
|
||
node = nodeList[0];
|
||
if (node != null)
|
||
{
|
||
cloned = node.CloneNode(true);
|
||
parentNode = node.ParentNode;
|
||
|
||
//Add the node to the document.
|
||
parentNode.InsertAfter(cloned, node);
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
/// <param name="value"></param>
|
||
private void deleteQUERYblockIntoXml(string value)
|
||
{
|
||
XmlNodeList nodeList;
|
||
XmlNode node;
|
||
|
||
XmlNode root = docIN.DocumentElement;
|
||
|
||
nodeList = root.SelectNodes("descendant::" + value);
|
||
node = nodeList[0];
|
||
if (node != null)
|
||
{
|
||
node.RemoveAll();
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private int getPianificazioneSpecs()
|
||
{
|
||
int rc = 0;
|
||
//DataTable tb = SectionManager.GetDataSection("Generator_getPianificazioneSpecs", dsParam);
|
||
//DataTable tb = BusinessManager.GetDataTableFromStoredProcedure_ConsulenzaEvoluta("REP_Generator_getPianificazioneSpecs", dsParam.ChiaveClientePB);
|
||
DataTable tb = BusinessManager.GetDataTableFromStoredProcedure_ConsulenzaEvoluta("REP_Pian_P63_IndicatoriArea", dsParam.ChiaveClientePB);
|
||
|
||
DataView view = new DataView(tb);
|
||
view.RowFilter = "NEED_AREA = 'Ris'";
|
||
dtProgetto = view.ToTable();
|
||
|
||
numberOfQUERYtagsRis = dtProgetto.Rows.Count;
|
||
|
||
view = new DataView(tb);
|
||
view.RowFilter = "NEED_AREA = 'Inv'";
|
||
dtProgetto = view.ToTable();
|
||
dtProgetto.Columns.Remove("NEED_AREA");
|
||
|
||
rc = dtProgetto.Rows.Count;
|
||
|
||
return rc;
|
||
}
|
||
|
||
|
||
#endregion
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
struct elementoStampa
|
||
{
|
||
public string tagName;
|
||
public ArrayList alAttributi;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Utilizzato solo dal report di pianificazione
|
||
/// </summary>
|
||
struct attributiElementoStampa
|
||
{
|
||
public string titolo;
|
||
public string valore;
|
||
}
|
||
|
||
|
||
|
||
|