1001 lines
37 KiB
C#
1001 lines
37 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Collections.Generic;
|
|
|
|
/// <summary>
|
|
/// Gestisce il report di diagnosi.
|
|
/// In questa versione è presente l'alberatura.
|
|
/// Si basa sulla stored " R6_S_Generator 1, 'idmodello' ".
|
|
/// </summary>
|
|
public partial class ReportDiagnosi : System.Web.UI.Page
|
|
{
|
|
private Cliente _cliente;
|
|
|
|
private string codiceFiscale;
|
|
private string codiceRete;
|
|
private string codicePB;
|
|
private bool reportNominativo = false;
|
|
|
|
public string pathNav;
|
|
public int idReport; //indica il modello (fixed) COMPLETO di QUESTO report da cui costruire la treeview iniziale
|
|
|
|
|
|
public static int tpReport = 1; //valore proprietario (fixed) di QUESTO report //DA VALUTARE!!
|
|
public static int idReportAlbero = 1; //valore proprietario (fixed) di QUESTO report //DA VALUTARE!!
|
|
public static int idReportBase = 2;
|
|
public static int idReportCompleto = 1;
|
|
|
|
public string ambiente;
|
|
public int lastSavedReportId;
|
|
public static string nomeReport = "DIAGNOSI"; //valore proprietario (fixed) di QUESTO report
|
|
public static string nomeReportCompleto = "Diagnosi completo"; //valore proprietario (fixed) di QUESTO report
|
|
public static string nomeReportDiagnosi = "DIAGNOSI"; //valore proprietario (fixed) di QUESTO report
|
|
|
|
string nomeReportPerLabel;
|
|
string descrizioneReportPerLabel;
|
|
string reportIdToPass;
|
|
public int reportIdToLoadBack = -1;
|
|
public string endOfjob = "0";
|
|
private string token;
|
|
int IDReportToLoad = -1;
|
|
string baseCompleto = "";
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
#region Add attribute to controls
|
|
rbl_scelte.Attributes.Add("OnClick", "CallCheck_all_in_document()");
|
|
ddl_Modello.Attributes.Add("OnChange", "CallCheck_all_in_document()");
|
|
rbl_Privacy.Attributes.Add("OnClick", "CallCheck_all_in_document()");
|
|
#endregion
|
|
|
|
token = Request.QueryString.Get("token");
|
|
codiceRete = Request.QueryString.Get("tipoRete");
|
|
codicePB = Request.QueryString.Get("codPB");
|
|
codiceFiscale = Request.QueryString.Get("codCliente");
|
|
ambiente = Request.QueryString.Get("ambiente");
|
|
pathNav = Request.QueryString.Get("pathNav");
|
|
|
|
_cliente = Cliente.getCliente(codiceRete + codicePB, codiceFiscale);
|
|
|
|
if (Request.QueryString["lastReportPrinted"] != null)
|
|
IDReportToLoad = Convert.ToInt32(Request.QueryString.Get("lastReportPrinted"));
|
|
|
|
if (!Page.IsPostBack)
|
|
{
|
|
#region Nuova gestione privacy
|
|
|
|
if (_cliente.SottoscrizioneContrattoSei)
|
|
{
|
|
rbl_Privacy.Items[0].Selected = true;
|
|
rbl_Privacy.Items[0].Enabled = true;
|
|
rbl_Privacy.Items[1].Enabled = true;
|
|
reportNominativo = true;
|
|
}
|
|
else
|
|
{
|
|
rbl_Privacy.Items[1].Selected = true;
|
|
rbl_Privacy.Items[0].Enabled = false;
|
|
this.lbl_Privacy.Visible = true;
|
|
lbl_Privacy.Text = "La reportistica nominativa può essere stampata per i clienti che hanno sottoscritto la consulenza evoluta SEI";
|
|
reportNominativo = false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region From Gestione Modelli e stampa
|
|
|
|
if (Request.QueryString["baseCompleto"] != null && Request.QueryString["baseCompleto"] != "")
|
|
baseCompleto = Request.QueryString.Get("baseCompleto").ToString();
|
|
|
|
string loadingReport = "";
|
|
|
|
if (baseCompleto == "")
|
|
loadingReport = Request.QueryString.Get("idReportToLoad");
|
|
else
|
|
loadingReport = baseCompleto;
|
|
|
|
nomeReportPerLabel = Request.QueryString.Get("nomeInizialeReport");
|
|
descrizioneReportPerLabel = Request.QueryString.Get("descrizioneInizialeReport");
|
|
|
|
fillModelli();
|
|
|
|
if (loadingReport != null && loadingReport != "")
|
|
{
|
|
if (loadingReport == "loadBASE")
|
|
{
|
|
rbl_scelte.SelectedIndex = 0;
|
|
IDReportToLoad = idReportBase;
|
|
}
|
|
else
|
|
{
|
|
IDReportToLoad = Convert.ToInt32(loadingReport);
|
|
// Carico il report base
|
|
|
|
if (IDReportToLoad != idReportBase && IDReportToLoad != idReportCompleto)
|
|
{
|
|
if (nomeReportPerLabel != null && nomeReportPerLabel != "")
|
|
{
|
|
txb_nomeModello.Text = nomeReportPerLabel;
|
|
this.ddl_Modello.Enabled = true;
|
|
this.ddl_Modello.Items.FindByText(nomeReportPerLabel).Selected = true;
|
|
|
|
if (descrizioneReportPerLabel != null && descrizioneReportPerLabel != "")
|
|
txb_descrizione.Text = descrizioneReportPerLabel;
|
|
|
|
//rbl_scelte.Items[2].Selected = true;
|
|
rbl_scelte.SelectedIndex = 2;
|
|
}
|
|
|
|
}
|
|
else if (IDReportToLoad == idReportCompleto)
|
|
{
|
|
//rbl_scelte.Items[1].Selected = true;
|
|
rbl_scelte.SelectedIndex = 1;
|
|
|
|
}
|
|
else if (IDReportToLoad == idReportBase)
|
|
{
|
|
//rbl_scelte.Items[0].Selected = true;
|
|
rbl_scelte.SelectedIndex = 0;
|
|
|
|
}
|
|
}
|
|
//if (IDReportToLoad == -1) //vuol dire che devo caricare l'ultimo report da modello "salvato"
|
|
//{
|
|
// IDReportToLoad = loadLastSavedUserModel(); //da attivare x sapere quale modello e' stato usato per ultimo da quell'operatore x quel cliente
|
|
//}
|
|
}
|
|
|
|
#endregion
|
|
|
|
LoadVincoliInSession(codiceFiscale, codicePB, codiceRete);
|
|
|
|
if (IDReportToLoad == -1)
|
|
createTreeView(idReportAlbero, idReportBase, false);
|
|
else
|
|
createTreeView(idReportAlbero, IDReportToLoad, false);
|
|
|
|
|
|
if (!ClientScript.IsStartupScriptRegistered("gestAnalisiRischio"))
|
|
{
|
|
String cstext = "<script language='JavaScript'>defaultAnalisiRischio();</script>";
|
|
ClientScript.RegisterStartupScript(this.GetType(), "gestAnalisiRischio", cstext);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void btn_Stampa_Click(object sender, EventArgs e)
|
|
{
|
|
int idCliente = _cliente.IdCliente_SEIReport;
|
|
|
|
if (idCliente != -1)
|
|
{
|
|
int rc = 0;
|
|
//inizializzo il cookie che segnala la possibilita' di mostrare la pagina di inserimento note (reportStampa.aspx)
|
|
HttpCookie ck_endOfJob = new HttpCookie("endOfJob");
|
|
ck_endOfJob.Value = "0";
|
|
Response.Cookies.Add(ck_endOfJob);
|
|
|
|
if (rbl_scelte.SelectedItem.Value == "1")
|
|
{
|
|
baseCompleto = idReportCompleto.ToString();
|
|
}
|
|
else if (rbl_scelte.SelectedItem.Value == "2")
|
|
{
|
|
baseCompleto = idReportBase.ToString();
|
|
}
|
|
else if (rbl_scelte.SelectedItem.Value == "")
|
|
{
|
|
if (ddl_Modello.SelectedIndex == 0)
|
|
baseCompleto = idReportBase.ToString();
|
|
else
|
|
{
|
|
string[] split = ddl_Modello.SelectedItem.Value.Split('|');
|
|
|
|
if (split.Length > 0)
|
|
baseCompleto = split[0];
|
|
}
|
|
}
|
|
|
|
string nomeInizialeReport = this.txb_nomeModello.Text;
|
|
string descrizioneInizialeReport = this.txb_descrizione.Text;
|
|
reportNominativo = this.rbl_Privacy.Items[0].Selected ? true : false;
|
|
|
|
idReport = scriviNuovoModelloReportIntoDB("LAST USED CONFIG" + "_" + idCliente.ToString(), idCliente);
|
|
|
|
rc = InsertDatiInReportSezioniPers(idReport, "|", HiddenFieldStampa.Value, codiceRete + codicePB);
|
|
|
|
if (rc > 0)
|
|
{
|
|
Session["HIDDENFIELD"] = HiddenFieldStampa.Value;
|
|
|
|
string command = "generaPDF(\"Generator.aspx\",\"tipoReport=DIAGNOSI&action=createDiagnosi&codicePB=" + codicePB + "&codiceFiscale=" + codiceFiscale + "&token=" + token + "&codiceRete=" + codiceRete + "&idReport=" + idReport.ToString() + "&ambiente=" + ambiente + "&nomeInizialeReport=" + nomeInizialeReport + "&descrizioneInizialeReport=" + descrizioneInizialeReport + "&baseCompleto=" + baseCompleto + "&checkPrivacy=" + reportNominativo + "\");";
|
|
|
|
ClientScript.RegisterStartupScript(typeof(string), "pppppp",
|
|
"<script language=\"javascript\" type=\"text/javascript\">" + "\n" +
|
|
"<!--" + "\n" +
|
|
command + "\n" +
|
|
"//-->" + "\n" +
|
|
"</script>");
|
|
|
|
#region Gestione custom del ritorno alla pagina di diagnosi
|
|
|
|
createTreeView(idReportAlbero, idReport, false);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
|
|
private int InsertDatiInReportSezioniPers(int idReport, string delimiter, string hiddensezioniselezionate, string utente)
|
|
{
|
|
#region Salvataggio Modello
|
|
SezioneVincolo vincoli = (SezioneVincolo)Session["VINCOLIDIAGNOSI"];
|
|
|
|
int rc = 0;
|
|
List<Parametro> parametri = new List<Parametro>();
|
|
|
|
Parametro parametro = new Parametro();
|
|
parametro.DbType = DbType.Int32;
|
|
parametro.Value = idReport;
|
|
parametro.ParameterName = "pIdReport";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = delimiter;
|
|
parametro.ParameterName = "delimiter";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = hiddensezioniselezionate;
|
|
parametro.ParameterName = "splitstring";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = utente;
|
|
parametro.ParameterName = "utente";
|
|
parametri.Add(parametro);
|
|
|
|
//Variabili per i vincoli
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHaBFWallet);
|
|
parametro.ParameterName = "CustomerHaPatrimonioBF";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHasOnlyBFWallet);
|
|
parametro.ParameterName = "CustomerHasOnlyBFWallet";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHaPatrimonioTerziEdHaUnSoloIntermediario);
|
|
parametro.ParameterName = "CustomerHaPatrimonioTerziEdHaUnSoloIntermediario";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHaPatrimonioTerzi);
|
|
parametro.ParameterName = "CustomerHaPatrimonioTerzi";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHasOnlyWalletByOtherInstitutes);
|
|
parametro.ParameterName = "CustomerHasOnlyWalletByOtherInstitutes";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHasNoPiramideModello);
|
|
parametro.ParameterName = "CustomerHasNoPiramideModello";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHasNoPatNonRapPoliticaInv);
|
|
parametro.ParameterName = "CustomerHasNoPatNonRapPoliticaInv";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = Convert.ToInt16(vincoli.CustomerHasNoPatNonRapAsset);
|
|
parametro.ParameterName = "CustomerHasNoPatNonRapAsset";
|
|
parametri.Add(parametro);
|
|
|
|
rc = DataAccess.ExecuteNonQueryStoredProcedure(DBProvider.SqlServer, "sp_InsertIdSezioniIntoReportSezioniPers_Diagnosi", parametri);
|
|
|
|
return rc;
|
|
#endregion
|
|
}
|
|
|
|
private int scriviNuovoModelloReportIntoDB(string reportName, int idCliente)
|
|
{
|
|
int rc = -1;
|
|
|
|
List<Parametro> parametri = new List<Parametro>();
|
|
|
|
Parametro parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = reportName;
|
|
parametro.ParameterName = "nome";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = this.txb_descrizione.Text; ;
|
|
parametro.ParameterName = "descrizione";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Boolean;
|
|
parametro.Value = false;
|
|
parametro.ParameterName = "flgModello";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = idReportAlbero;
|
|
parametro.ParameterName = "idReportModello";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = tpReport;
|
|
parametro.ParameterName = "tpReport";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = _cliente.CodiceRete + _cliente.CodicePB;
|
|
parametro.ParameterName = "utente";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int32;
|
|
parametro.Value = idCliente;
|
|
parametro.ParameterName = "idCliente";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int16;
|
|
parametro.Value = rbl_Privacy.SelectedIndex;
|
|
parametro.ParameterName = "Privacy";
|
|
parametri.Add(parametro);
|
|
|
|
rc = DataAccess.ExecuteNonQueryStoredProcedure(DBProvider.SqlServer, "sp_insertNewReportModelNew", parametri);
|
|
|
|
return rc;
|
|
}
|
|
|
|
protected void rbl_scelte_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
int tiporeport = -1;
|
|
this.txb_nomeModello.Text = "";
|
|
this.txb_descrizione.Text = "";
|
|
lbl_message.Text = "";
|
|
|
|
|
|
if (rbl_scelte.SelectedItem.Value != "")
|
|
{
|
|
tiporeport = Convert.ToInt32(rbl_scelte.SelectedItem.Value);
|
|
ddl_Modello.Enabled = false;
|
|
ddl_Modello.SelectedIndex = 0;
|
|
}
|
|
else
|
|
{
|
|
ddl_Modello.Enabled = true;
|
|
ddl_Modello.SelectedIndex = 0;
|
|
}
|
|
|
|
|
|
// Carico il report selezionato che puo essere base o completo visto che Modelli risuleterebbe vuoto
|
|
if (tiporeport != -1)
|
|
{
|
|
createTreeView(idReportAlbero, tiporeport, false);
|
|
}
|
|
else
|
|
{
|
|
createTreeView(idReportAlbero, idReportCompleto, true);
|
|
}
|
|
if (tiporeport == idReportBase)
|
|
{
|
|
if (!ClientScript.IsStartupScriptRegistered("gestAnalisiRischio"))
|
|
{
|
|
String cstext = "<script language='JavaScript'>defaultAnalisiRischio();</script>";
|
|
ClientScript.RegisterStartupScript(this.GetType(), "gestAnalisiRischio", cstext);
|
|
}
|
|
}
|
|
if (tiporeport == idReportCompleto)
|
|
{
|
|
//if (!ClientScript.IsStartupScriptRegistered("dis2grafici"))
|
|
//{
|
|
// String cstext = "<script language='JavaScript'>Disabilita2GraficiRischio();</script>";
|
|
// ClientScript.RegisterStartupScript(this.GetType(), "dis2grafici", cstext);
|
|
//}
|
|
if (!ClientScript.IsStartupScriptRegistered("abilitaPerimetro"))
|
|
{
|
|
String cstext = "<script language='JavaScript'>abilitaApprofondimentoPerimetro();</script>";
|
|
ClientScript.RegisterStartupScript(this.GetType(), "abilitaPerimetro", cstext);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void createTreeView(int tipoAlbero, int tipoReport, bool viewstate)
|
|
{
|
|
DataTable dtAlbero = null;
|
|
DataTable dtVincoli = null;
|
|
|
|
dtVincoli = getVincoliAlbero(tipoAlbero);
|
|
|
|
dtAlbero = CreateDataSource(tipoAlbero, tipoReport, Convert.ToInt16(viewstate));
|
|
|
|
if (dtAlbero.Columns.Contains("SezionePers"))
|
|
dtAlbero.Columns["SezionePers"].ReadOnly = false;
|
|
|
|
if (viewstate)
|
|
setStatoSezioni(ref dtAlbero);
|
|
|
|
// Ritorna l'albero con i vincoli gestiti
|
|
gestioneVincoliAlbero(ref dtAlbero, dtVincoli);
|
|
|
|
|
|
TreeViewCompositeControl1.DataSource = dtAlbero;
|
|
TreeViewCompositeControl1.DataBind();
|
|
|
|
String cstext = "<script language='JavaScript'>max2check();</script>";
|
|
ClientScript.RegisterStartupScript(this.GetType(), "max2check", cstext);
|
|
}
|
|
|
|
DataTable CreateDataSource(int idreportAlbero, int idreport, int flagViewState)
|
|
{
|
|
List<Parametro> parametri = new List<Parametro>();
|
|
|
|
Parametro parametro = new Parametro();
|
|
parametro.DbType = DbType.Int32;
|
|
parametro.Value = idreportAlbero;
|
|
parametro.ParameterName = "pIdReportAlbero";
|
|
parametri.Add(parametro);
|
|
|
|
|
|
// flagViewState = 0 (false)
|
|
// flagViewState = 1 (true)
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int32;
|
|
parametro.Value = flagViewState;
|
|
parametro.ParameterName = "flagViewState";
|
|
parametri.Add(parametro);
|
|
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.Int32;
|
|
parametro.Value = idreport;
|
|
parametro.ParameterName = "pIdReport";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = codiceRete;
|
|
parametro.ParameterName = "pRete";
|
|
parametri.Add(parametro);
|
|
|
|
return DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "sp_getSezioni_ByIdReport_TreeView", parametri);
|
|
|
|
}
|
|
|
|
private DataTable getVincoliAlbero(int idReport)
|
|
{
|
|
DataTable dt = null;
|
|
// I vincoli relativi alla privacy li recupero sempre
|
|
string codiceVincoli = Resources.GlobalResource.Vincolo_Flag_Privacy_Anomima;
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_Flag_Privacy_Nominativa;
|
|
|
|
SezioneVincolo vincoli = (SezioneVincolo)Session["VINCOLIDIAGNOSI"];
|
|
|
|
#region SEZIONE VINCOLO
|
|
|
|
//// d.lisena 06/12/2010
|
|
//// Se il cliente ha solo il cc presso fideuram devo abilitare la parte di albero relativa a SintesiPatrimonio, PatrimonioBF e Analisi rischio.
|
|
//// Metto questa condizione con la speranza di poter cambiare questa gestione dei vincoli
|
|
//if (vincoli.CustomerHasCCBancaFideuram == true)
|
|
//{
|
|
// vincoli.CustomerHasOnlyBFWallet = true;
|
|
// vincoli.CustomerHasNoWalletAtAll = false;
|
|
//}
|
|
|
|
|
|
// Vincolo cliente non ha
|
|
if (vincoli.CustomerHasOnlyBFWallet)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasOnlyBFWallet;
|
|
}
|
|
|
|
// Il cliente ha solo patrimonio presso altri istituti
|
|
if (vincoli.CustomerHasOnlyWalletByOtherInstitutes)
|
|
{
|
|
|
|
if (!vincoli.CustomerHasCCBancaFideuram)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasOnlyWalletByOtherInstitutes;
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHaSoloCCPressoBF;
|
|
}
|
|
}
|
|
|
|
// Customer Ha Patrimonio Terzi Ed Ha Un Solo Intermediario
|
|
if (vincoli.CustomerHaPatrimonioTerziEdHaUnSoloIntermediario)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHaPatrimonioTerziEdHaUnSoloIntermediario;
|
|
}
|
|
|
|
// // Customer Ha Patrimonio Terzi Ed Ha Un Solo Intermediario
|
|
//if (vincoli.CustomerHaPatrimonioTerziEdHaUnSoloIntermediario)
|
|
//{
|
|
// codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHaPatrimonioTerziEdHaUnSoloIntermediario;
|
|
//}
|
|
|
|
// Customer Ha Patrimonio Terzi
|
|
if (!vincoli.CustomerHaPatrimonioTerzi)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHaPatrimonioTerzi;
|
|
}
|
|
|
|
// Customer Non ha piramide modello
|
|
if (vincoli.CustomerHasNoPiramideModello)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasNoPiramideModello;
|
|
}
|
|
|
|
// Customer Non ha portafogli
|
|
if (vincoli.CustomerHasNoWalletAtAll)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasNoWalletAtAll;
|
|
|
|
if (!vincoli.CustomerHasCCBancaFideuram)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHaSoloCCPressoBF;
|
|
|
|
if (vincoli.CustomerHasPatrimionioImmobiliareOAltroPatrimonio)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasPatrimionioImmobiliareOAltroPatrimonio;
|
|
|
|
if (vincoli.CustomerHasNoRischio)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasNoRischio;
|
|
|
|
}
|
|
|
|
if (vincoli.CustomerHasNoDatiProfessionali)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasNoDatiProfessionali;
|
|
|
|
}
|
|
|
|
if (vincoli.CustomerHasNoFabbisognoPrevidenziale)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasNoFabbisognoPrevidenziale;
|
|
|
|
}
|
|
|
|
if (vincoli.CustomerHasNoDatiProfessionali && vincoli.CustomerHasNoFabbisognoPrevidenziale)
|
|
{
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_NoDatiProfessionali_NoFabbisognoPrevidenziale;
|
|
|
|
}
|
|
|
|
if (vincoli.CustomerCheckImmobiliareEdAltroPatrimonio != 3)
|
|
{
|
|
if (vincoli.CustomerCheckImmobiliareEdAltroPatrimonio == 0)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerCheckImmobiliareEdAltroPatrimonio_0;
|
|
else if (vincoli.CustomerCheckImmobiliareEdAltroPatrimonio == 1)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerCheckImmobiliareEdAltroPatrimonio_1;
|
|
else if (vincoli.CustomerCheckImmobiliareEdAltroPatrimonio == 2)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerCheckImmobiliareEdAltroPatrimonio_2;
|
|
}
|
|
|
|
if (vincoli.CustomerHasNoPatNonRapAsset)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasNoPatNonRapAsset;
|
|
|
|
if (vincoli.CustomerHasNoPatNonRapPoliticaInv)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_CustomerHasNoPatNonRapPoliticaInv;
|
|
|
|
|
|
|
|
// NUOVI VINCOLI
|
|
if (!vincoli.IsVarProxati)
|
|
codiceVincoli += "|" + Resources.GlobalResource.Vincolo_VarProxati;
|
|
#endregion
|
|
|
|
#region Recupero dal db il datatable vincoli passando la stringa
|
|
List<Parametro> parametri = new List<Parametro>();
|
|
Parametro parametro = new Parametro();
|
|
parametro.DbType = DbType.Int32;
|
|
parametro.Value = idReport;
|
|
parametro.ParameterName = "pIdReport";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = "|";
|
|
parametro.ParameterName = "delimiter";
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.DbType = DbType.String;
|
|
parametro.Value = codiceVincoli;
|
|
parametro.ParameterName = "splitstring";
|
|
parametri.Add(parametro);
|
|
|
|
dt = DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "sp_getVincoliSezioni", parametri);
|
|
|
|
#endregion
|
|
|
|
return dt;
|
|
|
|
}
|
|
|
|
private void setStatoSezioni(ref DataTable dtAlbero)
|
|
{
|
|
string words = HiddenFieldSezioni.Value.Trim();
|
|
|
|
if (words == "")
|
|
if (Session["HIDDENFIELD"] != null && Session["HIDDENFIELD"] != "")
|
|
words = Session["HIDDENFIELD"].ToString();
|
|
|
|
DataRow key = null;
|
|
|
|
if (words.Length > 0)
|
|
{
|
|
if (dtAlbero.PrimaryKey.Length == 0)
|
|
{
|
|
DataColumn[] primarykeys = new DataColumn[1];
|
|
primarykeys[0] = dtAlbero.Columns["IDSezione"];
|
|
dtAlbero.PrimaryKey = primarykeys;
|
|
|
|
}
|
|
|
|
string[] split = words.Split('|');
|
|
|
|
foreach (string s in split)
|
|
{
|
|
|
|
if (s.Trim() != "")
|
|
{
|
|
key = dtAlbero.Rows.Find(s);
|
|
if (key != null)
|
|
key["SezionePers"] = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void gestioneVincoliAlbero(ref DataTable dtAlbero, DataTable dtVincoli)
|
|
{
|
|
DataRow key = null;
|
|
|
|
#region Cancello le righe del vincolo privacy se non selezionalto o selezionabile
|
|
if (rbl_Privacy.Visible == true && rbl_Privacy.Items[0].Selected == true)
|
|
{
|
|
// Privacy Nominativa
|
|
// Elimini le righe della privacy anonima
|
|
DataRow[] drs = dtVincoli.Select(" IDVincolo = '" + Resources.GlobalResource.Vincolo_Flag_Privacy_Anomima.Trim() + "'");
|
|
|
|
foreach (DataRow rowVincolo in drs)
|
|
{
|
|
dtVincoli.Rows.Remove(rowVincolo);
|
|
}
|
|
}
|
|
else if ((rbl_Privacy.Visible == true && rbl_Privacy.Items[1].Selected == true) || (rbl_Privacy.Visible == false))
|
|
{
|
|
// Privacy Anonima
|
|
// Eliminio le righe della privacy nominativa
|
|
DataRow[] drs = dtVincoli.Select(" IDVincolo = '" + Resources.GlobalResource.Vincolo_Flag_Privacy_Nominativa.Trim() + "'");
|
|
|
|
foreach (DataRow rowVincolo in drs)
|
|
{
|
|
dtVincoli.Rows.Remove(rowVincolo);
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
// settaggio della primary key
|
|
if (dtAlbero.PrimaryKey.Length == 0)
|
|
{
|
|
DataColumn[] primarykeys = new DataColumn[1];
|
|
primarykeys[0] = dtAlbero.Columns["IDSezione"];
|
|
dtAlbero.PrimaryKey = primarykeys;
|
|
|
|
}
|
|
// recupero idsesione per ogni
|
|
foreach (DataRow rowVincolo in dtVincoli.Rows)
|
|
{
|
|
key = dtAlbero.Rows.Find(rowVincolo["IDSEZIONE"]);
|
|
|
|
// trova la chiave
|
|
if (key != null)
|
|
{
|
|
#region Gestione Vincoli
|
|
switch (rowVincolo["TIPOVINCOLO"].ToString())
|
|
{
|
|
case "CHECKED":
|
|
key["SezionePers"] = 1;
|
|
break;
|
|
case "CHECKED|DISABLE":
|
|
key["SezionePers"] = 1;
|
|
key["IsDefault"] = 0;
|
|
break;
|
|
case "UNCHECKED|DISABLE":
|
|
key["IsDefault"] = 0;
|
|
key["SezionePers"] = 0;
|
|
break;
|
|
case "UNCHECKED|ENABLE":
|
|
key["IsDefault"] = 1;
|
|
key["SezionePers"] = 0;
|
|
break;
|
|
case "LABELGREY":
|
|
key["CSSClass"] = "lblTestoDescrizioneGrigio";
|
|
key["IsSectionPrinting"] = 0;
|
|
break;
|
|
case "LABELGREYBOLD":
|
|
key["CSSClass"] = "lblTestoDescrizioneGrigioBold";
|
|
key["IsSectionPrinting"] = 0;
|
|
break;
|
|
case "UNCHECKED|DISABLE|UNMANDATORY":
|
|
key["IsDefault"] = 0;
|
|
key["SezionePers"] = 0;
|
|
key["IsMandatory"] = 0;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
|
|
public void LoadVincoliInSession(string codiceFiscale, string codiceAgente, string codiceRete)
|
|
{
|
|
CTable tbl = new CTable();
|
|
SezioneVincolo SezVincolo = new SezioneVincolo();
|
|
bool conPatrimonioTerzi = false;
|
|
bool conPatrimonioBF = false;
|
|
|
|
//set variabili per abilitare pulsanti
|
|
tbl.LoadDati(codiceFiscale, codicePB, codiceRete);
|
|
|
|
conPatrimonioBF = tbl.Diagnosi_CustomerHasBFWallet();
|
|
conPatrimonioTerzi = tbl.Diagnosi_CustomerHaPatrimonioTerzi();
|
|
SezVincolo.CustomerHasCCBancaFideuram = tbl.Diagnosi_CustomerHaCCPressoBF();
|
|
|
|
SezVincolo.CustomerHasNoWalletAtAll = tbl.Diagnosi_CustomerHasNoWalletAtAll();
|
|
SezVincolo.CustomerHaBFWallet = conPatrimonioBF;
|
|
|
|
if (conPatrimonioBF && (conPatrimonioTerzi == false))
|
|
SezVincolo.CustomerHasOnlyBFWallet = true;
|
|
else
|
|
SezVincolo.CustomerHasOnlyBFWallet = false;
|
|
|
|
SezVincolo.CustomerHasOnlyWalletByOtherInstitutes = tbl.Diagnosi_CustomerHasOnlyWalletByOtherInstitutes();
|
|
|
|
SezVincolo.CustomerHasPatrimionioImmobiliareOAltroPatrimonio = tbl.Diagnosi_CustomerHasPatrimionioImmobiliareOAltroPatrimonio();
|
|
SezVincolo.CustomerHasNoFabbisognoPrevidenziale = tbl.Diagnosi_CustomerHasNoFabbisognoPrevidenziale();
|
|
SezVincolo.CustomerHasNoDatiProfessionali = tbl.Diagnosi_CustomerHasNoDatiProfessionali();
|
|
SezVincolo.CustomerHasNoPiramideModello = tbl.Diagnosi_CustomerHasNoPiramideModello();
|
|
SezVincolo.CustomerHasNoRischio = tbl.Diagnosi_CustomerHasNoRischio(codiceFiscale, codicePB, codiceRete, token);
|
|
SezVincolo.CustomerCheckImmobiliareEdAltroPatrimonio = tbl.Diagnosi_CustomerCheckImmobiliareEdAltroPatrimonio();
|
|
SezVincolo.CustomerHaPatrimonioTerzi = conPatrimonioTerzi;
|
|
SezVincolo.CustomerHaSoloCCPressoBF = tbl.Diagnosi_CustomerHaSoloCCPressoBF();
|
|
SezVincolo.CustomerHaPatrimonioTerziEdHaUnSoloIntermediario = tbl.Diagnosi_CustomerHaPatrimonioTerziEdHaUnSoloIntermediario();
|
|
SezVincolo.IsVarProxati = tbl.Diagnosi_CustomerHasProdottiNonCatalogati();
|
|
// La funzione sotto popola la varianile Diag_CustomerHasNoPatNonRapAsset
|
|
// Sono vincolato alla gestione fantastica precedente
|
|
tbl.Diagnosi_CustomerHasNoPatNonRapAsset();
|
|
SezVincolo.CustomerHasNoPatNonRapAsset = tbl.Diag_CustomerHasNoPatNonRapAsset;
|
|
|
|
// La funzione sotto popola la varianile Diag_CustomerHasNoPatNonRapAsset
|
|
// SONO VINCOLATO ALLA GESTIONE FANTASTICA PRECEDENTE
|
|
tbl.Diagnosi_CustomerHasNoPatNonRapPoliticaInv();
|
|
SezVincolo.CustomerHasNoPatNonRapPoliticaInv = tbl.Diag_CustomerHasNoPatNonRapPoliticaInv;
|
|
|
|
Session["VINCOLIDIAGNOSI"] = SezVincolo;
|
|
}
|
|
|
|
protected void btn_Salva_Click(object sender, EventArgs e)
|
|
{
|
|
int idReport;
|
|
int rc = 0;
|
|
|
|
string nomeModello = txb_nomeModello.Text;
|
|
nomeModello = nomeModello.Trim();
|
|
int idCliente = _cliente.IdCliente_SEIReport;
|
|
|
|
idReport = scriviNuovoModelloReportIntoDB(nomeModello, idCliente); //salvo il modello che non va stampato...
|
|
|
|
fillModelli();
|
|
|
|
if (idReport != -1)
|
|
{
|
|
#region Salvataggio Modello
|
|
rc = InsertDatiInReportSezioniPers(idReport, "|", HiddenFieldSezioni.Value, codiceRete + codicePB);
|
|
#endregion
|
|
}
|
|
else this.lbl_message.Text = "Errore nel salvataggio del modello " + nomeModello + ".";
|
|
|
|
if (rc > 0)
|
|
{
|
|
this.lbl_message.ForeColor = System.Drawing.Color.Black;
|
|
this.lbl_message.Text = "Il Modello " + nomeModello + " e' stato salvato correttamente.";
|
|
createTreeView(idReportAlbero, idReport, false);
|
|
}
|
|
else
|
|
{
|
|
this.lbl_message.Text = "Errore nel salvataggio del modello " + nomeModello + ".";
|
|
createTreeView(idReportAlbero, idReportBase, false);
|
|
}
|
|
|
|
#region Modello Salvato
|
|
this.ddl_Modello.Enabled = true;
|
|
this.ddl_Modello.Items.FindByValue(idReport.ToString() + "|" + txb_descrizione.Text).Selected = true;
|
|
//rbl_scelte.Items[2].Selected = true;
|
|
rbl_scelte.SelectedIndex = 2;
|
|
#endregion
|
|
}
|
|
|
|
protected void btn_GestioneModelli_Click(object sender, EventArgs e)
|
|
{
|
|
if (rbl_scelte.SelectedItem.Value == "1")
|
|
{
|
|
reportIdToPass = idReportCompleto.ToString();
|
|
}
|
|
else if (rbl_scelte.SelectedItem.Value == "2")
|
|
{
|
|
reportIdToPass = idReportBase.ToString();
|
|
}
|
|
else if (rbl_scelte.SelectedItem.Value == "")
|
|
{
|
|
if (ddl_Modello.SelectedIndex == 0)
|
|
reportIdToPass = idReportBase.ToString();
|
|
else
|
|
{
|
|
string[] split = ddl_Modello.SelectedItem.Value.Split('|');
|
|
|
|
if (split.Length > 0)
|
|
reportIdToPass = split[0];
|
|
}
|
|
}
|
|
|
|
string nomeInizialeReport = this.txb_nomeModello.Text;
|
|
string descrizioneInizialeReport = this.txb_descrizione.Text;
|
|
|
|
if (this.rbl_Privacy.Items[0].Selected == true)
|
|
reportNominativo = true;
|
|
else
|
|
reportNominativo = false;
|
|
|
|
Session["HIDDENFIELD"] = "";
|
|
Response.Redirect("archivioModelli.aspx?codCliente=" + codiceFiscale + "&tipoRete=" + codiceRete + "&codPB=" + codicePB + "&pathNav=" + pathNav + "&tpReport=" + tpReport + "&utente=" + _cliente.CodiceRete + _cliente.CodicePB + "&caller=" + nomeReportDiagnosi + "&idReport=" + reportIdToPass + "&nomeInizialeReport=" + nomeInizialeReport + "&descrizioneInizialeReport=" + descrizioneInizialeReport + "&checkPrivacy=" + reportNominativo + "&token=" + token);
|
|
|
|
}
|
|
|
|
protected void ddl_Modello_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string[] split = ddl_Modello.SelectedItem.Value.Split('|');
|
|
|
|
string idreport = "";
|
|
string desc = "";
|
|
|
|
if (split.Length > 0)
|
|
{
|
|
if (split[0] != null)
|
|
idreport = split[0];
|
|
|
|
if (split.Length == 2)
|
|
if (split[1] != null)
|
|
desc = split[1];
|
|
}
|
|
|
|
|
|
if (ddl_Modello.SelectedIndex != 0)
|
|
createTreeView(idReportAlbero, Convert.ToInt32(idreport), false);
|
|
else
|
|
createTreeView(idReportAlbero, idReportCompleto, true);
|
|
|
|
lbl_message.Text = "";
|
|
|
|
this.txb_nomeModello.Text = ddl_Modello.SelectedItem.Text;
|
|
this.txb_descrizione.Text = desc;
|
|
|
|
|
|
|
|
}
|
|
|
|
protected void rbl_Privacy_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
int tiporeport = -1;
|
|
this.txb_nomeModello.Text = "";
|
|
this.txb_descrizione.Text = "";
|
|
lbl_message.Text = "";
|
|
|
|
if (rbl_scelte.SelectedItem.Value != "")
|
|
{
|
|
tiporeport = Convert.ToInt32(rbl_scelte.SelectedItem.Value);
|
|
ddl_Modello.Enabled = false;
|
|
ddl_Modello.SelectedIndex = 0;
|
|
}
|
|
else
|
|
{
|
|
ddl_Modello.Enabled = true;
|
|
ddl_Modello.SelectedIndex = 0;
|
|
}
|
|
|
|
// Carico il report selezionato che puo essere base o completo visto che Modelli risuleterebbe vuoto
|
|
if (tiporeport != -1)
|
|
{
|
|
createTreeView(idReportAlbero, tiporeport, false);
|
|
}
|
|
else
|
|
{
|
|
createTreeView(idReportAlbero, idReportCompleto, true);
|
|
}
|
|
|
|
if (tiporeport == idReportBase)
|
|
{
|
|
if (!ClientScript.IsStartupScriptRegistered("gestAnalisiRischio"))
|
|
{
|
|
String cstext = "<script language='JavaScript'>defaultAnalisiRischio();</script>";
|
|
ClientScript.RegisterStartupScript(this.GetType(), "gestAnalisiRischio", cstext);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void fillModelli()
|
|
{
|
|
this.ddl_Modello.Items.Clear();
|
|
|
|
|
|
List<Parametro> parametri = new List<Parametro>();
|
|
Parametro parametro = new Parametro();
|
|
parametro.ParameterName = "pIdReportModello";
|
|
parametro.Value = idReportAlbero;
|
|
parametro.DbType = DbType.Int32;
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro();
|
|
parametro.ParameterName = "pUtente";
|
|
|
|
if ((_cliente.CodiceRete + _cliente.CodicePB).Length > 0)
|
|
parametro.Value = _cliente.CodiceRete + _cliente.CodicePB;
|
|
else
|
|
parametro.Value = System.DBNull.Value;
|
|
|
|
parametro.DbType = DbType.String;
|
|
parametri.Add(parametro);
|
|
|
|
DataTable dt = DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "sp_getReport_ByUtenteAndModello", parametri);
|
|
|
|
ddl_Modello.Items.Add("Selezione Modelli");
|
|
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
string nome = dr["Nome"].ToString();
|
|
if (nome.IndexOf("LAST USED CONFIG") == -1)
|
|
{
|
|
ListItem li = new ListItem(dr["Nome"].ToString(), dr["IdReport"].ToString() + "|" + dr["Descrizione"].ToString());
|
|
this.ddl_Modello.Items.Add(li);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|