using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Text;
using PDFGenerator.Presentation.Section.Tables;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.BusinessLayer;
using System.Resources;
using System.Reflection;

namespace PDFGenerator.Presentation.Section
{
    class S130 : ISezione
    {
        private string _header = "";

        public string Header
        {
            get { return _header; }
            set { _header = value; }
        }

        private TipoReport _tipologiaReport;
        public TipoReport TipologiaReport
        {
            get { return _tipologiaReport; }
            set { _tipologiaReport = value; }
        }

        private string _testoIntroduttivo = string.Empty;
        public string TestoIntroduttivo
        {
            get { return _testoIntroduttivo; }
            set { _testoIntroduttivo = value; }
        }

        private string _testoChiusura = string.Empty;
        public string TestoChiusura
        {
            get { return _testoChiusura; }
            set { _testoChiusura = value; }
        }


        public S130()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        #region ISezione Members

        public void writeSezione(DataThread dataThread)
        {
            DocumentPDF document = dataThread.DocumentPDF;
            //DataSectionParameter dataSectionParameter = paramSez.getParam();

            DataSetS130 set = (DataSetS130)dataThread.Data.DatiSezione;
           
            document.setSezTitolo(dataThread.SezioneReport.Titolo);
            string tempTesto = dataThread.SezioneReport.TestoIntroduttivo;

            document.setChapterHeader(tempTesto, 0, 520, 8);

            float YTable = document.getLastPos();
            float XTable = document.getMargineLeft();  

            DatiTabella datitab = new DatiTabella();
            datitab.SetRowDim(15);
            datitab.table = set.Tables["PrincipaliPosizioni"];
            Tabella tabellaDati = new Tabella(XTable, YTable);
            tabellaDati.Header = true;
            tabellaDati.AltezzaCella = 15;
            tabellaDati.Datasource = datitab.table;
            tabellaDati.Colonne.Add(new Colonna("Prodotto", "Prodotto", 312, TipoAllineamento.SINISTRA, false, 9, false));
            tabellaDati.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 100, TipoAllineamento.DESTRA, false, 9, false));
            tabellaDati.Colonne.Add(new Colonna("PesoRelativo", "Peso Relativo (%)",100, TipoAllineamento.DESTRA, false, 9, false));
            tabellaDati.Draw(datitab, document);

            document.setLastPos(((datitab.getNumRow() * datitab.GetRowDim()) + datitab.getHeaderDim()) - 20);
            
        }
        #endregion

    }
}