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

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

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

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


            var testoIntroduttivo = new FormattedTextAreaPDF(stringaTestoIntroduttivo, EnvironmentFacade.RendererFacade.XLeftLimit + 5)
            {
                TextHorizontalAlign = TextAlign.Justify
            };

            AddElement(testoIntroduttivo);
            AddElement(new SpacePDF(10));
        }

        /// <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;
        }
    }
}
