protected void btnConfermaInserimentoReferente_Click(object sender, EventArgs e) { //INSERISCO IL REFERENTE if (!string.IsNullOrEmpty(tbInsCognomeReferente.Text) && (string.IsNullOrEmpty(tbInsEmailReferente.Text) || basePage.ValidaIndirizzoEmail(tbInsEmailReferente.Text.Trim()))) { Esito esito = new Esito(); try { NascondiErroriValidazione(); Anag_Referente_Clienti_Fornitori nuovoReferente = new Anag_Referente_Clienti_Fornitori(); nuovoReferente.Id_azienda = Convert.ToInt32(ViewState["idAzienda"]); nuovoReferente.Attivo = cbInsAttivoReferente.Checked; nuovoReferente.Cognome = tbInsCognomeReferente.Text.Trim(); nuovoReferente.Nome = tbInsNomeReferente.Text.Trim(); nuovoReferente.Cellulare = tbInsCellulareReferente.Text.Trim(); nuovoReferente.Email = tbInsEmailReferente.Text.Trim(); nuovoReferente.Note = tbInsNoteReferente.Text.Trim(); nuovoReferente.Settore = tbInsSettoreReferente.Text.Trim(); nuovoReferente.Telefono1 = tbInsTelefono1Referente.Text.Trim(); nuovoReferente.Telefono2 = tbInsTelefono2Referente.Text.Trim(); int iNuovoReferente = Anag_Referente_Clienti_Fornitori_BLL.Instance.CreaReferente(nuovoReferente, ((Anag_Utenti)Session[SessionManager.UTENTE]), ref esito); if (esito.Codice != Esito.ESITO_OK) { basePage.ShowError(esito.Descrizione); } else { tbInsCognomeReferente.Text = ""; tbInsNomeReferente.Text = ""; tbInsCellulareReferente.Text = ""; tbInsEmailReferente.Text = ""; tbInsNoteReferente.Text = ""; tbInsSettoreReferente.Text = ""; tbInsTelefono1Referente.Text = ""; tbInsTelefono2Referente.Text = ""; cbInsAttivoReferente.Checked = true; editAzienda(); } } catch (Exception ex) { if (esito.Codice == Esito.ESITO_OK) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = ex.Message + Environment.NewLine + ex.StackTrace; } basePage.ShowError(ex.Message); } } else { basePage.ShowError("Verificare il corretto inserimento dei campi"); } }
protected void gvMod_Referenti_RigaSelezionata(object sender, EventArgs e) { //SCARICO IL REFERENTE SE SELEZIONATO if (gvMod_Referenti.SelectedIndex >= 0) { Esito esito = new Esito(); try { NascondiErroriValidazione(); string referenteSelezionato = gvMod_Referenti.Rows[gvMod_Referenti.SelectedIndex].Cells[1].Text; Anag_Referente_Clienti_Fornitori referente = Anag_Referente_Clienti_Fornitori_BLL.Instance.getReferenteById(ref esito, Convert.ToInt32(referenteSelezionato)); if (esito.Codice != Esito.ESITO_OK) { btnModificaReferente.Visible = false; btnInserisciReferente.Visible = true; tbIdReferenteDaModificare.Text = ""; basePage.ShowError(esito.Descrizione); } else { btnModificaReferente.Visible = true; btnInserisciReferente.Visible = false; tbIdReferenteDaModificare.Text = referente.Id.ToString(); tbInsCognomeReferente.Text = referente.Cognome; tbInsNomeReferente.Text = referente.Nome; tbInsSettoreReferente.Text = referente.Settore; tbInsEmailReferente.Text = referente.Email; tbInsTelefono1Referente.Text = referente.Telefono1; tbInsTelefono2Referente.Text = referente.Telefono2; tbInsNoteReferente.Text = referente.Note; tbInsCellulareReferente.Text = referente.Cellulare; cbInsAttivoReferente.Checked = referente.Attivo; } } catch (Exception ex) { btnModificaReferente.Visible = false; btnInserisciReferente.Visible = true; tbIdReferenteDaModificare.Text = ""; if (esito.Codice == Esito.ESITO_OK) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = ex.Message + Environment.NewLine + ex.StackTrace; } basePage.ShowError(ex.Message); } } }
public List <Anag_Referente_Clienti_Fornitori> getReferentiByIdAzienda(ref Esito esito, int idAzienda) { List <Anag_Referente_Clienti_Fornitori> listaReferenti = new List <Anag_Referente_Clienti_Fornitori>(); try { using (SqlConnection con = new SqlConnection(sqlConstr)) { string query = "SELECT * FROM anag_referente_clienti_fornitori WHERE id_Azienda = " + idAzienda.ToString(); query += " ORDER BY settore,cognome,nome"; using (SqlCommand cmd = new SqlCommand(query)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); if (dt != null && dt.Rows != null && dt.Rows.Count > 0) { foreach (DataRow riga in dt.Rows) { Anag_Referente_Clienti_Fornitori referente = new Anag_Referente_Clienti_Fornitori(); referente.Id = riga.Field <int>("id"); referente.Id_azienda = riga.Field <int>("id_azienda"); referente.Nome = riga.Field <string>("nome"); referente.Cognome = riga.Field <string>("cognome"); referente.Email = riga.Field <string>("email"); referente.Cellulare = riga.Field <string>("cellulare"); referente.Settore = riga.Field <string>("settore"); referente.Telefono1 = riga.Field <string>("telefono1"); referente.Telefono2 = riga.Field <string>("telefono2"); referente.Note = riga.Field <string>("note"); referente.Attivo = riga.Field <bool>("attivo"); listaReferenti.Add(referente); } } } } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = ex.Message + Environment.NewLine + ex.StackTrace; } return(listaReferenti); }
public Anag_Referente_Clienti_Fornitori getReferenteById(ref Esito esito, int id) { Anag_Referente_Clienti_Fornitori referente = new Anag_Referente_Clienti_Fornitori(); try { using (SqlConnection con = new SqlConnection(sqlConstr)) { string query = "SELECT * FROM anag_referente_clienti_fornitori WHERE id = " + id.ToString(); using (SqlCommand cmd = new SqlCommand(query)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); if (dt != null && dt.Rows != null && dt.Rows.Count > 0) { referente.Id = dt.Rows[0].Field <int>("id"); referente.Id_azienda = dt.Rows[0].Field <int>("id_azienda"); referente.Nome = dt.Rows[0].Field <string>("nome"); referente.Cognome = dt.Rows[0].Field <string>("cognome"); referente.Email = dt.Rows[0].Field <string>("email"); referente.Cellulare = dt.Rows[0].Field <string>("cellulare"); referente.Settore = dt.Rows[0].Field <string>("settore"); referente.Telefono1 = dt.Rows[0].Field <string>("telefono1"); referente.Telefono2 = dt.Rows[0].Field <string>("telefono2"); referente.Note = dt.Rows[0].Field <string>("note"); referente.Attivo = dt.Rows[0].Field <bool>("attivo"); } else { esito.Codice = Esito.ESITO_KO_ERRORE_NO_RISULTATI; esito.Descrizione = "Nessun dato trovato nella tabella anag_referente_clienti_fornitori "; } } } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = ex.Message + Environment.NewLine + ex.StackTrace; } return(referente); }
public int CreaReferente(Anag_Referente_Clienti_Fornitori referente, Anag_Utenti utente, ref Esito esito) { //@id_azienda int, //@cognome varchar(50), //@nome varchar(50), //@settore varchar(30), //@telefono1 varchar(25), //@telefono2 varchar(25), //@cellulare varchar(25), //@email varchar(60), //@note varchar(200), //@id int output, //@attivo bit try { using (SqlConnection con = new SqlConnection(sqlConstr)) { using (SqlCommand StoreProc = new SqlCommand("InsertReferenteClientiFornitori")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { StoreProc.Connection = con; sda.SelectCommand = StoreProc; StoreProc.CommandType = CommandType.StoredProcedure; StoreProc.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output; // PARAMETRI PER LOG UTENTE SqlParameter idUtente = new SqlParameter("@idUtente", utente.id); idUtente.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(idUtente); SqlParameter nomeUtente = new SqlParameter("@nomeUtente", utente.username); nomeUtente.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(nomeUtente); // FINE PARAMETRI PER LOG UTENTE SqlParameter id_azienda = new SqlParameter("@id_azienda", referente.Id_azienda); id_azienda.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(id_azienda); SqlParameter cognome = new SqlParameter("@cognome", referente.Cognome); cognome.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(cognome); SqlParameter nome = new SqlParameter("@nome", referente.Nome); nome.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(nome); SqlParameter settore = new SqlParameter("@settore", referente.Settore); settore.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(settore); SqlParameter telefono1 = new SqlParameter("@telefono1", referente.Telefono1); telefono1.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(telefono1); SqlParameter telefono2 = new SqlParameter("@telefono2", referente.Telefono2); telefono2.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(telefono2); SqlParameter cellulare = new SqlParameter("@cellulare", referente.Cellulare); cellulare.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(cellulare); SqlParameter email = new SqlParameter("@email", referente.Email); email.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(email); SqlParameter note = new SqlParameter("@note", referente.Note); note.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(note); SqlParameter attivo = new SqlParameter("@attivo", referente.Attivo); attivo.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(attivo); StoreProc.Connection.Open(); StoreProc.ExecuteNonQuery(); int iReturn = Convert.ToInt32(StoreProc.Parameters["@id"].Value); return(iReturn); } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_SCRITTURA_TABELLA; esito.Descrizione = "Anag_Referenti_Clienti_Fornitori_DAL.cs - CreaReferente " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace; } return(0); }
public Esito AggiornaReferente(Anag_Referente_Clienti_Fornitori referente, Anag_Utenti utente) { Esito esito = new Esito(); try { using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(sqlConstr)) { using (System.Data.SqlClient.SqlCommand StoreProc = new System.Data.SqlClient.SqlCommand("UpdateReferenteClientiFornitori")) { using (System.Data.SqlClient.SqlDataAdapter sda = new System.Data.SqlClient.SqlDataAdapter()) { StoreProc.Connection = con; sda.SelectCommand = StoreProc; StoreProc.CommandType = CommandType.StoredProcedure; System.Data.SqlClient.SqlParameter id = new System.Data.SqlClient.SqlParameter("@id", referente.Id); id.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(id); // PARAMETRI PER LOG UTENTE SqlParameter idUtente = new SqlParameter("@idUtente", utente.id); idUtente.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(idUtente); SqlParameter nomeUtente = new SqlParameter("@nomeUtente", utente.username); nomeUtente.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(nomeUtente); // FINE PARAMETRI PER LOG UTENTE SqlParameter id_azienda = new SqlParameter("@id_azienda", referente.Id_azienda); id_azienda.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(id_azienda); SqlParameter cognome = new SqlParameter("@cognome", referente.Cognome); cognome.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(cognome); SqlParameter nome = new SqlParameter("@nome", referente.Nome); nome.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(nome); SqlParameter settore = new SqlParameter("@settore", referente.Settore); settore.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(settore); SqlParameter telefono1 = new SqlParameter("@telefono1", referente.Telefono1); telefono1.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(telefono1); SqlParameter telefono2 = new SqlParameter("@telefono2", referente.Telefono2); telefono2.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(telefono2); SqlParameter cellulare = new SqlParameter("@cellulare", referente.Cellulare); cellulare.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(cellulare); SqlParameter email = new SqlParameter("@email", referente.Email); email.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(email); SqlParameter note = new SqlParameter("@note", referente.Note); note.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(note); SqlParameter attivo = new SqlParameter("@attivo", referente.Attivo); attivo.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(attivo); StoreProc.Connection.Open(); int iReturn = StoreProc.ExecuteNonQuery(); } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_SCRITTURA_TABELLA; esito.Descrizione = "Anag_Referente_Clienti_Fornitori_DAL.cs - AggiornaReferente " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace; } return(esito); }
public Esito PopolaPannelloNotaSpese(DatiAgenda eventoSelezionato, FiguraProfessionale figuraProfessionaleSelezionata) { Esito esito = new Esito(); try { if (eventoSelezionato != null && eventoSelezionato.LavorazioneCorrente != null) { #region LEGGO I PARAMETRI DI VS Config cfAppo = Config_BLL.Instance.getConfig(ref esito, "PARTITA_IVA"); string pIvaVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "DENOMINAZIONE"); string denominazioneVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "TOPONIMO"); string toponimoVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "INDIRIZZO"); string indirizzoVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "CIVICO"); string civicoVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "CAP"); string capVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "CITTA"); string cittaVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "PROVINCIA"); string provinciaVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "EMAIL"); string emailVs = cfAppo.valore; #endregion List <DatiPianoEsternoLavorazione> listaDatiPianoEsternoLavorazione = eventoSelezionato.LavorazioneCorrente.ListaDatiPianoEsternoLavorazione; if (listaDatiPianoEsternoLavorazione != null) { string nomeFile = "NotaSpese.pdf"; string pathNotaSpese = ConfigurationManager.AppSettings["PATH_DOCUMENTI_PROTOCOLLO"] + nomeFile; string mapPathNotaSpese = MapPath(ConfigurationManager.AppSettings["PATH_DOCUMENTI_PROTOCOLLO"]) + nomeFile; //string prefissoUrl = Request.Url.Scheme + "://" + Request.Url.Authority; iText.IO.Image.ImageData imageData = iText.IO.Image.ImageDataFactory.Create(MapPath("~/Images/logoVSP_trim.png")); PdfWriter wr = new PdfWriter(mapPathNotaSpese); PdfDocument doc = new PdfDocument(wr); doc.SetDefaultPageSize(iText.Kernel.Geom.PageSize.A4.Rotate()); Document document = new Document(doc); document.SetMargins(50, 30, 50, 30); // COLORE BLU VIDEOSYSTEM iText.Kernel.Colors.Color coloreIntestazioni = new iText.Kernel.Colors.DeviceRgb(33, 150, 243); Paragraph pIntestazioneNotaSpese = new Paragraph("Nota Spese di: " + figuraProfessionaleSelezionata.Nome + " " + figuraProfessionaleSelezionata.Cognome); pIntestazioneNotaSpese.SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); pIntestazioneNotaSpese.SetFontSize(20); pIntestazioneNotaSpese.SetBold(); document.Add(pIntestazioneNotaSpese); // AGGIUNGO TABLE PER LAYOUT INTESTAZIONE iText.Layout.Element.Table tbIntestazione = new iText.Layout.Element.Table(new float[] { 1, 9 }).UseAllAvailableWidth().SetBorder(iText.Layout.Borders.Border.NO_BORDER); iText.Layout.Element.Image image = new iText.Layout.Element.Image(imageData).ScaleAbsolute(90, 80).SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER); Cell cellaImmagine = new Cell().SetVerticalAlignment(iText.Layout.Properties.VerticalAlignment.MIDDLE).SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER); cellaImmagine.Add(image); tbIntestazione.AddCell(cellaImmagine); iText.Layout.Element.Table tbIntestazioneDx = new iText.Layout.Element.Table(new float[] { 2, 3, 2, 3 }).UseAllAvailableWidth().SetBorder(iText.Layout.Borders.Border.NO_BORDER); Anag_Clienti_Fornitori cliente = Anag_Clienti_Fornitori_BLL.Instance.getAziendaById(eventoSelezionato.id_cliente, ref esito); Paragraph pTitolo = new Paragraph("Cliente").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); Paragraph pValore = new Paragraph(cliente.RagioneSociale.Trim()).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Referente").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); string nomeReferente = ""; if (eventoSelezionato.LavorazioneCorrente.IdReferente != null) { Anag_Referente_Clienti_Fornitori referente = Anag_Referente_Clienti_Fornitori_BLL.Instance.getReferenteById(ref esito, Convert.ToInt32(eventoSelezionato.LavorazioneCorrente.IdReferente.Value)); nomeReferente = referente.Nome + " " + referente.Cognome; } pValore = new Paragraph(nomeReferente).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Produzione").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pValore = new Paragraph(eventoSelezionato.produzione).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Capotecnico").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); string nomeCapotecnico = ""; if (eventoSelezionato.LavorazioneCorrente.IdCapoTecnico != null) { Anag_Collaboratori coll = Anag_Collaboratori_BLL.Instance.getCollaboratoreById(eventoSelezionato.LavorazioneCorrente.IdCapoTecnico.Value, ref esito); nomeCapotecnico = coll.Nome + " " + coll.Cognome; } pValore = new Paragraph(nomeCapotecnico).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Lavorazione").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.lavorazione).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Data Inizio").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.data_inizio_impegno.ToShortDateString()).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Luogo").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.luogo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Data Lavoraz.").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.data_inizio_lavorazione.ToShortDateString()).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Indirizzo").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.indirizzo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Cod.Lavor.").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.codice_lavoro).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazione.AddCell(tbIntestazioneDx).SetBorder(iText.Layout.Borders.Border.NO_BORDER); document.Add(tbIntestazione); Paragraph pSpazio = new Paragraph(" "); document.Add(pSpazio); Paragraph pLuogoData = new Paragraph(cittaVs + ", " + DateTime.Today.ToLongDateString()); pLuogoData.SetFontSize(8); document.Add(pLuogoData); document.Add(pSpazio); // INTESTAZIONE GRIGLIA iText.Layout.Element.Table table = new iText.Layout.Element.Table(new float[] { 90, 70, 70, 70, 70, 70, 70, 70, 200 }).SetWidth(780); Border bordoDoppio = new DoubleBorder(1); Cell cella = new Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER); table.AddHeaderCell(cella); Paragraph intestazioneMain = new Paragraph("Tipologia di pagamento").SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); cella = new Cell(1, 3).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); cella.SetBorderLeft(bordoDoppio); cella.Add(intestazioneMain); table.AddHeaderCell(cella); intestazioneMain = new Paragraph("Costi in Euro").SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); cella = new Cell(1, 5).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); cella.SetBorderLeft(bordoDoppio); cella.Add(intestazioneMain); table.AddHeaderCell(cella); Paragraph intestazione = new Paragraph("Data").SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Sofid").SetFontSize(10).SetBold().SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); cella = new Cell().SetBorderLeft(bordoDoppio); cella.Add(intestazione); table.AddHeaderCell(cella).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Carta").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Contanti").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Carburante").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); cella = new Cell().SetBorderLeft(bordoDoppio); cella.Add(intestazione); table.AddHeaderCell(cella).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Albergo").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Trasporti").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Pasti").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); intestazione = new Paragraph("Varie").SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER); // CELLE VUOTE for (int i = 0; i < 12; i++) { table.AddCell(new Cell().SetHeight(15)); cella = new Cell().SetBorderLeft(bordoDoppio); table.AddCell(cella); table.AddCell(" "); table.AddCell(" "); cella = new Cell().SetBorderLeft(bordoDoppio); table.AddCell(cella); table.AddCell(" "); table.AddCell(" "); table.AddCell(" "); table.AddCell(" "); } document.Add(table); Paragraph pFirma = new Paragraph("in fede"); pFirma.SetFontSize(9); pFirma.SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT); pFirma.SetMarginRight(90); pFirma.SetMarginTop(13); document.Add(pFirma); iText.Kernel.Geom.Rectangle pageSize = doc.GetPage(1).GetPageSize(); int n = doc.GetNumberOfPages(); // AGGIUNGO CONTEGGIO PAGINE E FOOTER PER OGNI PAGINA for (int i = 1; i <= n; i++) { //AGGIUNGO NUM.PAGINA document.ShowTextAligned(new Paragraph("pagina " + i.ToString() + " di " + n.ToString()).SetFontSize(7), pageSize.GetWidth() - 60, pageSize.GetHeight() - 20, i, iText.Layout.Properties.TextAlignment.CENTER, iText.Layout.Properties.VerticalAlignment.TOP, 0); //AGGIUNGO FOOTER document.ShowTextAligned(new Paragraph(denominazioneVs + " P.IVA " + pIvaVs + Environment.NewLine + "Sede legale: " + toponimoVs + " " + indirizzoVs + " " + civicoVs + " - " + capVs + " " + cittaVs + " " + provinciaVs + " e-mail: " + emailVs).SetFontSize(7).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER), pageSize.GetWidth() / 2, 30, i, iText.Layout.Properties.TextAlignment.CENTER, iText.Layout.Properties.VerticalAlignment.TOP, 0); } //document.Flush(); document.Close(); wr.Close(); framePdfNotaSpese.Attributes.Remove("src"); framePdfNotaSpese.Attributes.Add("src", pathNotaSpese.Replace("~", "")); DivFramePdfNotaSpese.Visible = true; framePdfNotaSpese.Visible = true; ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaFrame", script: "javascript: document.getElementById('" + framePdfNotaSpese.ClientID + "').contentDocument.location.reload(true);", addScriptTags: true); btnStampaNotaSpese.Attributes.Add("onclick", "window.open('" + pathNotaSpese.Replace("~", "") + "');"); } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = "PopolaPannelloNotaSpese(DatiAgenda eventoSelezionato, FiguraProfessionale figuraProfessionaleSelezionata) " + ex.Message + Environment.NewLine + ex.StackTrace; } return(esito); }
public Esito AggiornaReferente(Anag_Referente_Clienti_Fornitori referente, Anag_Utenti utente) { Esito esito = Anag_Referente_Clienti_Fornitori_DAL.Instance.AggiornaReferente(referente, utente); return(esito); }
public int CreaReferente(Anag_Referente_Clienti_Fornitori referente, Anag_Utenti utente, ref Esito esito) { int iREt = Anag_Referente_Clienti_Fornitori_DAL.Instance.CreaReferente(referente, utente, ref esito); return(iREt); }
public Anag_Referente_Clienti_Fornitori getReferenteById(ref Esito esito, int id) { Anag_Referente_Clienti_Fornitori referenteREt = Anag_Referente_Clienti_Fornitori_DAL.Instance.getReferenteById(ref esito, id); return(referenteREt); }
public Esito popolaPannelloPianoEsterno(DatiAgenda eventoSelezionato) { Esito esito = new Esito(); try { if (eventoSelezionato != null && eventoSelezionato.LavorazioneCorrente != null) { // LEGGO I PARAMETRI DI VS Config cfAppo = Config_BLL.Instance.getConfig(ref esito, "PARTITA_IVA"); string pIvaVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "DENOMINAZIONE"); string denominazioneVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "TOPONIMO"); string toponimoVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "INDIRIZZO"); string indirizzoVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "CIVICO"); string civicoVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "CAP"); string capVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "CITTA"); string cittaVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "PROVINCIA"); string provinciaVs = cfAppo.valore; cfAppo = Config_BLL.Instance.getConfig(ref esito, "EMAIL"); string emailVs = cfAppo.valore; List <DatiPianoEsternoLavorazione> listaDatiPianoEsternoLavorazione = eventoSelezionato.LavorazioneCorrente.ListaDatiPianoEsternoLavorazione; if (listaDatiPianoEsternoLavorazione != null) { Protocolli protocolloPianoEsterno = new Protocolli(); int idTipoProtocollo = UtilityTipologiche.getElementByNome(UtilityTipologiche.caricaTipologica(EnumTipologiche.TIPO_PROTOCOLLO), "Piano Esterno", ref esito).id; List <Protocolli> listaProtocolli = Protocolli_BLL.Instance.getProtocolliByCodLavIdTipoProtocollo(eventoSelezionato.codice_lavoro, idTipoProtocollo, ref esito, true); string numeroProtocollo = ""; if (listaProtocolli.Count == 0) { numeroProtocollo = Protocolli_BLL.Instance.getNumeroProtocollo(); } else { protocolloPianoEsterno = listaProtocolli.First(); numeroProtocollo = protocolloPianoEsterno.Numero_protocollo; } // GESTIONE NOMI FILE PDF //string nomeFile = "PianoEsterno_" + eventoSelezionato.LavorazioneCorrente.Id.ToString() + ".pdf"; //string nomeFile = "PianoEsterno_" + numeroProtocollo + ".pdf"; string nomeFile = "PianoEsterno_" + eventoSelezionato.codice_lavoro + ".pdf"; string pathPianoEsterno = ConfigurationManager.AppSettings["PATH_DOCUMENTI_PROTOCOLLO"] + nomeFile; string mapPathPianoEsterno = MapPath(ConfigurationManager.AppSettings["PATH_DOCUMENTI_PROTOCOLLO"]) + nomeFile; //string prefissoUrl = Request.Url.Scheme + "://" + Request.Url.Authority; iText.IO.Image.ImageData imageData = iText.IO.Image.ImageDataFactory.Create(MapPath("~/Images/logoVSP_trim.png")); PdfWriter wr = new PdfWriter(mapPathPianoEsterno); PdfDocument doc = new PdfDocument(wr); doc.SetDefaultPageSize(iText.Kernel.Geom.PageSize.A4.Rotate()); //doc.SetDefaultPageSize(iText.Kernel.Geom.PageSize.A4); //Document document = new Document(doc); Document document = new Document(doc, iText.Kernel.Geom.PageSize.A4.Rotate(), false); //document.SetMargins(90, 30, 50, 30); document.SetMargins(50, 30, 50, 30); //iText.Kernel.Colors.Color coloreIntestazioni = new iText.Kernel.Colors.DeviceRgb(0, 225, 0); // COLORE BLU VIDEOSYSTEM iText.Kernel.Colors.Color coloreIntestazioni = new iText.Kernel.Colors.DeviceRgb(33, 150, 243); // AGGIUNGO TABLE PER LAYOUT INTESTAZIONE iText.Layout.Element.Table tbIntestazione = new iText.Layout.Element.Table(new float[] { 1, 9 }).UseAllAvailableWidth().SetBorder(iText.Layout.Borders.Border.NO_BORDER); //iText.Layout.Element.Table tbIntestazione = new iText.Layout.Element.Table(3).UseAllAvailableWidth(); iText.Layout.Element.Image image = new iText.Layout.Element.Image(imageData).ScaleAbsolute(90, 80).SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER); Cell cellaImmagine = new Cell().SetVerticalAlignment(iText.Layout.Properties.VerticalAlignment.MIDDLE).SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER); cellaImmagine.Add(image); tbIntestazione.AddCell(cellaImmagine); iText.Layout.Element.Table tbIntestazioneDx = new iText.Layout.Element.Table(new float[] { 2, 3, 2, 3 }).UseAllAvailableWidth().SetBorder(iText.Layout.Borders.Border.NO_BORDER); Anag_Clienti_Fornitori cliente = Anag_Clienti_Fornitori_BLL.Instance.getAziendaById(eventoSelezionato.id_cliente, ref esito); Paragraph pTitolo = new Paragraph("Cliente").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); Paragraph pValore = new Paragraph(cliente.RagioneSociale.Trim()).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Referente").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); string nomeReferente = ""; if (eventoSelezionato.LavorazioneCorrente.IdReferente != null) { Anag_Referente_Clienti_Fornitori referente = Anag_Referente_Clienti_Fornitori_BLL.Instance.getReferenteById(ref esito, Convert.ToInt32(eventoSelezionato.LavorazioneCorrente.IdReferente.Value)); nomeReferente = referente.Nome + " " + referente.Cognome; } pValore = new Paragraph(nomeReferente).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Produzione").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pValore = new Paragraph(eventoSelezionato.produzione).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Capotecnico").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); string nomeCapotecnico = ""; if (eventoSelezionato.LavorazioneCorrente.IdCapoTecnico != null) { Anag_Collaboratori coll = Anag_Collaboratori_BLL.Instance.getCollaboratoreById(eventoSelezionato.LavorazioneCorrente.IdCapoTecnico.Value, ref esito); nomeCapotecnico = coll.Nome + " " + coll.Cognome; } pValore = new Paragraph(nomeCapotecnico).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pValore).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Lavorazione").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.lavorazione).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Data Inizio").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.data_inizio_impegno.ToShortDateString()).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Luogo").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.luogo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Data Lavoraz.").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.data_inizio_lavorazione.ToShortDateString()).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Indirizzo").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.indirizzo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); pTitolo = new Paragraph("Cod.Lavor.").SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(pTitolo).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(eventoSelezionato.codice_lavoro).SetBorder(iText.Layout.Borders.Border.NO_BORDER); iText.Layout.Element.Cell cellaNote = new iText.Layout.Element.Cell(2, 4).SetBorder(iText.Layout.Borders.Border.NO_BORDER); string notePianoEsterno = ""; if (eventoSelezionato.LavorazioneCorrente.NotePianoEsterno != null) { notePianoEsterno = eventoSelezionato.LavorazioneCorrente.NotePianoEsterno; } Paragraph pNotePiano = new Paragraph(notePianoEsterno.Trim()).SetFontSize(10).SetBorder(iText.Layout.Borders.Border.NO_BORDER); cellaNote.Add(pNotePiano).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazioneDx.AddCell(cellaNote).SetBorder(iText.Layout.Borders.Border.NO_BORDER); tbIntestazione.AddCell(tbIntestazioneDx).SetBorder(iText.Layout.Borders.Border.NO_BORDER); document.Add(tbIntestazione); Paragraph pSpazio = new Paragraph(" "); document.Add(pSpazio); Paragraph pLuogoData = new Paragraph(cittaVs + ", " + DateTime.Today.ToLongDateString()); document.Add(pLuogoData); document.Add(pSpazio); // INTESTAZIONE GRIGLIA iText.Layout.Element.Table table = new iText.Layout.Element.Table(10).UseAllAvailableWidth(); //.SetBorderTop(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.ORANGE, 5)).SetBorderBottom(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.YELLOW, 5)).SetBorderLeft(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.GREEN, 5)).SetBorderRight(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.RED, 5)); Paragraph intestazione = new Paragraph("Data").SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Personale").SetFontSize(10).SetBold().SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Qualifica").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Intervento").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Telefono").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Città").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Albergo").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Diaria").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Orario").SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); intestazione = new Paragraph("Note").SetFontSize(10).SetFontSize(10).SetBold().SetBackgroundColor(coloreIntestazioni, 0.7f); table.AddHeaderCell(intestazione); string dataConfronto = ""; foreach (DatiPianoEsternoLavorazione dpe in listaDatiPianoEsternoLavorazione) { string collaboratoreFornitore = ""; string telefono = ""; string qualifica = ""; string citta = ""; string descrizioneArticoloAssociato = ""; if (dpe.IdCollaboratori != null) { Anag_Collaboratori coll = Anag_Collaboratori_BLL.Instance.getCollaboratoreById(dpe.IdCollaboratori.Value, ref esito); collaboratoreFornitore = coll.Cognome.Trim() + " " + coll.Nome.Trim(); // prendo descrizione da datiArticoliLavorazione filtrando per data, idCollaboratore e idLavorazione DatiArticoliLavorazione articoloAssociato = SessionManager.EventoSelezionato.LavorazioneCorrente.ListaArticoliLavorazione.FirstOrDefault(x => x.IdCollaboratori == coll.Id && x.Data == dpe.Data); if (articoloAssociato != null) { descrizioneArticoloAssociato = articoloAssociato.Descrizione; } FiguraProfessionale fp = coll.CreaFiguraProfessionale(descrizioneArticoloAssociato); //if (fp!=null && !string.IsNullOrEmpty(fp.ElencoQualifiche)) qualifica = fp.ElencoQualifiche; if (fp != null && !string.IsNullOrEmpty(fp.DescrizioneArticoloAssociato)) { qualifica = fp.DescrizioneArticoloAssociato; } if (fp != null && !string.IsNullOrEmpty(fp.Telefono)) { telefono = fp.Telefono; } if (telefono.StartsWith("0039")) { telefono = telefono.Substring(4); } if (telefono.StartsWith("+39")) { telefono = telefono.Substring(3); } if (fp != null && !string.IsNullOrEmpty(fp.Citta)) { citta = fp.Citta; } } else if (dpe.IdFornitori != null) { Anag_Clienti_Fornitori clienteFornitore = Anag_Clienti_Fornitori_BLL.Instance.getAziendaById(dpe.IdFornitori.Value, ref esito); collaboratoreFornitore = clienteFornitore.RagioneSociale.Trim(); // prendo descrizione da datiArticoliLavorazione filtrando per data, idFornitore e idLavorazione DatiArticoliLavorazione articoloAssociato = SessionManager.EventoSelezionato.LavorazioneCorrente.ListaArticoliLavorazione.FirstOrDefault(x => x.IdFornitori == clienteFornitore.Id && x.Data == dpe.Data); if (articoloAssociato != null) { descrizioneArticoloAssociato = articoloAssociato.Descrizione; } FiguraProfessionale fp = clienteFornitore.CreaFiguraProfessionale(descrizioneArticoloAssociato); //if (fp != null && !string.IsNullOrEmpty(fp.ElencoQualifiche)) qualifica = fp.ElencoQualifiche; if (fp != null && !string.IsNullOrEmpty(fp.DescrizioneArticoloAssociato)) { qualifica = fp.DescrizioneArticoloAssociato; } if (fp != null && !string.IsNullOrEmpty(fp.Telefono)) { telefono = fp.Telefono; } if (fp != null && !string.IsNullOrEmpty(fp.Citta)) { citta = fp.Citta; } } string importoDiaria = "0,00"; if (dpe.ImportoDiaria != null) { importoDiaria = dpe.ImportoDiaria.Value.ToString("###,###.00"); } string nota = ""; if (!string.IsNullOrEmpty(dpe.Nota)) { nota = dpe.Nota; } string dataPiano = ""; if (dpe.Data != null) { dataPiano = dpe.Data.Value.ToShortDateString(); } // METTO SEPARATORE QUANDO CAMBIA DATA if (string.IsNullOrEmpty(dataConfronto)) { dataConfronto = dataPiano; } if (!string.IsNullOrEmpty(dataConfronto) && !dataConfronto.Equals(dataPiano)) { dataConfronto = dataPiano; Cell cellavuota = new Cell(2, 10).SetHeight(10f); table.AddCell(cellavuota); } string orario = ""; if (dpe.Orario != null) { orario = dpe.Orario.Value.ToShortTimeString(); } string intervento = ""; if (dpe.IdIntervento != null) { intervento = SessionManager.ListaTipiIntervento.FirstOrDefault(x => x.id == dpe.IdIntervento).nome; } string albergo = "no"; if (dpe.Albergo != null && dpe.Albergo == true) { albergo = "si"; } //Paragraph p = new Paragraph(dpe.Data.Value.ToLongDateString() + " " + orario + " " + collaboratoreFornitore + " " + nota).SetFontSize(8); //document.Add(p); table.AddCell(dataPiano).SetFontSize(8).SetFontSize(10); table.AddCell(collaboratoreFornitore); table.AddCell(qualifica).SetFontSize(8); table.AddCell(intervento).SetFontSize(8); table.AddCell(telefono).SetFontSize(8); table.AddCell(citta).SetFontSize(8); table.AddCell(albergo).SetFontSize(8); Paragraph pImportoDiaria = new Paragraph(importoDiaria).SetFontSize(8).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT); table.AddCell(pImportoDiaria); table.AddCell(orario).SetFontSize(8); table.AddCell(nota).SetFontSize(8); } document.Add(table); //iText.Kernel.Geom.Rectangle pageSize = doc.GetPage(1).GetPageSize(); int n = doc.GetNumberOfPages(); iText.Kernel.Geom.Rectangle pageSize = doc.GetPage(n).GetPageSize(); // AGGIUNGO CONTEGGIO PAGINE E FOOTER PER OGNI PAGINA for (int i = 1; i <= n; i++) { // AGGIUNGO LOGO //iText.Layout.Element.Image image = new iText.Layout.Element.Image(imageData).ScaleAbsolute(60, 60).SetFixedPosition(i, 20, pageSize.GetHeight() - 80); //document.Add(image); //AGGIUNGO NUM.PAGINA document.ShowTextAligned(new Paragraph("pagina " + i.ToString() + " di " + n.ToString()).SetFontSize(7), pageSize.GetWidth() - 60, pageSize.GetHeight() - 20, i, iText.Layout.Properties.TextAlignment.CENTER, iText.Layout.Properties.VerticalAlignment.TOP, 0); //AGGIUNGO FOOTER document.ShowTextAligned(new Paragraph(denominazioneVs + " P.IVA " + pIvaVs + Environment.NewLine + "Sede legale: " + toponimoVs + " " + indirizzoVs + " " + civicoVs + " - " + capVs + " " + cittaVs + " " + provinciaVs + " e-mail: " + emailVs).SetFontSize(7).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER), pageSize.GetWidth() / 2, 30, i, iText.Layout.Properties.TextAlignment.CENTER, iText.Layout.Properties.VerticalAlignment.TOP, 0); } document.Close(); wr.Close(); if (File.Exists(mapPathPianoEsterno)) { // SE FILE OK INSERISCO O AGGIORNO PROTOCOLLO DI TIPO PIANO ESTERNO if (listaProtocolli.Count == 0) { //INSERISCO protocolloPianoEsterno.Attivo = true; protocolloPianoEsterno.Cliente = cliente.RagioneSociale.Trim(); protocolloPianoEsterno.Codice_lavoro = eventoSelezionato.codice_lavoro; protocolloPianoEsterno.Data_inizio_lavorazione = eventoSelezionato.data_inizio_impegno; protocolloPianoEsterno.Data_protocollo = DateTime.Today; protocolloPianoEsterno.Descrizione = "Piano Esterno"; protocolloPianoEsterno.Id_cliente = eventoSelezionato.id_cliente; protocolloPianoEsterno.Id_tipo_protocollo = idTipoProtocollo; protocolloPianoEsterno.Lavorazione = eventoSelezionato.lavorazione; protocolloPianoEsterno.PathDocumento = Path.GetFileName(mapPathPianoEsterno); protocolloPianoEsterno.Produzione = eventoSelezionato.produzione; protocolloPianoEsterno.Protocollo_riferimento = ""; protocolloPianoEsterno.Numero_protocollo = numeroProtocollo; protocolloPianoEsterno.Pregresso = false; protocolloPianoEsterno.Destinatario = "Cliente"; int idProtPianoEsterno = Protocolli_BLL.Instance.CreaProtocollo(protocolloPianoEsterno, ref esito); } else { // AGGIORNO protocolloPianoEsterno.PathDocumento = Path.GetFileName(mapPathPianoEsterno); esito = Protocolli_BLL.Instance.AggiornaProtocollo(protocolloPianoEsterno); } //string nomeFileToDisplay = BaseStampa.Instance.AddPageNumber(mapPathPdfSenzaNumeroPagina, mapPianoEsterno, ref esito); //if (File.Exists(mapPathPdfSenzaNumeroPagina)) File.Delete(mapPathPdfSenzaNumeroPagina); //if (esito.codice == Esito.ESITO_OK) { framePdfPianoEsterno.Attributes.Remove("src"); framePdfPianoEsterno.Attributes.Add("src", pathPianoEsterno.Replace("~", "")); DivFramePdfPianoEsterno.Visible = true; framePdfPianoEsterno.Visible = true; ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaFrame", script: "javascript: document.getElementById('" + framePdfPianoEsterno.ClientID + "').contentDocument.location.reload(true);", addScriptTags: true); btnStampaPianoEsterno.Attributes.Add("onclick", "window.open('" + pathPianoEsterno.Replace("~", "") + "');"); //} } else { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = "Il File " + pathPianoEsterno.Replace("~", "") + " non è stato creato correttamente!"; } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = "popolaPannelloPianoEsterno(DatiAgenda eventoSelezionato) " + ex.Message + Environment.NewLine + ex.StackTrace; } return(esito); }