2025-04-15 12:10:19 +02:00

57 lines
3.7 KiB
C#

using System;
using System.Configuration;
class LetteraRistampa : LetteraBenvenuto {
//private FormattedTextArea saluti;
public LetteraRistampa (string rete, int id, string testo, string nome, string cognome, string indirizzo, string appellativo,string obj,string firma, TipoContratto contract)
: base(rete,id, testo, nome, cognome,indirizzo,true,appellativo,obj,firma, contract,0) {
string[] valoriTextArea = ConfigurationManager.AppSettings["OffSetLetteraRistampaCliente"].Split(',');
this.cliente.Height = this.cliente.Height + Convert.ToInt32(valoriTextArea[3]);
valoriTextArea = ConfigurationManager.AppSettings["OffSetLetteraRistampaOggetto"].Split(',');
this.oggetto.Width = this.cliente.Width + Convert.ToInt32(valoriTextArea[2]);
this.oggetto.Y = this.oggetto.Y + Convert.ToInt32(valoriTextArea[1]);
valoriTextArea = ConfigurationManager.AppSettings["OffSetLetteraRistampaLuogo"].Split(',');
this.luogo.Y = this.luogo.Y + Convert.ToInt32(valoriTextArea[1]);
valoriTextArea = ConfigurationManager.AppSettings["OffSetLetteraRistampaCorpo"].Split(',');
this.corpo.Height = this.corpo.Height + Convert.ToInt32(valoriTextArea[1]);;
this.corpo.Width = this.corpo.Width + Convert.ToInt32(valoriTextArea[2]);
this.corpo.Y = this.corpo.Y + Convert.ToInt32(valoriTextArea[1]);
valoriTextArea = ConfigurationManager.AppSettings["OffsetLetteraRistampaSaluti"].Split(',');
this.saluti.X += Convert.ToSingle(valoriTextArea[0]);
this.saluti.Y += Convert.ToSingle(valoriTextArea[1]);
this.saluti.Width += Convert.ToSingle(valoriTextArea[2]);
//this.saluti.Height += Convert.ToSingle(valoriTextArea[0]);
this.settaCampi();
this.nomeLettera = "LetteraRistampa" + id;
}
protected override void settaCampi() {
this.cliente.Text = this.appellativo.Trim() + "\r\n" + nome.Trim() + " " + cognome.Trim() + "\r\n" + indirizzo.Trim();
int fontLenght = Convert.ToInt32(ConfigurationManager.AppSettings["fontSize"]);
float lenght = ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.appellativo.Trim(), fontLenght) > ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.nome.Trim(), fontLenght) ? ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.appellativo.Trim(), fontLenght) : ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.nome.Trim(), fontLenght);
lenght = lenght > ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.cognome.Trim(), fontLenght) ? lenght : ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.cognome.Trim(), fontLenght);
lenght = lenght > ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.indirizzo.Trim(), fontLenght) ? lenght : ceTe.DynamicPDF.Font.TimesRoman.GetTextWidth(this.indirizzo.Trim(), fontLenght);
float end_pos = this.cliente.Width + this.cliente.X;
//this.cliente.X = end_pos - lenght;// * (float)(5)-63;
//this.cliente.Width = lenght;// * (float)(5)+63;
this.luogo.Text = "<B>Relazione Clientela</B>\r\nTorino, " + dataGenerazione.ToString("dd/MM/yyyy");
this.oggetto.Text = this.testoOggetto; //"<B>Oggetto: contratto n. " + codiceContratto + " intestato a: " + nome + " " + cognome+"</B>";
this.corpo.Text = testo;
this.saluti.Text = this.testoSaluti;
string[] valoriTextArea = ConfigurationManager.AppSettings["OffsetFirmaRistampa"].Split(',');
this.firma.X += Convert.ToSingle(valoriTextArea[0]);
this.firma.Y += Convert.ToSingle(valoriTextArea[1]);
}
}