156 lines
8.3 KiB
C#
156 lines
8.3 KiB
C#
using ceTe.DynamicPDF;
|
|
using DataAccessLayer;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace PDFGeneratorLetteraBenvenuto
|
|
{
|
|
public class TemplateProvider
|
|
{
|
|
string _templateReportPath;
|
|
string _templateCopertinaPath;
|
|
string _templateGlossarioPath;
|
|
string _templateWelcomeLetterPath;
|
|
public float _reportTypeFontColor_R;
|
|
public float _reportTypeFontColor_G;
|
|
public float _reportTypeFontColor_B;
|
|
public float _chapterBackground_R;
|
|
public float _chapterBackground_G;
|
|
public float _chapterBackground_B;
|
|
public float _chapterFontColor_R;
|
|
public float _chapterFontColor_G;
|
|
public float _chapterFontColor_B;
|
|
public float _tableHeaderFontColor_R;
|
|
public float _tableHeaderFontColor_G;
|
|
public float _tableHeaderFontColor_B;
|
|
private Stream _templateReportStream;
|
|
private Stream _templateCopertinaStream;
|
|
private Stream _templateGlossarioStream;
|
|
private Stream _templateWelcomeLetterStream;
|
|
|
|
|
|
int _tipoReport;
|
|
string _rete;
|
|
bool _periodico;
|
|
|
|
public TemplateProvider(int TipoReport, string rete, bool periodico, int idReportDiagnosi)
|
|
{
|
|
_tipoReport = TipoReport;
|
|
_rete = rete;
|
|
_periodico = periodico;
|
|
|
|
|
|
|
|
using (DataAccessDE de = new DataAccessDE(DBProvider.SqlServerStampeC6))
|
|
{
|
|
IDataReader rd = de.ExecuteDataReaderStoredProcedure(DBProvider.SqlServerStampeC6, "dbo.GetPDFTemplateConfiguration_Rosaspina",
|
|
new List<Parametro>()
|
|
{
|
|
new Parametro() { ParameterName = "Rete", Value = rete },
|
|
new Parametro() { ParameterName = "Trimestrale", Value = (periodico ? 1:0) },
|
|
new Parametro() { ParameterName = "Tipo", Value = TipoReport }
|
|
});
|
|
if (rd.Read())
|
|
{
|
|
//_templateReportPath = rd["TemplateReportPath"].ToString();
|
|
//_templateCopertinaPath = rd["TemplateCopertinaPath"].ToString();
|
|
//_templateGlossarioPath = rd["TemplateGlossarioPath"].ToString();
|
|
//_templateWelcomeLetterPath = rd["TemplateWelcomeLetterPath"].ToString();
|
|
|
|
|
|
/*********** Forzatura per Test - Pino **************/
|
|
if (idReportDiagnosi != 6)
|
|
{
|
|
_templateReportPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\Templ_BFreport.pdf";
|
|
_templateCopertinaPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\Templ_copertinaSP.pdf";
|
|
_templateGlossarioPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\GlossarioBF_REPORT_MONITORAGGIO.pdf";
|
|
//_templateWelcomeLetterPath = @"C:\Users\andrea.magliacane\OneDrive - Accenture\Desktop\Cartella_progetti\TP_SEI_Project_15062021\TP_SEI_Project\root\ContrattoSEI\PDFGenerator\PDFTemplate\TemplateBF_New2.pdf";
|
|
_templateWelcomeLetterPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\TemplateBF_New2.pdf";
|
|
}
|
|
else
|
|
{
|
|
/* PER SIMULARE DIRECT BANK Pino */
|
|
_templateReportPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\Templ_BFreport_DB.pdf";
|
|
_templateCopertinaPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\Templ_copertinaBF_DB_1.pdf";
|
|
_templateGlossarioPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\GlossarioBF_REPORT_MONITORAGGIO.pdf";
|
|
_templateWelcomeLetterPath = @"C:\FideuramTrimestrale\TP_SEI_Project_Trimestrale\root\ContrattoSEI\PDFGenerator\PDFTemplate\TemplateBF_New2_DB_2.pdf";
|
|
}
|
|
/***************************************************/
|
|
|
|
|
|
_reportTypeFontColor_R = (float)(((Double)Int32.Parse(rd["ReportTypeFontColor_R"].ToString())) / 255.00);
|
|
_reportTypeFontColor_G = (float)(((Double)Int32.Parse(rd["ReportTypeFontColor_G"].ToString())) / 255.00);
|
|
_reportTypeFontColor_B = (float)(((Double)Int32.Parse(rd["ReportTypeFontColor_B"].ToString())) / 255.00);
|
|
|
|
_chapterBackground_R = (float)(((Double)Int32.Parse(rd["ChapterBackground_R"].ToString())) / 255.00);
|
|
_chapterBackground_G = (float)(((Double)Int32.Parse(rd["ChapterBackground_G"].ToString())) / 255.00);
|
|
_chapterBackground_B = (float)(((Double)Int32.Parse(rd["ChapterBackground_B"].ToString())) / 255.00);
|
|
|
|
_chapterFontColor_R = (float)(((Double)Int32.Parse(rd["ChapterFontColor_R"].ToString())) / 255.00);
|
|
_chapterFontColor_G = (float)(((Double)Int32.Parse(rd["ChapterFontColor_G"].ToString())) / 255.00);
|
|
_chapterFontColor_B = (float)(((Double)Int32.Parse(rd["ChapterFontColor_B"].ToString())) / 255.00);
|
|
|
|
_tableHeaderFontColor_R = (float)(((Double)Int32.Parse(rd["TableHeaderFontColor_R"].ToString())) / 255.00);
|
|
_tableHeaderFontColor_G = (float)(((Double)Int32.Parse(rd["TableHeaderFontColor_G"].ToString())) / 255.00);
|
|
_tableHeaderFontColor_B = (float)(((Double)Int32.Parse(rd["TableHeaderFontColor_B"].ToString())) / 255.00);
|
|
|
|
(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());
|
|
}
|
|
}
|
|
}
|
|
|
|
public int SignYPosition
|
|
{
|
|
get
|
|
{
|
|
return 716;// (!_periodico && _tipoReport == 2) ? 716 : 720; //_rete == "S" &&
|
|
|
|
}
|
|
}
|
|
|
|
public int LetteraAccompagnamentoPeriodicoSalutiYBonus { get { return -5; } }// (!_periodico && _tipoReport == 2) ? -33 : -50; } } //_rete == "S"
|
|
public int LetteraAccompagnamentoPeriodicoFirmaYBonus { get { return -5; } }// (!_periodico && _tipoReport == 2) ? -45 : -50; } } //_rete == "S" &&
|
|
|
|
public int SalutiYBonus { get { return 15; } }// (!_periodico && _tipoReport == 2) ? 10 : 15; } } //_rete == "S" &&
|
|
public System.IO.Stream TemplateReport { get { return _templateReportStream; } }
|
|
public System.IO.Stream TemplateWelcomeLetter { get { return _templateWelcomeLetterStream; } }
|
|
public System.IO.Stream TemplateCopertina { get { return _templateCopertinaStream; } }
|
|
public System.IO.Stream TemplateGlossario { get { return _templateGlossarioStream; } }
|
|
public ceTe.DynamicPDF.RgbColor ReportTypeFontColor
|
|
{
|
|
get
|
|
{
|
|
return new ceTe.DynamicPDF.RgbColor(_reportTypeFontColor_R, _reportTypeFontColor_G, _reportTypeFontColor_B);
|
|
}
|
|
}
|
|
public ceTe.DynamicPDF.RgbColor ChapterBackgroundColor
|
|
{
|
|
get
|
|
{
|
|
return new ceTe.DynamicPDF.RgbColor(_chapterBackground_R, _chapterBackground_G, _chapterBackground_B);
|
|
}
|
|
}
|
|
public ceTe.DynamicPDF.RgbColor ChapterFontColor
|
|
{
|
|
get
|
|
{
|
|
return new ceTe.DynamicPDF.RgbColor(_chapterFontColor_R, _chapterFontColor_G, _chapterFontColor_B);
|
|
}
|
|
}
|
|
public ceTe.DynamicPDF.RgbColor TableHeaderFontColor
|
|
{
|
|
get
|
|
{
|
|
return new ceTe.DynamicPDF.RgbColor(_tableHeaderFontColor_R, _tableHeaderFontColor_G, _tableHeaderFontColor_B);
|
|
}
|
|
}
|
|
}
|
|
}
|