329 lines
18 KiB
C#
329 lines
18 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using Consulenza.ExternalServices;
|
||
using Consulenza.ReportWriter.Business;
|
||
using Consulenza.ReportWriter.Business.Entity;
|
||
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
||
using System.Data;
|
||
using Consulenza.ReportCommon;
|
||
|
||
namespace Consulenza.ReportWriter.Manager.Section.Immobiliare.Monitoraggio
|
||
{
|
||
/// <summary>
|
||
/// Patrimonio Immobiliare Stima delle imposte (id 43) Terreni
|
||
/// </summary>
|
||
public class S11 : Entity.Section
|
||
{
|
||
public S11(EnvironmentFacade environmentFacade, int idSection)
|
||
: base(environmentFacade, idSection)
|
||
{
|
||
try
|
||
{
|
||
Draw();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SectionLogger.Write("S11", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Scheda2. Patrimonio immobiliare –Sintesi (distribuzione del patrimonio complessivo del cliente diviso per tipologia e cointestatari)
|
||
/// </summary>
|
||
protected override sealed void Draw()
|
||
{
|
||
var width = 340;
|
||
string paragrafoSx, paragrafoDx, titolo;
|
||
int textCont = 0;
|
||
FormattedTextAreaPDF testoSx = null;
|
||
FormattedTextAreaPDF testoDx = null;
|
||
int x1Linea = 35;
|
||
int x2Linea;
|
||
bool isFirstRow = false;
|
||
|
||
var dataset = GetDataSet();
|
||
var _text = dataset.Tables[0];
|
||
var data = dataset.Tables[1];
|
||
|
||
List<int> indiciPagina = _text.AsEnumerable().Select(z => z.Field<int>("idREP_IMM_MON_Pagina")).Distinct().ToList();
|
||
|
||
foreach (var indice in indiciPagina)
|
||
{
|
||
if (_text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).Count() > 0)
|
||
{
|
||
var testo = _text.AsEnumerable().Where(x => x.Field<int>("idREP_IMM_MON_Pagina") == indice).ToList();
|
||
|
||
foreach (var row in testo)
|
||
{
|
||
#region IMU + Tabella
|
||
if (row.Field<string>("titolo").Contains("IMU"))
|
||
{
|
||
paragrafoSx = paragrafoDx = "";
|
||
titolo = row.Field<string>("titolo") + "<br>";
|
||
for (int i = 1; i <= 15; i++)
|
||
paragrafoSx += row.Field<string>("testo" + i) != null ?
|
||
"<p>" + row.Field<string>("testo" + i).Replace("<br/>","<br>") + " </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.Replace("<br>", "");
|
||
}
|
||
}
|
||
|
||
x1Linea = 35;
|
||
x2Linea = 750;
|
||
var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = true };
|
||
var _titolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left };
|
||
testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { AutoIncrementYWritable = false, FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
||
testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
||
|
||
/***************************** Modifica per parti statiche Semestrale 10 / 2020 - Pino *************************************/
|
||
AddElement(new SpacePDF(30)); // 45
|
||
/***************************************************************************************************************************/
|
||
AddElement(_titolo);
|
||
AddElement(new SpacePDF(5));
|
||
AddElement(lineaVerticaleSeparazione);
|
||
AddElement(new SpacePDF(10));
|
||
AddElement(testoSx);
|
||
AddElement(new SpacePDF(-2)); //-7 -2 -15
|
||
AddElement(testoDx);
|
||
AddElement(new SpacePDF(5)); //10
|
||
|
||
#region Tabella
|
||
if (data.AsEnumerable().Where(x => x.Field<string>("row1") != "").Count() > 0)
|
||
{
|
||
DataTable tabella = new DataTable();
|
||
for (int index = 1; index <= 5; index++)
|
||
tabella.Columns.Add("column" + index);
|
||
|
||
List<string> columnName = new List<string>();
|
||
for (int index = 1; index <= 5; index++)
|
||
columnName.Add(data.Rows[0].Field<string>("column" + index));
|
||
columnName.RemoveAll(item => item == null);
|
||
|
||
foreach (var _row in data.AsEnumerable())
|
||
{
|
||
if (_row["row1"] != null && _row["row1"].ToString() != "")
|
||
tabella.Rows.Add(_row["row1"], _row["row2"], _row["row3"], _row["row4"], _row["row5"]);
|
||
}
|
||
|
||
foreach (var column in tabella.Columns.Cast<DataColumn>().ToArray())
|
||
if (tabella.AsEnumerable().All(dr => dr.IsNull(column)))
|
||
tabella.Columns.Remove(column);
|
||
|
||
TablePDF table = new TablePDF(x1Linea, tabella)
|
||
{
|
||
Style = Style.Immobiliare,
|
||
AlternateRow = false,
|
||
Footer = false,
|
||
ShowBorderLastLine = true,
|
||
AdditionalSpaceBetweenHeadersAndTable = 5.0F
|
||
};
|
||
|
||
for (int idColumn = 1; idColumn <= tabella.Columns.Count; idColumn++)
|
||
table.Columns.Add(new ColumnPDF(tabella.Rows[0].Field<string>("column" + idColumn), idColumn == 2 ? 400 : 160, idColumn == 1 ? HorizontalAlignmentType.Sinistra : HorizontalAlignmentType.Centrato, false, false, 9, ColumnType.Testo, "column" + idColumn, columnName[idColumn - 1]) { HeaderFontColor = new ColorPDF(92, 89, 81), HeaderFontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, HeaderGroupTextDeltaY = 10 });
|
||
|
||
for (int i = 0; i < tabella.Rows.Count; i++)
|
||
for (int k = 0; k < table.Columns.Count; k++)
|
||
{
|
||
table.Cells[k, i].YContentOffset = 2;
|
||
}
|
||
|
||
AddElement(new SpacePDF(22));
|
||
AddElement(table);
|
||
}
|
||
#endregion
|
||
}
|
||
#endregion
|
||
|
||
#region TARI
|
||
if (row.Field<string>("titolo").Contains("TARI"))
|
||
{
|
||
paragrafoSx = paragrafoDx = "";
|
||
titolo = row.Field<string>("titolo") + "<br>";
|
||
for (int i = 1; i <= 15; i++)
|
||
paragrafoSx += row.Field<string>("testo" + i) != null ?
|
||
"<p>" + row.Field<string>("testo" + i).Replace("<br/>", "<br>") + "</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;
|
||
}
|
||
|
||
x1Linea = 35;
|
||
x2Linea = 750;
|
||
var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = true };
|
||
var _titolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left };
|
||
testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { AutoIncrementYWritable = false, FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
||
testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
||
|
||
/*********************************** Modifiche parti statiche Semestrale 10/2020 - Pino ******************************************/
|
||
AddElement(new SpacePDF(25)); //45
|
||
AddElement(_titolo);
|
||
AddElement(new SpacePDF(5));
|
||
AddElement(lineaVerticaleSeparazione);
|
||
AddElement(new SpacePDF(2)); //10
|
||
AddElement(testoSx);
|
||
AddElement(new SpacePDF(-6)); //-7 -2 -15 -32
|
||
AddElement(testoDx);
|
||
//AddElement(new SpacePDF(5)); //10
|
||
/**********************************************************************************************************************************/
|
||
}
|
||
#endregion
|
||
}
|
||
}
|
||
}
|
||
|
||
#region Codice Originale
|
||
/* Codice Originale */
|
||
//for (int j = 0; j < _text.Rows.Count + 1; j++) {
|
||
// int switchVar = (j % 2 == 0 ? 0 : 1);
|
||
// switch (switchVar) {
|
||
// case 0:
|
||
// //TEXT
|
||
// paragrafoSx = paragrafoDx = "";
|
||
// titolo = _text.Rows[textCont].Field<string>("titolo") + "<br>";
|
||
// for (int i = 1; i <= 15; i++)
|
||
// paragrafoSx += _text.Rows[textCont].Field<string>("testo" + i) != null ?
|
||
// "<p>" + _text.Rows[textCont].Field<string>("testo" + i) + "</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.Replace("<br>","");
|
||
// }
|
||
|
||
|
||
// x1Linea = 35;
|
||
// x2Linea = 750;
|
||
// var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = true };
|
||
// var _titolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left };
|
||
// testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { AutoIncrementYWritable = false, FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
||
// testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
||
|
||
// AddElement(new SpacePDF(45));
|
||
// AddElement(_titolo);
|
||
// AddElement(new SpacePDF(5));
|
||
// AddElement(lineaVerticaleSeparazione);
|
||
// AddElement(new SpacePDF(10));
|
||
// AddElement(testoSx);
|
||
// AddElement(new SpacePDF(-2)); //-7 -2 -15
|
||
// AddElement(testoDx);
|
||
// AddElement(new SpacePDF(5)); //10
|
||
// }
|
||
// switchVar++;
|
||
// textCont++;
|
||
// isFirstRow = true;
|
||
// break;
|
||
|
||
// case 1:
|
||
// if (data.AsEnumerable().Where(x => x.Field<string>("row1") != "").Count() > 0)
|
||
// {
|
||
// DataTable tabella = new DataTable();
|
||
// for (int index = 1; index <= 5; index++)
|
||
// tabella.Columns.Add("column" + index);
|
||
|
||
// List<string> columnName = new List<string>();
|
||
// for (int index = 1; index <= 5; index++)
|
||
// columnName.Add(data.Rows[0].Field<string>("column" + index));
|
||
// columnName.RemoveAll(item => item == null);
|
||
|
||
// foreach (var _row in data.AsEnumerable())
|
||
// {
|
||
// if (_row["row1"] != null && _row["row1"].ToString() != "")
|
||
// tabella.Rows.Add(_row["row1"], _row["row2"], _row["row3"], _row["row4"], _row["row5"]);
|
||
// }
|
||
|
||
// foreach (var column in tabella.Columns.Cast<DataColumn>().ToArray())
|
||
// if (tabella.AsEnumerable().All(dr => dr.IsNull(column)))
|
||
// tabella.Columns.Remove(column);
|
||
|
||
// TablePDF table = new TablePDF(x1Linea, tabella)
|
||
// {
|
||
// Style = Style.Immobiliare,
|
||
// AlternateRow = false,
|
||
// Footer = false,
|
||
// ShowBorderLastLine = true,
|
||
// AdditionalSpaceBetweenHeadersAndTable = 5.0F
|
||
// };
|
||
|
||
// for (int idColumn = 1; idColumn <= tabella.Columns.Count; idColumn++)
|
||
// table.Columns.Add(new ColumnPDF(tabella.Rows[0].Field<string>("column" + idColumn), idColumn == 2 ? 400 : 160, idColumn == 1 ? HorizontalAlignmentType.Sinistra : HorizontalAlignmentType.Centrato, false, false, 9, ColumnType.Testo, "column" + idColumn, columnName[idColumn - 1]) { HeaderFontColor = new ColorPDF(92, 89, 81), HeaderFontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, HeaderGroupTextDeltaY = 10});
|
||
|
||
// for (int i = 0; i < tabella.Rows.Count; i++)
|
||
// for (int k = 0; k < table.Columns.Count; k++)
|
||
// {
|
||
// table.Cells[k, i].YContentOffset = 2;
|
||
// }
|
||
|
||
// AddElement(new SpacePDF(22));
|
||
// AddElement(table);
|
||
// }
|
||
// switchVar++;
|
||
// break;
|
||
// }
|
||
//}
|
||
/* Fine Codice Originale*/
|
||
#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 = "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_S11_Scadenzario", parametri);
|
||
|
||
}
|
||
}
|
||
}
|