using System; using System.Collections.Generic; using System.Data; namespace PDFGenerator.BusinessLayer { /// /// Summary description for Capitolo /// public class CapitoloReport : Report { private Int32 _id; private string _titolo; private string _testoIntroduttivo; private string _testoIntroduttivoAlternativo; private List _children = new List(); private string _querySql; private Int32 _ordine; private Report _parent; private bool _checkstampaelemento; private bool _checkstampato; private string _intermediario = string.Empty; private bool _stampainnuovapagina = false; public List Children { get { return _children; } } /// /// Costruttore /// public CapitoloReport() { _checkstampaelemento = true; } /// /// Costruttore /// /// public CapitoloReport(int idCapitolo) { _id = idCapitolo; _checkstampaelemento = true; } /// /// Costruttore. /// /// id del Capitolo /// Datarow che contiene i campi: /// queryOracleCapitolo, /// titoloCapitolo, /// testoCapitolo, /// stampainnuovapagina /// che valorizzano le rispettive proprietà dell'oggetto capitolo. /// public CapitoloReport(int idCapitolo, DataRow SourceDatarow) : this(idCapitolo) { _querySql = SourceDatarow["querySqlCapitolo"].ToString(); _titolo = SourceDatarow["titoloCapitolo"].ToString(); _testoIntroduttivo = SourceDatarow["testoCapitolo"].ToString(); _testoIntroduttivoAlternativo = SourceDatarow["testoCapitoloAlternativo"] == DBNull.Value ? string.Empty : SourceDatarow["testoCapitoloAlternativo"].ToString(); _stampainnuovapagina = Convert.ToBoolean(SourceDatarow["nuovaPaginaCapitolo"]); } #region Proprieta /// /// Imposta o recupera l'Id del Capitolo. /// public new int Id { get { return _id; } set { _id = value; } } /// /// Imposta o recupera il Titolo del Capitolo. /// public new string Titolo { get { return _titolo; } set { _titolo = value; } } /// /// Imposta o recupera il testo che introduce il Capitolo. /// public new string TestoIntroduttivo { get { return _testoIntroduttivo; } set { _testoIntroduttivo = value; } } /// /// Imposta o recupera il testo alternativo che introduce il Capitolo. /// public string TestoIntroduttivoAlternativo { get { return _testoIntroduttivoAlternativo; } set { _testoIntroduttivoAlternativo = value; } } /// Imposta o recupera il nome del file .sql contenente la select oracle /// da lanciare nel caso in cui il capitolo sia sottoposto a query. /// public string QuerySql { get { return _querySql; } set { _querySql = value; } } /// /// Imposta o recupera l'ordine di stampa del capitolo. /// public new int Ordine { get { return _ordine; } set { _ordine = value; } } /// /// Restituisce l'oggetto Report padre dell'oggetto Capitolo corrente. /// public Report CapitoloParent { get { return _parent; } set { _parent = value; } } /// /// Indica se il capitolo deve essere stampato oppure no. /// Di default true /// public new bool CheckStampaElemento { get { return _checkstampaelemento; } set { _checkstampaelemento = value; } } /// /// Indica se il capitolo è già stato stampato. /// Utilizzato nei capitoli sottoposti a query. /// public bool CheckStampato { get { return _checkstampato; } set { _checkstampato = value; } } /// /// Intermediario associato al capitolo. /// Utilizzato nei capitoli sottoposti a query. /// public string Intermediario { get { return _intermediario; } set { _intermediario = value; } } /// /// Indica se il testo del capitolo va stampato in una nuova pagina del documento. /// Di default = false. /// public bool StampaInNuovaPagina { get { return _stampainnuovapagina; } set { _stampainnuovapagina = value; } } #endregion #region Metodi public void Add(ParagrafoReport child) { _children.Add(child); } public void Remove(ParagrafoReport child) { _children.Remove(child); } public new void Disegna() { foreach (ParagrafoReport child in _children) { child.ParagrafoParent = this; child.Disegna(); } } #endregion } }