231 lines
12 KiB
C#
231 lines
12 KiB
C#
using System;
|
|
using ceTe.DynamicPDF;
|
|
using Consulenza.ReportWriter.Business;
|
|
using Consulenza.ReportCommon;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using System.Data;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Immobiliare.Diagnosi.Nucleo
|
|
{
|
|
public class S1 : Entity.Section
|
|
{
|
|
public S1(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("S1", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Scheda1. (Copertina (Nome del nucleo, CF dei clientiPB del nucleo solo se sono un max di 4, altrimenti non compaiono in copertina
|
|
/// data di produzione del report e nome e cognome del Private Banker))
|
|
/// </summary>
|
|
protected override sealed void Draw() //linda
|
|
{
|
|
var dati = GetDataSet();
|
|
|
|
float _yPrivate = 366; // y di Private banker aumenta o diminuisce a seconda della presenza o meno di cf clienti nucleo
|
|
|
|
var x = EnvironmentFacade.RendererFacade.XLeftLimit + 5;
|
|
var nomeNucleo = Helper.CapitalizeWords(EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.NomeNucleo);
|
|
var nomePrivateBanker = Helper.CapitalizeWords(EnvironmentFacade.ReportEnvironment.PrivateBanker.Nominativo);
|
|
//List<FormattedTextAreaPDF> listaClientiNucleo = new List<FormattedTextAreaPDF>();
|
|
|
|
//int _y = 366;
|
|
////if (EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ListaClientiNucleo.Count <= 4)
|
|
////{
|
|
|
|
// //string tipopersona = "";
|
|
// int _k = 0;
|
|
// foreach (Cliente c in EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ListaClientiNucleo)
|
|
// {
|
|
// _k = _k + 1;
|
|
// //tipopersona = c.Tipo == ClienteType.Fisico ? "Codice fiscale" : c.CodiceFiscale!=string.Empty ? "Codice fiscale" : "Partita IVA";
|
|
// listaClientiNucleo.Add(new FormattedTextAreaPDF(string.Format("{0} {1} - {2}", c.Nome, c.Cognome,c.Tipo== ClienteType.Fisico ? c.CodiceFiscale : c.CodiceFiscale != string.Empty ? c.CodiceFiscale : c.PartitaIva), x, 740, TextAlign.Right) { FontSize = 10, Y = _y, AutoIncrementYWritable = false });
|
|
// if (_k < 6)
|
|
// _y += 12;
|
|
|
|
// }
|
|
// _yPrivate = _y + 12;
|
|
////}
|
|
|
|
|
|
// data di stampa
|
|
var dataStampa = new FormattedTextAreaPDF(string.Format("{0} {1}", "Report prodotto il", Helper.FormatDateMonthName(DateTime.Now)), x, 500) { FontSize = 7, Y = 525, AutoIncrementYWritable = false, AbsolutePosition = true };
|
|
var dataAggiornamentoCatastale = new FormattedTextAreaPDF(string.Format("({0} {1})", "dati catastali aggiornati al", Helper.FormatDateMonthName(Convert.ToDateTime(dati.Tables[0].Rows[0]["datarichiesta"]))), x, 500) { FontSize = 6, Y = 534, AutoIncrementYWritable = false, AbsolutePosition = true };
|
|
|
|
// info del cliente
|
|
var areaNucleoNominativo = new FormattedTextAreaPDF(string.Format("{0} {1}", "<B>Nucleo:</B>", nomeNucleo), x, 740, TextAlign.Right) { FontSize = 10, Y = 350, AutoIncrementYWritable = false };
|
|
|
|
// info del private banker
|
|
var areaPrivateBankerNominativo = new FormattedTextAreaPDF(string.Format("{0} {1}", "<B>Private Banker:</B>", nomePrivateBanker), x, 740, TextAlign.Right) { FontSize = 10, Y = _yPrivate, AutoIncrementYWritable = false };
|
|
|
|
|
|
// Aggiungo gli oggetti
|
|
AddElement(areaNucleoNominativo);
|
|
//if (listaClientiNucleo.Count <= 4)
|
|
//{
|
|
// foreach (FormattedTextAreaPDF areaCFClientiNucleo in listaClientiNucleo)
|
|
// AddElement(areaCFClientiNucleo);
|
|
//}
|
|
//else
|
|
//{
|
|
// _k = 0;
|
|
// foreach (FormattedTextAreaPDF areaCFClientiNucleo in listaClientiNucleo)
|
|
// {
|
|
// _k = _k + 1;
|
|
// if (_k <= 4)
|
|
// AddElement(areaCFClientiNucleo);
|
|
// else
|
|
// {
|
|
// var areaAltri = new FormattedTextAreaPDF("Altri", x, 740, TextAlign.Right);
|
|
// areaAltri.FontSize = 10;
|
|
// areaAltri.Y = _y;
|
|
// areaAltri.AutoIncrementYWritable = false;
|
|
// AddElement(areaAltri);
|
|
// break;
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
AddElement(areaPrivateBankerNominativo);
|
|
AddElement(dataStampa);
|
|
AddElement(dataAggiornamentoCatastale);
|
|
|
|
|
|
//var x = EnvironmentFacade.RendererFacade.XLeftLimit + 5;
|
|
//var nomeNucleo = Helper.CapitalizeWords(EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.NomeNucleo);
|
|
//var nomePrivateBanker = Helper.CapitalizeWords(EnvironmentFacade.ReportEnvironment.PrivateBanker.Nominativo);
|
|
|
|
//// data di stampa
|
|
//var dataStampa = new FormattedTextAreaPDF(string.Format("{0} {1}", "Report prodotto il ", Helper.FormatDateMonthName(DateTime.Now)), x, 500) { FontSize = 6, Y = 480, AutoIncrementYWritable = false, AbsolutePosition = true };
|
|
//string data = "";
|
|
//if (dati.Tables[1].Rows.Count > 0)
|
|
// data = string.Format("({0} {1} - {2} {3})", "dati catastali aggiornati al",
|
|
// Helper.FormatDateMonthName(Convert.ToDateTime(dati.Tables[1].Rows[0]["dataRichiesta"])),
|
|
// "dati finanziari aggiornati al",
|
|
// Helper.FormatDateMonthName(Convert.ToDateTime(dati.Tables[1].Rows[0]["dataPF"]))
|
|
// );
|
|
//else
|
|
// data = string.Format("({0} {1} - {2} {3})", "dati catastali aggiornati al",
|
|
// "--",
|
|
// "dati finanziari aggiornati al",
|
|
// "--"
|
|
// );
|
|
|
|
//var dataAggiornamentoCatastale = new FormattedTextAreaPDF(data, x, 500) { FontSize = 6, Y = 490, AutoIncrementYWritable = false, AbsolutePosition = true };
|
|
//string labelCliente = EnvironmentFacade.ReportEnvironment.Cliente.Tipo == ClienteType.Fisico ? "Codice fiscale" : EnvironmentFacade.ReportEnvironment.Cliente.CodiceFiscale != string.Empty ? "Codice fiscale" : "Partita Iva";
|
|
//string datoCliente = EnvironmentFacade.ReportEnvironment.Cliente.Tipo == ClienteType.Fisico ? EnvironmentFacade.ReportEnvironment.Cliente.CodiceFiscale : EnvironmentFacade.ReportEnvironment.Cliente.CodiceFiscale != string.Empty ? EnvironmentFacade.ReportEnvironment.Cliente.CodiceFiscale : EnvironmentFacade.ReportEnvironment.Cliente.PartitaIva;
|
|
//// info del cliente
|
|
//string infoCliente = string.Format("{0} {1}", "<B>Nucleo:</B> ", nomeNucleo);
|
|
//var areaCliente = new FormattedTextAreaPDF(infoCliente, x, 740, TextAlign.Right) { FontSize = 10, Y = 350, AutoIncrementYWritable = false };
|
|
//List<FormattedTextAreaPDF> listaClientiNucleo = new List<FormattedTextAreaPDF>();
|
|
//var _yPrivate = 350;
|
|
//if (dati.Tables[0].Rows.Count <= 4)
|
|
//{
|
|
// int _y = 366;
|
|
// foreach (DataRow row in dati.Tables[0].Rows)
|
|
// {
|
|
// listaClientiNucleo.Add(new FormattedTextAreaPDF(string.Format("{0}{1}- {2}", ToCamelCase(row["nome"].ToString()), ToCamelCase(row["cognome"].ToString()), row["codFis"]), x, 740, TextAlign.Right) { FontSize = 10, Y = _y, AutoIncrementYWritable = false });
|
|
// _y += 12;
|
|
// }
|
|
// _yPrivate = _y + 12;
|
|
//}
|
|
//else
|
|
//{
|
|
// int _y = 366;
|
|
// int _k = 0;
|
|
// foreach (DataRow row in dati.Tables[0].Rows)
|
|
// {
|
|
// _k += 1;
|
|
// if (_k <= 4)
|
|
// listaClientiNucleo.Add(new FormattedTextAreaPDF(string.Format("{0}{1}- {2}", ToCamelCase(row["nome"].ToString()), ToCamelCase(row["cognome"].ToString()), row["codFis"]), x, 740, TextAlign.Right) { FontSize = 10, Y = _y, AutoIncrementYWritable = false });
|
|
// else
|
|
// {
|
|
// listaClientiNucleo.Add(new FormattedTextAreaPDF(string.Format("{0}", "Altri"), x, 740, TextAlign.Right) { FontSize = 10, Y = _y, AutoIncrementYWritable = false });
|
|
// break;
|
|
// }
|
|
// _y += 12;
|
|
// }
|
|
// _yPrivate = _y + 12;
|
|
//}
|
|
|
|
//foreach (FormattedTextAreaPDF areaCFClientiNucleo in listaClientiNucleo)
|
|
// AddElement(areaCFClientiNucleo);
|
|
|
|
//// info del private banker
|
|
//var areaPrivateBankerNominativo = new FormattedTextAreaPDF(string.Format("{0} {1}", "<B>Private Banker:</B>", nomePrivateBanker), x, 740, TextAlign.Right) { FontSize = 10, Y = _yPrivate, AutoIncrementYWritable = false };
|
|
|
|
|
|
//// Aggiungo gli oggetti
|
|
//AddElement(areaCliente);
|
|
//AddElement(areaPrivateBankerNominativo);
|
|
//AddElement(dataStampa);
|
|
//AddElement(dataAggiornamentoCatastale);
|
|
}
|
|
|
|
protected string ToCamelCase(string toConvert)
|
|
{
|
|
toConvert = toConvert.ToLower();
|
|
var split = toConvert.Split(' ');
|
|
StringBuilder sb = new StringBuilder();
|
|
foreach (string _string in split)
|
|
{
|
|
if (_string.Length > 0)
|
|
{
|
|
string firstLetter = _string.Substring(0, 1);
|
|
string rest = _string.Substring(1, (_string.Length - 1));
|
|
sb.Append(firstLetter.ToUpper() + rest);
|
|
sb.Append(" ");
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataTable.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataTable GetDataTable()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataSet.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataSet GetDataSet()
|
|
|
|
{
|
|
#region Definizione dei parametri
|
|
|
|
var parametri = new List<Parametro>
|
|
{
|
|
new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.Int64,
|
|
ParameterName = "ChiaveNucleo",
|
|
Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo
|
|
}
|
|
};
|
|
|
|
#endregion
|
|
|
|
return EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ImmobiliareCEUnica ? DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_Nucleo_Immobiliare_S1_Copertina", parametri)
|
|
: DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaEvoluta, "REP_Nucleo_Immobiliare_S1_Copertina", parametri);
|
|
|
|
}
|
|
}
|
|
}
|