309 lines
13 KiB
C#
309 lines
13 KiB
C#
using System;
|
|
using System.Web;
|
|
//using System.Web.Services;
|
|
//using System.Web.Services.Protocols;
|
|
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;
|
|
|
|
|
|
public class DSS160ProdottiAreeBisogno : IDataSection
|
|
{
|
|
|
|
public DataSectionResult getDataSection(List<SessionStruct> tabelleSessione, string querySql, DataThread dataThread)
|
|
{
|
|
try
|
|
{
|
|
DataSectionResult dsr = new DataSectionResult();
|
|
|
|
FormatNum conv = new FormatNum();
|
|
string area = string.Empty;
|
|
string nomeProgetto = string.Empty;
|
|
string ordinamentoProgetto = string.Empty;
|
|
DataSetS160 ds160 = new DataSetS160();
|
|
|
|
ds160.ProdottiAreeBisogno.Columns["Controvalore"].Caption = "Controvalore <br> (€) ";
|
|
|
|
DataTable dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);
|
|
|
|
DataSetS160.ProdottiAreeBisognoRow dr;
|
|
DataSetS160.ProdottiTotaleRow drTot;
|
|
DataSetS160.DettaglioProgettiRow drProgetti;
|
|
|
|
foreach (DataRow row in dt.Rows)
|
|
{
|
|
dr = ds160.ProdottiAreeBisogno.NewProdottiAreeBisognoRow();
|
|
|
|
//Se cambia l'area popolo la tabella dei totali. GESTIRE IL CASO DEI PROGETTI PER Inv
|
|
if (area != row["needarea"].ToString())
|
|
{
|
|
drTot = ds160.ProdottiTotale.NewProdottiTotaleRow();
|
|
drTot.AreaBisogno = row["needareades"].ToString();
|
|
if (row["needarea"].ToString().ToLower() == "na")
|
|
drTot.Totale = "TOTALE RISORSE " + row["needareades"].ToString().ToUpper();
|
|
else
|
|
drTot.Totale = "TOTALE " + row["needareades"].ToString().ToUpper();
|
|
drTot.CodiceAreaBisogno = row["needarea"].ToString();
|
|
drTot.Controvalore = Convert.ToDecimal(row["somma_controval_needarea"]);
|
|
|
|
if (row["var_needareaString"] != DBNull.Value)
|
|
drTot.Var = row["var_needareaString"].ToString();
|
|
else
|
|
drTot.Var = conv.ConvertNum(row["var_needarea"]);
|
|
|
|
|
|
ds160.ProdottiTotale.AddProdottiTotaleRow(drTot);
|
|
}
|
|
|
|
|
|
area = row["needarea"].ToString();
|
|
|
|
//V
|
|
//if (area == "Inv" && nomeProgetto != row["nome_progetto"].ToString())
|
|
if (dataThread.Periodico)
|
|
{
|
|
if (area == "Inv" && ordinamentoProgetto != row["ORDINAMENTO_PROGETTO"].ToString())
|
|
{
|
|
drProgetti = ds160.DettaglioProgetti.NewDettaglioProgettiRow();
|
|
drProgetti.NomeProgetto = row["nome_progetto"].ToString();
|
|
drProgetti.Controvalore = Convert.ToDecimal(row["somma_controval_need_prog"]);
|
|
drProgetti.OrdinamentoProgetto = row["ORDINAMENTO_PROGETTO"].ToString();
|
|
if (row["var_need_progString"] != DBNull.Value)
|
|
drProgetti.Var = row["var_need_progString"].ToString();
|
|
else
|
|
drProgetti.Var = conv.ConvertNum(row["var_need_prog"]);
|
|
|
|
|
|
ds160.DettaglioProgetti.AddDettaglioProgettiRow(drProgetti);
|
|
}
|
|
else
|
|
{
|
|
if (area == "Inv" && nomeProgetto != row["nome_progetto"].ToString())
|
|
{
|
|
drProgetti = ds160.DettaglioProgetti.NewDettaglioProgettiRow();
|
|
drProgetti.NomeProgetto = row["nome_progetto"].ToString();
|
|
drProgetti.Controvalore = Convert.ToDecimal(row["somma_controval_need_prog"]);
|
|
drProgetti.OrdinamentoProgetto = row["ORDINAMENTO_PROGETTO"].ToString();
|
|
if (row["var_need_progString"] != DBNull.Value)
|
|
drProgetti.Var = row["var_need_progString"].ToString();
|
|
else
|
|
drProgetti.Var = conv.ConvertNum(row["var_need_prog"]);
|
|
|
|
|
|
ds160.DettaglioProgetti.AddDettaglioProgettiRow(drProgetti);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (area == "Inv" && nomeProgetto != row["nome_progetto"].ToString())
|
|
{
|
|
drProgetti = ds160.DettaglioProgetti.NewDettaglioProgettiRow();
|
|
drProgetti.NomeProgetto = row["nome_progetto"].ToString();
|
|
drProgetti.Controvalore = Convert.ToDecimal(row["somma_controval_need_prog"]);
|
|
//drProgetti.OrdinamentoProgetto = row["ORDINAMENTO_PROGETTO"].ToString();
|
|
if (row["var_need_progString"] != DBNull.Value)
|
|
drProgetti.Var = row["var_need_progString"].ToString();
|
|
else
|
|
drProgetti.Var = conv.ConvertNum(row["var_need_prog"]);
|
|
|
|
|
|
ds160.DettaglioProgetti.AddDettaglioProgettiRow(drProgetti);
|
|
}
|
|
else
|
|
{
|
|
if (area == "Inv" && nomeProgetto != row["nome_progetto"].ToString())
|
|
{
|
|
drProgetti = ds160.DettaglioProgetti.NewDettaglioProgettiRow();
|
|
drProgetti.NomeProgetto = row["nome_progetto"].ToString();
|
|
drProgetti.Controvalore = Convert.ToDecimal(row["somma_controval_need_prog"]);
|
|
//drProgetti.OrdinamentoProgetto = row["ORDINAMENTO_PROGETTO"].ToString();
|
|
if (row["var_need_progString"] != DBNull.Value)
|
|
drProgetti.Var = row["var_need_progString"].ToString();
|
|
else
|
|
drProgetti.Var = conv.ConvertNum(row["var_need_prog"]);
|
|
|
|
|
|
ds160.DettaglioProgetti.AddDettaglioProgettiRow(drProgetti);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//V Modifica fatta in trimestrale per gestire il doppio nome progetto uguale in monitoraggio
|
|
if (dataThread.Periodico)
|
|
ordinamentoProgetto = row["ORDINAMENTO_PROGETTO"].ToString();
|
|
nomeProgetto = row["nome_progetto"].ToString();
|
|
|
|
//V Modifica fatta in trimestrale per gestire il doppio nome progetto uguale in monitoraggio
|
|
if (dataThread.Periodico)
|
|
dr.OrdinamentoProgetto = row["ORDINAMENTO_PROGETTO"].ToString();
|
|
|
|
dr.AreaBisogno = row["needareades"].ToString();
|
|
dr.Progetto = nomeProgetto;
|
|
dr.CodiceAreaBisogno = row["needarea"].ToString();
|
|
dr.DataSottoscrizione = row["dataSottoscrizione"].ToString();
|
|
//Hazem
|
|
//dr.Contratto = row["contrattoDossier"].ToString();
|
|
dr.Descrizione = row["descrizione"].ToString();
|
|
|
|
|
|
|
|
|
|
//if (row["PartitaViaggiante"] != DBNull.Value && Convert.ToDouble(row["PartitaViaggiante"]) > 0)
|
|
// dr.__IMAGE_ = UtilityManager.getAppSetting("PartiteViaggianti");
|
|
//else
|
|
|
|
dr.__IMAGE_ = string.Empty;
|
|
|
|
dr.Controvalore = Convert.ToDecimal(row["controvalore"]);
|
|
|
|
if (row["varProdottoString"] != DBNull.Value)
|
|
dr.Var = row["varProdottoString"].ToString();
|
|
else
|
|
dr.Var = conv.ConvertNum(row["varProdotto"]);
|
|
|
|
//Hazem
|
|
if (row["CreditRiskString"] != DBNull.Value)
|
|
dr.CreditRisk = row["CreditRiskString"].ToString();
|
|
else
|
|
dr.CreditRisk = UtilityBusinessLayer.GetRiskCreditEmitClassName(row["CreditRiskEmit"].ToString());
|
|
|
|
dr.PerformanceYTD = conv.ConvertNum(row["PerformanceYTD"]);
|
|
|
|
dr.PerformanceDS = conv.ConvertNum(row["performanceDS"]);
|
|
dr.CodiceAreaBisogno = row["needarea"].ToString();
|
|
|
|
// Nota sul grado di copertura
|
|
if (!string.IsNullOrEmpty(row["copertura_needareaString"].ToString()))
|
|
dr.Copertura = row["copertura_needareaString"].ToString();
|
|
|
|
|
|
#region E-DEFAULT4
|
|
|
|
if (
|
|
(dr.Descrizione == "CR FERRARA-16 TV SUB")||
|
|
(dr.Descrizione == "B MARCHE-2015 SUB TV")||
|
|
(dr.Descrizione == "BCA MARCHE FRN 16")||
|
|
(dr.Descrizione == "B MARCHE 18 6% SUB")||
|
|
(dr.Descrizione == "B MARCHE 12/18 6%")||
|
|
(dr.Descrizione == "BCA MARCHE FRN 17")||
|
|
(dr.Descrizione == "BP ETRURIA-16 STUSUB")||
|
|
(dr.Descrizione == "BP ETRURIA 17 SUB TV")||
|
|
(dr.Descrizione == "B ETRURIA 18 3,5%SUB")||
|
|
(dr.Descrizione == "B ETRURIA 13-23 5%")||
|
|
(dr.Descrizione == "BP ETRUR 16 STDW SUB")||
|
|
(dr.Descrizione == "BP ETRURIA 17 SUB SU")||
|
|
(dr.Descrizione == "CRCHIETI-16 STUP SUB")||
|
|
(dr.Descrizione == "CR FERRARA-17 TV SUB")
|
|
)
|
|
{
|
|
dr.Controvalore = 999999999999;
|
|
}
|
|
|
|
|
|
#endregion E-DEFAULT4
|
|
|
|
|
|
|
|
|
|
//Bido Jan 2011 release.
|
|
//Section 43.
|
|
//if (area == "Liq" && dataThread.ReportType().TipoReport == TipoReport.MONITORAGGIO)
|
|
//{
|
|
// dr.CreditRisk = "n.a.";
|
|
// dr.Var = "0,00";
|
|
//}
|
|
//End Bido Jan 2011 release
|
|
|
|
ds160.ProdottiAreeBisogno.AddProdottiAreeBisognoRow(dr);
|
|
}
|
|
|
|
//Bido Jan 2011 release.
|
|
#region New Added Section to Section 43
|
|
|
|
DataTable dt_A = null;
|
|
|
|
if (dataThread.Periodico)
|
|
dt_A = SectionManager.GetDataSection(tabelleSessione, "[C6MartPeriodico].[PL_S43ContoCorrenteBF]", dataThread);
|
|
else
|
|
dt_A = SectionManager.GetDataSection(tabelleSessione, "[C6Mart].[PL_S43ContoCorrenteBF]", dataThread);
|
|
DataSetS160.ContoCorrenteRow dr_A;
|
|
|
|
#region New Section Data Load
|
|
foreach (DataRow row in dt_A.Rows)
|
|
{
|
|
dr_A = ds160.ContoCorrente.NewContoCorrenteRow();
|
|
dr_A.Data = row["datadiSottoscrizione"].ToString();
|
|
dr_A.Numero = row["conto"].ToString();
|
|
|
|
if (row["ControValore"] != DBNull.Value)
|
|
dr_A.SaldoContabile = decimal.Parse(row["ControValore"].ToString());
|
|
|
|
if (row["SALDO_DISPONIBILE"] != DBNull.Value)
|
|
dr_A.SaldoDisponibile = decimal.Parse(row["SALDO_DISPONIBILE"].ToString());
|
|
|
|
//dr_A.CreditRisk = row["CreditRisk"].ToString();
|
|
//dr_A.Var = row["Var"].ToString();
|
|
|
|
//Fixed Value Fields
|
|
dr_A.CreditRisk = "n.a.";
|
|
dr_A.Var = "0.00";
|
|
|
|
ds160.ContoCorrente.AddContoCorrenteRow(dr_A);
|
|
}
|
|
//End Bido Jan 2011 release
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
#region New Added Section to Section 43
|
|
|
|
DataTable dt_B = null;
|
|
|
|
if (dataThread.Periodico)
|
|
dt_B = SectionManager.GetDataSection(tabelleSessione, "[C6MartPeriodico].[PL_S43LineaSelfBF]", dataThread);
|
|
else
|
|
dt_B = SectionManager.GetDataSection(tabelleSessione, "[C6Mart].[PL_S43LineaSelfBF]", dataThread);
|
|
DataSetS160.LineaSelfRow dr_B;
|
|
|
|
#region New Section Data Load
|
|
foreach (DataRow row in dt_B.Rows)
|
|
{
|
|
dr_B = ds160.LineaSelf.NewLineaSelfRow();
|
|
dr_B.NumContratto= row["NumContratto"].ToString();
|
|
dr_B.ControValore = decimal.Parse(row["ControValore"].ToString());
|
|
dr_B.DataSott = row["DataSott"].ToString();
|
|
dr_B.NomeProdotto = row["NomeProdotto"].ToString();
|
|
ds160.LineaSelf.AddLineaSelfRow(dr_B);
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
dsr.DatiSezione = ds160;
|
|
dsr.Esito = ds160.ProdottiAreeBisogno.Rows.Count;
|
|
return dsr;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
}
|