using System;
using System.Data;
using Consulenza.ReportWriter.Business.OBJ_PDF;
using Consulenza.ReportCommon;
using Consulenza.ReportWriter.Business;

namespace Consulenza.ReportWriter.Manager.Section.Base.Proposta
{
    public class T3 : Entity.Section
    {
        public T3(EnvironmentFacade environmentFacade, int idSection)
            : base(environmentFacade, idSection)
        {
            try
            {
                Draw();
            }
            catch (Exception ex)
            {
                SectionLogger.Write("T3", ex.Message, SectionLoggerMessageLevel.E, base.EnvironmentFacade.ReportEnvironment);
            }
        }

        /// <summary>
        /// Disegna l'oggetto T3
        /// </summary>
        protected override sealed void Draw()
        {
            var dtT3 = GetText();

            var stringaTestoIntroduttivo = base.EnvironmentFacade.ReportEnvironment.Proposta.EsitoAdeguatezza == TipologiaEsitoAdeguatezza.Adeguata ? 
                dtT3.Rows[0]["Testo1"].ToString() : 
                dtT3.Rows[0]["Testo2"].ToString();


            var testoIntroduttivo = new FormattedTextAreaPDF(stringaTestoIntroduttivo, base.EnvironmentFacade.RendererFacade.XLeftLimit + 5)
            {
                ID = "T3"
            };

            base.AddElement(testoIntroduttivo);
            base.AddElement(new SpacePDF(20));
        }

        /// <summary>
        /// Recupera i dati necessari alla Section restituendo un DataTable.
        /// </summary>
        /// <returns></returns>
        protected sealed override DataTable GetDataTable()
        {
            return null;
        }

        /// <summary>
        /// Recupera i dati necessari alla Section restituendo un DataSet.
        /// </summary>
        /// <returns></returns>
        protected sealed override DataSet GetDataSet()
        {
            return null;
        }
    }
}
