254 lines
12 KiB
C#
254 lines
12 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Collections;
|
|
using ceTe.DynamicPDF;
|
|
using ceTe.DynamicPDF.Text;
|
|
using ceTe.DynamicPDF.PageElements.Charting;
|
|
using PDFGenerator.BusinessLayer;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.Presentation.Section.Charts;
|
|
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
/// <summary>
|
|
/// Summary description for S169
|
|
/// </summary>
|
|
//public abstract class S169 : ISezione
|
|
public class S169 : ISezione
|
|
{
|
|
|
|
private string _titolo = string.Empty;
|
|
private string _testointroduttivo = string.Empty;
|
|
private TipoReport _tipologiareport;
|
|
|
|
|
|
|
|
/// <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;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera il tipo di report.
|
|
/// </summary>
|
|
public TipoReport TipologiaReport
|
|
{
|
|
get
|
|
{
|
|
return _tipologiareport;
|
|
}
|
|
set
|
|
{
|
|
_tipologiareport = value;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
public S169()
|
|
{
|
|
}
|
|
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
|
|
DataSetS96 set = (DataSetS96)dataThread.Data.DatiSezione;
|
|
DataTable _datasource = set.Tables["DatiGrafico"];
|
|
|
|
#region recupero dati frecce
|
|
int classeRischio = 0;
|
|
|
|
if (_datasource.Rows[0]["ClasseRischioCreditoStr"] != DBNull.Value)
|
|
{
|
|
if (_datasource.Rows[0]["ClasseRischioCreditoStr"].ToString().ToUpper() == "N.A.")
|
|
classeRischio = -1;
|
|
}
|
|
else
|
|
classeRischio = Convert.ToInt32(_datasource.Rows[0]["ClasseRischioCredito"]);
|
|
|
|
|
|
// Rischio Mercato/VarP
|
|
double varP = 0;
|
|
if (_datasource.Rows[0]["RischioMercatoStr"] != DBNull.Value)
|
|
{
|
|
if (_datasource.Rows[0]["RischioMercatoStr"].ToString().ToUpper() == "N.A.")
|
|
varP = -1;
|
|
}
|
|
else
|
|
varP = Convert.ToInt32(_datasource.Rows[0]["RischioMercato"]);
|
|
|
|
// Rischio Mercato Massimo
|
|
decimal varMassimo = 0;
|
|
if (_datasource.Rows[0]["RischioMercatoMaxStr"] != DBNull.Value)
|
|
{
|
|
if (_datasource.Rows[0]["RischioMercatoMaxStr"].ToString().ToUpper() == "N.A.")
|
|
varMassimo = -1;
|
|
}
|
|
else
|
|
varMassimo = Convert.ToDecimal(_datasource.Rows[0]["RischioMercatoMax"]);
|
|
|
|
|
|
// Rischio Credito Massimo
|
|
int classeRiskCredMax = 0;
|
|
if (_datasource.Rows[0]["RischioCreditoMaxStr"] != DBNull.Value)
|
|
{
|
|
if (_datasource.Rows[0]["RischioCreditoMaxStr"].ToString().ToUpper() == "N.A.")
|
|
classeRiskCredMax = -1;
|
|
}
|
|
else
|
|
classeRiskCredMax = Convert.ToInt32(_datasource.Rows[0]["RischioCreditoMax"]);
|
|
|
|
#endregion
|
|
|
|
|
|
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
|
|
#region Titolo e testo introduttivo
|
|
document.setSezTitoloDiagnosi(_titolo);
|
|
document.setChapterHeader(_testointroduttivo, 0, 520, 8);
|
|
//T - 1466629 - Y0Y5
|
|
if (_datasource.Rows.Count < 2) document.setLastPos(-50);
|
|
else document.setLastPos(-40);
|
|
#endregion
|
|
|
|
float fontsize = 5;
|
|
|
|
|
|
#region Grafico
|
|
|
|
GraficoS169 grafico = new GraficoS169();
|
|
grafico.Datasource = _datasource;
|
|
document.InsertGraficoS169(grafico.ToPage(), document.getMargineLeft() + 60, document.getLastPos());
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if ((_datasource.Rows[0]["Profilo"].ToString() == "A") && (varMassimo > 0) && (classeRiskCredMax > 0))
|
|
{
|
|
|
|
|
|
|
|
|
|
#region Freccia Rischio Mercato (VaR) massimo
|
|
float posnew=0;
|
|
if (varMassimo == decimal.Parse(SoglieVar.sVar1)) posnew = 118;//2
|
|
if (varMassimo == decimal.Parse(SoglieVar.sVar2)) posnew = 107;//4.5--
|
|
if (varMassimo == decimal.Parse(SoglieVar.sVar3)) posnew = 86;//9.5--
|
|
if (varMassimo == decimal.Parse(SoglieVar.sVar4)) posnew = 66;//15--
|
|
if (varMassimo == decimal.Parse(SoglieVar.sVar5)) posnew = 18;//27--
|
|
|
|
float yMarcatoreAsseYRettangolo = document.getLastPos() + posnew;
|
|
float xMarcatoreAsseYRettangolo = document.getMargineLeft();
|
|
|
|
ceTe.DynamicPDF.PageElements.Rectangle FrecciaMarcatoreAsseY = new ceTe.DynamicPDF.PageElements.Rectangle(xMarcatoreAsseYRettangolo + 49, yMarcatoreAsseYRettangolo, 10, 10, new RgbColor(234, 234, 234), new RgbColor(234, 234, 234));
|
|
FrecciaMarcatoreAsseY.Angle = 44;
|
|
page.Elements.Add(FrecciaMarcatoreAsseY);
|
|
//// Rettangolo
|
|
ceTe.DynamicPDF.PageElements.Rectangle RettangolomarcatoreAsseY = new ceTe.DynamicPDF.PageElements.Rectangle(xMarcatoreAsseYRettangolo + 08, yMarcatoreAsseYRettangolo, 40, FrecciaMarcatoreAsseY.Width * 1.414F, new RgbColor(234, 234, 234), new RgbColor(234, 234, 234));
|
|
page.Elements.Add(RettangolomarcatoreAsseY);
|
|
////Label
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Rischio Mercato", xMarcatoreAsseYRettangolo + 9, yMarcatoreAsseYRettangolo + 1, 80, FrecciaMarcatoreAsseY.Width * 1.414F, Globals.OpenTypeFontVerdana, fontsize));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("(VaR) massimo", xMarcatoreAsseYRettangolo + 9, yMarcatoreAsseYRettangolo + 8, 80, FrecciaMarcatoreAsseY.Width * 1.414F, Globals.OpenTypeFontVerdana, fontsize));
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("(" + varMassimo.ToString() + "%)", xMarcatoreAsseYRettangolo + 10, yMarcatoreAsseYRettangolo + 18, 80, FrecciaMarcatoreAsseY.Width * 1.414F, Globals.OpenTypeFontVerdana, fontsize));
|
|
|
|
|
|
#endregion
|
|
|
|
#region Legenda
|
|
float lastpos = document.getLastPos();
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(437, lastpos + 100, 10, 4, ceTe.DynamicPDF.CmykColor.Black, new RgbColor(234, 234, 234), 0.3F));//RgbColor(255, 255, 255)));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Area di non adeguatezza", 437 + 13, lastpos + 100, 160, 10, Globals.OpenTypeFontVerdana, fontsize, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(437, lastpos + 100 + 13, 10, 4, ceTe.DynamicPDF.CmykColor.Black, ceTe.DynamicPDF.CmykColor.White, 0.3F));//RgbColor(255, 255, 255)));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Area di adeguatezza", 437+13, lastpos + 100 + 13, 160, 10, Globals.OpenTypeFontVerdana, fontsize, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
|
|
#endregion
|
|
|
|
#region Freccia Rischio Credito massimo
|
|
float xMarcatoreAsseXRettangolo = 0;
|
|
if (classeRiskCredMax == 1)
|
|
xMarcatoreAsseXRettangolo = document.getMargineLeft() + 178-27; //selezione su Classe 1
|
|
else if (classeRiskCredMax == 2)
|
|
xMarcatoreAsseXRettangolo = document.getMargineLeft() + 250 - 27; //selezione su Classe 2
|
|
else if (classeRiskCredMax == 3)
|
|
xMarcatoreAsseXRettangolo = document.getMargineLeft() + 324 - 27; // selezione su Classe 3
|
|
|
|
// Recupero la Y
|
|
float yMarcatoreAsseXRettangolo = document.getLastPos() + grafico.Height +5;
|
|
|
|
// Rettangolo Base (principale)
|
|
ceTe.DynamicPDF.PageElements.Rectangle FrecciaMarcatoreAsseX_Base = new ceTe.DynamicPDF.PageElements.Rectangle(xMarcatoreAsseXRettangolo, yMarcatoreAsseXRettangolo, 55, 15, new RgbColor(234, 234, 234), new RgbColor(234, 234, 234));
|
|
page.Elements.Add(FrecciaMarcatoreAsseX_Base);
|
|
|
|
// Rettangolo a destra (punta destra)
|
|
ceTe.DynamicPDF.PageElements.Rectangle FrecciaMarcatoreAsseX_dx = new ceTe.DynamicPDF.PageElements.Rectangle(xMarcatoreAsseXRettangolo + (FrecciaMarcatoreAsseX_Base.Width / 2), yMarcatoreAsseXRettangolo - 10, 29, 10, new RgbColor(234, 234, 234), new RgbColor(234, 234, 234));
|
|
FrecciaMarcatoreAsseX_dx.Angle = 19.3F;
|
|
page.Elements.Add(FrecciaMarcatoreAsseX_dx);
|
|
|
|
//Rettangolo a sinistra (punta sinistra)
|
|
ceTe.DynamicPDF.PageElements.Rectangle FrecciaMarcatoreAsseX_sx = new ceTe.DynamicPDF.PageElements.Rectangle(xMarcatoreAsseXRettangolo, yMarcatoreAsseXRettangolo, 28.6F, 10, new RgbColor(234, 234, 234), new RgbColor(234, 234, 234));
|
|
FrecciaMarcatoreAsseX_sx.Angle = 339.4F;
|
|
page.Elements.Add(FrecciaMarcatoreAsseX_sx);
|
|
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Rischio Credito", xMarcatoreAsseXRettangolo + 7, yMarcatoreAsseXRettangolo, 80, 12, Globals.OpenTypeFontVerdana, fontsize));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("massimo", xMarcatoreAsseXRettangolo + 17, yMarcatoreAsseXRettangolo + 7, 80, 12, Globals.OpenTypeFontVerdana, fontsize));
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("(" + UtilityBusinessLayer.GetRiskCreditClassName(classeRiskCredMax.ToString()) + ")", xMarcatoreAsseXRettangolo + 12, yMarcatoreAsseXRettangolo + 14, 80, 12, Globals.OpenTypeFontVerdana, fontsize));
|
|
|
|
|
|
#endregion
|
|
|
|
#region titoli
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Rischio Mercato (VaR%)", document.getMargineLeft(), lastpos + 7, 120, 12, Globals.OpenTypeFontVerdana, fontsize, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Rischio Credito", 410, lastpos + 135, 100, 8, Globals.OpenTypeFontVerdana, fontsize, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
// T-1466629-Y0Y5
|
|
if (_datasource.Rows.Count < 2) document.setLastPos(160);
|
|
else document.setLastPos(155);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
} |