214 lines
8.2 KiB
C#
214 lines
8.2 KiB
C#
using System;
|
|
using Consulenza.ReportModeler.Manager;
|
|
using Consulenza.ReportCommon;
|
|
using Consulenza.DataServices;
|
|
|
|
namespace Consulenza.Unica.Business
|
|
{
|
|
/// <summary>
|
|
/// Classe che si occupa della generazione dell report di consulenza unica.
|
|
/// Espone un metodo dedicato per ogni report di cui consulenza unica si compone.
|
|
/// </summary>
|
|
public class GeneratorService
|
|
{
|
|
private readonly Int64 _chiaveClientePb;
|
|
private readonly Cliente _cliente = new Cliente();
|
|
private readonly PrivateBanker _privateBanker = new PrivateBanker();
|
|
|
|
public Consulenza.DataServices.DatiSeiUnico _datiSeiUnico;
|
|
public GeneratorService(Consulenza.DataServices.DatiSeiUnico datiSeiUnico) {
|
|
_datiSeiUnico = datiSeiUnico;
|
|
if (datiSeiUnico.all().clientePB != null)
|
|
{
|
|
_chiaveClientePb = datiSeiUnico.all().clientePB.chiaveClientePB;
|
|
_cliente = new Cliente
|
|
{
|
|
Chiave = _chiaveClientePb,
|
|
CodiceFiscale = _datiSeiUnico.clienteUnit().anagrafica.codiceFiscale,
|
|
Cognome = _datiSeiUnico.clienteUnit().anagrafica.cognome,
|
|
Nome = _datiSeiUnico.clienteUnit().anagrafica.nome,
|
|
PartitaIva = _datiSeiUnico.clienteUnit().anagrafica.partitaIva,
|
|
DataSottoscrizioneContratto = _datiSeiUnico.clienteUnit().anagrafica.dtSottoscrizione,
|
|
TipologiaContratto = _datiSeiUnico.clienteUnit().anagrafica.contratto,
|
|
DescrizioneProfilo = _datiSeiUnico.clienteUnit().anagrafica.descProfiloReport,
|
|
CodiceProfilo = _datiSeiUnico.clienteUnit().anagrafica.codProfilo
|
|
};
|
|
}
|
|
else {
|
|
_chiaveClientePb = 0;
|
|
_cliente = new Cliente
|
|
{
|
|
Chiave = _datiSeiUnico.all().nucleiUnit.anagrafica.chiaveNucleo,
|
|
CodiceFiscale = "",
|
|
Cognome = _datiSeiUnico.nucleiUnit() == null ? "" : _datiSeiUnico.nucleiUnit().anagrafica.nomeNucleo,
|
|
Nome = "",
|
|
PartitaIva = "",
|
|
TipologiaContratto = "",
|
|
DescrizioneProfilo = "",
|
|
CodiceProfilo = 0
|
|
};
|
|
}
|
|
|
|
_privateBanker = new PrivateBanker {
|
|
Cap = _datiSeiUnico.all().promotoreBancario.zipCode,
|
|
Citta = _datiSeiUnico.all().promotoreBancario.city,
|
|
Codice = _datiSeiUnico.all().promotoreBancario.codAge ,
|
|
CodiceRete = _datiSeiUnico.all().promotoreBancario.network,
|
|
Indirizzo = _datiSeiUnico.all().promotoreBancario.address,
|
|
Livello = _datiSeiUnico.all().promotoreBancario.rank,
|
|
Nominativo = string.Format("{0} {1}", _datiSeiUnico.all().promotoreBancario.surname, _datiSeiUnico.all().promotoreBancario.name),
|
|
NumeroCivico = "",
|
|
PrefissoTelefono = _datiSeiUnico.all().promotoreBancario.phonePrefix,
|
|
Telefono = _datiSeiUnico.all().promotoreBancario.phoneNumber
|
|
};
|
|
|
|
}
|
|
public GeneratorService() { }
|
|
public byte[] CreaReport_Unico(ReportStruct struttura, Consulenza.DataServices.DatiSeiUnico datiSeiUnico)
|
|
{
|
|
byte[] report;
|
|
|
|
try
|
|
{
|
|
_datiSeiUnico.Execute();
|
|
report = new ReportStructManager().CreateReport_Unico(struttura, datiSeiUnico);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(string.Format("Consulenza.Unica.Business.CreaReport_Unico(): {0}", ex.Message));
|
|
}
|
|
finally
|
|
{
|
|
|
|
}
|
|
|
|
return report;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore.
|
|
/// Recupera info su anagrafica del cliente e del privatebanker necessarie in tutte le sezioni del report.
|
|
/// </summary>
|
|
/// <param name="chiaveClientePb">chiaveclientepb</param>
|
|
public GeneratorService(Int64 chiaveClientePb)
|
|
{
|
|
_chiaveClientePb = chiaveClientePb;
|
|
|
|
var dataAnagrafica = new DataServices.Anagrafica(chiaveClientePb);
|
|
|
|
_cliente = dataAnagrafica.GetCliente();
|
|
_privateBanker = dataAnagrafica.GetPrivateBanker();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ottiene un array binario del PDF del report di Diagnosi di ConsulenzaUnica.
|
|
/// </summary>
|
|
/// <param name="struttura">struttura del report</param>
|
|
/// <returns></returns>
|
|
public byte[] CreaReport_Diagnosi(ReportStruct struttura)
|
|
{
|
|
byte[] report;
|
|
|
|
try
|
|
{
|
|
ReportStructManager reportStructManager = new ReportStructManager(_cliente, _privateBanker);
|
|
reportStructManager.datiSeiUnico = _datiSeiUnico;//FARE
|
|
report = reportStructManager.CreateReport_Diagnosi(_chiaveClientePb, struttura);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(string.Format("Consulenza.Unica.Business.CreaReport_Diagnosi(): {0}", ex.Message));
|
|
}
|
|
finally
|
|
{
|
|
//CacheStore.Clear(_chiaveClientePb);
|
|
}
|
|
|
|
return report;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ottiene un array binario del PDF del report di Monitoraggio di ConsulenzaUnica.
|
|
/// </summary>
|
|
/// <param name="struttura">struttura del report</param>
|
|
/// <returns></returns>
|
|
public byte[] CreaReport_Monitoraggio(ReportStruct struttura)
|
|
{
|
|
byte[] report;
|
|
|
|
try
|
|
{
|
|
ReportStructManager reportStructManager = new ReportStructManager(_cliente, _privateBanker);
|
|
reportStructManager.datiSeiUnico = _datiSeiUnico;//FARE
|
|
report = reportStructManager.CreateReport_Monitoraggio(_chiaveClientePb, struttura);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(string.Format("Consulenza.Unica.Business.CreaReport_Monitoraggio(): {0}", ex.Message));
|
|
}
|
|
finally
|
|
{
|
|
//CacheStore.Clear(_chiaveClientePb);
|
|
}
|
|
|
|
return report;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ottiene un array binario del PDF del report di Proposta di ConsulenzaUnica.
|
|
/// </summary>
|
|
/// <param name="struttura">struttura del report</param>
|
|
/// <returns></returns>
|
|
public byte[] CreaReport_Proposta(ReportStruct struttura)
|
|
{
|
|
byte[] report;
|
|
|
|
try
|
|
{
|
|
ReportStructManager reportStructManager = new ReportStructManager(_cliente, _privateBanker);
|
|
reportStructManager.datiSeiUnico = _datiSeiUnico;//FARE
|
|
report = reportStructManager.CreateReport_Proposta(_chiaveClientePb, struttura);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(string.Format("Consulenza.Unica.Business.CreaReport_Proposta(): {0}", ex.Message));
|
|
}
|
|
finally
|
|
{
|
|
//CacheStore.Clear(_chiaveClientePb);
|
|
}
|
|
|
|
return report;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ottiene un array binario del PDF del report di Nucleo di ConsulenzaUnica.
|
|
/// </summary>
|
|
/// <param name="struttura">struttura del report</param>
|
|
/// <returns></returns>
|
|
public byte[] CreaReport_Nucleo(ReportStruct struttura)
|
|
{
|
|
byte[] report;
|
|
|
|
try
|
|
{
|
|
ReportStructManager reportStructManager = new ReportStructManager(_cliente, _privateBanker);
|
|
reportStructManager.datiSeiUnico = _datiSeiUnico;//FARE
|
|
report = reportStructManager.CreateReport_Nucleo(_chiaveClientePb, struttura);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(string.Format("Consulenza.Unica.Business.CreaReport_Nucleo(): {0}", ex.Message));
|
|
}
|
|
finally
|
|
{
|
|
// CacheStore.Clear(_chiaveClientePb);
|
|
}
|
|
|
|
return report;
|
|
}
|
|
|
|
|
|
}
|
|
}
|