121 lines
5.1 KiB
C#
121 lines
5.1 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using System.Data;
|
||
|
||
namespace PDFGenerator.BusinessLayer.DataSection
|
||
{
|
||
class DSS176EvoluzioneLineaProtettaMultiramo : IDataSection
|
||
{
|
||
#region IDataSection Members
|
||
//private DataRow[] getRowControvaloreRisorseApportate(DataTable dt, string area, string nomeprogetto, Int32? ordinamento)
|
||
//{
|
||
// try
|
||
// {
|
||
// DataRow[] rowArray = null;
|
||
// // DataRow[] rowArrayDatiComuniPerformanceAreaS83 = null;
|
||
|
||
// if (dt != null)
|
||
// {
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
|
||
// if (area.ToUpper() == "INV")
|
||
// {
|
||
// //// Progetti
|
||
// //rowArrayDatiComuniPerformanceAreaS83 = dtDatiComuniPerformanceAreaS83.Select(" nome_progetto = '" + nomeprogetto.Replace("'", "''") + "' and NEED_AREA = '" + area.Replace("'", "''") + "'");
|
||
|
||
// //if (rowArrayDatiComuniPerformanceAreaS83 != null && rowArrayDatiComuniPerformanceAreaS83.Length > 0)
|
||
// if (ordinamento == null)
|
||
// rowArray = dt.Select(" nome_progetto = '" + nomeprogetto.Replace("'", "''") + "' and NEED_AREA = '" + area.Replace("'", "''") + "'");
|
||
// else
|
||
// rowArray = dt.Select(" ordinamento_progetto = " + ordinamento.ToString() + " and nome_progetto = '" + nomeprogetto.Replace("'", "''") + "' and NEED_AREA = '" + area.Replace("'", "''") + "'");
|
||
// }
|
||
// else
|
||
// {
|
||
// //// no progetti
|
||
// //rowArrayDatiComuniPerformanceAreaS83 = dtDatiComuniPerformanceAreaS83.Select(" NEED_AREA = '" + area.Replace("'", "''") + "'");
|
||
|
||
// //if (rowArrayDatiComuniPerformanceAreaS83 != null && rowArrayDatiComuniPerformanceAreaS83.Length > 0)
|
||
// rowArray = dt.Select(" NEED_AREA = '" + area.Replace("'", "''") + "'");
|
||
// }
|
||
// }
|
||
// }
|
||
// return rowArray;
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// throw ex;
|
||
// }
|
||
//}
|
||
//private Int32? _ordinamentoProgettoPerAreeMonitorate;
|
||
|
||
//public Int32? OrdinamentoProgettoPerAreeMonitorate { set { _ordinamentoProgettoPerAreeMonitorate = value; } }
|
||
|
||
//public StructColor toBeFound = new StructColor();
|
||
|
||
public DataSectionResult getDataSection(List<SessionStruct> tabelleSessione, string querySql, DataThread dataThread)
|
||
{
|
||
|
||
DataSectionResult dsr = new DataSectionResult();
|
||
|
||
querySql = "[C6martPeriodico].[PL_MP_S176EvoluzioneLineaProtettaMultiramo]";
|
||
//// Controllo presenza dati needarea/progetto vincolo S83
|
||
//DataTable dtDatiComuniPerformanceAreaS83 = SectionManager.GetDataSection("DatiComuniPerformanceAreaS83", datiMonitoraggio.DsParam);
|
||
|
||
// S176 Monitoraggio Investimento
|
||
DataTable dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);
|
||
DataSetS176 ds176 = new DataSetS176();
|
||
|
||
DataRow dr;
|
||
DateTime data;
|
||
|
||
#region Prodotto
|
||
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
DataRow drProdotto = ds176.Prodotto.NewRow();
|
||
drProdotto["DescrizioneProdotto"] = dt.Rows[0]["DescrizioneProdotto"].ToString();
|
||
drProdotto["Contratto"] = dt.Rows[0]["Contratto"].ToString();
|
||
data = Convert.ToDateTime(dt.Rows[0]["DataSottoscrizione"]);
|
||
drProdotto["DataSottoscrizione"] = data.ToShortDateString();
|
||
ds176.Prodotto.Rows.Add(drProdotto);
|
||
#endregion
|
||
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
|
||
dr = ds176.DatiGrafico.NewRow();
|
||
|
||
dr["Controvalore"] = row["Controvalore"];
|
||
dr["ControvaloreProtetto"] = row["ControvaloreProtetto"];
|
||
dr["ControvaloreMonitorato"] = row["ControvaloreMonitorato"];
|
||
data = Convert.ToDateTime(row["DataRiferimento"]);
|
||
dr["DataRiferimento"] = data.ToShortDateString();
|
||
data = Convert.ToDateTime(row["DataTrim"]);
|
||
dr["DataTrim"] = data.ToShortDateString();
|
||
ds176.DatiGrafico.Rows.Add(dr);
|
||
}
|
||
|
||
}
|
||
|
||
dsr.DatiSezione = ds176;
|
||
//Se non sono passati almeno 5 giri di calcolo del rendimento, l’oggetto non deve essere mostrato
|
||
|
||
DataView view = new DataView(ds176.DatiGrafico);
|
||
DataTable dtFilter = view.ToTable(true, "DataRiferimento");
|
||
int esito = 0;
|
||
|
||
//if (dtFilter.Rows.Count < 5)
|
||
// esito = 0;
|
||
//else
|
||
esito = ds176.Prodotto.Rows.Count;
|
||
|
||
dsr.Esito = esito;
|
||
return dsr;
|
||
}
|
||
#endregion
|
||
|
||
}
|
||
}
|