152 lines
6.6 KiB
C#
152 lines
6.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using System.Data;
|
|
using Consulenza.ReportWriter.Business;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Base.Proposta
|
|
{
|
|
public class P10 : Entity.Section
|
|
{
|
|
public P10(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("P10", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Disegna l'oggetto P10
|
|
/// </summary>
|
|
protected override sealed void Draw()
|
|
{
|
|
var dtP10 = GetDataTable();
|
|
|
|
if (dtP10.Rows.Count <= 0) return;
|
|
|
|
#region Cliente professionale/retail?
|
|
|
|
//Adriano
|
|
//Adriano: bisogna poi avere anche l'info sul tipo cliente (pro/ret)
|
|
bool profiloProfessionale = false;
|
|
if (dtP10.Rows[0]["TipoConsulenza"].ToString() == "P")
|
|
profiloProfessionale = true;
|
|
|
|
bool profiloAggressivo = Convert.ToInt32(dtP10.Rows[0]["Profilo"].ToString().Substring(0, 1)) >= 5;
|
|
bool profiloProfessionaleAggressivo = profiloProfessionale && profiloAggressivo;
|
|
//--Adriano
|
|
|
|
#endregion
|
|
#region Tabella
|
|
|
|
var tabella = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit , 3, 4)
|
|
{
|
|
ID = "P10",
|
|
Header = false,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
ShowSeparationLines = true,
|
|
WidthSeparationLines = 2,
|
|
ShowBorderContent = true
|
|
};
|
|
|
|
|
|
tabella.Columns.Add(new ColumnPDF("Descrizione", 180, HorizontalAlignmentType.Sinistra, true, true, 8, ColumnType.Testo));
|
|
tabella.Columns.Add(new ColumnPDF("Valori", 343, HorizontalAlignmentType.Sinistra, false, false, 8, ColumnType.Objectpdf));
|
|
tabella.Columns[0].PaddingLeft = 10;
|
|
tabella.Columns[1].PaddingLeft = 5;
|
|
|
|
tabella.Cells[0, 0].Value = "Profilo finanziario";
|
|
// to do if delegato
|
|
|
|
if ( EnvironmentFacade.ReportEnvironment.PrivateDelegato.chiaveDelegato > 0 )
|
|
tabella.Cells[0, 1].Value = "Livello di esperienza e conoscenza *";
|
|
else
|
|
tabella.Cells[0, 1].Value = "Livello di esperienza e conoscenza";
|
|
|
|
tabella.Cells[0, 2].Value = "Limite massimo rischio mercato (VaR)";
|
|
tabella.Cells[0, 3].Value = "Limite massimo rischio credito";
|
|
|
|
var textFormattedTextAreaProfilo = string.Format("<b>{0}</b> {1}", dtP10.Rows[0]["Profilo"], dtP10.Rows[0]["DescProfilo"]);
|
|
//Adriano
|
|
var textFormattedTextAreaEsperienza = string.Format("<b>{0}</b>", profiloProfessionale? "n.a.": dtP10.Rows[0]["EspConoscenza"]);
|
|
var textFormattedTextAreaLimiteRischioMercato = string.Format("<b>{0}%</b>", profiloProfessionale? "50,00" : dtP10.Rows[0]["RischioMercatoMax"]);
|
|
//--Adriano
|
|
//originale:
|
|
//var textFormattedTextAreaEsperienza = string.Format("<b>{0}</b>", dtP10.Rows[0]["EspConoscenza"]);
|
|
//var textFormattedTextAreaLimiteRischioMercato = string.Format("<b>{0}%</b>", dtP10.Rows[0]["RischioMercatoMax"]);
|
|
var textFormattedTextAreaLimiteRischioCredito = string.Format("<b>{0}</b>", dtP10.Rows[0]["RischioCreditoMax"]);
|
|
|
|
var ftaProfilo = new FormattedTextAreaPDF(textFormattedTextAreaProfilo, 0, 338);
|
|
var ftaEsperienza = new FormattedTextAreaPDF(textFormattedTextAreaEsperienza, 0, 338);
|
|
var ftaLimiteRischioMercato = new FormattedTextAreaPDF(textFormattedTextAreaLimiteRischioMercato, 0, 338);
|
|
var ftaLimiteRischioCredito = new FormattedTextAreaPDF(textFormattedTextAreaLimiteRischioCredito, 0, 338);
|
|
|
|
tabella.Cells[1, 0].ValueObject = ftaProfilo;
|
|
tabella.Cells[1, 1].ValueObject = ftaEsperienza;
|
|
tabella.Cells[1, 2].ValueObject = ftaLimiteRischioMercato;
|
|
tabella.Cells[1, 3].ValueObject = ftaLimiteRischioCredito;
|
|
|
|
#endregion
|
|
var descrizioneNota ="* Il 'Livello di esperienza e conoscenza' indicato rappresenta il profilo di Esperienza e Conoscenza del Legale Rappresentante/Delegato";
|
|
var delegato = EnvironmentFacade.ReportEnvironment.PrivateDelegato.Nome + " " + EnvironmentFacade.ReportEnvironment.PrivateDelegato.Cognome;
|
|
var textNotaLivelloEsperienzaeConoscenza = new FormattedTextAreaPDF(string.Format("{0} {1}", descrizioneNota, delegato), EnvironmentFacade.RendererFacade.XLeftLimit, 550, ceTe.DynamicPDF.TextAlign.Left) { Y = 265, FontSize = 8 };
|
|
|
|
|
|
AddElement(tabella);
|
|
if (EnvironmentFacade.ReportEnvironment.PrivateDelegato.chiaveDelegato > 0)
|
|
AddElement(textNotaLivelloEsperienzaeConoscenza);
|
|
AddElement(new SpacePDF(20));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataTable.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataTable GetDataTable()
|
|
{
|
|
var parametri = new List<Parametro>();
|
|
|
|
#region Definizione dei parametri
|
|
|
|
var parametro = new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.Int64,
|
|
ParameterName = "chiaveClientePB",
|
|
Value = EnvironmentFacade.ReportEnvironment.Cliente.Chiave
|
|
};
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.Int32,
|
|
ParameterName = "chiaveProposta",
|
|
Value = EnvironmentFacade.ReportEnvironment.Proposta.Chiave
|
|
};
|
|
parametri.Add(parametro);
|
|
|
|
#endregion
|
|
|
|
return EnvironmentFacade.ReportEnvironment.Proposta.PropostaCBUnica ? DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_Prop_P10", parametri)
|
|
: DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerConsulenzaBase, "REP_Prop_P10", parametri);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataSet.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataSet GetDataSet()
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|