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 DSS155PatrimonioImmobiliare : 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);

        dsr.Esito = dt.Rows.Count;
        DataSetS155 ds155 = new DataSetS155();
        DataRow dr;

        ds155.Patrimonio.Columns["Localita"].Caption = "Località";
        ds155.Patrimonio.Columns["Affitti"].Caption += "<br> € &nbsp; &nbsp; &nbsp; &nbsp;";
        ds155.Patrimonio.Columns["Valore"].Caption += "<br> € &nbsp; &nbsp; &nbsp; &nbsp;";
        // PROQUOTA 20181228
        ds155.Patrimonio.Columns["ValoreProQuota"].Caption += "<br> € &nbsp; &nbsp; &nbsp; &nbsp;";
        //--PROQUOTA 20181228

        foreach (DataRow row in dt.Rows)
        {
            dr = ds155.Patrimonio.NewRow();
            dr["Descrizione"] = row["DESCRIZIONE"];
            dr["Tipologia"] = row["TIPOLOGIA"];
            dr["Localita"] = row["LOCALITA"];
            dr["Affitti"] = row["AFFITTOPERCEPITO"];
            dr["Valore"] = row["VALORE"];
            // PROQUOTA 20181228
            dr["ValoreProQuota"] = row["Valore_ProQuota"];
            dr["TipologiaDiritto"] = row["TipologiaDiritto"];
            dr["ProQuota"] = row["ProQuota"];
            //--PROQUOTA 20181228

            ds155.Patrimonio.Rows.Add(dr);
        }

        if (dt.Rows.Count > 0)
        {
            DataRow drTot = ds155.TotalePatrimonio.NewRow();
            drTot["Descrizione"] = "TOTALE";
            drTot["Valore"] = dt.Rows[0]["TOTALE"];
            drTot["TotaleAffitto"] = dt.Rows[0]["TotaleAffitto"];
            // PROQUOTA 20181228
            drTot["ValoreProQuota"] = dt.Rows[0]["TotaleProQuota"];
            //--PROQUOTA 20181228

            ds155.TotalePatrimonio.Rows.Add(drTot);
        }

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

        return dsr;
    }

    #endregion
}