2025-04-15 12:10:19 +02:00

91 lines
2.8 KiB
C#

using System;
using System.Web;
using System.Text;
using System.Data;
using System.Collections;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.BusinessLayer;
using System.Collections.Generic;
using PDFGenerator;
public class DSS50FondiAltriIstituti : IDataSection
{
public DataSectionResult getDataSection(List<SessionStruct> tabelleSessione, string querySql, DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
DataSectionResult dsr = new DataSectionResult();
FormatNum conv = new FormatNum();
DataSetS50 ds50 = new DataSetS50();
string asterisco = string.Empty;
DataTable dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);
DataSetS50.FondiRow dr;
DataSetS50.FondiTotaleRow drTot;
bool primaRiga = true;
foreach (DataRow row in dt.Rows)
{
dr = ds50.Fondi.NewFondiRow();
dr.Intermediario = row["Intermediario"].ToString();
dr.DataSottoscrizione = row["dataSottoscrizione"].ToString();
dr.Descrizione = row["descrizione_prodotto"].ToString();
dr.Controvalore = Convert.ToDecimal(row["controvalore"]);
dr.TipoVersamento = row["tipo_versamento"].ToString();
dr.Ammontare = Convert.ToDecimal(row["ammontare"]);
//Hazem
if (row["CreditRisk"] != DBNull.Value)
dr.CreditRisk = row["CreditRiskString"].ToString();
else
dr.CreditRisk = UtilityBusinessLayer.GetRiskCreditClassName(row["CreditRisk"].ToString());
if (row["var_prodottoString"] != DBNull.Value)
dr.Var = row["var_prodottoString"].ToString();
else
dr.Var = conv.ConvertNum(row["var_prodotto"]);
dr.VarProxato = row["ProdNonInCatalogo"].ToString();
if (!string.IsNullOrEmpty(row["Copertura_Totale"].ToString()))
dr.Copertura = row["Copertura_Totale"].ToString();
ds50.Fondi.AddFondiRow(dr);
if (primaRiga)
{
drTot = ds50.FondiTotale.NewFondiTotaleRow();
drTot.Totale = "TOTALE FONDI PENSIONE";
drTot.Controvalore = Convert.ToDecimal(row["somma_controval"]);
if (row["var_totaleString"] != DBNull.Value)
drTot.Var = row["var_totaleString"].ToString();
else
if (row["var_totale"] != DBNull.Value)
drTot.Var = conv.ConvertNum(row["var_totale"]);
ds50.FondiTotale.AddFondiTotaleRow(drTot);
primaRiga = false;
}
}
dsr.DatiSezione = ds50;
dsr.Esito = ds50.Fondi.Rows.Count;
return dsr;
}
}