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; public class DSS37PiramideModello : IDataSection { #region IDataSection Members public StructColor toBeFound = new StructColor(); public DataSectionResult getDataSection(List tabelleSessione, string querySql, DataThread dataThread) { try { DataSectionResult dsr = new DataSectionResult(); DataTable dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread); if(Convert.ToDecimal(dt.Rows[0]["Totale"])==0) { dsr.DatiSezione = null; dsr.Esito = 0; return dsr; } // Decimal ctvTotale = 0; DataSetS37 ds37 = new DataSetS37(); DataRow dr; bool first = true; double percInv = 0; foreach (DataRow row in dt.Rows) { //if (Convert.ToDouble(row["TOTALE"]) != 0) //{ if (row["need_breve"].ToString() == "Inv") { if (first) { dr = ds37.AreeBisogno.NewRow(); dr["Percentuale"] = row["totale_percentuale"]; percInv = Convert.ToDouble(row["totale_percentuale"]); ds37.AreeBisogno.Rows.Add(dr); } if (percInv > 0 && (Convert.ToInt32(row["NumeroProgettiInv"]) > 1 || (row["nome_progetto"].ToString() != "Progetto investimento"))) { dr = ds37.Investimenti.NewRow(); dr["progetto"] = row["nome_progetto"]; dr["Percentuale"] = row["perc_need"]; dr["Orizzonte"] = row["orizz_temp"]; ds37.Investimenti.Rows.Add(dr); if (first) { dr = ds37.TotaleConti.NewRow(); dr["Descrizione"] = "TOTALE"; dr["Percentuale"] = row["totale_percentuale"]; dr["Orizzonte"] = " "; first = false; ds37.TotaleConti.Rows.Add(dr); } } else first = false; } else { dr = ds37.AreeBisogno.NewRow(); dr["Percentuale"] = row["totale_percentuale"]; ds37.AreeBisogno.Rows.Add(dr); } //} } dsr.DatiSezione = ds37; dsr.Esito = ds37.AreeBisogno.Rows.Count; return dsr; } catch (Exception ex) { throw ex; } } #endregion }