2025-04-15 12:10:19 +02:00

711 lines
32 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ceTe.DynamicPDF.Text;
using ceTe.DynamicPDF;
using PDFGenerator.Presentation.Section;
using PDFGenerator;
using PDFGenerator.Presentation.Section.Tables;
using PDFGenerator.Presentation.Section.Charts;
using PDFGenerator.BusinessLayer;
using PDFGenerator.BusinessLayer.DataSection;
using System.Collections.Generic;
using ContrattoSei.Utilities;
using System.Linq;
using ceTe.DynamicPDF.PageElements;
public class S172 : ISezione
{
private string _titolo = string.Empty;
private string _testointroduttivo = string.Empty;
/// <summary>
/// Titolo della sezione
/// </summary>
public string Titolo
{
get
{
return _titolo;
}
set
{
_titolo = value;
}
}
/// <summary>
/// Testo introduttivo della Sezione.
/// </summary>
public string TestoIntroduttivo
{
get
{
return _testointroduttivo;
}
set
{
_testointroduttivo = value;
}
}
public S172()
{
//
// TODO: Add constructor logic here
//
}
public void writeSezione(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
document.setSezTitolo(dataThread.SezioneReport.Titolo);
string tempTesto = dataThread.SezioneReport.TestoIntroduttivo;
string tempTestoAlt = dataThread.SezioneReport.TestoIntroduttivoAlternativo;
float spaceSection;
int wCol1 = 170;
int wCol2 = 70;
int wCol3 = 83;
int wCol4 = 187;
//if (dataThread.Rete.ToUpper() == "S")
//{
// //FC 26062015 Aggionamento nuova Ragione Sociale
// tempTesto = tempTesto.Replace("Fideuram", "Sanpaolo Invest");
// tempTestoAlt = tempTesto.Replace("Fideuram", "Sanpaolo Invest");
//}
//*********************************** Cecco modifiche dicitura IWBANK*****************************
if (dataThread.Rete.ToUpper() == "S")
{
//FC 26062015 Aggionamento nuova Ragione Sociale
// Rosaspina Andrea//
tempTesto = tempTesto.Replace("Fideuram", "Fideuram S.p.A., commercializzato tramite la rete di private banker Sanpaolo Invest");
tempTestoAlt = tempTesto.Replace("Fideuram", "Fideuram S.p.A., commercializzato tramite la rete di private banker Sanpaolo Invest");
//tempTesto = tempTesto.Replace("Fideuram", "Sanpaolo Invest");
//tempTestoAlt = tempTesto.Replace("Fideuram", "Sanpaolo Invest");
}
else if (dataThread.Rete.ToUpper() == "W")
{
tempTesto = tempTesto.Replace("Fideuram", "IW Private Investments");
tempTestoAlt = tempTesto.Replace("Fideuram", "IW Private Investments");
}
//***********************************************************************************************
document.setHeaderSpace(1);
document.setChapterHeader(tempTesto.Replace("$/Banca/$", dataThread.NomeRete).Replace("Sanpaolo Invest", "Fideuram S.p.A., commercializzati tramite la rete di private banker Sanpaolo Invest"), 0, 520, 8);
float marginePiramide = 30;
DatiTabella datitab = new DatiTabella();
DataSetS172 set = (DataSetS172)dataThread.Data.DatiSezione;
#region Resulset- Verifica disegno colonna "copertura"
datitab.table = set.Tables["ResultSet"];
// _mostracolonnacopertura = Convert.ToBoolean(datitab.table.Rows[0][0]);
#endregion
//calcola se entra nella pagina altrimenti aggiunge una nuova pagina. In questa sezione il # di righe è fissato
//devo considerare lo spazio dell'header- ora lo aggiungo manualmente
if (document.checkMargin(300))
document.addPage();
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
////aggiorna l'indice, titolo e header sezione
//document.setSezTitolo(_testotitolo);
//document.setSezHeader(_testointroduttivo);
#region Piramide
//disegno la parte della piramide
PiramideTutela modello = new PiramideTutela();
modello.writeSezione(document);
#endregion
#region Tabella a destra della piramide
// disegno la tabella a destra della piramide.
#region datasource tabella
//setta la datatable
datitab.table = set.Tables["GraficoPiramide"];
// Servono due righe fittizie per allineamento con l'immagine della piramide
datitab.table.Rows.Add("", "", "", "", 0, "-1", "");
datitab.table.Rows.Add("", "", "", "", 6, "-1", "");
DataView view = new DataView(datitab.table);
view.Sort = "OrderNeedArea";
view.RowFilter = "";
datitab.table = view.ToTable(false, "AreaBisogno", "Controvalore", "ControvaloreProtetto", "ContributoProtezioneColumn");
#endregion
Tabella tabella = new Tabella();
tabella.LineeTabella = false;
tabella.Y = document.getLastPos();
tabella.X = 210;
tabella.Header = true;
tabella.HeaderFont = 8;
tabella.SaltoPagina = false;
tabella.Datasource = datitab.table;
tabella.AltezzaCella = 21;
tabella.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", wCol2, TipoAllineamento.DESTRA, false, 8, false));
tabella.Colonne.Add(new Colonna("ControvaloreProtetto", "Controvalore protetto (€)", wCol3, TipoAllineamento.DESTRA, false, 8, false));
tabella.Colonne.Add(new Colonna("ContributoProtezioneColumn", "Contributo alla protezione (%)", wCol4, TipoAllineamento.SINISTRA, false, 8, false));
tabella.Draw(datitab, document);
spaceSection = tabella.AltezzaTabella;
#endregion
#region Grafico a farfalla per Prodotti
#region Recupero i valori da assegnare alle serie del grafico
DataView viewSerie = new DataView(set.Tables["GraficoPiramide"]);
viewSerie.Sort = "OrderNeedArea";
viewSerie.RowFilter = "";
var datiSerie = viewSerie.ToTable(false, "AreaBisogno", "Controvalore", "ControvaloreProtetto", "ContributoProtezione", "ContributoProtezioneColumn");
List<IValoriSerie> listaValoriContributo = new List<IValoriSerie>();
List<IValoriSerie> listaValoriRischioRelativo = new List<IValoriSerie>();
IValoriSerie IvaloriSerieContributo = new IValoriSerie();
IvaloriSerieContributo.chiave = "ContributoProtezione";
IvaloriSerieContributo.valore = Decimal.MinValue;
foreach (DataRow row in datiSerie.Rows)
{
IvaloriSerieContributo.chiave = "ContributoProtezione";
IvaloriSerieContributo.valore = Convert.ToDecimal(row["ContributoProtezione"]);
listaValoriContributo.Add(IvaloriSerieContributo);
}
IvaloriSerieContributo.chiave = "ContributoProtezione";
IvaloriSerieContributo.valore = Decimal.MinValue;
#endregion
double altezzaGraficoContributo = 21 * (tabella.Datasource.Rows.Count + 0.55);
IstoFarfallaS172 graficoContributo = new IstoFarfallaS172((double)190, altezzaGraficoContributo);
graficoContributo.AutoSize = true;
graficoContributo.DocumentPDF = document;
graficoContributo.PositionX = 365;
graficoContributo.PositionY = Convert.ToInt32(document.getLastPos() + 12); //542;
graficoContributo.AxisY_LineColor = true;
graficoContributo.AxisY_Hide = false;
graficoContributo.AxysX_Increment = Convert.ToDecimal(1);
graficoContributo.AxisY_DashStyle = Dundas.Charting.WebControl.ChartDashStyle.Dash;
SerieIstoFarfallaS172 serieContributo = new SerieIstoFarfallaS172();
serieContributo = new SerieIstoFarfallaS172();
serieContributo.Name = "Contributo";
serieContributo.Values = listaValoriContributo;
serieContributo.ElementPosition = new Dundas.Charting.WebControl.ElementPosition(1F, -5.5F, 110F, 107F);
serieContributo.AxisY_CustumizedByValues = true;
serieContributo.ReverseAxisY = false;
serieContributo.AxisY_MaximumValue = Convert.ToDouble(listaValoriContributo.Max(x=>x.valore));
serieContributo.PixelPointWidth = 80;
graficoContributo.SerieList.Add(serieContributo);
// Disegno il grafico
graficoContributo.Draw();
#endregion
// 21-2-2011 MZ:
// If the customer has only allocated resources the financial resources will equal to them only
// and the same if the user has non allocated resources only the financial resources will equal to them only so if each of allocated or un allocated equal zero,
// we didnt draw both of them and we draw the financial resources only.
// But there is a special case as well that we didnt draw the financial resources as well in the case above if the customer doesnt have negative bank account and doesnt have Operazioni in corso as
// then the financial resources will be equal to the “TOTALE PATRIMONIO”
#region Tabella per il Totale delle Risorse Allocate
// disegno la tabella per il Totale delle Risorse Allocate
#region datasource tabellaRisorseAllocate
//setta la datatable
datitab = new DatiTabella();
datitab.table = set.Tables["RisorseAllocate"];
#endregion
Tabella tabellaRisorseAllocate = new Tabella();
tabellaRisorseAllocate.X = document.getMargineLeft();
tabellaRisorseAllocate.Y = document.getLastPos() + tabella.AltezzaTabella + marginePiramide;
tabellaRisorseAllocate.AltezzaCella = 18;
tabellaRisorseAllocate.SaltoPagina = false;
tabellaRisorseAllocate.Datasource = datitab.table;
tabellaRisorseAllocate.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, false, 8, true));
tabellaRisorseAllocate.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, false, 8, true));
tabellaRisorseAllocate.Colonne.Add(new Colonna("ControvaloreProtetto", "", wCol3, TipoAllineamento.DESTRA, false, 8, true));
tabellaRisorseAllocate.Colonne.Add(new Colonna("ContributoProtezione", "", wCol4, TipoAllineamento.SINISTRA, false, 8, true));
// 21-02-2011 MZ: Draw the Risorse Allocate row if the customer has un allocated resources as well
if (set.Tables["RisorseNonAllocate"].Rows.Count > 0)
{
tabellaRisorseAllocate.Draw(datitab, document);
spaceSection = spaceSection + tabellaRisorseAllocate.AltezzaTabella;
}
#endregion
#region Tabella per il Totale delle Risorse non Allocate
// disegno la tabella per il Totale delle Risorse Allocate
#region datasource tabellaRisorseAllocate
//setta la datatable
datitab = new DatiTabella();
datitab.table = set.Tables["RisorseNonAllocate"];
#endregion
Tabella tabellaRisorseNonAllocate = new Tabella();
tabellaRisorseNonAllocate.X = document.getMargineLeft();
tabellaRisorseNonAllocate.Y = document.getLastPos() + tabella.AltezzaTabella + tabellaRisorseAllocate.AltezzaTabella + marginePiramide;
tabellaRisorseNonAllocate.AltezzaCella = 18;
tabellaRisorseNonAllocate.SaltoPagina = false;
tabellaRisorseNonAllocate.Datasource = datitab.table;
tabellaRisorseNonAllocate.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, false, 8, false));
tabellaRisorseNonAllocate.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, false, 8, false));
tabellaRisorseNonAllocate.Colonne.Add(new Colonna("ControvaloreProtetto", "", wCol3, TipoAllineamento.DESTRA, false, 8, false));
tabellaRisorseNonAllocate.Colonne.Add(new Colonna("", "", wCol4, TipoAllineamento.SINISTRA, false, 8, false));
// 21-02-2011 MZ: Draw the un allocated resources row if the customer has allocated resources as well
if (set.Tables["RisorseNonAllocate"].Rows.Count > 0)
{
tabellaRisorseNonAllocate.Draw(datitab, document);
spaceSection = spaceSection + tabellaRisorseNonAllocate.AltezzaTabella;
}
#endregion
#region Tabella per il Totale delle Risorse Finanaziarie
// disegno la tabella per il Totale delle Risorse Finanaziarie
#region datasource tabellaRisorseFinanaziarie
//setta la datatable
datitab = new DatiTabella();
datitab.table = set.Tables["RisorseFinanziarie"];
#endregion
Tabella tabellaRisorseFinanaziarie = new Tabella();
tabellaRisorseFinanaziarie.X = document.getMargineLeft();
tabellaRisorseFinanaziarie.Y = document.getLastPos() + tabella.AltezzaTabella + tabellaRisorseAllocate.AltezzaTabella + tabellaRisorseNonAllocate.AltezzaTabella + marginePiramide;
tabellaRisorseFinanaziarie.SaltoPagina = false;
tabellaRisorseFinanaziarie.Datasource = datitab.table;
tabellaRisorseFinanaziarie.AltezzaCella = 18;
tabellaRisorseFinanaziarie.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, false, 8, true));
tabellaRisorseFinanaziarie.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, false, 8, true));
tabellaRisorseFinanaziarie.Colonne.Add(new Colonna("ControvaloreProtetto", "", wCol3, TipoAllineamento.DESTRA, false, 8, true));
tabellaRisorseFinanaziarie.Colonne.Add(new Colonna("ContributoProtezione", "", wCol4, TipoAllineamento.SINISTRA, false, 8, true));
// 21-02-2011 MZ: Draw the financial resources row if the customer doesn't have un allocated resources or allocated resources but has negative bank account or has Operazioni in corso
// OR draw it if the customer has both un allocated resources and allocated resources and has negative bank account well or has Operazioni in corso as well
if (
((set.Tables["RisorseAllocate"].Rows.Count == 0 || set.Tables["RisorseNonAllocate"].Rows.Count == 0) && set.Tables["PartiteViaggianti"].Rows.Count > 0) || ((set.Tables["RisorseAllocate"].Rows.Count == 0 || set.Tables["RisorseNonAllocate"].Rows.Count == 0) && dataThread.TotalNegativeCurrentAccountValue < 0) || ((set.Tables["RisorseAllocate"].Rows.Count == 0 || set.Tables["RisorseNonAllocate"].Rows.Count == 0) && dataThread.TotalSelfNegCurrentAccountValue < 0)
||
((set.Tables["RisorseAllocate"].Rows.Count > 0 && set.Tables["RisorseNonAllocate"].Rows.Count > 0 && set.Tables["PartiteViaggianti"].Rows.Count > 0) || (set.Tables["RisorseAllocate"].Rows.Count > 0 && set.Tables["RisorseNonAllocate"].Rows.Count > 0 && dataThread.TotalNegativeCurrentAccountValue < 0)) || (set.Tables["RisorseAllocate"].Rows.Count > 0 && set.Tables["RisorseNonAllocate"].Rows.Count > 0 && dataThread.TotalSelfNegCurrentAccountValue < 0)
)
{
tabellaRisorseFinanaziarie.Draw(datitab, document);
spaceSection = spaceSection + tabellaRisorseFinanaziarie.AltezzaTabella;
}
#endregion
#region Tabella per il Conto Corrente
// disegno la tabella per il Conto Corrente
#region datasource tabellaContoCorrente
//setta la datatable
datitab = new DatiTabella();
datitab.table = set.Tables["ContoCorrente"];
#endregion
Tabella tabellaContoCorrente = new Tabella();
// 21-02-2011 MZ: Draw the row Conto Corrente if the customer has negative bank account.
if (dataThread.TotalNegativeCurrentAccountValue < 0)
{
tabellaContoCorrente.X = document.getMargineLeft();
tabellaContoCorrente.Y = document.getLastPos() + tabella.AltezzaTabella + tabellaRisorseAllocate.AltezzaTabella + tabellaRisorseNonAllocate.AltezzaTabella + tabellaRisorseFinanaziarie.AltezzaTabella + marginePiramide;
tabellaContoCorrente.SaltoPagina = false;
tabellaContoCorrente.Datasource = datitab.table;
tabellaContoCorrente.AltezzaCella = 18;
tabellaContoCorrente.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, false, 8, false));
tabellaContoCorrente.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, false, 8, false));
tabellaContoCorrente.Colonne.Add(new Colonna("ControvaloreProtetto", "", wCol3, TipoAllineamento.DESTRA, false, 8, false));
tabellaContoCorrente.Colonne.Add(new Colonna("", "", wCol4, TipoAllineamento.SINISTRA, false, 8, false));
tabellaContoCorrente.Draw(datitab, document);
spaceSection = spaceSection + tabellaContoCorrente.AltezzaTabella;
}
#endregion
#region Tabella per LineaSelf negativa
// disegno la tabella per il Conto Corrente
#region datasource tabellaLineaSelfNeg
//setta la datatable
datitab = new DatiTabella();
datitab.table = set.Tables["LineaSelf"];
#endregion
Tabella tabellaLineaSelfNeg = new Tabella();
// 21-02-2011 MZ: Draw the row Conto Corrente if the customer has negative bank account.
if (dataThread.TotalSelfNegCurrentAccountValue < 0)
{
tabellaLineaSelfNeg.X = document.getMargineLeft();
tabellaLineaSelfNeg.Y = document.getLastPos() + tabella.AltezzaTabella + tabellaRisorseAllocate.AltezzaTabella + tabellaRisorseNonAllocate.AltezzaTabella + tabellaRisorseFinanaziarie.AltezzaTabella + tabellaContoCorrente.AltezzaTabella + marginePiramide;
tabellaLineaSelfNeg.SaltoPagina = false;
tabellaLineaSelfNeg.Datasource = datitab.table;
tabellaLineaSelfNeg.AltezzaCella = 18;
tabellaLineaSelfNeg.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, false, 8, false));
tabellaLineaSelfNeg.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, false, 8, false));
tabellaLineaSelfNeg.Colonne.Add(new Colonna("ControvaloreProtetto", "", wCol3, TipoAllineamento.DESTRA, false, 8, false));
tabellaLineaSelfNeg.Colonne.Add(new Colonna("", "", wCol4, TipoAllineamento.SINISTRA, false, 8, false));
tabellaLineaSelfNeg.Draw(datitab, document);
spaceSection = spaceSection + tabellaLineaSelfNeg.AltezzaTabella;
}
#endregion
#region Tabella per gli Investimenti in corso o Partite Viaggianti
// disegno la tabella per gli Investimenti in corso o Partite Viaggianti
#region datasource tabellaPartiteViaggianti
//setta la datatable
datitab = new DatiTabella();
datitab.table = set.Tables["PartiteViaggianti"];
#endregion
Tabella tabellaPartiteViaggianti = new Tabella();
// Draw the Operazioni in corso row if the customer has Operazioni in corso.
if (datitab.table.Rows.Count > 0)
{
tabellaPartiteViaggianti.X = document.getMargineLeft();
tabellaPartiteViaggianti.Y = document.getLastPos() + tabella.AltezzaTabella + tabellaRisorseAllocate.AltezzaTabella + tabellaRisorseNonAllocate.AltezzaTabella + tabellaRisorseFinanaziarie.AltezzaTabella + tabellaContoCorrente.AltezzaTabella + tabellaLineaSelfNeg.AltezzaTabella + marginePiramide;
tabellaPartiteViaggianti.SaltoPagina = false;
tabellaPartiteViaggianti.Datasource = datitab.table;
tabellaPartiteViaggianti.AltezzaCella = 18;
tabellaPartiteViaggianti.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, false, 8, false));
tabellaPartiteViaggianti.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, false, 8, false));
tabellaPartiteViaggianti.Colonne.Add(new Colonna("ControvaloreProtetto", "", wCol3, TipoAllineamento.DESTRA, false, 8, false));
tabellaPartiteViaggianti.Colonne.Add(new Colonna("", "", wCol4, TipoAllineamento.SINISTRA, false, 8, false));
tabellaPartiteViaggianti.Draw(datitab, document);
spaceSection = spaceSection + tabellaPartiteViaggianti.AltezzaTabella;
}
#endregion
#region Tabella per il Totale Patrimonio
// disegno la tabella per il Totale Patrimonio
#region datasource tabellaTotalePatrimonio
//setta la datatable
datitab = new DatiTabella();
datitab.table = set.Tables["TotalePatrimonio"];
#endregion
Tabella tabellaTotalePatrimonio = new Tabella();
tabellaTotalePatrimonio.X = document.getMargineLeft();
tabellaTotalePatrimonio.Y = document.getLastPos() + tabella.AltezzaTabella + tabellaRisorseAllocate.AltezzaTabella + tabellaRisorseNonAllocate.AltezzaTabella + tabellaRisorseFinanaziarie.AltezzaTabella + tabellaContoCorrente.AltezzaTabella + tabellaLineaSelfNeg.AltezzaTabella + tabellaPartiteViaggianti.AltezzaTabella + marginePiramide;
//tabellaTotalePatrimonio.Y = document.getLastPos() + (float)altezzaGraficoPesoRischio_Prodotto + tabellaRisorseAllocate.AltezzaTabella + tabellaRisorseNonAllocate.AltezzaTabella + tabellaRisorseFinanaziarie.AltezzaTabella + tabellaContoCorrente.AltezzaTabella + tabellaLineaSelfNeg.AltezzaTabella + tabellaPartiteViaggianti.AltezzaTabella + marginePiramide;
tabellaTotalePatrimonio.SaltoPagina = false;
tabellaTotalePatrimonio.Datasource = datitab.table;
tabellaTotalePatrimonio.AltezzaCella = 18;
tabellaTotalePatrimonio.LineeTabella = true;
tabellaTotalePatrimonio.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, true, 8, true));
tabellaTotalePatrimonio.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, true, 8, true));
tabellaTotalePatrimonio.Colonne.Add(new Colonna("ControvaloreProtetto", "", wCol3, TipoAllineamento.DESTRA, true, 8, true));
tabellaTotalePatrimonio.Colonne.Add(new Colonna("ContributoProtezione", "", wCol4, TipoAllineamento.SINISTRA, false, 8, true));
tabellaTotalePatrimonio.Draw(datitab, document);
spaceSection = spaceSection + tabellaTotalePatrimonio.AltezzaTabella;
#endregion
document.setLastPos(spaceSection);
#region Nota
string nota = getNota1(set).Replace("$/Banca/$", dataThread.NomeRete).Replace("Sanpaolo", "Fideuram S.p.A., commercializzata tramite la rete di private banker Sanpaolo Invest");
datitab = new DatiTabella();
datitab.table = set.Tables["LineeProtetteNote"];
set.Tables["LineeProtetteNote"].Rows.Add("", string.Concat("(*) ", nota));
FormattedTextArea text = new FormattedTextArea(string.Concat("(*) ", nota), document.getMargineLeft(), document.getLastPos() - 30, 510, 50, new FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
text.Height = text.GetRequiredHeight();
text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
page.Elements.Add(text);
document.setLastPos(50);
#endregion
document.setLastPos(0);
}
public virtual string LineeProtetteTitolo(DataRow itemLinea)
{
return itemLinea["Linea"].ToString() + " - contratto " + itemLinea["Contratto"].ToString();
}
public virtual string getNota1(DataSet ds)
{
//nel campo 'text' ci sarà l'elenco delle 'RS'(CS80/CT80) + Interfund + Fonditalia
string text = "";
//nel campo 'textBis' ci sarà l'elenco delle 'RS'(CS80/CT80) + Sintonia
string textBis = "";
string text2 = "";
string text3 = "";
//nel campo 'text3Bis' memorizzo il testo della 'Sintonia'
string text3Bis = "";
string text4 = "";
int num = 0;
int num2 = 0;
int numSintonia = 0;
int numRS = 0;
foreach (DataRow itemLinea in ds.Tables["LineeProtette"].Rows)
{
/* La prima parte della nota deve tenere conto, per il testo dinamico, solo dei
prodotti delle linee protette di Fideuram Vita Insieme (RS) (una o entrambe)
e/o l'Interfund Crescita Protetta 80 e/o il Fonditalia Crescita Protetta 80
In questo ciclo salvo anche il numero delle FVI RS (CS80/CT80) perché serve
alla determinazione dell'ultima parte della nota
*/
if (itemLinea["Linea"].ToString().IndexOf("Sintonia") <= 0 )
{
if (num > 0)
{
text = text + " e \"" + this.LineeProtetteTitolo(itemLinea) + "\"";
//se siamo in presenza di 'RS' salvo il testo di queste per la parte 3 della nota
if (((itemLinea["Linea"].ToString().IndexOf("Blue") > 0) ||
(itemLinea["Linea"].ToString().IndexOf("White") > 0)))
{
textBis = textBis + " e \"" + this.LineeProtetteTitolo(itemLinea) + "\"";
numRS++;
}
}
else
{
text = text + "\"" + this.LineeProtetteTitolo(itemLinea) + "\"";
if (((itemLinea["Linea"].ToString().IndexOf("Blue") > 0) ||
(itemLinea["Linea"].ToString().IndexOf("White") > 0)))
{
textBis = textBis + "\"" + this.LineeProtetteTitolo(itemLinea) + "\"";
numRS++;
}
}
num++;
} else
{
//salvo il testo della linea protetta 'sintonia'
if (numSintonia > 0)
{
text3Bis = text3Bis + " e \"" + this.LineeProtetteTitolo(itemLinea) + "\"";
}
else
{
text3Bis = text3Bis + "\"" + this.LineeProtetteTitolo(itemLinea) + "\"";
}
numSintonia++;
}
}
////se ci sono solo Sintonia allora num=0; allora per entrare nello switch aggiungo il contatore relativo
//if (num == 0)
//{
// num = numSintonia;
//}
/*
La prima parte della nota deve uscire solo se sono presenti
le linee protette di Fideuram Vita Insieme (RS) (una o entrambe)
e/o
l'Interfund Crescita Protetta 80 e/o il Fonditalia Crescita Protetta 80
*/
if (num > 0)
{
switch (num)
{
case 0:
text3 = "La linea protetta ";
text3 += text;
//text4 = " Il \"controvalore protetto\" della linea protetta " + text;
//text4 += " è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
//text4 += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
//text4 += "del report.";
break;
case 1:
text3 = "La linea protetta ";
text3 += text;
//text4 = " Il \"controvalore protetto\" della linea protetta " + text;
//text4 += " è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
//text4 += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
//text4 += "del report.";
break;
default:
text3 = "Le linee protette ";
text3 += text;
//text4 = " Il \"controvalore protetto\" delle linee protette " + text;
//text4 += " è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
//text4 += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
//text4 += "del report.";
break;
}
string text5 = " che lei detiene presso $/Banca/$, $/s/$ ";
if (num > 0)
{
switch (num2)
{
case 0:
//text3 = "Il fondo ";
text3 += text5;
break;
case 1:
if (num > 0)
{
text3 = "I fondi ";
text3 = text3 + ", " + text2 + text5;
}
else
{
text3 = "Il fondo ";
text3 = text3 + text2 + text5;
}
break;
default:
if (num > 0)
{
text3 = "I fondi ";
text3 = text3 + ", " + text2 + text5;
}
else
{
text3 = "Il fondo ";
text3 = text3 + text2 + text5;
}
break;
}
if (num + num2 > 1)
{
text3 = text3.Replace("$/s/$", " prevedono ");
}
else
{
text3 = text3.Replace("$/s/$", " prevede ");
}
// se sono presenti prodotti Sintonia non chiudo con il punto la frase
if (numSintonia > 0)
{
text3 += " una protezione del capitale pari all80% del controvalore massimo raggiunto dalla data di partenza";
}
else
{
text3 += " una protezione del capitale pari all80% del controvalore massimo raggiunto dalla data di partenza.";
}
}
}
// se è presente Sintonia completo la parte 1 della nota (se presente), altrimenti scrivo la sola parte 2
if (num > 0 && numSintonia > 0)
{
text3 += ", altresì la " + text3Bis + " che lei detiene presso $/Banca/$ prevede una protezione del capitale pari all85% del controvalore investito sul contratto.";
}
else if (numSintonia > 0)
{
text3 += "La " + text3Bis + " che lei detiene presso $/Banca/$ prevede una protezione del capitale pari all85% del controvalore investito sul contratto.";
}
/* L'ultima parte della nota deve essere aggiunta solo se sono presenti le
linee protette di Fideuram Vita Insieme (RS) (una o entrambe)
e /o
la linea protetta sottostante la "Polizza Multiramo con protezione"
*/
//if (num > 0)
int totaleLinee = numRS + numSintonia;
if (totaleLinee > 0)
{
text4 = " Il \"controvalore protetto\"";
if (totaleLinee == 1)
{
text4 += " della ";
} else
{
text4 += " delle ";
}
if (numSintonia > 0)
{
text4 += text3Bis;//Sintonia
}
if (numRS > 0)
{
if (numSintonia > 0)
{
text4 += " e " + textBis;// Aggiungo gli 'RS'
}
else
{
text4 += textBis;// Aggiungo gli 'RS'
}
}
text4 += " è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
text4 += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
text4 += "del report.";
text3 += text4;
}
return text3;
}
}