using System;
using System.Collections.Generic;
using System.Linq;
using Consulenza.ExternalServices;
using Consulenza.ReportWriter.Business;
using Consulenza.ReportWriter.Business.OBJ_PDF;
using System.Data;
using Consulenza.ReportWriter.Business.CHART_PDF;
using Consulenza.ReportCommon;
using Consulenza.ReportWriter.Business.Entity;
using System.Text;
using Consulenza.ReportWriter.Business.Headers;

namespace Consulenza.ReportWriter.Manager.Section.Immobiliare.MonitoraggioNucleo
{
    /// <summary>
    /// Scheda 16
    /// </summary>
    public class S16 : Monitoraggio.S16
    {
        //public bool bEstero = false;

        public S16(EnvironmentFacade environmentFacade, int idSection)
            : base(environmentFacade, idSection)
        {
        }

        protected override DataSet GetDataSet()
        {
            var parametri = new List<Parametro>
            {
                new Parametro
                {
                    Direction = ParameterDirection.Input,
                    DbType = DbType.Int64,
                    ParameterName = "chiaveNucleo",
                    Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo
                }
            };

            var dt = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S28_MapStratImmEsteroNucleo", parametri);
            if (dt.Tables[0].Rows.Count > 0)
                bEstero = true;

            parametri = new List<Parametro>
            {
                new Parametro
                {
                    Direction = ParameterDirection.Input,
                    DbType = DbType.Int32,
                    ParameterName = "chiaveClientePB",
                    Value = null
                },
                new Parametro
                {
                    Direction = ParameterDirection.Input,
                    DbType = DbType.Int32,
                    ParameterName = "chiaveNucleo",
                    Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo
                }
            };

            return DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S_AnalisiRischioSintesi", parametri);
        }
    }
}
