670 lines
38 KiB
C#
670 lines
38 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Consulenza.ReportWriter.Business;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using System.Data;
|
|
using Consulenza.ReportWriter.Business.CHART_PDF;
|
|
using System.Globalization;
|
|
using Consulenza.ReportWriter.Business.Entity;
|
|
using Consulenza.ReportCommon;
|
|
namespace Consulenza.ReportWriter.Manager.Section.Immobiliare.Monitoraggio
|
|
{
|
|
/// <summary>
|
|
/// Distribuzione geografica Terreni (id 36)
|
|
/// </summary>
|
|
public class S4 : Entity.Section
|
|
{
|
|
public S4(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("S4", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
protected override sealed void Draw()
|
|
{
|
|
var dataset = GetDataSet();
|
|
var _text = dataset.Tables[0];
|
|
var dataGrafici = dataset.Tables[1];
|
|
var width = 340;
|
|
//var xSx = 35;
|
|
var xDx = 410;
|
|
|
|
List<int> indiciPagina = _text.AsEnumerable()
|
|
.Select(z => z.Field<int>("idREP_IMM_MON_Pagina")).Distinct().ToList();
|
|
|
|
foreach (var indice in indiciPagina)
|
|
{
|
|
if (indice == 5)
|
|
{
|
|
FormattedTextAreaPDF testoSx = null;
|
|
FormattedTextAreaPDF testoDx = null;
|
|
|
|
int i = 0;
|
|
string paragrafoSx;
|
|
string paragrafoDx;
|
|
|
|
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
|
var data = _text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList();
|
|
|
|
foreach (var row in data)
|
|
{
|
|
paragrafoSx = paragrafoDx = "";
|
|
if (!row.Field<string>("posizione").Equals("R"))
|
|
//paragrafoSx += "<B>" + row.Field<string>("titolo") + "</B><br><br>";
|
|
paragrafoSx += "<B>" + row.Field<string>("titolo") + "</B><br><br>";
|
|
else
|
|
paragrafoDx += "<B>" + row.Field<string>("titolo") + "</B><br><br>";
|
|
|
|
/**** Originale ****/
|
|
//for (int j = 1; j <= 15; j++)
|
|
// if (!row.Field<string>("posizione").Equals("R"))
|
|
// paragrafoSx += row.Field<string>("testo" + j) != null ?
|
|
// "<p>" + row.Field<string>("testo" + j) + "</p><br>" : "";
|
|
/******************/
|
|
/****** Modifica per il sottolineato ***********/
|
|
for (int j = 1; j <= 15; j++)
|
|
{
|
|
if (!row.Field<string>("posizione").Equals("R"))
|
|
{
|
|
if (row.Field<string>("testo" + j) != null)
|
|
{
|
|
|
|
if (row.Field<string>("testo" + j).Contains("<u>Mercato residenziale.</u>"))
|
|
{
|
|
string testo = row.Field<string>("testo" + j).Replace("<u>", "").Replace("</u>", "");
|
|
|
|
//paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + row.Field<string>("testo" + j) + "</p><br>" : "";
|
|
paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + testo + "</p><br>" : "";
|
|
|
|
paragrafoSx = SplitTesto(paragrafoSx, "Mercato residenziale.");
|
|
}
|
|
else
|
|
{
|
|
if (row.Field<string>("testo" + j).Contains("<u>Mercato commerciale.</u>"))
|
|
{
|
|
string testo = row.Field<string>("testo" + j).Replace("<u>", "").Replace("</u>", "");
|
|
|
|
//paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + row.Field<string>("testo" + j) + "</p><br>" : "";
|
|
paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + testo + "</p><br>" : "";
|
|
|
|
paragrafoSx = SplitTesto(paragrafoSx, "Mercato commerciale.");
|
|
}
|
|
else
|
|
{
|
|
if (row.Field<string>("testo" + j).Contains("<u>Mercato delle compravendite.</u>"))
|
|
{
|
|
string testo = row.Field<string>("testo" + j).Replace("<u>", "").Replace("</u>", "");
|
|
|
|
//paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + row.Field<string>("testo" + j) + "</p><br>" : "";
|
|
paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + testo + "</p><br>" : "";
|
|
|
|
paragrafoSx = SplitTesto(paragrafoSx, "Mercato delle compravendite.");
|
|
}
|
|
else
|
|
{
|
|
if (row.Field<string>("testo" + j).Contains("<u>Mercato delle locazioni.</u>"))
|
|
{
|
|
string testo = row.Field<string>("testo" + j).Replace("<u>", "").Replace("</u>", "");
|
|
|
|
//paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + row.Field<string>("testo" + j) + "</p><br>" : "";
|
|
paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + testo + "</p><br>" : "";
|
|
|
|
paragrafoSx = SplitTesto(paragrafoSx, "Mercato delle locazioni.");
|
|
}
|
|
else
|
|
paragrafoSx += row.Field<string>("testo" + j) != null ? "<p>" + row.Field<string>("testo" + j) + "</p><br>" : "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
/**************************************/
|
|
|
|
|
|
|
|
// SPLIT PARAGRAFO
|
|
if (paragrafoSx.Contains("SPLITPARAGRAPH"))
|
|
{
|
|
var listaSplit = StringExtensions.SplitAtOccurence(paragrafoSx, "SPLITPARAGRAPH", 1);
|
|
paragrafoSx = listaSplit[0] + "</p>";
|
|
paragrafoDx = "<br><p>";
|
|
listaSplit.RemoveRange(0, 1);
|
|
foreach (var stringa in listaSplit)
|
|
paragrafoDx += stringa;
|
|
|
|
}
|
|
|
|
testoSx = new FormattedTextAreaPDF(paragrafoSx.Replace("<p></p><br>", ""), 35, width + 10) { AutoIncrementYWritable = false, Y = 48, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, FontSize = 9.26F, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
testoDx = new FormattedTextAreaPDF(paragrafoDx.Replace("<p></p><br>", ""), 405, width + 12) { AutoIncrementYWritable = false, Y = 53, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, FontSize = 9.26F, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
//testoDx = new FormattedTextAreaPDF(paragrafoDx.Replace("<p></p><br>", ""), 405, width + 12) { AutoIncrementYWritable = false, Y = 53, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, FontSize = 9.26F, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
|
|
//////AddElement(new ResetterYPDF(55+(i*5)));
|
|
////AddElement(new ResetterYPDF(45 + (i * 5)));
|
|
////AddElement(testoSx);
|
|
////addFiller(row, 3);
|
|
////if (paragrafoDx != "")
|
|
////{
|
|
//// i = i + 1;
|
|
//// //AddElement(new ResetterYPDF((paragrafoDx.ToLower().Contains("<b>") ? 55 : 50)+(i * 5)));
|
|
//// if (i == 2)
|
|
//// AddElement(new ResetterYPDF((paragrafoDx.ToLower().Contains("<b>") ? 245 : 40) ));
|
|
//// else
|
|
//// AddElement(new ResetterYPDF((paragrafoDx.ToLower().Contains("<b>") ? 320 : 40)));
|
|
//// //if (indice == 5)
|
|
//// // AddElement(new SpacePDF(21));
|
|
|
|
//// AddElement(testoDx);
|
|
//// addFiller(row, 4);
|
|
////}
|
|
}
|
|
|
|
|
|
AddElement(new SpacePDF(24)); //24
|
|
AddElement(testoSx);
|
|
AddElement(testoDx);
|
|
|
|
if (getNota(_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList()[0], 1).Length > 0)
|
|
{
|
|
string testoNota = getNota(_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList()[0], 1);
|
|
int count = testoNota.Replace("<br>", "\t").Count(x => x == '\t');
|
|
var nota = new FormattedTextAreaPDF();
|
|
if (count == 0)
|
|
//nota = new FormattedTextAreaPDF(testoNota, 60, width*2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 18, FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 13 - 5, FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
else
|
|
{
|
|
if (indice == 5)
|
|
nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 18, FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
else
|
|
//nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 18 - (6 * count), FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 13 - (5 * count), FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
}
|
|
AddElement(nota);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
var data = _text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList();
|
|
|
|
string paragrafoSx = "";
|
|
string paragrafoDx = "";
|
|
string labelSx = "";
|
|
string labelDx = "";
|
|
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
|
FormattedTextAreaPDF testoSx = null;
|
|
FormattedTextAreaPDF testoDx = null;
|
|
|
|
bool halfPage = _text.AsEnumerable().Where(x => x.Field<string>("posizione").Equals("R") || x.Field<string>("posizione").Equals("L")).Any();
|
|
|
|
if (_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList().Count > 0)
|
|
{
|
|
foreach (var row in data)
|
|
{
|
|
labelSx = "";
|
|
labelDx = "";
|
|
|
|
if (!row.Field<string>("posizione").Equals("R"))
|
|
labelSx += "<B>" + row.Field<string>("titolo") + "</B><br><br>";
|
|
else
|
|
labelDx += "<B>" + row.Field<string>("titolo") + "</B><br><br>";
|
|
|
|
int i = 1;
|
|
|
|
for (i = 1; i <= 15; i++)
|
|
{
|
|
if (!row.Field<string>("posizione").Equals("R"))
|
|
labelSx += row.Field<string>("testo" + i) != null ? "<p>" + row.Field<string>("testo" + i).Replace("<br/>", "<br>") + "</p><br>" : "";
|
|
else
|
|
labelDx += row.Field<string>("testo" + i) != null ? "<p>" + row.Field<string>("testo" + i) + "</p><br>" : "";
|
|
}
|
|
|
|
paragrafoSx += labelSx;
|
|
paragrafoDx += labelDx;
|
|
}
|
|
|
|
AddElement(new ResetterYPDF(55));
|
|
testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width + 10) { FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width) { FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
AddElement(testoSx);
|
|
addFiller(_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList()[0], 3);
|
|
AddElement(new ResetterYPDF(55));
|
|
AddElement(testoDx);
|
|
addFiller(_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList()[0], 4);
|
|
|
|
if (getNota(_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList()[0], 1).Length > 0)
|
|
{
|
|
string testoNota = getNota(_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList()[0], 1);
|
|
int count = testoNota.Replace("<br>", "\t").Count(x => x == '\t');
|
|
var nota = new FormattedTextAreaPDF();
|
|
if (count == 0)
|
|
//nota = new FormattedTextAreaPDF(testoNota, 60, width*2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 18, FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 13 - 5, FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
else
|
|
{
|
|
if (indice == 5)
|
|
nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 18, FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
else
|
|
//nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 18 - (6 * count), FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 13 - (5 * count), FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
}
|
|
AddElement(nota);
|
|
}
|
|
|
|
if (dataGrafici.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).Any())
|
|
{
|
|
|
|
var xLinea = xDx - 10;
|
|
var y1Linea = 45;
|
|
var y2Linea = EnvironmentFacade.RendererFacade.YLowerLimit - 20;
|
|
var lineaVerticaleSeparazione = new LinePDF(xLinea, y1Linea, xLinea, y2Linea, 0.5F, ColorPDF.Immobiliare_Marrone) { AutoIncrementYWritable = false };
|
|
AddElement(lineaVerticaleSeparazione);
|
|
|
|
AddElement(new ResetterYPDF(50));
|
|
|
|
var grafici = dataGrafici.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList();
|
|
var nomiGrafici = grafici.AsEnumerable().Select(z => z.Field<string>("descrizione")).Distinct().ToList();
|
|
var testoTitolo = new FormattedTextAreaPDF("Residenziale<br>", 420) { FontSize = 10, FontColor = new ColorPDF(152, 149, 133), AutoIncrementYWritable = true, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
AddElement(new SpacePDF(5));
|
|
AddElement(testoTitolo);
|
|
foreach (string nome in nomiGrafici)
|
|
if (grafici.Where(x => x.Field<string>("descrizione").Contains(nome)).Any())
|
|
AddChart(nome, grafici.Where(x => x.Field<string>("descrizione").Contains(nome)).CopyToDataTable());
|
|
if (grafici.Where(x => x.Field<string>("notaGraf1") != null).Any())
|
|
{
|
|
IEnumerable<DataRow> rows = grafici.AsEnumerable()
|
|
.Where(x => x.Field<string>("notaGraf1") != null);
|
|
string testoNota = getNota(rows.FirstOrDefault(), 2);
|
|
int count = testoNota.Replace("<br>", "\t").Count(x => x == '\t');
|
|
var nota = new FormattedTextAreaPDF();
|
|
if (count == 0)
|
|
//nota = new FormattedTextAreaPDF(getNota(rows.FirstOrDefault(), 2), xDx, 340) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 18, FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
nota = new FormattedTextAreaPDF(getNota(rows.FirstOrDefault(), 2), xDx+9, 340) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 13 - 5, FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
else
|
|
nota = new FormattedTextAreaPDF(getNota(rows.FirstOrDefault(), 2), xDx+9, 340) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 13 - (6 * count), FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
|
|
AddElement(nota);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void AddChart(string asseY, DataTable grafico)
|
|
{
|
|
if (grafico != null)
|
|
{
|
|
bool isPercentage = grafico.Rows[0].Field<int>("percentuale") == 1 ? true : false;
|
|
bool noDecimal = grafico.Rows[0].Field<int>("decimali") >= 1 ? true : false;
|
|
|
|
double percentageAxisXMargin = 0.05d;
|
|
|
|
var graficoCombination = new CombinationPDF(450, 1.0F)
|
|
{
|
|
Height = 70,
|
|
Width = 300,
|
|
ChartBaseHeight = 70,
|
|
ChartBaseWidth = 300,
|
|
|
|
ShowLineAxisX = true,
|
|
IntervalNumberAxisX = grafico.Rows.Count,
|
|
LabelFormatAxisX = FormatType.DataShort,
|
|
|
|
//LabelFormatAxisY = isPercentage ? FormatType.PercentualeImmobiliare: FormatType.Intero,
|
|
LabelFormatAxisY = isPercentage ? FormatType.Decimale2 : FormatType.Intero,
|
|
|
|
ShowLineAxisY = false,
|
|
ShowLabelAxisY = true,
|
|
AutoIncrementYWritable = true,
|
|
StartFromZeroAxisY = false,
|
|
CustomLabelAxisX = new List<CombinationPDFCustomLabel>(),
|
|
ShowCustomLabelsAxisX = true,
|
|
InnerChartDeltaY = 7.5f,
|
|
DontCalculateMaxAndMinAxisY = true
|
|
};
|
|
graficoCombination.SetReportEnvironment(EnvironmentFacade.ReportEnvironment);
|
|
|
|
|
|
// creo le Serie
|
|
var serieCombination = new List<Serie>()
|
|
{
|
|
new Serie
|
|
{ Name = "Linea",
|
|
Type = Dundas.Charting.WebControl.SeriesChartType.Line,
|
|
BorderWidth = 5,
|
|
Color = ColorPDF.Immobiliare_Grigio_TitoloGrande,
|
|
MarkerSize = 20,
|
|
MarkerStyle = Dundas.Charting.WebControl.MarkerStyle.Diamond,
|
|
LabelStyle = "Top",
|
|
}
|
|
};
|
|
|
|
DateTime date;
|
|
foreach (DataRow item in grafico.Rows)
|
|
{
|
|
if (item["chiave"].ToString().Contains("-"))
|
|
date = DateTime.ParseExact(item["chiave"].ToString(), "MMM-yy", new CultureInfo("it-IT"));
|
|
else
|
|
date = DateTime.ParseExact(item["chiave"].ToString(), "yyyy", new CultureInfo("it-IT"));
|
|
|
|
graficoCombination.CustomLabelAxisX.Add(new CombinationPDFCustomLabel()
|
|
{
|
|
Text = item["chiave"].ToString(),
|
|
Value = date.ToOADate()
|
|
});
|
|
|
|
|
|
double _item = Convert.ToDouble(Helper.FormatDecimal(item["valMin"].ToString(), 4)) * (item["percentuale"].ToString().Equals("1") ? 100 : 1);
|
|
|
|
var _item2 = Convert.ToDecimal(item["valMin"]);
|
|
|
|
#region Definizione punti
|
|
|
|
/******************************* Modifiche per parti statiche 10/2020 - Pino ****************************************/
|
|
string _label = string.Empty;
|
|
if (grafico.Rows[0].Field<string>("descrizione").Contains("Trend dei prezzi di locazione annuale (media Italia)"))
|
|
_label = _item.ToString("0.00");
|
|
else
|
|
_label = !isPercentage ? (!noDecimal ? _item.ToString("N0") : _item.ToString("0.0")) :
|
|
Helper.FormatDecimal(Convert.ToString(_item.ToString()), grafico.Rows[0].Field<string>("descrizione").Contains("Trend") ? 2 : 1);
|
|
/*********************************************************************************************************************/
|
|
|
|
|
|
|
|
serieCombination[0].Points.Add(new Point
|
|
{
|
|
Color = ColorPDF.Immobiliare_Grigio_TitoloGrande,
|
|
Values = new ValuesPointXY(date.ToOADate(), _item),
|
|
//Label = !isPercentage ? Helper.FormatCurrency(_item.ToString()).Replace(",00","") :
|
|
// Helper.FormatPercentage(Convert.ToString(_item.ToString()), grafico.Rows[0].Field<string>("descrizione").Contains("Trend") ? 2 : 1),
|
|
|
|
//Label = !isPercentage ? (!noDecimal ? _item.ToString("N0") : _item.ToString("0.0")) :
|
|
// Helper.FormatPercentage(Convert.ToString(_item.ToString()), grafico.Rows[0].Field<string>("descrizione").Contains("Trend") ? 2 : 1),
|
|
|
|
|
|
|
|
//Label = !isPercentage ? (!noDecimal ? _item.ToString("N0") : _item.ToString("0.0")) :
|
|
// Helper.FormatDecimal(Convert.ToString(_item.ToString()), grafico.Rows[0].Field<string>("descrizione").Contains("Trend") ? 2 : 1),
|
|
|
|
Label = _label,
|
|
|
|
LabelAxisY = _item.ToString(),
|
|
FontSizeLabelAxisY = 8.4f,
|
|
FontBoldLabelAxisY = false,
|
|
ShowLabelAxisY = true,
|
|
Marker = new PointMarker()
|
|
{
|
|
MarkerStyle = Dundas.Charting.WebControl.MarkerStyle.Diamond,
|
|
MarkerColor = System.Drawing.Color.SandyBrown
|
|
},
|
|
/******************************************** Modifiche per parti statiche semestrale 10/2020 - Pino ***********************************/
|
|
/******************************************** dimensione font per la label dei grafici *********************/
|
|
Font = new System.Drawing.Font("verdanab", 6F, System.Drawing.FontStyle.Bold)
|
|
//Font = new System.Drawing.Font("verdanab", 4.3F, System.Drawing.FontStyle.Bold)
|
|
/***************************************************************************************************************************************/
|
|
|
|
});
|
|
#endregion
|
|
|
|
}
|
|
|
|
var minValue = serieCombination[0].Points.Min(x => x.Values.X);
|
|
var maxValue = serieCombination[0].Points.Max(x => x.Values.X);
|
|
|
|
//minValue = minValue - Math.Abs(minValue * percentageAxisXMargin / 100);
|
|
//maxValue = maxValue + Math.Abs(maxValue * percentageAxisXMargin / 100);
|
|
//graficoCombination.AxisXMinimum = (float)minValue;
|
|
// graficoCombination.AxisXMaximum = (float)maxValue;
|
|
|
|
var difference = (maxValue - minValue) * percentageAxisXMargin;
|
|
graficoCombination.AxisXMinimum = (float)(minValue - difference);
|
|
graficoCombination.AxisXMaximum = (float)(maxValue + difference);
|
|
|
|
//graficoCombination.ChartBase.ChartAreas[0].AxisX.Minimum = 3000;
|
|
//graficoCombination.ChartBase.ChartAreas[0].AxisX.Maximum = 10000;
|
|
|
|
// AXIS Y
|
|
var minValueY = serieCombination[0].Points.Min(x => x.Values.Y);
|
|
var maxValueY = serieCombination[0].Points.Max(x => x.Values.Y);
|
|
var axisYDistance = maxValueY - minValueY;
|
|
|
|
/********************** Modifiche per parti statiche semestrale 10/2020 - Pino ****************************/
|
|
List<Tuple<string, double, double,int>> _listaValoriMinMaxAxisY = new List<Tuple<string, double, double,int>>();
|
|
|
|
Tuple<string,double,double,int> ValoriMinMaxAxisY = new Tuple<string, double, double,int>("Trend dei prezzi di acquisto (media Italia)", 1345, 1470,5); //5
|
|
_listaValoriMinMaxAxisY.Add(ValoriMinMaxAxisY);
|
|
ValoriMinMaxAxisY = new Tuple<string, double, double,int>("Trend dei prezzi di locazione annuale (media Italia)", 58, 64,6); //58,64,5
|
|
_listaValoriMinMaxAxisY.Add(ValoriMinMaxAxisY);
|
|
ValoriMinMaxAxisY = new Tuple<string, double, double,int>("Trend* della redditività lorda residenziale (media Italia)", 4.20, 4.40,5); //4.20, 4.38,3
|
|
_listaValoriMinMaxAxisY.Add(ValoriMinMaxAxisY);
|
|
|
|
ValoriMinMaxAxisY = new Tuple<string, double, double, int>("Tempi medi per la vendita delle abitazioni", 3, 12, 3);
|
|
_listaValoriMinMaxAxisY.Add(ValoriMinMaxAxisY);
|
|
|
|
if (_listaValoriMinMaxAxisY.Where(f=> f.Item1==asseY).Count() > 0)
|
|
{
|
|
|
|
if (asseY == "Trend dei prezzi di acquisto (media Italia)")
|
|
{
|
|
graficoCombination.MinimumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item2).FirstOrDefault()); // minValueY - (axisYDistance * 295 / 100);
|
|
graficoCombination.MaximumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item3).FirstOrDefault()); //maxValueY + (axisYDistance * 500 / 100);
|
|
graficoCombination.IntervalNumberAxisY = _listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item4).FirstOrDefault();
|
|
}
|
|
else
|
|
{
|
|
if (asseY== "Trend* della redditività lorda residenziale (media Italia)")
|
|
{
|
|
// per test
|
|
//graficoCombination.MinimumValueAxisY = minValueY - (axisYDistance * 12 / 100);
|
|
//graficoCombination.MaximumValueAxisY = maxValueY + (axisYDistance * 30 / 100);
|
|
//graficoCombination.LabelFormatAxisY = FormatType.Decimale2;
|
|
|
|
|
|
graficoCombination.MinimumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item2).FirstOrDefault());
|
|
graficoCombination.MaximumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item3).FirstOrDefault());
|
|
|
|
//graficoCombination.IntervalNumberAxisY = _listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item4).FirstOrDefault();
|
|
}
|
|
else
|
|
{
|
|
if (asseY == "Tempi medi per la vendita delle abitazioni")
|
|
{
|
|
//graficoCombination.MinimumValueAxisY = minValueY - (axisYDistance * 12 / 100);
|
|
//graficoCombination.MaximumValueAxisY = maxValueY + (axisYDistance * 30 / 100) + 0.3;
|
|
|
|
graficoCombination.MinimumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item2).First().ToString());
|
|
graficoCombination.MaximumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item3).First().ToString());
|
|
graficoCombination.IntervalNumberAxisY = _listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item4).First();
|
|
//graficoCombination.LabelFormatAxisY = FormatType.Intero;
|
|
}
|
|
else
|
|
{
|
|
// Trend dei prezzi di locazione annuale (media Italia)
|
|
graficoCombination.MinimumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item2).FirstOrDefault());
|
|
graficoCombination.MaximumValueAxisY = Convert.ToDouble(_listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item3).FirstOrDefault());
|
|
|
|
graficoCombination.IntervalNumberAxisY = _listaValoriMinMaxAxisY.Where(f => f.Item1 == asseY).Select(s => s.Item4).FirstOrDefault();
|
|
graficoCombination.LabelFormatAxisY = FormatType.Intero; //FormatType.Decimale2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
graficoCombination.MinimumValueAxisY = minValueY - (axisYDistance * 12 / 100);
|
|
//graficoCombination.MinimumValueAxisY = 0;
|
|
graficoCombination.MaximumValueAxisY = maxValueY + (axisYDistance * 30 / 100);
|
|
|
|
//if (asseY == "Tempi medi per la vendita delle abitazioni")
|
|
//{
|
|
// graficoCombination.MinimumValueAxisY = 5;
|
|
// graficoCombination.MaximumValueAxisY = 10;
|
|
// graficoCombination.MinimumValueAxisY =5; //4
|
|
//}
|
|
|
|
|
|
if (asseY == "Tempi medi per la locazione delle abitazioni")
|
|
{
|
|
graficoCombination.MinimumValueAxisY = 1;
|
|
graficoCombination.MaximumValueAxisY = 5;
|
|
graficoCombination.LabelFormatAxisY = FormatType.Intero;
|
|
}
|
|
|
|
if (asseY.Substring(0,10) == "Evoluzione")
|
|
{
|
|
graficoCombination.MinimumValueAxisY = 5;
|
|
graficoCombination.MaximumValueAxisY = 20; //+ 0.7;
|
|
graficoCombination.LabelFormatAxisY = FormatType.Intero;
|
|
graficoCombination.IntervalNumberAxisY = 3;
|
|
}
|
|
|
|
// AXIS Y
|
|
//if (asseY == "Tempi medi per la locazione delle abitazioni" || asseY == "Trend dei prezzi di locazione annuale (media Italia)")
|
|
// graficoCombination.LabelFormatAxisY = FormatType.Decimale1;
|
|
|
|
//if (asseY.Substring(0, 10) == "Evoluzione")
|
|
// graficoCombination.LabelFormatAxisY = FormatType.Decimale1;
|
|
}
|
|
/**********************************************************************************************************/
|
|
|
|
|
|
//graficoCombination.MinimumValueAxisY = minValueY - (axisYDistance * 12 / 100);
|
|
////graficoCombination.MinimumValueAxisY = 0;
|
|
//graficoCombination.MaximumValueAxisY = maxValueY + (axisYDistance * 30 / 100);
|
|
|
|
//if (asseY == "Tempi medi per la vendita delle abitazioni")
|
|
// graficoCombination.MinimumValueAxisY = 1; //5
|
|
|
|
//// AXIS Y
|
|
//if (asseY == "Tempi medi per la locazione delle abitazioni" || asseY == "Trend dei prezzi di locazione annuale (media Italia)")
|
|
// graficoCombination.LabelFormatAxisY = FormatType.Decimale1;
|
|
|
|
//if (asseY.Substring(0, 10) == "Evoluzione")
|
|
// graficoCombination.LabelFormatAxisY = FormatType.Decimale1;
|
|
|
|
|
|
graficoCombination.SeriesCollection = serieCombination;
|
|
|
|
|
|
var testo = new FormattedTextAreaPDF(asseY, 420) { FontSize = 8, FontBold = true, FontColor = new ColorPDF(92, 89, 81), AutoIncrementYWritable = true, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
AddElement(testo);
|
|
AddElement(new SpacePDF(10));
|
|
|
|
var labelYNote = new FormattedTextAreaPDF((string)grafico.Rows[0]["asseY"], 450 - 41)
|
|
{
|
|
DeltaY = graficoCombination.Height / 2,
|
|
AutoIncrementYWritable = false,
|
|
};
|
|
var labelsWidth = labelYNote.GetWidthReal(EnvironmentFacade.ReportEnvironment.FontFamily, false);
|
|
labelYNote.TextVerticalDirection = true;
|
|
labelYNote.DeltaY += 10 + labelsWidth / 2;
|
|
AddElement(labelYNote);
|
|
AddElement(graficoCombination);
|
|
AddElement(new SpacePDF(30));
|
|
}
|
|
}
|
|
|
|
protected void addFiller(DataRow row, int position)
|
|
{
|
|
int x = 0;
|
|
int y = 0;
|
|
switch (position)
|
|
{
|
|
case 3:
|
|
x = 35;
|
|
y = 130;
|
|
break;
|
|
case 4:
|
|
x = 600;
|
|
y = 150;
|
|
break;
|
|
}
|
|
if (row.Field<string>("bytesImage") != null && (row.Field<int?>("isIcon") ?? 0) == position)
|
|
{
|
|
var casetta = new ImagePDF(x, 0.25F, "CASA.jpeg") { Y = EnvironmentFacade.RendererFacade.YLowerLimit - y };
|
|
AddElement(casetta);
|
|
}
|
|
}
|
|
|
|
protected virtual string getNota(DataRow row, int tipoNota)
|
|
{
|
|
string nota = "";
|
|
for (int i = 1; i <= 5; i++)
|
|
if (row.Field<string>(tipoNota == 2 ? "notaGraf" + i : "nota" + i) != null)
|
|
nota += row.Field<string>((tipoNota == 2 ? "notaGraf" : "nota") + i) + "<br>";
|
|
return nota;
|
|
}
|
|
|
|
|
|
/// <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 = "IdReport",
|
|
Value = EnvironmentFacade.ReportEnvironment.ReportId
|
|
},
|
|
new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.Int32,
|
|
ParameterName = "IdSezione",
|
|
Value = IdSection
|
|
}
|
|
};
|
|
|
|
|
|
return DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerReportModeler, "REP_Monitoraggio_Immobiliare_S3_S4_Focus", parametri);
|
|
|
|
}
|
|
|
|
private string SplitTesto(string testo,string testoCercato)
|
|
{
|
|
string testoNuovo = string.Empty;
|
|
|
|
try
|
|
{
|
|
string[] testoDiviso = testo.Split(new[] { testoCercato }, StringSplitOptions.None);
|
|
|
|
testoNuovo = string.Concat(testoDiviso[0].ToString(), "<u>", testoCercato, "</u>", testoDiviso[1].ToString());
|
|
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
throw new Exception("Errore in SplitTesto - S4 " + ex.Message);
|
|
}
|
|
|
|
return testoNuovo;
|
|
}
|
|
}
|
|
} |