214 lines
5.7 KiB
C#
214 lines
5.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
|
|
namespace PDFGenerator.BusinessLayer
|
|
{
|
|
/// <summary>
|
|
/// Summary description for Capitolo
|
|
/// </summary>
|
|
public class CapitoloReport : Report
|
|
{
|
|
private Int32 _id;
|
|
private string _titolo;
|
|
private string _testoIntroduttivo;
|
|
private string _testoIntroduttivoAlternativo;
|
|
private List<ParagrafoReport> _children = new List<ParagrafoReport>();
|
|
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<ParagrafoReport> Children
|
|
{
|
|
get
|
|
{
|
|
return _children;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
public CapitoloReport()
|
|
{
|
|
_checkstampaelemento = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
/// <param name="idCapitolo"></param>
|
|
public CapitoloReport(int idCapitolo)
|
|
{
|
|
_id = idCapitolo;
|
|
_checkstampaelemento = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore.
|
|
/// </summary>
|
|
/// <param name="idCapitolo">id del Capitolo</param>
|
|
/// <param name="SourceDatarow">Datarow che contiene i campi:
|
|
/// queryOracleCapitolo,
|
|
/// titoloCapitolo,
|
|
/// testoCapitolo,
|
|
/// stampainnuovapagina
|
|
/// che valorizzano le rispettive proprietà dell'oggetto capitolo.
|
|
/// </param>
|
|
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
|
|
/// <summary>
|
|
/// Imposta o recupera l'Id del Capitolo.
|
|
/// </summary>
|
|
public new int Id
|
|
{
|
|
get { return _id; }
|
|
set { _id = value; }
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera il Titolo del Capitolo.
|
|
/// </summary>
|
|
public new string Titolo
|
|
{
|
|
get { return _titolo; }
|
|
set { _titolo = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera il testo che introduce il Capitolo.
|
|
/// </summary>
|
|
public new string TestoIntroduttivo
|
|
{
|
|
get { return _testoIntroduttivo; }
|
|
set { _testoIntroduttivo = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera il testo alternativo che introduce il Capitolo.
|
|
/// </summary>
|
|
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.
|
|
/// </summary>
|
|
public string QuerySql
|
|
{
|
|
get { return _querySql; }
|
|
set { _querySql = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera l'ordine di stampa del capitolo.
|
|
/// </summary>
|
|
public new int Ordine
|
|
{
|
|
get { return _ordine; }
|
|
set { _ordine = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Restituisce l'oggetto Report padre dell'oggetto Capitolo corrente.
|
|
/// </summary>
|
|
public Report CapitoloParent
|
|
{
|
|
get { return _parent; }
|
|
set { _parent = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Indica se il capitolo deve essere stampato oppure no.
|
|
/// Di default true
|
|
/// </summary>
|
|
public new bool CheckStampaElemento
|
|
{
|
|
get { return _checkstampaelemento; }
|
|
set { _checkstampaelemento = value; }
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Indica se il capitolo è già stato stampato.
|
|
/// Utilizzato nei capitoli sottoposti a query.
|
|
/// </summary>
|
|
public bool CheckStampato
|
|
{
|
|
get { return _checkstampato; }
|
|
set { _checkstampato = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Intermediario associato al capitolo.
|
|
/// Utilizzato nei capitoli sottoposti a query.
|
|
/// </summary>
|
|
public string Intermediario
|
|
{
|
|
get { return _intermediario; }
|
|
set { _intermediario = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Indica se il testo del capitolo va stampato in una nuova pagina del documento.
|
|
/// Di default = false.
|
|
/// </summary>
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|