using System; using System.Data; using Consulenza.ReportWriter.Business.OBJ_PDF; using ceTe.DynamicPDF; using Consulenza.ReportWriter.Business; using System.Collections.Generic; namespace Consulenza.ReportWriter.Manager.Section.Base.Proposta { public class T9 : Entity.Section { public T9(EnvironmentFacade environmentFacade, int idSection) : base(environmentFacade, idSection) { try { Draw(); } catch (Exception ex) { SectionLogger.Write("T9", ex.Message, SectionLoggerMessageLevel.E, base.EnvironmentFacade.ReportEnvironment); } } /// /// Disegna l'oggetto T9 /// protected override sealed void Draw() { var dtT9 = GetText(); if (dtT9.Rows.Count <= 0) return; //Adriano //Adriano: bisogna poi avere anche l'info sul tipo cliente (pro/ret) var cliente = GetCliente(); bool profiloProfessionale = false; if (cliente.Rows[0]["TipoConsulenza"].ToString() == "P") profiloProfessionale = true; bool profiloAggressivo = Convert.ToInt32(cliente.Rows[0]["Profilo"].ToString().Substring(0, 1)) >= 5; bool profiloProfessionaleAggressivo = profiloProfessionale && profiloAggressivo; //--Adriano //Adriano string stringaTestoIntroduttivo; if(profiloProfessionale) stringaTestoIntroduttivo = dtT9.Rows[0]["Testo2"].ToString(); else stringaTestoIntroduttivo = dtT9.Rows[0]["Testo1"].ToString(); var testoIntroduttivo = new FormattedTextAreaPDF(stringaTestoIntroduttivo, base.EnvironmentFacade.RendererFacade.XLeftLimit + 5) //--Adriano //originale: //string stringaTestoIntroduttivo = dtT9.Rows[0]["Testo1"].ToString(); //var testoIntroduttivo = new FormattedTextAreaPDF(stringaTestoIntroduttivo, base.EnvironmentFacade.RendererFacade.XLeftLimit + 5) { TextHorizontalAlign = TextAlign.Justify }; base.AddElement(testoIntroduttivo); base.AddElement(new SpacePDF(20)); } protected DataTable GetCliente() { var parametri = new List(); #region Definizione dei parametri var parametro = new Parametro { Direction = ParameterDirection.Input, DbType = DbType.Int64, ParameterName = "chiaveClientePB", Value = EnvironmentFacade.ReportEnvironment.Cliente.Chiave }; parametri.Add(parametro); parametro = new Parametro { Direction = ParameterDirection.Input, DbType = DbType.Int32, ParameterName = "chiaveProposta", Value = EnvironmentFacade.ReportEnvironment.Proposta.Chiave }; parametri.Add(parametro); #endregion return EnvironmentFacade.ReportEnvironment.Proposta.PropostaCBUnica ? DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_Prop_P10", parametri) : DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerConsulenzaBase, "REP_Prop_P10", parametri); } /// /// Recupera i dati necessari alla Section restituendo un DataTable. /// /// protected sealed override DataTable GetDataTable() { return null; } /// /// Recupera i dati necessari alla Section restituendo un DataSet. /// /// protected sealed override DataSet GetDataSet() { return null; } } }