472 lines
14 KiB
C#
472 lines
14 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Globalization;
|
|
using PDFGenerator.Presentation.Section;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using System.Data;
|
|
using DataAccessLayer;
|
|
using System.Data.SqlClient;
|
|
using System.Data.Common;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
|
|
namespace PDFGenerator.BusinessLayer
|
|
{
|
|
public class DataThread : DataThreadModel
|
|
{
|
|
private DocumentPDF _documentPDF;
|
|
private DataSectionResult _data;
|
|
private List<ReportTipo> _reportsType;
|
|
public DataThread(DBProvider dbProvider)
|
|
{
|
|
|
|
Data = null;
|
|
ReportsType = new List<ReportTipo>();
|
|
DocumentPDF = null;
|
|
SezioneReport = null;
|
|
}
|
|
|
|
private DataTable _schema;
|
|
private DataTable _pesopercentuale;
|
|
private DataTable _rischiorelativo;
|
|
private DataTable _controvaloritotali;
|
|
public DataTable PesoPercentuale
|
|
{
|
|
get { return _pesopercentuale; }
|
|
set { _pesopercentuale = value; }
|
|
}
|
|
|
|
public DataTable RischioRelativo
|
|
{
|
|
get { return _rischiorelativo; }
|
|
set { _rischiorelativo = value; }
|
|
}
|
|
|
|
public DataTable ControvaloriTotali
|
|
{
|
|
get { return _controvaloritotali; }
|
|
set { _controvaloritotali = value; }
|
|
}
|
|
|
|
public DataTable Schema
|
|
{
|
|
get { return _schema; }
|
|
set { _schema = value; }
|
|
}
|
|
|
|
public SezioneReport SezioneReport { get; set; }
|
|
public CapitoloReport CapitoloReport { get; set; }
|
|
public ParagrafoReport ParagrafoReport { get; set; }
|
|
|
|
public DocumentPDF DocumentPDF
|
|
{
|
|
get { return _documentPDF; }
|
|
set { _documentPDF = value; }
|
|
}
|
|
|
|
public DataSectionResult Data
|
|
{
|
|
get { return _data; }
|
|
set { _data = value; }
|
|
}
|
|
|
|
public ReportTipo ReportType()
|
|
{
|
|
return ReportsType.Find(
|
|
delegate (ReportTipo r)
|
|
{
|
|
return r.Descrizione.ToUpper() == TipoReport.ToUpper();
|
|
}
|
|
);
|
|
}
|
|
|
|
public List<ReportTipo> ReportsType
|
|
{
|
|
get { return _reportsType; }
|
|
set { _reportsType = value; }
|
|
}
|
|
|
|
public TipoContratto _tipoContratto;
|
|
|
|
public TipoContratto TipoContratto
|
|
{
|
|
get { return _tipoContratto; }
|
|
set { _tipoContratto = value; }
|
|
}
|
|
|
|
public List<Tuple<string, string, decimal>> SelfNegativeValue { get; set; }
|
|
public decimal GetSelfNegativeValue(string key)
|
|
{
|
|
decimal ret;
|
|
if (SelfNegativeValue == null)
|
|
{
|
|
SelfNegativeValue = new List<Tuple<string, string, decimal>>();
|
|
}
|
|
var retList = SelfNegativeValue.Where<Tuple<string, string, decimal>>(x => x.Item1.Equals(key)).ToList();
|
|
if (retList.Count > 0)
|
|
ret = retList.FirstOrDefault().Item3;
|
|
else ret = 0;
|
|
|
|
return ret;
|
|
}
|
|
|
|
private decimal _totaleS6;
|
|
public decimal TotaleS6
|
|
{
|
|
get { return _totaleS6; }
|
|
set { _totaleS6 = value; }
|
|
}
|
|
|
|
private DataTable _dtDSS6Intermediari;
|
|
public DataTable DtDSS6Intermediari
|
|
{
|
|
get { return _dtDSS6Intermediari; }
|
|
set { _dtDSS6Intermediari = value; }
|
|
}
|
|
|
|
private decimal _totalSelfNegCurrentAccountValue;
|
|
public decimal TotalSelfNegCurrentAccountValue
|
|
{
|
|
get { return _totalSelfNegCurrentAccountValue; }
|
|
set { _totalSelfNegCurrentAccountValue = value; }
|
|
}
|
|
|
|
private bool _isSavingMap;
|
|
public bool IsSavingMap
|
|
{
|
|
get { return _isSavingMap; }
|
|
set { _isSavingMap = value; }
|
|
}
|
|
|
|
private string _area;
|
|
public string Area
|
|
{
|
|
get { return _area; }
|
|
set { _area = value; }
|
|
}
|
|
|
|
private string _progetto;
|
|
public string Progetto
|
|
{
|
|
get { return _progetto; }
|
|
set { _progetto = value; }
|
|
}
|
|
|
|
private int _scaduto;
|
|
public int Scaduto
|
|
{
|
|
get { return _scaduto; }
|
|
set { _scaduto = value; }
|
|
}
|
|
|
|
private int _riskArea;
|
|
public int RiskArea
|
|
{
|
|
get { return _riskArea; }
|
|
set { _riskArea = value; }
|
|
}
|
|
|
|
private bool _isProfessionalClient;
|
|
public bool IsProfessionalClient
|
|
{
|
|
get { return _isProfessionalClient; }
|
|
set { _isProfessionalClient = value; }
|
|
}
|
|
|
|
private string _intermediario;
|
|
public string Intermediario
|
|
{
|
|
get { return _intermediario; }
|
|
set { _intermediario = value; }
|
|
}
|
|
|
|
private DateTime _dataFineTrimestreCorrente;
|
|
public DateTime DataFineTrimestreCorrente
|
|
{
|
|
get { return _dataFineTrimestreCorrente; }
|
|
set { _dataFineTrimestreCorrente = value; }
|
|
}
|
|
|
|
private decimal _totaleS57;
|
|
public decimal TotaleS57
|
|
{
|
|
get { return _totaleS57; }
|
|
set { _totaleS57 = value; }
|
|
}
|
|
|
|
private string _flgprof;
|
|
public string Flgprof
|
|
{
|
|
get { return _flgprof; }
|
|
set { _flgprof = value; }
|
|
}
|
|
|
|
private decimal _gpEligoFondi;
|
|
public decimal GPEligoFondi
|
|
{
|
|
get { return _gpEligoFondi; }
|
|
set { _gpEligoFondi = value; }
|
|
}
|
|
|
|
private decimal _gpEligoTitoli;
|
|
public decimal GPEligoTitoli
|
|
{
|
|
get { return _gpEligoTitoli; }
|
|
set { _gpEligoTitoli = value; }
|
|
}
|
|
|
|
private decimal _patrimonioNonRappresentabileFI;
|
|
public decimal PatrimonioNonRappresentabileFI
|
|
{
|
|
get { return _patrimonioNonRappresentabileFI; }
|
|
set { _patrimonioNonRappresentabileFI = value; }
|
|
}
|
|
|
|
public bool clienteAdeguato(string pRete, string pCodiceFiscale, bool pPeriodico)
|
|
{
|
|
var parameters = new List<SqlParameter>()
|
|
{
|
|
new SqlParameter
|
|
{
|
|
ParameterName="Rete",
|
|
Value=pRete
|
|
},
|
|
new SqlParameter
|
|
{
|
|
ParameterName="CodiceFiscale",
|
|
Value=pCodiceFiscale
|
|
}
|
|
};
|
|
|
|
string sSql = "";
|
|
|
|
if (pPeriodico)
|
|
sSql = "[C6MartPeriodico].[PL_D_S178IndicatoriEsitoAdeguatezza]";
|
|
else
|
|
sSql = "[C6Mart].[PL_D_S178IndicatoriEsitoAdeguatezza]";
|
|
|
|
DataTable dt = null;
|
|
using (SQLServer db = new SQLServer(pCodiceFiscale, pRete))
|
|
{
|
|
dt = db.GetDataTableFromProcedure(sSql, parameters);
|
|
}
|
|
|
|
bool bRet = false;
|
|
if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
|
|
{
|
|
bRet = true;
|
|
foreach (DataRow row in dt.Rows)
|
|
{
|
|
if (row[2].ToInt32() == 0)
|
|
{
|
|
bRet = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return bRet;
|
|
|
|
}
|
|
|
|
private bool _adesioneSuccessivaAvanzato;
|
|
public bool AdesioneSuccessivaAvanzato
|
|
{
|
|
get { return _adesioneSuccessivaAvanzato; }
|
|
set { _adesioneSuccessivaAvanzato = value; }
|
|
}
|
|
|
|
private bool _contrattoOld;
|
|
public bool ContrattoOld
|
|
{
|
|
get { return _contrattoOld; }
|
|
set { _contrattoOld = value; }
|
|
}
|
|
|
|
private string _nomeFileReport;
|
|
public string NomeFileReport
|
|
{
|
|
get { return _nomeFileReport; }
|
|
set { _nomeFileReport = value; }
|
|
}
|
|
|
|
private bool _profiloIsAct;
|
|
public bool ProfiloIsAct
|
|
{
|
|
get { return _profiloIsAct; }
|
|
set { _profiloIsAct = value; }
|
|
}
|
|
|
|
private decimal _coperturaTotaleRisorseFinanziarie;
|
|
public decimal CoperturaTotaleRisorseFinanziarie
|
|
{
|
|
get { return _coperturaTotaleRisorseFinanziarie; }
|
|
set { _coperturaTotaleRisorseFinanziarie = value; }
|
|
}
|
|
|
|
private int _idReportPDFDiagnosi;
|
|
public int IdReportPDFDiagnosi
|
|
{
|
|
get { return _idReportPDFDiagnosi; }
|
|
set { _idReportPDFDiagnosi = value; }
|
|
}
|
|
|
|
private int _idReportPDFMonitoraggio;
|
|
public int IdReportPDFMonitoraggio
|
|
{
|
|
get { return _idReportPDFMonitoraggio; }
|
|
set { _idReportPDFMonitoraggio = value; }
|
|
}
|
|
|
|
private string _codiceContratto;
|
|
public string CodiceContratto
|
|
{
|
|
get { return _codiceContratto; }
|
|
set { _codiceContratto = value; }
|
|
}
|
|
|
|
private DateTime _dataFineTrimestreCorrente_LetteraAccompagnamento;
|
|
public DateTime DataFineTrimestreCorrente_LetteraAccompagnamento
|
|
{
|
|
get { return _dataFineTrimestreCorrente_LetteraAccompagnamento; }
|
|
set { _dataFineTrimestreCorrente_LetteraAccompagnamento = value; }
|
|
}
|
|
|
|
private bool _noMonitoraggio;
|
|
public bool NoMonitoraggio
|
|
{
|
|
get { return _noMonitoraggio; }
|
|
set { _noMonitoraggio = value; }
|
|
}
|
|
|
|
private string _ultimaSezioneStampata;
|
|
public string UltimaSezioneStampata
|
|
{
|
|
get { return _ultimaSezioneStampata; }
|
|
set { _ultimaSezioneStampata = value; }
|
|
}
|
|
|
|
private decimal _patrimonioNonRappresentabileAI;
|
|
public decimal PatrimonioNonRappresentabileAI
|
|
{
|
|
get { return _patrimonioNonRappresentabileAI; }
|
|
set { _patrimonioNonRappresentabileAI = value; }
|
|
}
|
|
|
|
private decimal _patrimonioNonRappresentabileCompl;
|
|
public decimal PatrimonioNonRappresentabileCompl
|
|
{
|
|
get { return _patrimonioNonRappresentabileCompl; }
|
|
set { _patrimonioNonRappresentabileCompl = value; }
|
|
}
|
|
|
|
private bool _hasProdottiAltaComplessita;
|
|
public bool HasProdottiAltaComplessita
|
|
{
|
|
get { return _hasProdottiAltaComplessita; }
|
|
set { _hasProdottiAltaComplessita = value; }
|
|
}
|
|
|
|
private bool _isAdequatezza;
|
|
public bool IsAdequatezza
|
|
{
|
|
get { return _isAdequatezza; }
|
|
set { _isAdequatezza = value; }
|
|
}
|
|
|
|
private string _nomeFilePdf;
|
|
public string NomeFilePdf
|
|
{
|
|
get { return _nomeFilePdf; }
|
|
set { _nomeFilePdf = value; }
|
|
}
|
|
|
|
private string _areaEstesa;
|
|
public string AreaEstesa
|
|
{
|
|
get { return _areaEstesa; }
|
|
set { _areaEstesa = value; }
|
|
}
|
|
|
|
private decimal _patrimoniofinanziarioctv;
|
|
public decimal Patrimoniofinanziarioctv
|
|
{
|
|
get { return _patrimoniofinanziarioctv; }
|
|
set { _patrimoniofinanziarioctv = value; }
|
|
}
|
|
|
|
private decimal _gradoCoperturaMacroAssetInterno;
|
|
public decimal GradoCoperturaMacroAssetInterno
|
|
{
|
|
get { return _gradoCoperturaMacroAssetInterno; }
|
|
set { _gradoCoperturaMacroAssetInterno = value; }
|
|
}
|
|
|
|
private decimal _gradoCoperturaMacroAssetTotale;
|
|
public decimal GradoCoperturaMacroAssetTotale
|
|
{
|
|
get { return _gradoCoperturaMacroAssetTotale; }
|
|
set { _gradoCoperturaMacroAssetTotale = value; }
|
|
}
|
|
|
|
private decimal _gradoCoperturaMacroAssetAltri;
|
|
public decimal GradoCoperturaMacroAssetAltri
|
|
{
|
|
get { return _gradoCoperturaMacroAssetAltri; }
|
|
set { _gradoCoperturaMacroAssetAltri = value; }
|
|
}
|
|
|
|
private int _totalePagine;
|
|
public int TotalePagine
|
|
{
|
|
get { return _totalePagine; }
|
|
set { _totalePagine = value; }
|
|
}
|
|
|
|
private System.IO.Stream _stream;
|
|
public System.IO.Stream Stream
|
|
{
|
|
get { return _stream; }
|
|
set { _stream = value; }
|
|
}
|
|
|
|
public DateTime ContractSubscriptionDate
|
|
{
|
|
get
|
|
{
|
|
|
|
string data_y = "", data_m = "", data_d = "";
|
|
DataTable dx = null;
|
|
string sql = "Select top 1 year(DATA_PERF) as y, month(DATA_PERF) as m, day(DATA_PERF) as d FROM [C6MartPeriodico].[RP_vContrattiPerGenerazioneReport] where cod_fiscale = @codfisc and rete=@rete";
|
|
List<SqlParameter> parameters = new List<SqlParameter>
|
|
{
|
|
new SqlParameter
|
|
{
|
|
ParameterName="codfisc",
|
|
Value=CodiceFiscale
|
|
},
|
|
new SqlParameter
|
|
{
|
|
ParameterName="rete",
|
|
Value=Rete
|
|
}
|
|
};
|
|
using (SQLServer db = new SQLServer())
|
|
{
|
|
dx = db.executeQuery(sql, parameters);
|
|
}
|
|
if (dx != null && dx.Rows.Count > 0)
|
|
{
|
|
data_y = dx.Rows[0][0].ToString();
|
|
data_m = dx.Rows[0][1].ToString();
|
|
data_d = dx.Rows[0][2].ToString();
|
|
return new DateTime(Int32.Parse(data_y), Int32.Parse(data_m), Int32.Parse(data_d));
|
|
}
|
|
|
|
return DateTime.MinValue;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|