236 lines
12 KiB
C#
236 lines
12 KiB
C#
using System;
|
|
using System.Web;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Collections;
|
|
using System.Configuration;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.BusinessLayer;
|
|
using System.Collections.Generic;
|
|
using PDFGenerator;
|
|
|
|
namespace PDFGenerator.BusinessLayer.DataSection
|
|
{
|
|
public class DSS43BISProdottiAreeBisogno : IDataSection
|
|
{
|
|
|
|
|
|
private Int32? _ordinamentoProgettoPerAreeMonitorate;
|
|
|
|
public Int32? OrdinamentoProgettoPerAreeMonitorate { set { _ordinamentoProgettoPerAreeMonitorate = value; } }
|
|
|
|
|
|
#region IDataSection Members
|
|
|
|
public DataSectionResult getDataSection(List<SessionStruct> tabelleSessione, string querySql, DataThread dataThread)
|
|
{
|
|
try
|
|
{
|
|
DataSectionResult dsr = new DataSectionResult();
|
|
DataSetS43BIS ds43BIS = new DataSetS43BIS();
|
|
|
|
DataSetS43BIS.ProdottiAreeBisognoRow drDettaglioProdotti;
|
|
DataSetS43BIS.ProdottiTotaleRow drTotali;
|
|
|
|
FormatNum conv = new FormatNum();
|
|
string area = string.Empty;
|
|
string nomeProgetto = string.Empty;
|
|
|
|
|
|
ds43BIS.ProdottiAreeBisogno.Columns["Controvalore"].Caption = "Controvalore <br> € ";
|
|
|
|
DataTable dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);
|
|
DataRow[] drS43BIS = dt.Select("ORDINAMENTO_PROGETTO =" + _ordinamentoProgettoPerAreeMonitorate + " and needarea='" + dataThread.Area + "' And nome_progetto='" + dataThread.Progetto.Replace("'", "''") + "'");
|
|
|
|
|
|
|
|
|
|
DataTable distinctTable = dt.DefaultView.ToTable(true, "needarea", "nome_progetto");
|
|
DataRow[] drTotaleProgettiInvestimento = distinctTable.Select(" needarea = 'Inv'");
|
|
int totaleProgettiInvestimento = drTotaleProgettiInvestimento.Length;
|
|
|
|
|
|
|
|
|
|
foreach (DataRow row in drS43BIS)
|
|
{
|
|
#region Totali
|
|
|
|
if (area != row["needarea"].ToString() || nomeProgetto != row["nome_progetto"].ToString())
|
|
{
|
|
drTotali = ds43BIS.ProdottiTotale.NewProdottiTotaleRow();
|
|
drTotali.AreaBisogno = row["needareades"].ToString();
|
|
if (row["needarea"].ToString().ToLower() == "na")
|
|
drTotali.Totale = "TOTALE RISORSE " + row["needareades"].ToString().ToUpper();
|
|
else
|
|
{
|
|
if (row["needarea"].ToString().ToLower() == "inv")
|
|
{
|
|
// Se c'è un solo progetto in investimento chiamato "progetto investimento" il totale deve essere TOTALE INVESTIMENTO
|
|
if (totaleProgettiInvestimento == 1 && row["nome_progetto"].ToString().ToLower() == "progetto investimento")
|
|
drTotali.Totale = "TOTALE " + row["needareades"].ToString().ToUpper();
|
|
else
|
|
drTotali.Totale = "TOTALE " + row["nome_progetto"].ToString().ToUpper();
|
|
|
|
}
|
|
else
|
|
drTotali.Totale = "TOTALE " + row["needareades"].ToString().ToUpper();
|
|
}
|
|
|
|
drTotali.Progetto = row["nome_progetto"].ToString();
|
|
drTotali.CodiceAreaBisogno = row["needarea"].ToString();
|
|
|
|
if (row["needarea"].ToString().ToLower() == "inv")
|
|
{
|
|
#region Controvalore, Var per area bisogno Investimento
|
|
|
|
//Controvalore, Var e copertura per area bisogno Investimento
|
|
drTotali.Controvalore = Convert.ToDecimal(row["somma_controval_need_prog"]);
|
|
|
|
if (row["var_need_progString"] != DBNull.Value)
|
|
drTotali.Var = row["var_need_progString"].ToString();
|
|
else
|
|
drTotali.Var = conv.ConvertNum(row["var_need_prog"]);
|
|
|
|
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
#region Controvalore, Var per area bisogno diversa da Investimento
|
|
|
|
// Controvalore, Var e copertura per area bisogno diversa da Investimento
|
|
drTotali.Controvalore = Convert.ToDecimal(row["somma_controval_needarea"]);
|
|
|
|
if (row["var_needareaString"] != DBNull.Value)
|
|
drTotali.Var = row["var_needareaString"].ToString();
|
|
else
|
|
drTotali.Var = conv.ConvertNum(row["var_needarea"]);
|
|
|
|
|
|
#endregion
|
|
}
|
|
|
|
ds43BIS.ProdottiTotale.AddProdottiTotaleRow(drTotali);
|
|
}
|
|
#endregion
|
|
|
|
area = row["needarea"].ToString();
|
|
nomeProgetto = row["nome_progetto"].ToString();
|
|
|
|
#region Dettaglio
|
|
|
|
drDettaglioProdotti = ds43BIS.ProdottiAreeBisogno.NewProdottiAreeBisognoRow();
|
|
drDettaglioProdotti.AreaBisogno = row["needareades"].ToString();
|
|
drDettaglioProdotti.Progetto = nomeProgetto;
|
|
drDettaglioProdotti.CodiceAreaBisogno = row["needarea"].ToString();
|
|
drDettaglioProdotti.DataAssociazione = row["dataAssociazione"].ToString();
|
|
//Hazem
|
|
//drDettaglioProdotti.Contratto = row["contrattoDossier"].ToString();
|
|
drDettaglioProdotti.Descrizione = row["descrizione"].ToString();
|
|
|
|
//if (row["PartitaViaggiante"] != DBNull.Value && Convert.ToDouble(row["PartitaViaggiante"]) > 0)
|
|
// drDettaglioProdotti.__IMAGE_ = UtilityManager.getAppSetting("PartiteViaggianti");
|
|
//else
|
|
|
|
drDettaglioProdotti.__IMAGE_ = string.Empty;
|
|
|
|
|
|
drDettaglioProdotti.Controvalore = Convert.ToDecimal(row["controvalore"]);
|
|
|
|
|
|
if (row["varProdottoString"] != DBNull.Value)
|
|
drDettaglioProdotti.Var = row["varProdottoString"].ToString();
|
|
else
|
|
drDettaglioProdotti.Var = conv.ConvertNum(row["varProdotto"]);
|
|
|
|
//Hazem
|
|
if (row["CreditRiskString"] != DBNull.Value)
|
|
drDettaglioProdotti.CreditRisk = row["CreditRiskString"].ToString();
|
|
else
|
|
drDettaglioProdotti.CreditRisk = UtilityBusinessLayer.GetRiskCreditEmitClassName(row["CreditRiskEmit"].ToString());
|
|
|
|
drDettaglioProdotti.PerformanceYTD = conv.ConvertNum(row["PerformanceYTD"]);
|
|
drDettaglioProdotti.PerformanceDS = conv.ConvertNum(row["performanceDS"]);
|
|
|
|
drDettaglioProdotti.VersatoNetto = row["VersatoNetto"] == DBNull.Value ? row["VersatoNettoString"].ToString() : conv.ConvertNum(row["VersatoNetto"]);
|
|
drDettaglioProdotti.UtilePerdita = row["MinusPlusValenza"] == DBNull.Value ? row["MinusPlusValenzaString"].ToString() : conv.ConvertNum(row["MinusPlusValenza"]);
|
|
|
|
drDettaglioProdotti.CodiceAreaBisogno = row["needarea"].ToString();
|
|
|
|
|
|
#region E-DEFAULT4
|
|
|
|
if (
|
|
|
|
(drDettaglioProdotti.Descrizione.IndexOf("B MARCHE-2015 SUB TV", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("BCA MARCHE FRN 16", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("B MARCHE 18 6% SUB", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("B MARCHE 12/18 6%", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("BCA MARCHE FRN 17", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("BP ETRURIA-16 STUSUB", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("BP ETRURIA 17 SUB TV", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("B ETRURIA 18 3,5%SUB", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("B ETRURIA 13-23 5%", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("BP ETRUR 16 STDW SUB", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("BP ETRURIA 17 SUB SU", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("CRCHIETI-16 STUP SUB", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("CR FERRARA-16 TV SUB", 0, StringComparison.CurrentCultureIgnoreCase) != -1) ||
|
|
(drDettaglioProdotti.Descrizione.IndexOf("CR FERRARA-17 TV SUB", 0, StringComparison.CurrentCultureIgnoreCase) != -1)
|
|
)
|
|
{
|
|
|
|
drDettaglioProdotti.Controvalore = 999999999999;
|
|
|
|
|
|
}
|
|
#endregion E-DEFAULT4
|
|
|
|
|
|
// Nota sul grado di copertura
|
|
if (area.ToLower() == "inv")
|
|
{
|
|
if (!string.IsNullOrEmpty(row["copertura_need_progString"].ToString()))
|
|
drDettaglioProdotti.Copertura = row["copertura_need_progString"].ToString();
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(row["copertura_needareaString"].ToString()))
|
|
drDettaglioProdotti.Copertura = row["copertura_needareaString"].ToString();
|
|
}
|
|
|
|
//Bido Jan. Relaease
|
|
//if (area.ToLower() == "liq" && dataThread.ReportType().TipoReport == TipoReport.MONITORAGGIO)
|
|
//{
|
|
// drDettaglioProdotti.VersatoNetto = "n.d.";
|
|
// drDettaglioProdotti.UtilePerdita = "n.d.";
|
|
// drDettaglioProdotti.Var = "0,00";
|
|
// drDettaglioProdotti.CreditRisk = "n.a.";
|
|
|
|
//}
|
|
//Bido Jan. Release
|
|
|
|
ds43BIS.ProdottiAreeBisogno.AddProdottiAreeBisognoRow(drDettaglioProdotti);
|
|
|
|
#endregion
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dsr.DatiSezione = ds43BIS;
|
|
dsr.Esito = ds43BIS.ProdottiAreeBisogno.Rows.Count;
|
|
return dsr;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|