using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.Data; namespace LogFilePDF { public struct TabellaLog { private string evento; public string Evento { get { return evento; } set { evento = value; } } private string data; public string Data { get { return data; } set { data = value; } } private string ora; public string Ora { get { return ora; } set { ora = value; } } private string utente; public string Utente { get { return utente; } set { utente = value; } } } public enum EventLog { RM_GenerazioneReportdapartePB = 0, C6_GenerazioneAutomaticaDiagnosiIniziale = 1, C6_GenerazioneAutomaticaReportPeriodico = 2, SELECTA_RistampaReport = 3, C6_LetteraAccompagnamento = 4, CambioStato_VerificareLocked = 5, CambioStato_UnlockedLocked = 6, } public class GestoreLogPDF { private string nome; private string cognome; private string applicativo; //da prendere nel appconfig private string rete; private string pb; private string cf; private int identificativoPdf; #region CTOR public GestoreLogPDF() { this.applicativo = ConfigurationManager.AppSettings["applicativo"]; } public GestoreLogPDF(int idPdf) : this() { this.identificativoPdf = idPdf; } public GestoreLogPDF(string nome, string cognome, string rete, string PB, string cf, int idPdf) : this(){ this.nome = nome; this.cognome = cognome; this.rete = rete; this.pb = PB; this.cf = cf; this.identificativoPdf = idPdf; } public GestoreLogPDF(string nome, string cognome, string rete, string PB, string cf) : this(nome,cognome,rete,PB,cf,0) {} #endregion public TabellaLog[] leggiLog() { DataTable dt = GestoreLogPDF_DAO.leggi(this); TabellaLog t; TabellaLog[] result = new TabellaLog[dt.Rows.Count]; int i = 0; foreach (DataRow r in dt.Rows) { t = new TabellaLog(); t.Evento = r["Evento"].ToString(); t.Utente = r["Nome"].ToString() + " " + r["Cognome"].ToString(); t.Data = ((DateTime)r["Data_Inserimento"]).ToShortDateString(); t.Ora = ((DateTime)r["Data_Inserimento"]).ToShortTimeString(); result[i++] = t; } return result; } public void scriviLog(EventLog tipo) { GestoreLogPDF_DAO.scrivi(this, tipo); } #region GET/SET Fields public string Nome { get { return nome; } set { nome = value; } } public string Cognome { get { return cognome; } set { cognome = value; } } public string Applicativo { get { return applicativo; } set { applicativo = value; } } public string Rete { get { return rete; } set { rete = value; } } public string Pb { get { return pb; } set { pb = value; } } public string Cf { get { return cf; } set { cf = value; } } public int IdentificativoPdf { get { return identificativoPdf; } set { identificativoPdf = value; } } #endregion } }