using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using PDFGenerator.BusinessLayer.DataSection; using PDFGenerator.BusinessLayer; using System.Collections.Generic; namespace PDFGenerator.BusinessLayer.DataSection { class DSS95ProfiloDiRischio : IDataSection { //private int _experince; //public int Experince //{ // set // { // _experince = value; // } // get // { // return _experince; // } //} private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); public DSS95ProfiloDiRischio() { // // TODO: Add constructor logic here // } #region IDataSection Members /// /// Implement the getDataSection function of the interface IDataSection. /// /// /// Sql Statment to be executed to return the Profile Risk of the certain customer in a certain network /// /// Data Table to be shown in the report public DataSectionResult getDataSection(List tabelleSessione, string querySql, DataThread dataThread) { try { DataSectionResult customerProfiloRischioDataSectionResult = new DataSectionResult(); //Random rnd = new Random(); DataRow customerProfiloRischioDataRow; DataRow customerProfilofinanziarioDataRow; DataRow customerProfiloDateDataRow; //S93 Data moved to S95 DataRow CTVDataRow; DataRow CTVTotali; decimal risorseFinanziarie = 0; decimal CC = 0; decimal investimentiInCorso = 0; FormatNum formatnum = new FormatNum(); decimal totalePartiteViaggianti = dataThread.PartiteViaggiantiInvestimento + dataThread.PartiteViaggiantiDisinvestimento; DataTable customerProfiloRischioDataTable = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread); DataSetS95 customerProfiloRischioRecordsDataSetS95 = new DataSetS95(); if (dataThread.profiloIsAct && customerProfiloRischioDataTable.Rows.Count > 0) { int profiloRischioClienteAssegnato = Convert.ToInt32(customerProfiloRischioDataTable.Rows[0]["codiceProfilo"]); #region Creazione righe datatable Profilofinanziario // Profilo finanziario customerProfilofinanziarioDataRow = customerProfiloRischioRecordsDataSetS95.Profilofinanziario.NewRow(); customerProfilofinanziarioDataRow["Descrizione"] = "Profilo finanziario"; customerProfilofinanziarioDataRow["Valore"] = customerProfiloRischioDataTable.Rows[0]["codiceProfilo"].ToString() + " " + customerProfiloRischioDataTable.Rows[0]["nomeProfilo"].ToString(); customerProfiloRischioRecordsDataSetS95.Profilofinanziario.Rows.Add(customerProfilofinanziarioDataRow); #endregion #region Creazione righe datatable profilorischio // VaR Massimo customerProfiloRischioDataRow = customerProfiloRischioRecordsDataSetS95.ProfiloRischio.NewRow(); customerProfiloRischioDataRow["Descrizione"] = "Rischio Mercato (VaR) massimo"; customerProfiloRischioDataRow["Valore"] = SoglieVar.ConvOld(customerProfiloRischioDataTable.Rows[0]["varMassimo"]); customerProfiloRischioRecordsDataSetS95.ProfiloRischio.Rows.Add(customerProfiloRischioDataRow); // Rischo Credito Massimo customerProfiloRischioDataRow = customerProfiloRischioRecordsDataSetS95.ProfiloRischio.NewRow(); customerProfiloRischioDataRow["Descrizione"] = "Rischio Credito massimo"; customerProfiloRischioDataRow["Valore"] = UtilityBusinessLayer.GetRiskCreditClassName(customerProfiloRischioDataTable.Rows[0]["RiskClass"].ToString()); customerProfiloRischioRecordsDataSetS95.ProfiloRischio.Rows.Add(customerProfiloRischioDataRow); // Experince customerProfiloRischioDataRow = customerProfiloRischioRecordsDataSetS95.ProfiloRischio.NewRow(); customerProfiloRischioDataRow["Descrizione"] = "Experince"; customerProfiloRischioDataRow["Valore"] = customerProfiloRischioDataTable.Rows[0]["Experince"].ToString(); customerProfiloRischioRecordsDataSetS95.ProfiloRischio.Rows.Add(customerProfiloRischioDataRow); #endregion #region Creazione righe datatable ProfiloDate // Data Ultimo Aggiornamento customerProfiloDateDataRow = customerProfiloRischioRecordsDataSetS95.ProfiloDate.NewRow(); // FC 09062015 // Aggiornamneto Label Descrizione //New Label Da inserire : customerProfiloDateDataRow["Descrizione"] = "Data inizio validità profilo"; //customerProfiloDateDataRow["Descrizione"] = "Ultimo aggiornamento questionario"; customerProfiloDateDataRow["Valore"] = customerProfiloRischioDataTable.Rows[0]["dataInizioValidita"].ToString(); customerProfiloRischioRecordsDataSetS95.ProfiloDate.Rows.Add(customerProfiloDateDataRow); #endregion #region RISORSE FINANZIARIE decimal PatrimonioBancaFideuramCTV_netto = dataThread.PatrimonioBancaFideuramCtvAlNettoContoCorrente; CTVDataRow = customerProfiloRischioRecordsDataSetS95.Dati.NewRow(); CTVDataRow["Descrizione"] = "Risorse finanziarie"; risorseFinanziarie = PatrimonioBancaFideuramCTV_netto; CTVDataRow["Controvalore"] = formatnum.ConvertNum(PatrimonioBancaFideuramCTV_netto) + " €"; customerProfiloRischioRecordsDataSetS95.Dati.Rows.Add(CTVDataRow); #endregion #region CONTO CORRENTE CTVDataRow = customerProfiloRischioRecordsDataSetS95.Dati.NewRow(); //CTVDataRow["Descrizione"] = "Conto corrente"; CTVDataRow["Descrizione"] = "C/C a saldo negativo"; CC = dataThread.ContoCorrente; CTVDataRow["Controvalore"] = formatnum.ConvertNum(CC) + " €"; if(CC != 0) customerProfiloRischioRecordsDataSetS95.Dati.Rows.Add(CTVDataRow); #endregion #region INVESTIMENTI IN CORSO CTVDataRow = customerProfiloRischioRecordsDataSetS95.Dati.NewDatiRow(); CTVDataRow["Descrizione"] = Resource.PartiteViaggianti; investimentiInCorso = dataThread.PartiteViaggiantiInvestimento + dataThread.PartiteViaggiantiDisinvestimento; CTVDataRow["Controvalore"] = formatnum.ConvertNum(investimentiInCorso) + " €"; if (totalePartiteViaggianti != 0) customerProfiloRischioRecordsDataSetS95.Dati.Rows.Add(CTVDataRow); #endregion #region TOTALE PATRIMONIO CTVTotali = customerProfiloRischioRecordsDataSetS95.Totali.NewRow(); CTVTotali["Descrizione"] = "Totale patrimonio"; decimal totale = risorseFinanziarie + CC + investimentiInCorso; CTVTotali["Controvalore"] = formatnum.ConvertNum(totale) + " €"; customerProfiloRischioRecordsDataSetS95.Totali.Rows.Add(CTVTotali); #endregion } customerProfiloRischioDataSectionResult.DatiSezione = customerProfiloRischioRecordsDataSetS95; customerProfiloRischioDataSectionResult.Esito = customerProfiloRischioRecordsDataSetS95.ProfiloRischio.Rows.Count; return customerProfiloRischioDataSectionResult; } catch (Exception ex) { try { logger.Error(string.Concat(ex.Message, " ", dataThread.CodiceFiscale)); } catch { } throw ex; } } #endregion } }