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.MonitoraggioNucleo { /// /// Glossario (id 42) /// //public class S10 : Monitoraggio.S10 //{ // public S10(EnvironmentFacade environmentFacade, int idSection) // : base(environmentFacade, idSection) // { // } //} public class S10 : Entity.Section { public S10(EnvironmentFacade environmentFacade, int idSection) : base(environmentFacade, idSection) { try { Draw(); } catch (Exception ex) { SectionLogger.Write("S10", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment); } } /// /// Scheda2. Patrimonio immobiliare –Sintesi (distribuzione del patrimonio complessivo del cliente diviso per tipologia e cointestatari) /// protected override sealed void Draw() { string titolo = ""; string paragrafoSx = ""; string paragrafoDx = ""; FormattedTextAreaPDF testoSx = null; FormattedTextAreaPDF testoDx = null; FormattedTextAreaPDF testoTitolo = null; FormattedTextAreaPDF notaTabella = null; int x1Linea, x2Linea; var dataset = GetDataSet(); var _text = dataset.Tables[0]; var data = dataset.Tables[1]; var width = 340; List indiciPagina = _text.AsEnumerable() .Select(z => z.Field("idREP_IMM_MON_Pagina")).Distinct().ToList(); int j = 1; foreach (var indice in indiciPagina) { #region Text OLD OLD //if (_text.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).Count() > 0) //{ // var testo = _text.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList(); // switch (j) // { // case 1: // AddElement(new SpacePDF(45)); // foreach (var row in testo) // { // paragrafoSx = paragrafoDx = ""; // titolo = row.Field("titolo") + "
"; // for (int i = 1; i <= 15; i++) // paragrafoSx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; // // SPLIT PARAGRAFO // if (paragrafoSx.Contains("SPLITPARAGRAPH")) // { // var listaSplit = StringExtensions.SplitAtOccurence(paragrafoSx, "SPLITPARAGRAPH", 1); // paragrafoSx = listaSplit[0] + "

"; // paragrafoDx += "

"; // listaSplit.RemoveRange(0, 1); // foreach (var stringa in listaSplit) // paragrafoDx += stringa; // testoTitolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // 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(_titolo); // AddElement(new SpacePDF(5)); // AddElement(lineaVerticaleSeparazione); // AddElement(new SpacePDF(10)); // AddElement(testoSx); // AddElement(new SpacePDF(-5)); // AddElement(testoDx); // AddElement(new SpacePDF(10)); // } // else // { // testoTitolo = new FormattedTextAreaPDF(titolo, 35, 40 + (600 / 2)) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // x1Linea = 35; // x2Linea = 40 + (600 / 2) + 35; // var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = true }; // testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; // AddElement(testoTitolo); // AddElement(new SpacePDF(5)); // AddElement(lineaVerticaleSeparazione); // AddElement(new SpacePDF(5)); // AddElement(testoSx); // AddElement(new SpacePDF(10)); // if (data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice // && x.Field("row1") != "").Count() > 0) // { // DataTable tabella = new DataTable(); // for (int index = 1; index <= 5; index++) // tabella.Columns.Add("column" + index); // List columnName = new List(); // for (int index = 1; index <= 5; index++) // columnName.Add(data.Rows[0].Field("column" + index)); // columnName.RemoveAll(item => item == null); // foreach (var _row in data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice)) // { // titolo = "
" + _row.Field("descrizione"); // 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().ToArray()) // if (tabella.AsEnumerable().All(dr => dr.IsNull(column))) // tabella.Columns.Remove(column); // AddElement(new ResetterYPDF()); // testoTitolo = new FormattedTextAreaPDF(titolo, 410, 300) { AutoIncrementYWritable = true, FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // TablePDF table = new TablePDF(410, tabella) // { // Style = Style.Immobiliare, // AlternateRow = false, // HeaderHeight = 25, // RowHeight = 10, // Footer = false, // ShowBorderLastLine = true, // HeaderTextVerticalAlign = VerticalAlignmentType.Basso // }; // for (int idColumn = 1; idColumn <= tabella.Columns.Count; idColumn++) // table.Columns.Add(new ColumnPDF(tabella.Rows[0].Field("column" + idColumn), idColumn == 1 ? 180 : 80, idColumn != 1 ? HorizontalAlignmentType.Centrato : HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "column" + idColumn, columnName[idColumn - 1]) { HeaderFontColor = new ColorPDF(92, 89, 81), HeaderFontSize = 7, DeltaYContent = 1 }); // if (getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]).Length > 0) // notaTabella = new FormattedTextAreaPDF(getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]), 410, table.Width - 15) { AutoIncrementYWritable = true, FontSize = 6, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaX = 5, DeltaY = 5 }; // AddElement(new ResetterYPDF(50)); // AddElement(testoTitolo); // AddElement(new SpacePDF(5)); // AddElement(table); // if (getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]).Length > 0) // AddElement(notaTabella); // AddElement(new SpacePDF(15)); // } // } // } // j++; // break; // case 2: // AddElement(new PagePDF(PagePDF.PagePDFType.Generic)); // AddElement(new SpacePDF(45)); // int element = 0; // foreach (var row in testo) // { // paragrafoSx = paragrafoDx = ""; // element++; // titolo = row.Field("titolo") + "
"; // if (row["posizione"].Equals("L")) // testoTitolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // else // testoTitolo = new FormattedTextAreaPDF(titolo, 410, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // x1Linea = row["posizione"].Equals("L") ? 35 : 410; // x2Linea = row["posizione"].Equals("L") ? 340 : 750; // var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = element > 2 ? false : true }; // for (int i = 1; i <= 15; i++) // if (row["posizione"].Equals("L")) // paragrafoSx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; // else // paragrafoDx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; // if (row["posizione"].Equals("L")) // testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { AutoIncrementYWritable = false, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; // else // testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width) { AutoIncrementYWritable = true, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; // if (element <= 2) // { // AddElement(new ResetterYPDF()); // AddElement(new SpacePDF(45)); // } // if (element == 3) // AddElement(new SpacePDF(10)); // if (element == 4) // AddElement(new SpacePDF(-52)); // AddElement(testoTitolo); // AddElement(new SpacePDF(5)); // AddElement(lineaVerticaleSeparazione); // AddElement(new SpacePDF(5)); // AddElement(row["posizione"].Equals("L") ? testoSx : testoDx); // AddElement(new SpacePDF(10)); // } // break; // } //} #endregion #region Text OLD //if (_text.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).Count() > 0) //{ // var testo = _text.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList(); // switch (j) // { // case 1: // AddElement(new SpacePDF(45)); // foreach (var row in testo) // { // paragrafoSx = paragrafoDx = ""; // titolo = row.Field("titolo") + "
"; // for (int i = 1; i <= 15; i++) // paragrafoSx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; // // SPLIT PARAGRAFO // if (paragrafoSx.Contains("SPLITPARAGRAPH")) // { // var listaSplit = StringExtensions.SplitAtOccurence(paragrafoSx, "SPLITPARAGRAPH", 1); // paragrafoSx = listaSplit[0] + "

"; // paragrafoDx += "

"; // listaSplit.RemoveRange(0, 1); // foreach (var stringa in listaSplit) // paragrafoDx += stringa; // testoTitolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // 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 = 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 }; // // Dati Statici 20181005 // //AddElement(new SpacePDF(15)); // //AddElement(_titolo); // //AddElement(new SpacePDF(5)); // //AddElement(lineaVerticaleSeparazione); // //AddElement(new SpacePDF(10)); // //AddElement(testoSx); // //AddElement(new SpacePDF(-5)); // //AddElement(testoDx); // //AddElement(new SpacePDF(10)); // AddElement(_titolo); // AddElement(new SpacePDF(5)); // AddElement(lineaVerticaleSeparazione); // AddElement(new SpacePDF(10)); // AddElement(testoSx); // AddElement(new SpacePDF(-5)); // AddElement(testoDx); // AddElement(new SpacePDF(-5)); // // End // } // else // { // testoTitolo = new FormattedTextAreaPDF(titolo, 35, 40 + (600 / 2)) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // x1Linea = 35; // x2Linea = 40 + (600 / 2) + 35; // var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = true }; // testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; // AddElement(testoTitolo); // AddElement(new SpacePDF(5)); // AddElement(lineaVerticaleSeparazione); // AddElement(new SpacePDF(5)); // AddElement(testoSx); // AddElement(new SpacePDF(10)); // if (data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice // && x.Field("row1") != "").Count() > 0) // { // DataTable tabella = new DataTable(); // for (int index = 1; index <= 5; index++) // tabella.Columns.Add("column" + index); // List columnName = new List(); // for (int index = 1; index <= 5; index++) // columnName.Add(data.Rows[0].Field("column" + index)); // columnName.RemoveAll(item => item == null); // foreach (var _row in data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice)) // { // titolo = "
" + _row.Field("descrizione"); // 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().ToArray()) // if (tabella.AsEnumerable().All(dr => dr.IsNull(column))) // tabella.Columns.Remove(column); // AddElement(new ResetterYPDF()); // testoTitolo = new FormattedTextAreaPDF(titolo, 410, 300) { AutoIncrementYWritable = true, FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // TablePDF table = new TablePDF(410, tabella) // { // Style = Style.Immobiliare, // AlternateRow = false, // HeaderHeight = 25, // RowHeight = 10, // Footer = false, // ShowBorderLastLine = true, // HeaderTextVerticalAlign = VerticalAlignmentType.Basso // }; // for (int idColumn = 1; idColumn <= tabella.Columns.Count; idColumn++) // table.Columns.Add(new ColumnPDF(tabella.Rows[0].Field("column" + idColumn), idColumn == 1 ? 180 : 80, idColumn != 1 ? HorizontalAlignmentType.Centrato : HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "column" + idColumn, columnName[idColumn - 1]) { HeaderFontColor = new ColorPDF(92, 89, 81), HeaderFontSize = 7, DeltaYContent = 1 }); // if (getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]).Length > 0) // notaTabella = new FormattedTextAreaPDF(getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]), 410, table.Width - 10) { AutoIncrementYWritable = true, FontSize = 7, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaX = 5, DeltaY = 5 }; // AddElement(new ResetterYPDF(47)); // AddElement(testoTitolo); // AddElement(new SpacePDF(5)); // AddElement(table); // if (getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]).Length > 0) // AddElement(notaTabella); // AddElement(new SpacePDF(15)); // } // } // } // j++; // break; // case 2: // AddElement(new PagePDF(PagePDF.PagePDFType.Generic)); // AddElement(new SpacePDF(45)); // int element = 0; // foreach (var row in testo) // { // paragrafoSx = paragrafoDx = ""; // element++; // titolo = row.Field("titolo") + "
"; // if (row["posizione"].Equals("L")) // testoTitolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // else // testoTitolo = new FormattedTextAreaPDF(titolo, 410, width + 15) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; // x1Linea = row["posizione"].Equals("L") ? 35 : 410; // //x2Linea = row["posizione"].Equals("L") ? 340 : 765; // x2Linea = row["posizione"].Equals("L") ? 340 : 750; // var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = element > 2 ? false : true }; // for (int i = 1; i <= 15; i++) // if (row["posizione"].Equals("L")) // paragrafoSx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; // else // paragrafoDx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; // if (row["posizione"].Equals("L")) // testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { AutoIncrementYWritable = false, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; // else // //testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width + 10) { AutoIncrementYWritable = true, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; // testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width) { AutoIncrementYWritable = true, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; // if (element <= 2) // { // AddElement(new ResetterYPDF()); // AddElement(new SpacePDF(45)); // } // if (element == 3) // AddElement(new SpacePDF(6)); // if (element == 4) // AddElement(new SpacePDF(-36)); // AddElement(testoTitolo); // AddElement(new SpacePDF(5)); // AddElement(lineaVerticaleSeparazione); // //AddElement(new SpacePDF(5)); // AddElement(new SpacePDF(1)); // AddElement(row["posizione"].Equals("L") ? testoSx : testoDx); // AddElement(new SpacePDF(10)); // } // break; // } //} #endregion #region Text if (_text.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).Count() > 0) { var testo = _text.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList(); switch (j) { case 1: AddElement(new SpacePDF(30)); foreach (var row in testo) { paragrafoSx = paragrafoDx = ""; titolo = row.Field("titolo") + "
"; for (int i = 1; i <= 15; i++) paragrafoSx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; // SPLIT PARAGRAFO if (paragrafoSx.Contains("SPLITPARAGRAPH")) { var listaSplit = StringExtensions.SplitAtOccurence(paragrafoSx, "SPLITPARAGRAPH", 1); paragrafoSx = listaSplit[0] + "

"; paragrafoDx += "

"; listaSplit.RemoveRange(0, 1); foreach (var stringa in listaSplit) paragrafoDx += stringa; testoTitolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; 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 = 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 }; // Dati Statici 20181005 //AddElement(new SpacePDF(15)); //AddElement(_titolo); //AddElement(new SpacePDF(5)); //AddElement(lineaVerticaleSeparazione); //AddElement(new SpacePDF(10)); //AddElement(testoSx); //AddElement(new SpacePDF(-5)); //AddElement(testoDx); //AddElement(new SpacePDF(10)); AddElement(_titolo); AddElement(new SpacePDF(5)); AddElement(lineaVerticaleSeparazione); AddElement(new SpacePDF(10)); AddElement(testoSx); AddElement(new SpacePDF(-5)); AddElement(testoDx); AddElement(new SpacePDF(-5)); // End } else { testoTitolo = new FormattedTextAreaPDF(titolo, 35, 40 + (600 / 2)) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; x1Linea = 35; x2Linea = 40 + (600 / 2) + 35; var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = true }; testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; AddElement(testoTitolo); AddElement(new SpacePDF(5)); AddElement(lineaVerticaleSeparazione); AddElement(new SpacePDF(5)); AddElement(testoSx); AddElement(new SpacePDF(10)); if (data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice && x.Field("row1") != "").Count() > 0) { DataTable tabella = new DataTable(); for (int index = 1; index <= 5; index++) tabella.Columns.Add("column" + index); List columnName = new List(); for (int index = 1; index <= 5; index++) columnName.Add(data.Rows[0].Field("column" + index)); columnName.RemoveAll(item => item == null); foreach (var _row in data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice)) { titolo = "
" + _row.Field("descrizione"); 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().ToArray()) if (tabella.AsEnumerable().All(dr => dr.IsNull(column))) tabella.Columns.Remove(column); AddElement(new ResetterYPDF()); testoTitolo = new FormattedTextAreaPDF(titolo, 410, 300) { AutoIncrementYWritable = true, FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; TablePDF table = new TablePDF(410, tabella) { Style = Style.Immobiliare, AlternateRow = false, HeaderHeight = 25, RowHeight = 10, Footer = false, ShowBorderLastLine = true, HeaderTextVerticalAlign = VerticalAlignmentType.Basso }; for (int idColumn = 1; idColumn <= tabella.Columns.Count; idColumn++) table.Columns.Add(new ColumnPDF(tabella.Rows[0].Field("column" + idColumn), idColumn == 1 ? 190 : 80, idColumn != 1 ? HorizontalAlignmentType.Centrato : HorizontalAlignmentType.Sinistra, false, false, 8, ColumnType.Testo, "column" + idColumn, columnName[idColumn - 1]) { HeaderFontColor = new ColorPDF(92, 89, 81), HeaderFontSize = 8, DeltaYContent = 1 }); if (getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]).Length > 0) notaTabella = new FormattedTextAreaPDF(getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]), 410, table.Width - 10) { AutoIncrementYWritable = true, FontSize = 7, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaX = 5, DeltaY = 5 }; //AddElement(new ResetterYPDF(47)); AddElement(new ResetterYPDF(30)); AddElement(testoTitolo); AddElement(new SpacePDF(5)); AddElement(table); if (getNota(data.AsEnumerable().Where(x => x.Field("idREP_IMM_MON_Pagina") == indice).ToList()[0]).Length > 0) AddElement(notaTabella); AddElement(new SpacePDF(15)); } } } j++; break; case 2: AddElement(new PagePDF(PagePDF.PagePDFType.Generic)); int element = 0; foreach (var row in testo) { paragrafoSx = paragrafoDx = ""; element++; titolo = row.Field("titolo") + "
"; if (row["posizione"].Equals("L")) testoTitolo = new FormattedTextAreaPDF(titolo, 35, width) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; else testoTitolo = new FormattedTextAreaPDF(titolo, 410, width + 15) { FontSize = 13, FontColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left }; //x1Linea = row["posizione"].Equals("L") ? 35 : 410; ////x2Linea = row["posizione"].Equals("L") ? 340 : 765; //x2Linea = row["posizione"].Equals("L") ? 340 : 750; x1Linea = row["posizione"].Equals("L") ? 35 : 410; x2Linea = row["posizione"].Equals("L") ? 375 : 750; var lineaVerticaleSeparazione = new LinePDF(x1Linea, x2Linea, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = element > 2 ? false : true }; for (int i = 1; i <= 15; i++) if (row["posizione"].Equals("L")) paragrafoSx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; else paragrafoDx += row.Field("testo" + i) != null ? "

" + row.Field("testo" + i) + "


" : ""; if (row["posizione"].Equals("L")) testoSx = new FormattedTextAreaPDF(paragrafoSx, 35, width) { AutoIncrementYWritable = false, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; else //testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width + 10) { AutoIncrementYWritable = true, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; testoDx = new FormattedTextAreaPDF(paragrafoDx, 410, width) { AutoIncrementYWritable = true, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }; if (element <= 2) { AddElement(new ResetterYPDF()); //AddElement(new SpacePDF(45)); AddElement(new SpacePDF(30)); } if (element == 3) AddElement(new SpacePDF(-5)); if (element == 4) AddElement(new SpacePDF(-32)); AddElement(testoTitolo); AddElement(new SpacePDF(5)); AddElement(lineaVerticaleSeparazione); //AddElement(new SpacePDF(5)); //AddElement(row["posizione"].Equals("L") ? testoSx : testoDx); //AddElement(new SpacePDF(10)); AddElement(new SpacePDF(1)); AddElement(row["posizione"].Equals("L") ? testoSx : testoDx); AddElement(new SpacePDF(10)); } break; } } #endregion } } /// /// Recupera i dati necessari alla Section restituendo un DataTable. /// /// protected override DataTable GetDataTable() { return null; } public virtual string getNota(DataRow row) { string nota = ""; for (int i = 1; i <= 3; i++) nota += "

" + row["notaGrafico" + i] + "
"; if (nota != "") nota += "

"; return nota; } /// /// Recupera i dati necessari alla Section restituendo un DataSet. /// /// protected override DataSet GetDataSet() { var parametri = new List { 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_S10_Legge_Bilancio", parametri); } } }