using DataAccessLayer; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Configuration; using NLog; using System.Data.SqlClient; using System.Threading; namespace PDFGenerator.BusinessLayer.Utils { //public class TemplateProvider //{ // private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); // private string _templateReportPath; // private string _templateCopertinaPath; // private string _templateGlossarioPath; // private string _templateWelcomeLetterPath; // private float _reportTypeFontColor_R; // private float _reportTypeFontColor_G; // private float _reportTypeFontColor_B; // private float _chapterBackground_R; // private float _chapterBackground_G; // private float _chapterBackground_B; // private float _chapterFontColor_R; // private float _chapterFontColor_G; // private float _chapterFontColor_B; // private float _tableHeaderFontColor_R; // private float _tableHeaderFontColor_G; // private float _tableHeaderFontColor_B; // private Stream _templateReportStream; // private Stream _templateCopertinaStream; // private Stream _templateGlossarioStream; // private Stream _templateWelcomeLetterStream; // // 2 // public static int idReportDiagnosi; // public static string CF; // public static BusinessLayer.DataThread _dataThread; // private string ambiente = CACHE.AMBIENTE; // private DataTable Rosaspina = null; // public TemplateProvider(int contratto, string rete, bool periodico) // { // try // { // Rosaspina = null; // try // { // using (SQLServer db = new SQLServer()) // { // Rosaspina = db.GetDataTableFromProcedure("dbo.GetPDFTemplateConfiguration_Rosaspina", // new List() // { // new SqlParameter("Rete",rete), // new SqlParameter("Trimestrale",(periodico ? 1:0)), // new SqlParameter("Tipo",contratto) // } // ); // } // } // catch (Exception exx) // { // logger.Errors(exx); // } // if (Rosaspina != null && Rosaspina.Rows.Count > 0) // { // DataRow rd = Rosaspina.Rows[0]; // _reportTypeFontColor_R = rd["ReportTypeFontColor_R"].ToByte(); // _reportTypeFontColor_G = rd["ReportTypeFontColor_G"].ToByte(); // _reportTypeFontColor_B = rd["ReportTypeFontColor_B"].ToByte(); // _chapterBackground_R = rd["ChapterBackground_R"].ToByte(); // _chapterBackground_G = rd["ChapterBackground_G"].ToByte(); // _chapterBackground_B = rd["ChapterBackground_B"].ToByte(); // _chapterFontColor_R = rd["ChapterFontColor_R"].ToByte(); // _chapterFontColor_G = rd["ChapterFontColor_G"].ToByte(); // _chapterFontColor_B = rd["ChapterFontColor_B"].ToByte(); // _tableHeaderFontColor_R = rd["TableHeaderFontColor_R"].ToByte(); // _tableHeaderFontColor_G = rd["TableHeaderFontColor_G"].ToByte(); // _tableHeaderFontColor_B = rd["TableHeaderFontColor_B"].ToByte(); // _templateReportPath = rd["TemplateReportPath"].ToString(); // _templateCopertinaPath = rd["TemplateCopertinaPath"].ToString(); // _templateGlossarioPath = rd["TemplateGlossarioPath"].ToString(); // _templateWelcomeLetterPath = rd["TemplateWelcomeLetterPath"].ToString(); // } // if (ambiente == "SVILUPPO") // { // if (idReportDiagnosi != 6) // { // _templateReportPath = @"C:\TEMPLATES\PDFGeneration_FILE\S\Templ_BFreport.pdf"; // _templateCopertinaPath = @"C:\TEMPLATES\PDFGeneration_FILE\S\Templ_copertinaSP.pdf"; // _templateGlossarioPath = @"C:\TEMPLATES\PDFGeneration_FILE\S\Glossario.pdf"; // _templateWelcomeLetterPath = @"C:\TEMPLATES\PDFGeneration_FILE\S\TemplateBF.pdf"; // } // else // { // _templateReportPath = @"C:\TEMPLATES\PDFGeneration_FILE\FD\Report.pdf"; // _templateCopertinaPath = @"C:\TEMPLATES\PDFGeneration_FILE\FD\copertinaBF.pdf"; // _templateGlossarioPath = @"C:\TEMPLATES\PDFGeneration_FILE\FD\Glossario.pdf"; // _templateWelcomeLetterPath = @"C:\TEMPLATES\PDFGeneration_FILE\FD\Lettera.pdf"; // } // } // logger.Infos(" Utils -> _templateReportPath = " + _templateReportPath); // (new FileStream(_templateWelcomeLetterPath, FileMode.Open, FileAccess.Read)).CopyTo(_templateWelcomeLetterStream = new MemoryStream()); // (new FileStream(_templateReportPath, FileMode.Open, FileAccess.Read)).CopyTo(_templateReportStream = new MemoryStream()); // (new FileStream(_templateCopertinaPath, FileMode.Open, FileAccess.Read)).CopyTo(_templateCopertinaStream = new MemoryStream()); // (new FileStream(_templateGlossarioPath, FileMode.Open, FileAccess.Read)).CopyTo(_templateGlossarioStream = new MemoryStream()); // } // catch (Exception ex) // { // logger.Errors(ex); // } // } // public int SignYPosition { get { return 716; } } // public int LetteraAccompagnamentoPeriodicoSalutiYBonus { get { return -5; } } // public int LetteraAccompagnamentoPeriodicoFirmaYBonus { get { return -5; } } // public int SalutiYBonus { get { return 15; } } // public int MarginRight { get { return 259; } } // public int GlossarioMarginRight { get { return 40; } } // public int MarginDown { get { return 105; } } // public System.IO.Stream TemplateWelcomeLetter { get { return _templateWelcomeLetterStream; } } // public System.IO.Stream TemplateReport { get { return _templateReportStream; } } // public System.IO.Stream TemplateCopertina { get { return _templateCopertinaStream; } } // public ceTe.DynamicPDF.RgbColor ReportTypeFontColor { get { // return new ceTe.DynamicPDF.RgbColor(_reportTypeFontColor_R, _reportTypeFontColor_G, _reportTypeFontColor_B); // } } // public ceTe.DynamicPDF.RgbColor ChapterBackgroundColor { get { // if (idReportDiagnosi != 6) // return new ceTe.DynamicPDF.RgbColor(_chapterBackground_R, _chapterBackground_G, _chapterBackground_B); // else // return new ceTe.DynamicPDF.RgbColor(34, 128, 0); // } } // public ceTe.DynamicPDF.RgbColor ChapterFontColor // { // get // { // if (idReportDiagnosi != 6) // return new ceTe.DynamicPDF.RgbColor(_chapterFontColor_R, _chapterFontColor_G, _chapterFontColor_B); // else // return new ceTe.DynamicPDF.RgbColor(34, 128, 0); // } // } // public ceTe.DynamicPDF.RgbColor TableHeaderFontColor // { // get // { // return new ceTe.DynamicPDF.RgbColor(_tableHeaderFontColor_R, _tableHeaderFontColor_G, _tableHeaderFontColor_B); // } // } //} }