569 lines
31 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.MonitoraggioNucleo
{
/// <summary>
/// Distribuzione geografica Terreni (id 36)
/// </summary>
//public class S4 : Monitoraggio.S4
//{
// public S4(EnvironmentFacade environmentFacade, int idSection)
// : base(environmentFacade, idSection)
// {
// }
//}
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);
}
}
// OLD CODE
/// <summary>
///
/// </summary>
//protected override sealed void Draw()
//{
// var dataset = GetDataSet();
// var _text = dataset.Tables[0];
// var dataGrafici = dataset.Tables[1];
// var width = 340;
// var xDx = 410;
// List<int> indiciPagina = _text.AsEnumerable()
// .Select(z => z.Field<int>("idREP_IMM_MON_Pagina")).Distinct().ToList();
// foreach (var indice in indiciPagina)
// {
// 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) + "</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 };
// else
// {
// if (indice == 5)
// nota = new FormattedTextAreaPDF(testoNota, 60, width * 2) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 22, 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 };
// }
// 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(getNota(rows.FirstOrDefault(), 2), xDx, 340) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 20 - (5 * count), FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
// AddElement(nota);
// }
// }
// }
// }
//}
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>";
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>" : "";
else
paragrafoDx += 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 = "<p>";
listaSplit.RemoveRange(0, 1);
foreach (var stringa in listaSplit)
paragrafoDx += stringa;
}
testoSx = new FormattedTextAreaPDF(paragrafoSx.Replace("<p></p><br>", ""), 35, width + 5) { AutoIncrementYWritable = false, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, FontSize = 9.26F, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
testoDx = new FormattedTextAreaPDF(paragrafoDx.Replace("<p></p><br>", "<br><br>"), 405, width + 12) { AutoIncrementYWritable = false, 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>") ? 250 : 40)));
else
AddElement(new ResetterYPDF((paragrafoDx.ToLower().Contains("<b>") ? 325 : 40)));
//if (indice == 5)
// AddElement(new SpacePDF(21));
AddElement(testoDx);
addFiller(row, 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);
}
}
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) + "</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, 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, 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
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),
LabelAxisY = _item.ToString(),
FontSizeLabelAxisY = 8.4f,
FontBoldLabelAxisY = false,
ShowLabelAxisY = true,
Marker = new PointMarker()
{
MarkerStyle = Dundas.Charting.WebControl.MarkerStyle.Diamond,
MarkerColor = System.Drawing.Color.SandyBrown
},
Font = new System.Drawing.Font("verdanab", 6F, 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);
var difference = (maxValue - minValue) * percentageAxisXMargin;
graficoCombination.AxisXMinimum = (float)(minValue - difference);
graficoCombination.AxisXMaximum = (float)(maxValue + difference);
// 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;
graficoCombination.MinimumValueAxisY = minValueY - (axisYDistance * 12 / 100);
//graficoCombination.MinimumValueAxisY = 0;
graficoCombination.MaximumValueAxisY = maxValueY + (axisYDistance * 30 / 100);
// AXIS Y
if (asseY == "Tempi medi per la locazione delle abitazioni")
graficoCombination.LabelFormatAxisY = FormatType.Decimale1;
if (asseY.Substring(0, 10) == "Evoluzione")
graficoCombination.LabelFormatAxisY = FormatType.PercentualeImmobiliare;
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
// Impostato a -1 per prendere quello dei Report Monitoraggio Immobiliare
Value = EnvironmentFacade.ReportEnvironment.ReportId - 1
},
new Parametro
{
Direction = ParameterDirection.Input,
DbType = DbType.Int32,
ParameterName = "IdSezione",
Value = IdSection
}
};
return DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerReportModeler, "REP_Monitoraggio_Immobiliare_S3_S4_Focus", parametri);
}
}
}