using System;
using System.Web;
//using System.Web.Services;
//using System.Web.Services.Protocols;
using System.Text;
using System.Data;

using System.Collections;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.BusinessLayer;
using System.Collections.Generic;


public class DSS27AltroPatrimonio : IDataSection
{
    #region IDataSection Members
    public StructColor toBeFound = new StructColor();

    public DataSectionResult getDataSection(List<SessionStruct> tabelleSessione, string querySql, DataThread dataThread)
    {


        DataSectionResult dsr = new DataSectionResult();

        DataTable dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);

        Decimal ctvTotale = 0;
        DataSetS27 ds27 = new DataSetS27();

        ds27.Patrimonio.Columns["Valore"].Caption = "Controvalore <br> € &nbsp; &nbsp; &nbsp; &nbsp;";

        DataRow dr;

        foreach (DataRow row in dt.Rows)
        {

            dr = ds27.Patrimonio.NewRow();
            dr["Denominazione"] = row["DENOMINAZIONE"];
            dr["Quote"] = row["NUMEROQUOTE"];
            dr["Valore"] = row["VALORE"];

            ctvTotale += (Decimal)dr["Valore"];
            ds27.Patrimonio.Rows.Add(dr);
        }

        if (dt.Rows.Count > 0)
        {
            DataRow drTot = ds27.TotalePatrimonio.NewRow();
            drTot["Descrizione"] = "TOTALE";
            drTot["Valore"] = dt.Rows[0]["TOTALE"];
            ds27.TotalePatrimonio.Rows.Add(drTot);
        }

        dsr.DatiSezione = ds27;
        dsr.Esito = ds27.Patrimonio.Rows.Count;

        return dsr;
    }

    #endregion
}