1190 lines
74 KiB
C#
1190 lines
74 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using Consulenza.ExternalServices;
|
||
using Consulenza.ReportWriter.Business;
|
||
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
||
using System.Data;
|
||
using Consulenza.ReportWriter.Business.CHART_PDF;
|
||
using Consulenza.ReportCommon;
|
||
using Consulenza.ReportWriter.Business.Entity;
|
||
using System.Text;
|
||
using System.Drawing;
|
||
|
||
namespace Consulenza.ReportWriter.Manager.Section.Immobiliare.MonitoraggioNucleo
|
||
{
|
||
/// <summary>
|
||
/// Scheda 17
|
||
/// </summary>
|
||
public class S17 : Entity.Section
|
||
{
|
||
|
||
public S17(EnvironmentFacade environmentFacade, int idSection)
|
||
: base(environmentFacade, idSection)
|
||
{
|
||
try
|
||
{
|
||
Draw();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SectionLogger.Write("S17", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
||
}
|
||
}
|
||
|
||
private Color GetColor(double value)
|
||
{
|
||
value = value * 100;
|
||
if (value >= 80)
|
||
return Color.FromArgb(0, 109, 45);//(117, 255, 0);
|
||
if (value >= 60)
|
||
return Color.FromArgb(162, 216, 154);//(202, 255, 0);
|
||
if (value >= 40)
|
||
return Color.FromArgb(242, 221, 68);//(255, 234, 0);
|
||
if (value >= 20)
|
||
return Color.FromArgb(233, 148, 33);//(255, 121, 0);
|
||
else
|
||
return Color.FromArgb(213, 38, 7);//(255, 5, 0);
|
||
}
|
||
|
||
private CustomChartPDF DrawPieChart(double value, float currentDeltaY, Color colorRest, Color backgroundColor, double posX, double deltaY, double size, int widthPercentage)
|
||
{
|
||
CustomChartPDF pieChart = new CustomChartPDF()
|
||
{
|
||
X = (float)posX,
|
||
DeltaY = currentDeltaY
|
||
};
|
||
var baseChart = pieChart.ChartBase;
|
||
baseChart.ChartAreas.Add("Default");
|
||
baseChart.Legends[0].Enabled = false;
|
||
baseChart.ChartAreas[0].BackColor = backgroundColor;
|
||
baseChart.BackColor = backgroundColor;
|
||
baseChart.Width = new System.Web.UI.WebControls.Unit(size);
|
||
baseChart.Height = new System.Web.UI.WebControls.Unit(size);
|
||
baseChart.ChartAreas["Default"].Area3DStyle.Enable3D = false;
|
||
var colorValue = GetColor(value);
|
||
baseChart.PaletteCustomColors = new Color[] { colorValue, backgroundColor, colorRest, backgroundColor };
|
||
var serie = baseChart.Series.Add("SerieName");
|
||
//serie.Type = Dundas.Charting.WebControl.SeriesChartType.Pie;
|
||
serie.Type = Dundas.Charting.WebControl.SeriesChartType.Doughnut;
|
||
serie["DoughnutRadius"] = "40";
|
||
serie["PieStartAngle"] = "270";
|
||
|
||
serie.Points.AddXY(1, value - 0.01d);
|
||
serie.Points.AddXY(1, 0.005d);
|
||
serie.Points.AddXY(1, 1 - value);
|
||
serie.Points.AddXY(1, 0.005d);
|
||
|
||
var image = pieChart.GetImage();
|
||
Graphics g = Graphics.FromImage(image);
|
||
SolidBrush brush = new SolidBrush(backgroundColor);
|
||
|
||
int width = image.Width * (100 - widthPercentage) / 100;
|
||
int height = image.Height * (100 - widthPercentage) / 100;
|
||
int x = (image.Width - width) / 2;
|
||
int y = (image.Height - height) / 2;
|
||
g.DrawEllipse(new Pen(Color.White), new Rectangle(x, y, width, height));
|
||
g.FillEllipse(brush, new Rectangle(x, y, width, height));
|
||
|
||
g.Save();
|
||
g.DrawImage(image, new Rectangle(0, 0, image.Width, image.Height));
|
||
pieChart.SetCustomImage(image);
|
||
//image.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||
|
||
return pieChart;
|
||
}
|
||
|
||
private string UppercaseFirst(string s)
|
||
{
|
||
if (string.IsNullOrEmpty(s))
|
||
{
|
||
return string.Empty;
|
||
}
|
||
char[] a = s.ToCharArray();
|
||
a[0] = char.ToUpper(a[0]);
|
||
return new string(a);
|
||
}
|
||
/// <summary>
|
||
/// Scheda2. Patrimonio immobiliare –Sintesi (distribuzione del patrimonio complessivo del cliente diviso per tipologia e cointestatari)
|
||
/// </summary>
|
||
protected override sealed void Draw()
|
||
{
|
||
//var oLine = new LinePDF(35,100,55,100);
|
||
//AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 130, 355, 130);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 160, 355, 160);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 190, 355, 190);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 220, 355, 220);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 250, 355, 250);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 280, 355, 280);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 310, 355, 310);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 340, 355, 340);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 370, 355, 370);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 400, 355, 400);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 410, 355, 410);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 420, 355, 420);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 430, 355, 430);
|
||
//AddElement(oLine);
|
||
//oLine = new LinePDF(35, 440, 355, 440);
|
||
//AddElement(oLine);
|
||
|
||
//return;
|
||
|
||
var dataset = GetDataSet();
|
||
FormattedTextAreaPDF testoPagina = new FormattedTextAreaPDF(getTesto1(), 35) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, AutoIncrementYWritable = false, Width = 740, FixedHeight = 25 };
|
||
FormattedTextAreaPDF notaTabella = new FormattedTextAreaPDF("Nota(*): variazione percentuale del prezzo €/mq nel semestre di riferimento rispetto al semestre precedente.<BR>", 60, 680) { AutoIncrementYWritable = false, Y = EnvironmentFacade.RendererFacade.YLowerLimit - 23, FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaX = 5, DeltaY = 5 };
|
||
var listaOggettiDaRipetere = new List<ObjectPDF> { new SpacePDF(30), testoPagina, new SpacePDF(10), notaTabella };
|
||
|
||
addLegend(listaOggettiDaRipetere);
|
||
int cont = 0;
|
||
bool usoAbitativoStrumentale = dataset.Tables["1"].Rows.Count > 0 && dataset.Tables["2"].Rows.Count > 0;
|
||
|
||
int contatore = 0;
|
||
int contatoreDiversificazione = 0;
|
||
|
||
#region OLD VERSION 20180221
|
||
//foreach (DataTable table in dataset.Tables)
|
||
//{
|
||
//if (table != null && table.Rows.Count > 0 && contatore > 0 && contatore <= 4)
|
||
//{
|
||
// // patryk ----------
|
||
// // making sure that NEW PAGE is being added when its needed
|
||
|
||
// float rowHeight = 15;
|
||
// float headerHeight = 25;
|
||
// float footerHeight = 15;
|
||
// float tableTitleHeight = 25;
|
||
|
||
// if (cont == 0 || !usoAbitativoStrumentale)
|
||
// {
|
||
// AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
// }
|
||
|
||
// if (cont == 0)
|
||
// {
|
||
// AddElement(new RepeaterPDF(listaOggettiDaRipetere));
|
||
// }
|
||
|
||
// double pieChartValue = Convert.ToDouble(dataset.Tables[0].Rows[contatoreDiversificazione]["valoreDiversificazione"]);
|
||
// string text = UppercaseFirst(dataset.Tables[0].Rows[contatoreDiversificazione]["classeDiversificazione"].ToString().ToLower());
|
||
// contatoreDiversificazione++;
|
||
// var tablePDF = new TablePDF(35, table, dataset.Tables[contatore + "footer"])
|
||
// {
|
||
// Style = Style.Immobiliare,
|
||
// AlternateRow = false,
|
||
// HeaderHeight = headerHeight,
|
||
// RowHeight = rowHeight,
|
||
// FooterHeight = footerHeight,
|
||
// Footer = true,
|
||
// PageBreak = true,
|
||
// ShowBorderLastLine = false,
|
||
// ShowBorderLastLineInPageBreak = false,
|
||
// TableTitleDeltaX = 5,
|
||
// TableTitleFontSize = 12,
|
||
// TableTitleFontBold = true,
|
||
// TableTitleHeight = tableTitleHeight,
|
||
// DrawLineHeaderUP = true,
|
||
// TableTitle = getTitle(contatore.ToString()),
|
||
// HeaderTextDrawJustOnce = false,
|
||
// TableTitleFontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo,
|
||
// TableCantReachThisYPosition = 420,
|
||
// ShowBorderHeader = false,
|
||
// HeadersObjectsHeight = 25,
|
||
// AddSpaceBeforeTableAfterEntireTableIsMovedToNextPage = false,
|
||
// RowsIndexesThatCantEndPageYLimit = 260
|
||
// };
|
||
// //tablePDF.HeaderNoteObjects.Add(new SpacePDF(-25));
|
||
|
||
// // Original
|
||
// //float topChartDeltaY = 3;
|
||
// //tablePDF.HeaderNoteObjects.Add(new RectanglePDF(16, 160, new ColorPDF(Color.FromArgb(239, 240, 237)))
|
||
// //{
|
||
// // X = 575,
|
||
// // AutoIncrementYWritable = false,
|
||
// // DeltaY = topChartDeltaY
|
||
// //});
|
||
// //tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF("Diversificazione:", 575)
|
||
// //{
|
||
// // DeltaY = 3 + topChartDeltaY,
|
||
// // DeltaX = 3,
|
||
// // FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
// // AutoIncrementYWritable = false
|
||
// //});
|
||
// //tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF(text, 685)
|
||
// //{
|
||
// // DeltaY = 3 + topChartDeltaY,
|
||
// // DeltaX = 3,
|
||
// // FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
// // AutoIncrementYWritable = false,
|
||
// // FontBold = true
|
||
// //});
|
||
|
||
// //var pieChart = DrawPieChart(pieChartValue, topChartDeltaY, Color.FromArgb(196, 196, 186), Color.FromArgb(239, 240, 237), 651, 252, 16, 45);
|
||
// //tablePDF.HeaderNoteObjects.Add(pieChart);
|
||
|
||
// // Sfondo Bianco
|
||
// float topChartDeltaY = 3;
|
||
// tablePDF.HeaderNoteObjects.Add(new RectanglePDF(19, 188, new ColorPDF(Color.FromArgb(255, 255, 255)))
|
||
// {
|
||
// X = 545,
|
||
// AutoIncrementYWritable = false,
|
||
// DeltaY = topChartDeltaY,
|
||
// BorderColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo,
|
||
// BorderWidth = 0.2f
|
||
// });
|
||
// tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF("Diversificazione fabbricati:", 545)
|
||
// {
|
||
// DeltaY = 4 + topChartDeltaY,
|
||
// DeltaX = 3,
|
||
// FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
// AutoIncrementYWritable = false
|
||
// });
|
||
// tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF(text, 684)
|
||
// {
|
||
// DeltaY = 4 + topChartDeltaY,
|
||
// DeltaX = 3,
|
||
// FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
// AutoIncrementYWritable = false,
|
||
// FontBold = true
|
||
// });
|
||
|
||
// var pieChart = DrawPieChart(pieChartValue, topChartDeltaY + 1, Color.FromArgb(196, 196, 186), Color.FromArgb(255, 255, 255), 666, 252, 16, 45);
|
||
// tablePDF.HeaderNoteObjects.Add(pieChart);
|
||
|
||
// //tablePDF.Columns.Add(new ColumnPDF("comune", 140, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "comune", "Comune/Tipologia") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// //tablePDF.Columns.Add(new ColumnPDF("posizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "posizione", "Posizione urbana/Micro-zona") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// //tablePDF.Columns.Add(new ColumnPDF("numeroImmobili", 50, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "numeroImmobili", "Numero<br>immobili") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// //tablePDF.Columns.Add(new ColumnPDF("rischioV", 60, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Objectpdf, "rischioValore", "Rischio<br>valore") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// //tablePDF.Columns.Add(new ColumnPDF("rischioL", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "rischioLiquidita", "Rischio<br>liquidabilità") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// //tablePDF.Columns.Add(new ColumnPDF("trendV", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "trendValore", "Trend<br>valore*") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// //tablePDF.Columns.Add(new ColumnPDF("ProQuota", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "ProQuota", "Valore stimato<br>nucleo (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// //tablePDF.Columns.Add(new ColumnPDF("stimatoTotale", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "stimatoTotale", "Valore stimato<br>totale (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
|
||
// tablePDF.Columns.Add(new ColumnPDF("comune", 140, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "comune", "Comune/Tipologia") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
// tablePDF.Columns.Add(new ColumnPDF("posizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "posizione", "Posizione urbana/Micro-zona") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
// tablePDF.Columns.Add(new ColumnPDF("numeroImmobili", 50, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "numeroImmobili", "Numero<br>immobili") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
// tablePDF.Columns.Add(new ColumnPDF("rischioV", 60, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Objectpdf, "rischioValore", "Rischio<br>valore") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
// tablePDF.Columns.Add(new ColumnPDF("rischioL", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "rischioLiquidita", "Rischio<br>liquidabilità") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
// tablePDF.Columns.Add(new ColumnPDF("trendV", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "trendValore", "Trend<br>valore*") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
// tablePDF.Columns.Add(new ColumnPDF("ProQuota", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "ProQuota", "Valore stimato<br>nucleo (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
// tablePDF.Columns.Add(new ColumnPDF("stimatoTotale", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "stimatoTotale", "Valore stimato<br>totale (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
|
||
// tablePDF.FooterColumns.Add(new ColumnPDF("comuneFooter", 310, HorizontalAlignmentType.Sinistra, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// tablePDF.FooterColumns.Add(new ColumnPDF("numeroImmobiliFooter", 50, HorizontalAlignmentType.Centrato, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// tablePDF.FooterColumns.Add(new ColumnPDF("rischioValoreFooter", 60, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Immagine, "rischioValoreFooter", "") { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, ScaleColumnTypeImage = 0.30f, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// tablePDF.FooterColumns.Add(new ColumnPDF("rischioLiquiditaFooter", 49, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Immagine, "rischioLiquiditaFooter", "") { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, ScaleColumnTypeImage = 0.30f, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// tablePDF.FooterColumns.Add(new ColumnPDF("trend", 71, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// tablePDF.FooterColumns.Add(new ColumnPDF("ProQuotaFooter", 80, HorizontalAlignmentType.Destra, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// tablePDF.FooterColumns.Add(new ColumnPDF("stimatoTotaleFooter", 80, HorizontalAlignmentType.Destra, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
// tablePDF.FooterCells[2, 0].Value = dataset.Tables[contatore + "footer"].Rows[0]["rischioValore"].ToString();
|
||
// tablePDF.FooterCells[3, 0].Value = dataset.Tables[contatore + "footer"].Rows[0]["rischioLiquidita"].ToString();
|
||
|
||
// int i = 0;
|
||
// foreach (DataRow r in table.Rows)
|
||
// {
|
||
// if (table.Rows[i]["comune"].ToString().Contains("<B>"))
|
||
// {
|
||
// tablePDF.Cells[0, i].FontColor = ColorPDF.Nero;
|
||
// tablePDF.RowsIndexesThatCantEndPage.Add(i);
|
||
// }
|
||
|
||
// if (table.Rows[i]["comune"].ToString().Contains("<B>"))
|
||
// tablePDF.Cells[0, i].FontColor = ColorPDF.Nero;
|
||
|
||
// float additionalSpace = table.Rows[i]["posizione"].ToString().Length >= 35 ? 2 : 0;
|
||
// if (!table.Rows[i]["trendValore"].ToString().Contains("n.d.") && !table.Rows[i]["trendValore"].ToString().Equals("") && !table.Rows[i]["trendValore"].ToString().Contains("n.c."))
|
||
// {
|
||
// ImagePDF imageSymbol = new ImagePDF(0, 1, table.Rows[i]["trendValore"].ToString())
|
||
// {
|
||
// DeltaX = table.Rows[i]["trendValore"].ToString().Contains("horizontal") ? -10 : -9,
|
||
// Scale = table.Rows[i]["trendValore"].ToString().Contains("horizontal") ? 0.35f : 0.50f
|
||
// };
|
||
// var tempPositioneText = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
// var positioneHeight = tempPositioneText.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
// var tempImage = new ceTe.DynamicPDF.PageElements.Image(imageSymbol.Path, 0, 0, imageSymbol.Scale);
|
||
// var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
// //var deltaYOffset = ((currentRowHeight - tempImage.Height) / 2) - (positioneHeight / 3);
|
||
// imageSymbol.DeltaY = 1;
|
||
|
||
// tablePDF.Cells[5, i].ValueObjectList.Add(imageSymbol);
|
||
// }
|
||
// else if (!table.Rows[i]["comune"].ToString().Contains("<B>"))
|
||
// {
|
||
|
||
// var tempPositioneText = new FormattedTextAreaPDF
|
||
// {
|
||
// Text = "n.d.",
|
||
// FontBold = false,
|
||
// FontColor = new ColorPDF(92, 89, 81),
|
||
// DeltaX = sumColumns(tablePDF, 5) + 20,
|
||
// FontSize = 7,
|
||
// };
|
||
// var calcolapos = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
// var positioneHeight = calcolapos.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
// var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
// //var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6) - 4;
|
||
// //tempPositioneText.DeltaY = deltaYOffset;
|
||
// var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6);
|
||
// tempPositioneText.DeltaY = deltaYOffset - Convert.ToSingle(6.3);
|
||
|
||
// tablePDF.Cells[5, i].ValueObjectList.Add(tempPositioneText);
|
||
|
||
// }
|
||
// additionalSpace = table.Rows[i]["posizione"].ToString().Length >= 35 ? 4 : 0;
|
||
// if (!table.Rows[i]["rischioValore"].ToString().Contains("n.d.") && !table.Rows[i]["rischioValore"].ToString().Equals("") && !table.Rows[i]["rischioValore"].ToString().Contains("n.c."))
|
||
// {
|
||
// ImagePDF imageSymbolRischioValore = new ImagePDF(0, 1, table.Rows[i]["rischioValore"].ToString())
|
||
// {
|
||
// // DeltaY = additionalSpace,
|
||
// DeltaX = -2,
|
||
// Scale = 0.30f
|
||
// };
|
||
// var tempPositioneText = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
// var positioneHeight = tempPositioneText.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
// var tempImage = new ceTe.DynamicPDF.PageElements.Image(imageSymbolRischioValore.Path, 0, 0, imageSymbolRischioValore.Scale);
|
||
// var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
// // var deltaYOffset = ((currentRowHeight - tempImage.Height) / 2) - (positioneHeight / 6);
|
||
// imageSymbolRischioValore.DeltaY = 1;
|
||
// tablePDF.Cells[3, i].ValueObjectList.Add(imageSymbolRischioValore);
|
||
// }
|
||
// else
|
||
// {
|
||
|
||
// }
|
||
// if (!table.Rows[i]["rischioLiquidita"].ToString().Contains("n.d.") && !table.Rows[i]["rischioLiquidita"].ToString().Equals("") && !table.Rows[i]["rischioLiquidita"].ToString().Contains("n.c."))
|
||
// {
|
||
// ImagePDF imageSymbolRischioLiquidita = new ImagePDF(0, 1, table.Rows[i]["rischioLiquidita"].ToString())
|
||
// {
|
||
// //DeltaY = additionalSpace,
|
||
// DeltaX = -9.5F, //10
|
||
// Scale = 0.30f
|
||
// };
|
||
// var tempPositioneText = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
// var positioneHeight = tempPositioneText.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
// var tempImage = new ceTe.DynamicPDF.PageElements.Image(imageSymbolRischioLiquidita.Path, 0, 0, imageSymbolRischioLiquidita.Scale);
|
||
// var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
// //var deltaYOffset = ((currentRowHeight - tempImage.Height) / 2) - (positioneHeight / 6);
|
||
// imageSymbolRischioLiquidita.DeltaY = 1;
|
||
// tablePDF.Cells[4, i].ValueObjectList.Add(imageSymbolRischioLiquidita);
|
||
// }
|
||
// i++;
|
||
// }
|
||
// string title = getTitle(contatore.ToString());
|
||
|
||
// AddElement(tablePDF);
|
||
|
||
// AddElement(new SpacePDF(20));
|
||
|
||
// // patryk -------------------------
|
||
// var tables = dataset.Tables.Cast<DataTable>().Where(x => x.Rows.Count > 0).ToList();
|
||
// var lastTable = tables.Last();
|
||
// if (tables.Count > 4)
|
||
// {
|
||
// lastTable = tables[4];
|
||
// }
|
||
// if (table != lastTable)
|
||
// {
|
||
// ActionPDF action = new ActionPDF();
|
||
// action.YPositionAction = (yPos) =>
|
||
// {
|
||
// List<ObjectPDF> objectsList = new List<ObjectPDF>();
|
||
// if (yPos > 300)
|
||
// {
|
||
// objectsList.Add(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
// }
|
||
// return objectsList;
|
||
// };
|
||
// //AddElement(action);
|
||
// }
|
||
// // -------------------------------
|
||
|
||
// cont++;
|
||
//}
|
||
//contatore++;
|
||
//}
|
||
#endregion
|
||
|
||
|
||
|
||
foreach (DataTable table in dataset.Tables)
|
||
{
|
||
if (table != null && table.Rows.Count > 0 && contatore > 0 && contatore <= 4)
|
||
{
|
||
//// patryk ----------
|
||
//// making sure that NEW PAGE is being added when its needed
|
||
//float rowHeight = 20;
|
||
//float headerHeight = 25;
|
||
//float footerHeight = 15;
|
||
//float tableTitleHeight = 25;
|
||
|
||
float rowHeight = 18;
|
||
float headerHeight = 20;
|
||
float footerHeight = 13;
|
||
float tableTitleHeight = 20;
|
||
|
||
|
||
//float newTableHeight = 0;
|
||
//for (int j = 0; j < table.Rows.Count; j++)
|
||
//{
|
||
// var tempPositioneText = new FormattedTextAreaPDF(table.Rows[j]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
// var positioneHeight = tempPositioneText.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
// var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
// newTableHeight += currentRowHeight;
|
||
//}
|
||
//// here we have height of entire table calculated
|
||
//newTableHeight = newTableHeight + headerHeight + footerHeight + tableTitleHeight;
|
||
//// we dont care if it goes for multiple pages and its big
|
||
//newTableHeight = newTableHeight % spaceAvailableForOneTable;
|
||
|
||
|
||
// Commentare questa if per Salto pagina personalizzato
|
||
//if (cont == 0 || !usoAbitativoStrumentale)
|
||
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
|
||
if (cont == 0)
|
||
{
|
||
//AddElement(listaOggettiDaRipetere);
|
||
AddElement(new RepeaterPDF(listaOggettiDaRipetere));
|
||
}
|
||
double pieChartValue = Convert.ToDouble(dataset.Tables[0].Rows[contatoreDiversificazione]["valoreDiversificazione"]);
|
||
string text = UppercaseFirst(dataset.Tables[0].Rows[contatoreDiversificazione]["classeDiversificazione"].ToString().ToLower());
|
||
if (text == "")
|
||
text = "n.c.";
|
||
|
||
contatoreDiversificazione++;
|
||
var tablePDF = new TablePDF(35, table, dataset.Tables[contatore + "footer"])
|
||
{
|
||
Style = Style.Immobiliare,
|
||
AlternateRow = false,
|
||
HeaderHeight = headerHeight,
|
||
RowHeight = rowHeight,
|
||
FooterHeight = footerHeight,
|
||
Footer = true,
|
||
PageBreak = true,
|
||
ShowBorderLastLine = false,
|
||
ShowBorderLastLineInPageBreak = false,
|
||
TableTitleDeltaX = 5,
|
||
TableTitleFontSize = 12,
|
||
TableTitleFontBold = true,
|
||
TableTitleHeight = tableTitleHeight,
|
||
DrawLineHeaderUP = true,
|
||
TableTitle = getTitle(contatore.ToString()),
|
||
HeaderTextDrawJustOnce = false,
|
||
TableTitleFontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo,
|
||
TableCantReachThisYPosition = 420,
|
||
ShowBorderHeader = false,
|
||
HeadersObjectsHeight = 25,
|
||
AddSpaceBeforeTableAfterEntireTableIsMovedToNextPage = false,
|
||
//RowsIndexesThatCantEndPageYLimit = 260
|
||
RowsIndexesThatCantEndPageYLimit = 300
|
||
};
|
||
|
||
//tablePDF.HeaderNoteObjects.Add(new SpacePDF(-25));
|
||
|
||
// Original
|
||
//float topChartDeltaY = 3;
|
||
//tablePDF.HeaderNoteObjects.Add(new RectanglePDF(16, 160, new ColorPDF(Color.FromArgb(239, 240, 237)))
|
||
//{
|
||
// X = 575,
|
||
// AutoIncrementYWritable = false,
|
||
// DeltaY = topChartDeltaY
|
||
//});
|
||
//tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF("Diversificazione:", 575)
|
||
//{
|
||
// DeltaY = 3 + topChartDeltaY,
|
||
// DeltaX = 3,
|
||
// FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
// AutoIncrementYWritable = false
|
||
//});
|
||
//tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF(text, 685)
|
||
//{
|
||
// DeltaY = 3 + topChartDeltaY,
|
||
// DeltaX = 3,
|
||
// FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
// AutoIncrementYWritable = false,
|
||
// FontBold = true
|
||
//});
|
||
|
||
//var pieChart = DrawPieChart(pieChartValue, topChartDeltaY, Color.FromArgb(196, 196, 186), Color.FromArgb(239, 240, 237), 651, 252, 16, 45);
|
||
//tablePDF.HeaderNoteObjects.Add(pieChart);
|
||
|
||
// Sfondo Bianco
|
||
float topChartDeltaY = 3;
|
||
tablePDF.HeaderNoteObjects.Add(new RectanglePDF(19, 188, new ColorPDF(Color.FromArgb(255, 255, 255)))
|
||
{
|
||
X = 545,
|
||
AutoIncrementYWritable = false,
|
||
DeltaY = topChartDeltaY,
|
||
BorderColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo,
|
||
BorderWidth = 0.2f
|
||
});
|
||
tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF("Diversificazione fabbricati:", 545)
|
||
{
|
||
DeltaY = 4 + topChartDeltaY,
|
||
DeltaX = 3,
|
||
FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
AutoIncrementYWritable = false
|
||
});
|
||
tablePDF.HeaderNoteObjects.Add(new FormattedTextAreaPDF(text, 684)
|
||
{
|
||
DeltaY = 4 + topChartDeltaY,
|
||
DeltaX = 3,
|
||
FontColor = new ColorPDF(Color.FromArgb(92, 89, 81)),
|
||
AutoIncrementYWritable = false,
|
||
FontBold = true
|
||
});
|
||
|
||
var pieChart = DrawPieChart(pieChartValue, topChartDeltaY + 1, Color.FromArgb(196, 196, 186), Color.FromArgb(255, 255, 255), 666, 252, 16, 45);
|
||
tablePDF.HeaderNoteObjects.Add(pieChart);
|
||
|
||
|
||
//tablePDF.Columns.Add(new ColumnPDF("comune", 140, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "comune", "Comune/Tipologia") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
//tablePDF.Columns.Add(new ColumnPDF("posizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "posizione", "Posizione urbana/Micro-zona") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
//tablePDF.Columns.Add(new ColumnPDF("numeroImmobili", 50, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "numeroImmobili", "Numero<br>immobili") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
//tablePDF.Columns.Add(new ColumnPDF("rischioV", 60, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Objectpdf, "rischioValore", "Rischio<br>valore") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
//tablePDF.Columns.Add(new ColumnPDF("rischioL", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "rischioLiquidita", "Rischio<br>liquidabilità") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
//tablePDF.Columns.Add(new ColumnPDF("trendV", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "trendValore", "Trend<br>valore*") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
//tablePDF.Columns.Add(new ColumnPDF("ProQuota", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "ProQuota", "Valore stimato<br>pro quota (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
//tablePDF.Columns.Add(new ColumnPDF("stimatoTotale", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "stimatoTotale", "Valore stimato<br>totale (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
|
||
tablePDF.Columns.Add(new ColumnPDF("comune", 140, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "comune", "Comune/Tipologia") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
tablePDF.Columns.Add(new ColumnPDF("posizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "posizione", "Posizione urbana/Micro-zona") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
tablePDF.Columns.Add(new ColumnPDF("numeroImmobili", 50, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "numeroImmobili", "Numero<br>immobili") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
tablePDF.Columns.Add(new ColumnPDF("rischioV", 60, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Objectpdf, "rischioValore", "Rischio<br>valore") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
tablePDF.Columns.Add(new ColumnPDF("rischioL", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "rischioLiquidita", "Rischio<br>liquidabilità") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
tablePDF.Columns.Add(new ColumnPDF("trendV", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Objectpdf, "trendValore", "Trend<br>valore*") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
tablePDF.Columns.Add(new ColumnPDF("ProQuota", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "ProQuota", "Valore stimato<br>nucleo (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
tablePDF.Columns.Add(new ColumnPDF("stimatoTotale", 80, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "stimatoTotale", "Valore stimato<br>totale (€)") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Alto });
|
||
|
||
tablePDF.FooterColumns.Add(new ColumnPDF("comuneFooter", 310, HorizontalAlignmentType.Sinistra, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
tablePDF.FooterColumns.Add(new ColumnPDF("numeroImmobiliFooter", 50, HorizontalAlignmentType.Centrato, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
tablePDF.FooterColumns.Add(new ColumnPDF("rischioValoreFooter", 60, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Immagine, "rischioValoreFooter", "") { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, ScaleColumnTypeImage = 0.30f, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
tablePDF.FooterColumns.Add(new ColumnPDF("rischioLiquiditaFooter", 49, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Immagine, "rischioLiquiditaFooter", "") { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 1, ScaleColumnTypeImage = 0.30f, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
tablePDF.FooterColumns.Add(new ColumnPDF("trend", 71, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
tablePDF.FooterColumns.Add(new ColumnPDF("ProQuotaFooter", 80, HorizontalAlignmentType.Destra, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
tablePDF.FooterColumns.Add(new ColumnPDF("stimatoTotaleFooter", 80, HorizontalAlignmentType.Destra, false, true, 7, ColumnType.Testo) { HeaderFontBold = true, HeaderFontSize = 7, DeltaYContent = 0, FontColor = new ColorPDF(92, 89, 81), VerticalAlignment = VerticalAlignmentType.Centrato });
|
||
tablePDF.FooterCells[2, 0].Value = dataset.Tables[contatore + "footer"].Rows[0]["rischioValore"].ToString();
|
||
tablePDF.FooterCells[3, 0].Value = dataset.Tables[contatore + "footer"].Rows[0]["rischioLiquidita"].ToString();
|
||
|
||
int i = 0;
|
||
|
||
//EnvironmentFacade.RendererFacade.YWritable = 100;
|
||
foreach (DataRow r in table.Rows)
|
||
{
|
||
//EnvironmentFacade.RendererFacade.YWritable += 30;
|
||
if (table.Rows[i]["comune"].ToString().Contains("<B>"))
|
||
{
|
||
tablePDF.Cells[0, i].FontColor = ColorPDF.Nero;
|
||
tablePDF.RowsIndexesThatCantEndPage.Add(i);
|
||
}
|
||
//if (EnvironmentFacade.RendererFacade.YWritable > 400)
|
||
//{
|
||
// AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
// EnvironmentFacade.RendererFacade.YWritable = 100;
|
||
//}
|
||
// Modifica ES in data 20170904
|
||
// if (!table.Rows[i]["trendValore"].ToString().Contains("n.d.") && !table.Rows[i]["trendValore"].ToString().Equals(""))
|
||
if (!table.Rows[i]["trendValore"].ToString().Contains("n.d.") && !table.Rows[i]["trendValore"].ToString().Equals("") && !table.Rows[i]["trendValore"].ToString().Contains("n.c."))
|
||
{
|
||
ImagePDF imageSymbol = new ImagePDF(0, 1, table.Rows[i]["trendValore"].ToString())
|
||
{
|
||
DeltaX = table.Rows[i]["trendValore"].ToString().Contains("horizontal") ? -10 : -9,
|
||
Scale = table.Rows[i]["trendValore"].ToString().Contains("horizontal") ? 0.35f : 0.50f
|
||
};
|
||
var tempPositioneText = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
var positioneHeight = tempPositioneText.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
var tempImage = new ceTe.DynamicPDF.PageElements.Image(imageSymbol.Path, 0, 0, imageSymbol.Scale);
|
||
var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
//var deltaYOffset = ((currentRowHeight - tempImage.Height) / 2) - (positioneHeight / 3);
|
||
imageSymbol.DeltaY = 1;
|
||
|
||
tablePDF.Cells[5, i].ValueObjectList.Add(imageSymbol);
|
||
}
|
||
else if (!table.Rows[i]["comune"].ToString().Contains("<B>"))
|
||
{
|
||
|
||
var tempPositioneText = new FormattedTextAreaPDF
|
||
{
|
||
// Modifica ES in data 20170904
|
||
// Text = "n.d.",
|
||
Text = table.Rows[i]["posizione"].ToString().Trim() == "-" ? "n.c." : "n.d.",
|
||
FontBold = false,
|
||
FontColor = new ColorPDF(92, 89, 81),
|
||
DeltaX = sumColumns(tablePDF, 5) + 20,
|
||
FontSize = 7,
|
||
};
|
||
var calcolapos = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
var positioneHeight = calcolapos.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
//var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6) - 4;
|
||
var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6);
|
||
//if (tempPositioneText.Text == "n.c." || tempPositioneText.Text == "n.d.")
|
||
//tempPositioneText.DeltaY = deltaYOffset - Convert.ToSingle(5.7);
|
||
//else
|
||
tempPositioneText.DeltaY = deltaYOffset - Convert.ToSingle(8);
|
||
|
||
tablePDF.Cells[5, i].ValueObjectList.Add(tempPositioneText);
|
||
|
||
}
|
||
//additionalSpace = table.Rows[i]["posizione"].ToString().Length >= 35 ? 4 : 0;
|
||
// Modifica ES in data 20170904
|
||
//if (!table.Rows[i]["rischioValore"].ToString().Contains("n.d.") && !table.Rows[i]["rischioValore"].ToString().Equals(""))
|
||
if (!table.Rows[i]["rischioValore"].ToString().Contains("n.d.") && !table.Rows[i]["rischioValore"].ToString().Equals("") && !table.Rows[i]["trendValore"].ToString().Contains("n.c."))
|
||
{
|
||
ImagePDF imageSymbolRischioValore = new ImagePDF(0, 1, table.Rows[i]["rischioValore"].ToString())
|
||
{
|
||
// DeltaY = additionalSpace,
|
||
DeltaX = -2,
|
||
Scale = 0.30f
|
||
};
|
||
var tempPositioneText = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
var positioneHeight = tempPositioneText.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
var tempImage = new ceTe.DynamicPDF.PageElements.Image(imageSymbolRischioValore.Path, 0, 0, imageSymbolRischioValore.Scale);
|
||
var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
//var deltaYOffset = ((currentRowHeight - tempImage.Height) / 2) - (positioneHeight / 3);
|
||
imageSymbolRischioValore.DeltaY = 1;
|
||
tablePDF.Cells[3, i].ValueObjectList.Add(imageSymbolRischioValore);
|
||
}
|
||
else if (!table.Rows[i]["comune"].ToString().Contains("<B>"))
|
||
{
|
||
|
||
var tempPositioneText = new FormattedTextAreaPDF
|
||
{
|
||
// Modifica ES in data 20170904
|
||
// Text = "n.d.",
|
||
Text = table.Rows[i]["posizione"].ToString().Trim() == "-" ? "n.c." : "n.d.",
|
||
FontBold = false,
|
||
FontColor = new ColorPDF(92, 89, 81),
|
||
DeltaX = sumColumns(tablePDF, 3) + 60,
|
||
FontSize = 7,
|
||
};
|
||
var calcolapos = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
var positioneHeight = calcolapos.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
//var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6) - 4;
|
||
var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6);
|
||
//if (tempPositioneText.Text == "n.c." || tempPositioneText.Text == "n.d.")
|
||
// tempPositioneText.DeltaY = deltaYOffset - Convert.ToSingle(5.7);
|
||
//else
|
||
tempPositioneText.DeltaY = deltaYOffset - Convert.ToSingle(8);
|
||
|
||
tablePDF.Cells[3, i].ValueObjectList.Add(tempPositioneText);
|
||
}
|
||
|
||
// Modifica ES in data 20170904
|
||
//if (!table.Rows[i]["rischioLiquidita"].ToString().Contains("n.d.") && !table.Rows[i]["rischioLiquidita"].ToString().Equals(""))
|
||
|
||
if (!table.Rows[i]["rischioLiquidita"].ToString().Contains("n.d.") && !table.Rows[i]["rischioLiquidita"].ToString().Equals("") && !table.Rows[i]["trendValore"].ToString().Contains("n.c."))
|
||
{
|
||
ImagePDF imageSymbolRischioLiquidita = new ImagePDF(0, 1, table.Rows[i]["rischioLiquidita"].ToString())
|
||
{
|
||
//DeltaY = additionalSpace,
|
||
DeltaX = -9.5F, //10
|
||
Scale = 0.30f
|
||
};
|
||
var tempPositioneText = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
var positioneHeight = tempPositioneText.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
var tempImage = new ceTe.DynamicPDF.PageElements.Image(imageSymbolRischioLiquidita.Path, 0, 0, imageSymbolRischioLiquidita.Scale);
|
||
var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
//var deltaYOffset = ((currentRowHeight - tempImage.Height) / 2) - (positioneHeight / 3);
|
||
imageSymbolRischioLiquidita.DeltaY = 1;
|
||
tablePDF.Cells[4, i].ValueObjectList.Add(imageSymbolRischioLiquidita);
|
||
}
|
||
else if (!table.Rows[i]["comune"].ToString().Contains("<B>"))
|
||
{
|
||
|
||
var tempPositioneText = new FormattedTextAreaPDF
|
||
{
|
||
// Modifica ES in data 20170904
|
||
// Text = "n.d.",
|
||
Text = table.Rows[i]["posizione"].ToString().Trim() == "-" ? "n.c." : "n.d.",
|
||
FontBold = false,
|
||
FontColor = new ColorPDF(92, 89, 81),
|
||
DeltaX = sumColumns(tablePDF, 4) + 80,
|
||
FontSize = 7,
|
||
};
|
||
var calcolapos = new FormattedTextAreaPDF(table.Rows[i]["posizione"].ToString(), 0, 170) { FontSize = 7 };
|
||
var positioneHeight = calcolapos.GetHeight(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
||
var currentRowHeight = rowHeight > positioneHeight ? rowHeight : positioneHeight;
|
||
//var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6) - 4;
|
||
var deltaYOffset = (currentRowHeight / 2) - (positioneHeight / 6);
|
||
//if (tempPositioneText.Text == "n.c." || tempPositioneText.Text == "n.d.")
|
||
//tempPositioneText.DeltaY = deltaYOffset - Convert.ToSingle(5.7);
|
||
//else
|
||
tempPositioneText.DeltaY = deltaYOffset - Convert.ToSingle(8);
|
||
|
||
tablePDF.Cells[4, i].ValueObjectList.Add(tempPositioneText);
|
||
}
|
||
|
||
i++;
|
||
}
|
||
|
||
AddElement(tablePDF);
|
||
|
||
AddElement(new SpacePDF(20));
|
||
|
||
#region Modifiche Patryk per Salto Pagina
|
||
// patryk -------------------------
|
||
var tables = dataset.Tables.Cast<DataTable>().Where(x => x.Rows.Count > 0).ToList();
|
||
var lastTable = tables.Last();
|
||
if (tables.Count > 4)
|
||
{
|
||
lastTable = tables[4];
|
||
}
|
||
if (table != lastTable)
|
||
{
|
||
ActionPDF action = new ActionPDF();
|
||
action.YPositionAction = (yPos) =>
|
||
{
|
||
List<ObjectPDF> objectsList = new List<ObjectPDF>();
|
||
if (yPos > 300)
|
||
{
|
||
objectsList.Add(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
}
|
||
return objectsList;
|
||
};
|
||
//AddElement(action);
|
||
}
|
||
// -------------------------------
|
||
#endregion
|
||
|
||
cont++;
|
||
}
|
||
contatore++;
|
||
}
|
||
}
|
||
|
||
protected float sumColumns(TablePDF table, int columns)
|
||
{
|
||
float _var = 0;
|
||
|
||
for (int i = 0; i < Math.Min(columns, table.Columns.Count); i++)
|
||
_var += table.Columns[i].Width;
|
||
|
||
return _var;
|
||
|
||
}
|
||
|
||
protected void addLegend(List<ObjectPDF> repeatedList)
|
||
{
|
||
int xLegenda = 35;
|
||
int legendWidth = 260;
|
||
int legendHeight = 15;
|
||
float yLegenda = EnvironmentFacade.RendererFacade.YLowerLimit - 40;
|
||
AddElement(new SpacePDF(5));
|
||
|
||
var ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Livello di rischio",
|
||
FontColor = ColorPDF.Nero,
|
||
X = xLegenda + 10,
|
||
FontSize = 7,
|
||
Y = yLegenda - 10,
|
||
FontBold = true
|
||
};
|
||
|
||
// Original
|
||
//repeatedList.Add(new RectanglePDF(legendHeight, legendWidth, new ColorPDF(217, 217, 217)) { X = xLegenda, AutoIncrementYWritable = false, Y = yLegenda });
|
||
// Sfondo Bianco
|
||
repeatedList.Add(new RectanglePDF(legendHeight, legendWidth, new ColorPDF(255, 255, 255))
|
||
{
|
||
X = xLegenda,
|
||
AutoIncrementYWritable = false,
|
||
Y = yLegenda,
|
||
BorderColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo,
|
||
BorderWidth = 0.2f
|
||
});
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.30F, "basso.png") { DeltaY = 4F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
xLegenda += 15;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Basso",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
|
||
xLegenda += (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
||
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.30F, "medio_basso.png") { DeltaY = 4F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
xLegenda += 15;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Medio basso",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
xLegenda += (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.30F, "medio.png") { DeltaY = 4F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
xLegenda += 15;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Medio",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
xLegenda += (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.30F, "medio_alto.png") { DeltaY = 4F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
xLegenda += 15;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Medio alto",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
xLegenda += +(ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.30F, "alto.png") { DeltaY = 4F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
xLegenda += 15;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Alto",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
#region legenda freccia
|
||
xLegenda += 50;
|
||
legendWidth = 160;
|
||
legendHeight = 15;
|
||
// Original
|
||
//repeatedList.Add(new RectanglePDF(legendHeight, legendWidth, new ColorPDF(217, 217, 217)) { X = xLegenda, AutoIncrementYWritable = false, Y = yLegenda });
|
||
// Sfondo Bianco
|
||
repeatedList.Add(new RectanglePDF(legendHeight, legendWidth, new ColorPDF(255, 255, 255))
|
||
{
|
||
X = xLegenda,
|
||
AutoIncrementYWritable = false,
|
||
Y = yLegenda,
|
||
BorderColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo,
|
||
BorderWidth = 0.2f
|
||
});
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.50F, "upArrow.png") { DeltaY = 4F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Trend valore",
|
||
FontColor = ColorPDF.Nero,
|
||
X = xLegenda + 10,
|
||
FontSize = 7,
|
||
Y = yLegenda - 10,
|
||
FontBold = true
|
||
};
|
||
repeatedList.Add(ftaNomeLabel);
|
||
xLegenda += 20;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "In crescita",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
|
||
xLegenda += 40;// + (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.35F, "horizontalArrow.png") { DeltaY = 5.2F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
xLegenda += 20;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "Stabile",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
xLegenda += 25;// + (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
||
repeatedList.Add(ftaNomeLabel);
|
||
|
||
repeatedList.Add(new ImagePDF(xLegenda, 0.50F, "downArrow.png") { DeltaY = 4F, AutoIncrementYWritable = false, DeltaX = 4F, Y = yLegenda });
|
||
xLegenda += 20;
|
||
ftaNomeLabel = new FormattedTextAreaPDF
|
||
{
|
||
Text = "In calo",
|
||
FontColor = ColorPDF.Nero,
|
||
DeltaX = 1F,
|
||
DeltaY = 4F,
|
||
AutoIncrementYWritable = false,
|
||
X = xLegenda,
|
||
FontSize = 7,
|
||
Y = yLegenda
|
||
};
|
||
repeatedList.Add(ftaNomeLabel);
|
||
#endregion
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// Recupera i dati necessari alla Section restituendo un DataTable.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
protected override DataTable GetDataTable()
|
||
{
|
||
return null;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Recupera i dati necessari alla Section restituendo un DataSet.
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
protected override DataSet GetDataSet()
|
||
{
|
||
var parametri = new List<Parametro>
|
||
{
|
||
new Parametro
|
||
{
|
||
Direction = ParameterDirection.Input,
|
||
DbType = DbType.Int32,
|
||
ParameterName = "chiaveNucleo",
|
||
Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo
|
||
}
|
||
};
|
||
|
||
var dsOriginal = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S_AnalisiRischioDettaglio", parametri);
|
||
if (dsOriginal.Tables[0].Rows.Count == 0)
|
||
return null;
|
||
|
||
DataSet data = new DataSet();
|
||
data.Tables.Add(dsOriginal.Tables[0].Copy());
|
||
(data.Tables[0]).TableName = "diversificazione"; // Classe Diversificazione
|
||
dsOriginal.Tables.Remove(dsOriginal.Tables[0]);
|
||
|
||
data.Tables.Add(new DataTable("1")); // U
|
||
data.Tables["1"].Columns.Add("comune", typeof(string));
|
||
data.Tables["1"].Columns.Add("posizione", typeof(string));
|
||
data.Tables["1"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["1"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["1"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["1"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["1"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["1"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
data.Tables.Add(new DataTable("2")); // S
|
||
data.Tables["2"].Columns.Add("comune", typeof(string));
|
||
data.Tables["2"].Columns.Add("posizione", typeof(string));
|
||
data.Tables["2"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["2"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["2"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["2"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["2"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["2"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
data.Tables.Add(new DataTable("3")); // I
|
||
data.Tables["3"].Columns.Add("comune", typeof(string));
|
||
data.Tables["3"].Columns.Add("posizione", typeof(string));
|
||
data.Tables["3"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["3"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["3"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["3"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["3"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["3"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
data.Tables.Add(new DataTable("4")); // NS
|
||
data.Tables["4"].Columns.Add("comune", typeof(string));
|
||
data.Tables["4"].Columns.Add("posizione", typeof(string));
|
||
data.Tables["4"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["4"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["4"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["4"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["4"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["4"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
data.Tables.Add(new DataTable("1footer")); // U
|
||
data.Tables["1footer"].Columns.Add("comune", typeof(string));
|
||
data.Tables["1footer"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["1footer"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["1footer"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["1footer"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["1footer"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["1footer"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
data.Tables.Add(new DataTable("2footer")); // S
|
||
data.Tables["2footer"].Columns.Add("comune", typeof(string));
|
||
data.Tables["2footer"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["2footer"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["2footer"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["2footer"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["2footer"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["2footer"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
data.Tables.Add(new DataTable("3footer")); // I
|
||
data.Tables["3footer"].Columns.Add("comune", typeof(string));
|
||
data.Tables["3footer"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["3footer"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["3footer"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["3footer"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["3footer"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["3footer"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
data.Tables.Add(new DataTable("4footer")); // NS
|
||
data.Tables["4footer"].Columns.Add("comune", typeof(string));
|
||
data.Tables["4footer"].Columns.Add("numeroImmobili", typeof(string));
|
||
data.Tables["4footer"].Columns.Add("rischioValore", typeof(string));
|
||
data.Tables["4footer"].Columns.Add("rischioLiquidita", typeof(string));
|
||
data.Tables["4footer"].Columns.Add("trendValore", typeof(string));
|
||
data.Tables["4footer"].Columns.Add("proQuota", typeof(string));
|
||
data.Tables["4footer"].Columns.Add("stimatoTotale", typeof(string));
|
||
|
||
List<Int64> ordinamento = new List<Int64>();
|
||
ordinamento.Add(1);
|
||
ordinamento.Add(2);
|
||
ordinamento.Add(3);
|
||
ordinamento.Add(4);
|
||
|
||
foreach (int value in ordinamento)
|
||
{
|
||
if (dsOriginal.Tables[0].AsEnumerable().Where(x => x.Field<Int64>("chiaveUsoTipologia") == value).Count() > 0 &&
|
||
dsOriginal.Tables[1].AsEnumerable().Where(x => x.Field<Int64>("chiaveUsoTipologia") == value).Count() > 0)
|
||
{
|
||
DataTable copyDataTableBold = dsOriginal.Tables[0].AsEnumerable().Where(x => x.Field<Int64>("chiaveUsoTipologia") == value).CopyToDataTable();
|
||
for (int i = 0; i < copyDataTableBold.Rows.Count; i++)
|
||
{
|
||
data.Tables[value].Rows.Add("<B>" + copyDataTableBold.Rows[i]["comuneTipologia"] + "</B>", "",
|
||
"<B>" + copyDataTableBold.Rows[i]["numImmobiliComune"] + "</B>", "", "", "",
|
||
"<B>" + copyDataTableBold.Rows[i]["valProQuotaComune"] + "</B>",
|
||
"<B>" + copyDataTableBold.Rows[i]["valTotaleComune"] + "</B>");
|
||
|
||
DataTable copyDataTable = dsOriginal.Tables[1].AsEnumerable().Where(x =>
|
||
x.Field<Int64>("chiaveUsoTipologia").Equals(value) && x.Field<string>("comuneTipologia").Equals(copyDataTableBold.Rows[i]["comuneTipologia"])).CopyToDataTable();
|
||
for (int k = 0; k < copyDataTable.Rows.Count; k++)
|
||
{
|
||
string sEstero = "N";
|
||
if (copyDataTable.Rows[k]["posizioneMicroZona"].ToString() == "" || copyDataTable.Rows[k]["posizioneMicroZona"].ToString() == "-")
|
||
sEstero = "n.d.";
|
||
else
|
||
sEstero = copyDataTable.Rows[k]["posizioneMicroZona"].ToString();
|
||
|
||
data.Tables[value].Rows.Add(
|
||
copyDataTable.Rows[k]["finalitaTipologia"],
|
||
sEstero,
|
||
copyDataTable.Rows[k]["numImmobili"],
|
||
copyDataTable.Rows[k]["classeRischioValore"].ToString().ToLower() + ".png",
|
||
copyDataTable.Rows[k]["classeRischioLiquidabilita"].ToString().ToLower() + ".png",
|
||
translateStringInSymbol(copyDataTable.Rows[k]["trend"].ToString()),
|
||
Helper.FormatCurrency(Convert.ToDecimal(copyDataTable.Rows[k]["valProQuota"]).ToString()),
|
||
Helper.FormatCurrency(Convert.ToDecimal(copyDataTable.Rows[k]["valTotale"]).ToString()));
|
||
}
|
||
}
|
||
DataTable copyDataTableTotale = dsOriginal.Tables[2].AsEnumerable().Where(x => x.Field<Int64>("chiaveUsoTipologia") == value).CopyToDataTable();
|
||
data.Tables[value + "footer"].Rows.Add(
|
||
"Totale",
|
||
copyDataTableTotale.Rows[0]["numImmobili"],
|
||
copyDataTableTotale.Rows[0]["classeRischioValore"].ToString().ToLower() + ".png",
|
||
copyDataTableTotale.Rows[0]["classeRischioLiquidabilita"].ToString().ToLower() + ".png",
|
||
"",
|
||
Helper.FormatCurrency(Convert.ToDecimal(copyDataTableTotale.Rows[0]["valProQuota"]).ToString()),
|
||
Helper.FormatCurrency(Convert.ToDecimal(copyDataTableTotale.Rows[0]["valTotale"]).ToString()));
|
||
}
|
||
}
|
||
|
||
return data;
|
||
}
|
||
|
||
protected string getTesto1()
|
||
{
|
||
//return "Di seguito si rappresentano i diversi livelli di rischio del patrimonio immobiliare.";
|
||
return "Di seguito si rappresentano i diversi livelli di rischio del patrimonio immobiliare. I terreni sono esclusi dalle elaborazioni di rischio e <br> diversificazione.";
|
||
}
|
||
|
||
public static string translateStringInSymbol(string trend)
|
||
{
|
||
string result = "";
|
||
switch (trend)
|
||
{
|
||
case "=":
|
||
result = "horizontalArrow.png";
|
||
break;
|
||
case "-":
|
||
result = "downArrow.png";
|
||
break;
|
||
case "+":
|
||
result = "upArrow.png";
|
||
break;
|
||
default:
|
||
result = trend;
|
||
break;
|
||
|
||
}
|
||
return result;
|
||
}
|
||
|
||
public static string getTitle(string number)
|
||
{
|
||
string result = "";
|
||
switch (number)
|
||
{
|
||
case "1":
|
||
result = "Immobili d'uso abitativo";
|
||
break;
|
||
case "2":
|
||
result = "Immobili strumentali";
|
||
break;
|
||
case "3":
|
||
result = "Immobili d'investimento";
|
||
break;
|
||
case "4":
|
||
result = "Immobili con finalità non specificata";
|
||
break;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
}
|
||
}
|