protected void btnOKModificaNote_Click(object sender, EventArgs e) { NoteOfferta noteOfferta = (NoteOfferta)ViewState["NoteOfferta"]; noteOfferta.Banca = ddl_Banca.SelectedValue; noteOfferta.Pagamento = 30; // int.Parse(tbMod_Pagamento.Text); //int.Parse(ComboMod_Pagamento.SelectedValue); noteOfferta.NotaPagamento = tbMod_Pagamento.Text.Trim(); noteOfferta.Consegna = txt_Consegna.Text; noteOfferta.Note = txt_Note.Text.Trim(); Offerta_BLL.Instance.AggiornaNoteOfferta(noteOfferta); //RichiediOperazionePopup("SAVE_PDF_OFFERTA"); //DivFramePdf.Visible = true; //framePdf.Visible = true; DatiAgenda eventoSel = (DatiAgenda)ViewState["eventoSelezionato"]; Esito esito = popolaPannelloRiepilogo(eventoSel); ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaNote", script: "javascript: aggiornaRiepilogo()", addScriptTags: true); ScriptManager.RegisterStartupScript(Page, typeof(Page), "chiudiModificaNote", script: "javascript: document.getElementById('panelModificaNote').style.display='none'", addScriptTags: true); // FACCIO REFRESH SUL FRAME CHE VISUALIZZA IL PDF IN MODO DA VEDERE GLI AGGIORNAMENTI IN TEMPO REALE ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaFrame", script: "javascript: document.getElementById('" + framePdf.ClientID + "').contentDocument.location.reload(true);", addScriptTags: true); }
public Esito CreaEvento(DatiAgenda evento, List <string> listaIdTender, NoteOfferta noteOfferta) { Esito esito = new Esito(); esito = Agenda_DAL.Instance.CreaEvento(evento, listaIdTender, noteOfferta); return(esito); }
public NoteOfferta GetNoteOffertaByIdDatiAgenda(ref Esito esito, int idDatiAgenda) { NoteOfferta noteOfferta = new NoteOfferta(); try { using (SqlConnection con = new SqlConnection(sqlConstr)) { string query = "SELECT * FROM tab_note_offerta WHERE id_dati_agenda = " + idDatiAgenda.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) { noteOfferta.Id = dt.Rows[0].Field <int>("id"); noteOfferta.Id_dati_agenda = dt.Rows[0].Field <int>("id_dati_agenda"); noteOfferta.Banca = dt.Rows[0].Field <string>("banca"); noteOfferta.Pagamento = dt.Rows[0].Field <int>("pagamento"); noteOfferta.NotaPagamento = dt.Rows[0].Field <string>("notaPagamento"); noteOfferta.Consegna = dt.Rows[0].Field <string>("consegna"); noteOfferta.Note = ""; if (!string.IsNullOrEmpty(dt.Rows[0].Field <string>("note"))) { noteOfferta.Note = dt.Rows[0].Field <string>("note"); } } } } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = "Offerta_DAL.cs - getNoteOffertaByIdDatiAgenda " + Environment.NewLine + ex.Message; log.Error(ex.Message + Environment.NewLine + ex.StackTrace); } return(noteOfferta); }
protected void btnOKModificaNote_Click(object sender, EventArgs e) { NoteOfferta noteOfferta = (NoteOfferta)ViewState["NoteOfferta"]; noteOfferta.Banca = ddl_Banca.SelectedValue; noteOfferta.Pagamento = int.Parse(cmbMod_Pagamento.SelectedValue); noteOfferta.Consegna = txt_Consegna.Text; noteOfferta.Note = ""; Offerta_BLL.Instance.AggiornaNoteOfferta(noteOfferta); val_bancaStampa.Text = noteOfferta.Banca; val_pagamentoStampa.Text = noteOfferta.Pagamento.ToString() + " gg DFFM"; val_consegnaStampa.Text = noteOfferta.Consegna; RichiediOperazionePopup("SAVE_PDF_CONSUNTIVO"); ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaNote", script: "javascript: aggiornaRiepilogo()", addScriptTags: true); ScriptManager.RegisterStartupScript(Page, typeof(Page), "chiudiModificaNote", script: "javascript: document.getElementById('panelModificaNote').style.display='none'", addScriptTags: true); }
protected void btnOKModificaNote_Click(object sender, EventArgs e) { NoteOfferta noteOfferta = (NoteOfferta)ViewState["NoteOfferta"]; noteOfferta.Banca = ddl_Banca.SelectedValue; noteOfferta.Pagamento = 30; // int.Parse(tbMod_Pagamento.Text); //int.Parse(ComboMod_Pagamento.SelectedValue); noteOfferta.NotaPagamento = tbMod_Pagamento.Text.Trim(); noteOfferta.Consegna = txt_Consegna.Text; noteOfferta.Note = txt_Note.Text.Trim(); Offerta_BLL.Instance.AggiornaNoteOfferta(noteOfferta); val_bancaStampa.Text = noteOfferta.Banca; val_pagamentoStampa.Text = noteOfferta.NotaPagamento.ToString(); //+ " gg DFFM"; val_consegnaStampa.Text = noteOfferta.Consegna; //note.Text = txt_Note.Text.Trim().Replace(Environment.NewLine, " "); note.Text = BasePage.trimNote(txt_Note.Text.Trim(), 5); if (note.Text.IndexOf("\n") > -1) { note.Text = note.Text.Replace("\n", "<br/>"); } else { note.Text = txt_Note.Text; } RichiediOperazionePopup("SAVE_PDF_OFFERTA"); DivFramePdf.Visible = true; framePdf.Visible = true; ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaNote", script: "javascript: aggiornaRiepilogo()", addScriptTags: true); ScriptManager.RegisterStartupScript(Page, typeof(Page), "chiudiModificaNote", script: "javascript: document.getElementById('panelModificaNote').style.display='none'", addScriptTags: true); // FACCIO REFRESH SUL FRAME CHE VISUALIZZA IL PDF IN MODO DA VEDERE GLI AGGIORNAMENTI IN TEMPO REALE ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaFrame", script: "javascript: document.getElementById('" + framePdf.ClientID + "').contentDocument.location.reload(true);", addScriptTags: true); }
public Esito popolaPannelloFattura(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<DatiArticoliLavorazione> listaArticoliLavorazione = eventoSelezionato.LavorazioneCorrente.ListaArticoliLavorazione.Where(x => x.Stampa).OrderBy(x => x.Fattura).ToList<DatiArticoliLavorazione>(); List <DatiArticoliLavorazione> listaArticoliLavorazione = eventoSelezionato.LavorazioneCorrente.ListaArticoliLavorazione.Where(x => x.Stampa).ToList <DatiArticoliLavorazione>(); if (listaArticoliLavorazione != null) { Protocolli protocolloFattura = new Protocolli(); int idTipoProtocollo = UtilityTipologiche.getElementByNome(UtilityTipologiche.caricaTipologica(EnumTipologiche.TIPO_PROTOCOLLO), "Fattura", ref esito).id; List <Protocolli> listaProtocolli = Protocolli_BLL.Instance.getProtocolliByCodLavIdTipoProtocollo(eventoSelezionato.codice_lavoro, idTipoProtocollo, ref esito, true); string numeroProtocollo = ""; string numeroFattura = ""; if (listaProtocolli.Count == 0) { numeroProtocollo = Protocolli_BLL.Instance.getNumeroProtocollo(); // ESTRAPOLO IL NUMERO FATTURA DALLA TABELLA TAB_NUMERO_FATTURA numeroFattura = Protocolli_BLL.Instance.getNumeroFattura(); } else { bool trovato = false; foreach (Protocolli protocollo in listaProtocolli) { if (protocollo.Destinatario == "Cliente") { //protocolloFattura = listaProtocolli.First(); numeroProtocollo = protocollo.Numero_protocollo; numeroFattura = protocollo.Protocollo_riferimento; protocolloFattura = protocollo; trovato = true; break; } } if (!trovato) { numeroProtocollo = Protocolli_BLL.Instance.getNumeroProtocollo(); // ESTRAPOLO IL NUMERO FATTURA DALLA TABELLA TAB_NUMERO_FATTURA numeroFattura = Protocolli_BLL.Instance.getNumeroFattura(); listaProtocolli.Clear(); } } // GESTIONE NOMI FILE PDF //string nomeFile = "Fattura_" + eventoSelezionato.codice_lavoro + ".pdf"; string nomeFile = "Fattura_" + numeroFattura + ".pdf"; string pathFattura = ConfigurationManager.AppSettings["PATH_DOCUMENTI_PROTOCOLLO"] + nomeFile; string mapPathFattura = 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")); iText.IO.Image.ImageData imageDNV = iText.IO.Image.ImageDataFactory.Create(MapPath("~/Images/DNV_2008_ITA2.jpg")); PdfWriter wr = new PdfWriter(mapPathFattura); PdfDocument doc = new PdfDocument(wr); doc.SetDefaultPageSize(iText.Kernel.Geom.PageSize.A4); //Document document = new Document(doc); Document document = new Document(doc, iText.Kernel.Geom.PageSize.A4, false); document.SetMargins(245, 30, 110, 30); // ESTRAPOLO IL CLIENTE Anag_Clienti_Fornitori cliente = Anag_Clienti_Fornitori_BLL.Instance.getAziendaById(eventoSelezionato.id_cliente, ref esito); Paragraph pSpazio = new Paragraph(" "); document.Add(pSpazio); // CREAZIONE GRIGLIA iText.Layout.Element.Table tbGrigla = new iText.Layout.Element.Table(new float[] { 80, 70, 180, 70, 30, 30, 70 }).SetWidth(530).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetFixedLayout(); Paragraph pGriglia; Cell cellaGriglia; // COLORE BLU VIDEOSYSTEM iText.Kernel.Colors.Color coloreIntestazioni = new iText.Kernel.Colors.DeviceRgb(33, 150, 243); // INTESTAZIONE FATTURA pGriglia = new Paragraph("Fattura").SetFontSize(10).SetBold(); cellaGriglia = new Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); pGriglia = new Paragraph(numeroFattura + " Rif.Lav. " + eventoSelezionato.codice_lavoro).SetFontSize(10).SetBold(); cellaGriglia = new iText.Layout.Element.Cell(1, 2).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); //pGriglia = new Paragraph("").SetFontSize(10); //cellaGriglia = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); //cellaGriglia.Add(pGriglia); //tbGrigla.AddHeaderCell(cellaGriglia); pGriglia = new Paragraph("Rif.Prot. " + numeroProtocollo).SetFontSize(10).SetBold(); cellaGriglia = new iText.Layout.Element.Cell(1, 4).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); // INTESTAZIONE GRIGLIA pGriglia = new Paragraph("Codice").SetFontSize(10); cellaGriglia = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 1, 100)).SetPadding(5).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); pGriglia = new Paragraph("Descrizione Offerta").SetFontSize(10); cellaGriglia = new iText.Layout.Element.Cell(1, 2).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 1, 100)).SetPadding(5).SetTextAlignment(iText.Layout.Properties.TextAlignment.CENTER).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); pGriglia = new Paragraph("Prezzo").SetFontSize(10); cellaGriglia = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 1, 100)).SetPadding(5).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); pGriglia = new Paragraph("Qta").SetFontSize(10); cellaGriglia = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 1, 100)).SetPadding(5).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); pGriglia = new Paragraph("Iva").SetFontSize(10); cellaGriglia = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 1, 100)).SetPadding(5).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); pGriglia = new Paragraph("Totale").SetFontSize(10); cellaGriglia = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 1, 100)).SetPadding(5).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddHeaderCell(cellaGriglia); decimal totPrezzo = 0; decimal totIVA = 0; // CICLO GLI ARTICOLI //foreach (DatiArticoli da in listaDatiArticoli) foreach (DatiArticoliLavorazione da in listaArticoliLavorazione) { // CALCOLO I TOTALI //totPrezzo += da.Prezzo * da.Quantita; totPrezzo += da.Prezzo * 1; //totIVA += (da.Prezzo * da.Iva / 100) * da.Quantita; totIVA += (da.Prezzo * da.Iva / 100) * 1; string descrizione = da.Descrizione; string descrizioneLunga = da.DescrizioneLunga; pGriglia = new Paragraph(descrizione).SetFontSize(9); cellaGriglia = new Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); if (da.Consuntivo == true) { //descrizione = "(c)" + descrizione; //descrizioneLunga = "(Consuntivo)" + Environment.NewLine + descrizioneLunga; Text firstDesc = new Text("(Consuntivo)" + Environment.NewLine).SetFontSize(9).SetBold(); Text secondDesc = new Text(descrizioneLunga).SetFontSize(9); pGriglia = new Paragraph().Add(firstDesc).Add(secondDesc); } else { pGriglia = new Paragraph(descrizioneLunga).SetFontSize(9); } cellaGriglia = new Cell(1, 2).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); pGriglia = new Paragraph(da.Prezzo.ToString("###,##0.00")).SetFontSize(9); cellaGriglia = new Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); //pGriglia = new Paragraph(da.Quantita.ToString("##0")).SetFontSize(9); pGriglia = new Paragraph(1.ToString("##0")).SetFontSize(9); cellaGriglia = new Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); pGriglia = new Paragraph(da.Iva.ToString("##")).SetFontSize(9); cellaGriglia = new Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); //decimal totale = da.Prezzo * da.Quantita; decimal totale = da.Prezzo * 1; pGriglia = new Paragraph(totale.ToString("###,##0.00")).SetFontSize(9); cellaGriglia = new Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); } // AGGIUNGO UNO SPAZIO pGriglia = new Paragraph(" ").SetFontSize(9); cellaGriglia = new Cell(1, 7).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); // ESTRAPOLO NOTEOFFERTA NoteOfferta noteOfferta = Offerta_BLL.Instance.getNoteOffertaByIdDatiAgenda(eventoSelezionato.id, ref esito); // NOTE Text first = new Text("Note:").SetFontSize(9).SetBold(); //Text second = new Text(Environment.NewLine + "Gli articoli con la dicitura 'Cons' sono da ritenersi a CONSUNTIVO" + Environment.NewLine + noteOfferta.Note.Trim()).SetFontSize(9); Text second = new Text(Environment.NewLine + noteOfferta.Note.Trim()).SetFontSize(9); Paragraph paragraphNote = new Paragraph().Add(first).Add(second); cellaGriglia = new iText.Layout.Element.Cell(3, 3).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10); cellaGriglia.Add(paragraphNote); tbGrigla.AddCell(cellaGriglia); pGriglia = new Paragraph("Imponibile").SetFontSize(9); cellaGriglia = new iText.Layout.Element.Cell(1, 3).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); pGriglia = new Paragraph(totPrezzo.ToString("###,##0.00")).SetFontSize(9); cellaGriglia = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); // TOTALE IVA pGriglia = new Paragraph("i.v.a.").SetFontSize(9); cellaGriglia = new iText.Layout.Element.Cell(1, 3).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); pGriglia = new Paragraph(totIVA.ToString("###,##0.00")).SetFontSize(9); cellaGriglia = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); // TOTALE EURO pGriglia = new Paragraph("Totale Euro").SetFontSize(9); cellaGriglia = new iText.Layout.Element.Cell(1, 3).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); pGriglia = new Paragraph((totPrezzo + totIVA).ToString("###,##0.00")).SetFontSize(9); cellaGriglia = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetTextAlignment(iText.Layout.Properties.TextAlignment.RIGHT).SetBold(); cellaGriglia.Add(pGriglia); tbGrigla.AddCell(cellaGriglia); document.Add(tbGrigla); //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(90, 80).SetFixedPosition(i, 30, 740); document.Add(image); // CREAZIONE GRIGLIA INFORMAZIONI iText.Layout.Element.Table tbGriglaInfo = new iText.Layout.Element.Table(new float[] { 70, 230 }).SetWidth(300).SetFixedPosition(i, 30, 640, 300); Paragraph pGrigliaInfo = new Paragraph(cittaVs).SetFontSize(9).SetBold(); iText.Layout.Element.Cell cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); //pGrigliaInfo = new Paragraph(DateTime.Today.ToLongDateString()).SetFontSize(9); if (string.IsNullOrEmpty(tbDataProtocollo.Text)) { tbDataProtocollo.Text = eventoSelezionato.data_inizio_lavorazione.ToShortDateString(); } pGrigliaInfo = new Paragraph(Convert.ToDateTime(tbDataProtocollo.Text).ToLongDateString()).SetFontSize(9); cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); pGrigliaInfo = new Paragraph("Produzione:").SetFontSize(9).SetBold(); cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); pGrigliaInfo = new Paragraph(eventoSelezionato.produzione).SetFontSize(9); cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); pGrigliaInfo = new Paragraph("Lavorazione:").SetFontSize(9).SetBold(); cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); pGrigliaInfo = new Paragraph(eventoSelezionato.lavorazione).SetFontSize(9); cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); pGrigliaInfo = new Paragraph("Data Lav.ne:").SetFontSize(9).SetBold(); cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); pGrigliaInfo = new Paragraph(eventoSelezionato.data_inizio_lavorazione.ToString("dd/MM/yyyy")).SetFontSize(9); cellaGrigliaInfo = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaInfo.Add(pGrigliaInfo); tbGriglaInfo.AddCell(cellaGrigliaInfo); document.Add(tbGriglaInfo); // CREAZIONE GRIGLIA DESTINATARIO iText.Layout.Element.Table tbGriglaDest = new iText.Layout.Element.Table(new float[] { 70, 230 }).SetWidth(300).SetFixedPosition(i, 350, 650, 300); Paragraph pGrigliaDest = new Paragraph("Spettabile").SetFontSize(9).SetBold(); iText.Layout.Element.Cell cellaGrigliaDest = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaDest.Add(pGrigliaDest); tbGriglaDest.AddCell(cellaGrigliaDest); pGrigliaDest = new Paragraph(cliente.RagioneSociale).SetFontSize(9); cellaGrigliaDest = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaDest.Add(pGrigliaDest); tbGriglaDest.AddCell(cellaGrigliaDest); // INDIRIZZO DESTINATARIO pGrigliaDest = new Paragraph("Indirizzo").SetFontSize(9).SetBold(); cellaGrigliaDest = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaDest.Add(pGrigliaDest); tbGriglaDest.AddCell(cellaGrigliaDest); //pGrigliaDest = new Paragraph(cliente.TipoIndirizzoOperativo + " " + cliente.IndirizzoOperativo + " " + cliente.NumeroCivicoOperativo + Environment.NewLine + cliente.CapOperativo + " " + cliente.ComuneOperativo + " " + cliente.ProvinciaOperativo).SetFontSize(9); //cellaGrigliaDest = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); //cellaGrigliaDest.Add(pGrigliaDest); //tbGriglaDest.AddCell(cellaGrigliaDest); pGrigliaDest = new Paragraph(cliente.TipoIndirizzoLegale + " " + cliente.IndirizzoLegale + " " + cliente.NumeroCivicoLegale + Environment.NewLine + cliente.CapLegale + " " + cliente.ComuneLegale + " " + cliente.ProvinciaLegale).SetFontSize(9); cellaGrigliaDest = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaDest.Add(pGrigliaDest); tbGriglaDest.AddCell(cellaGrigliaDest); // PARTITA IVA DESTINATARIO pGrigliaDest = new Paragraph("P.Iva/C.F.").SetFontSize(9).SetBold(); cellaGrigliaDest = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaDest.Add(pGrigliaDest); tbGriglaDest.AddCell(cellaGrigliaDest); string pIvaCF = cliente.PartitaIva; if (string.IsNullOrEmpty(pIvaCF)) { pIvaCF = cliente.CodiceFiscale; } pGrigliaDest = new Paragraph(pIvaCF).SetFontSize(9); cellaGrigliaDest = new iText.Layout.Element.Cell().SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaDest.Add(pGrigliaDest); tbGriglaDest.AddCell(cellaGrigliaDest); document.Add(tbGriglaDest); //document.Add(pSpazio); //document.Add(pSpazio); // CREAZIONE INTESTAZIONE GRIGLIA //iText.Layout.Element.Table tbGriglaInt = new iText.Layout.Element.Table(new float[] { 80, 50, 200, 80, 20, 20, 80 }).SetWidth(530).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.WHITE, 10).SetFixedPosition(i, 30, 595, 530); ; //document.Add(tbGriglaInt); // AGGIUNGO LOGO DNV iText.Layout.Element.Image logoDnv = new iText.Layout.Element.Image(imageDNV).ScaleAbsolute(40, 40).SetFixedPosition(i, 518, 8); document.Add(logoDnv); //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); if (i == n) { // NELL'ULTIMA PAGINA AGGIUNGO LA GRIGLIA CON LE NOTE E IL TIMBRO // CREAZIONE GRIGLIA iText.Layout.Element.Table tbGriglaNoteFooter = new iText.Layout.Element.Table(new float[] { 80, 70, 180, 70, 30, 30, 70 }).SetWidth(530).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.LIGHT_GRAY, 10).SetFixedPosition(30, 50, 530).SetFixedLayout(); // PRIMA RIGA GRIGLIA NOTE FOOTER Paragraph pGrigliaNoteFooter = new Paragraph("Banca").SetFontSize(9); iText.Layout.Element.Cell cellaGrigliaNoteFooter = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); pGrigliaNoteFooter = new Paragraph(noteOfferta.Banca).SetFontSize(9); //cellaGrigliaNoteFooter = new iText.Layout.Element.Cell(1,2).SetBackgroundColor(iText.Kernel.Colors.ColorConstants.LIGHT_GRAY, 10).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(2); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell(1, 2).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorderRight(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 2, 50)).SetBorderTop(iText.Layout.Borders.Border.NO_BORDER).SetBorderLeft(iText.Layout.Borders.Border.NO_BORDER).SetBorderBottom(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); pGrigliaNoteFooter = new Paragraph("Timbro e firma per accettazione").SetFontSize(9); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell(1, 4).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); // SECONDA RIGA GRIGLIA NOTE FOOTER pGrigliaNoteFooter = new Paragraph("Pagamento").SetFontSize(9); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); pGrigliaNoteFooter = new Paragraph(noteOfferta.NotaPagamento).SetFontSize(9); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell(1, 2).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorderRight(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 2, 50)).SetBorderTop(iText.Layout.Borders.Border.NO_BORDER).SetBorderLeft(iText.Layout.Borders.Border.NO_BORDER).SetBorderBottom(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); pGrigliaNoteFooter = new Paragraph(" ").SetFontSize(9); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell(1, 4).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); // TERZA RIGA GRIGLIA NOTE FOOTER pGrigliaNoteFooter = new Paragraph("Consegna").SetFontSize(9); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell().SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); pGrigliaNoteFooter = new Paragraph(noteOfferta.Consegna.Replace("\r\n", " ")).SetFontSize(9); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell(1, 2).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorderRight(new iText.Layout.Borders.SolidBorder(iText.Kernel.Colors.ColorConstants.WHITE, 2, 50)).SetBorderTop(iText.Layout.Borders.Border.NO_BORDER).SetBorderLeft(iText.Layout.Borders.Border.NO_BORDER).SetBorderBottom(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); pGrigliaNoteFooter = new Paragraph(" ").SetFontSize(9); cellaGrigliaNoteFooter = new iText.Layout.Element.Cell(1, 4).SetBackgroundColor(coloreIntestazioni, 0.7f).SetBorder(iText.Layout.Borders.Border.NO_BORDER).SetPadding(5); cellaGrigliaNoteFooter.Add(pGrigliaNoteFooter); tbGriglaNoteFooter.AddCell(cellaGrigliaNoteFooter); document.Add(tbGriglaNoteFooter); } } document.Close(); wr.Close(); if (File.Exists(mapPathFattura)) { // SE FILE OK INSERISCO O AGGIORNO PROTOCOLLO DI FATTURA if (listaProtocolli.Count == 0) { //INSERISCO protocolloFattura.Attivo = true; protocolloFattura.Cliente = cliente.RagioneSociale.Trim(); protocolloFattura.Codice_lavoro = eventoSelezionato.codice_lavoro; protocolloFattura.Data_inizio_lavorazione = eventoSelezionato.data_inizio_impegno; //protocolloFattura.Data_protocollo = DateTime.Today; protocolloFattura.Data_protocollo = Convert.ToDateTime(tbDataProtocollo.Text); protocolloFattura.Descrizione = "Fattura"; protocolloFattura.Id_cliente = eventoSelezionato.id_cliente; protocolloFattura.Id_tipo_protocollo = idTipoProtocollo; protocolloFattura.Lavorazione = eventoSelezionato.lavorazione; protocolloFattura.PathDocumento = Path.GetFileName(mapPathFattura); protocolloFattura.Produzione = eventoSelezionato.produzione; protocolloFattura.Protocollo_riferimento = numeroFattura; protocolloFattura.Numero_protocollo = numeroProtocollo; protocolloFattura.Pregresso = false; protocolloFattura.Destinatario = "Cliente"; int idProtPianoEsterno = Protocolli_BLL.Instance.CreaProtocollo(protocolloFattura, ref esito); ViewState["idProtocollo"] = idProtPianoEsterno; } else { // AGGIORNO protocolloFattura.PathDocumento = Path.GetFileName(mapPathFattura); protocolloFattura.Data_protocollo = Convert.ToDateTime(tbDataProtocollo.Text); esito = Protocolli_BLL.Instance.AggiornaProtocollo(protocolloFattura); ViewState["idProtocollo"] = protocolloFattura.Id; } ViewState["importo"] = totPrezzo; ViewState["iva"] = listaArticoliLavorazione[0].Iva;// totIVA; ViewState["importoIva"] = totPrezzo + totIVA; ViewState["banca"] = noteOfferta.Banca; ViewState["numeroDocumento"] = eventoSelezionato.codice_lavoro; framePdfFattura.Attributes.Remove("src"); framePdfFattura.Attributes.Add("src", pathFattura.Replace("~", "")); DivFramePdfFattura.Visible = true; framePdfFattura.Visible = true; ScriptManager.RegisterStartupScript(Page, typeof(Page), "aggiornaFrame", script: "javascript: document.getElementById('" + framePdfFattura.ClientID + "').contentDocument.location.reload(true);", addScriptTags: true); btnStampaFattura.Attributes.Add("onclick", "window.open('" + pathFattura.Replace("~", "") + "');"); //} } else { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = "Il File " + pathFattura.Replace("~", "") + " non è stato creato correttamente!"; } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_GENERICO; esito.Descrizione = "popolaPannelloFattura(DatiAgenda eventoSelezionato) " + ex.Message + Environment.NewLine + ex.StackTrace; } return(esito); }
public Esito AggiornaNoteOfferta(NoteOfferta noteOfferta) { Esito esito = Offerta_DAL.Instance.AggiornaNoteOfferta(noteOfferta); return(esito); }
public int CreaNoteOfferta(NoteOfferta noteOfferta, ref Esito esito) { int iREt = Offerta_DAL.Instance.CreaNoteOfferta(noteOfferta, ref esito); return(iREt); }
public NoteOfferta getNoteOffertaById(int idNoteOfferta, ref Esito esito) { NoteOfferta noteOfferta = Offerta_DAL.Instance.GetNoteOffertaById(ref esito, idNoteOfferta); return(noteOfferta); }
public NoteOfferta getNoteOffertaByIdDatiAgenda(int idDatiAgenda, ref Esito esito) { NoteOfferta noteOfferta = Offerta_DAL.Instance.GetNoteOffertaByIdDatiAgenda(ref esito, idDatiAgenda); return(noteOfferta); }
public Esito popolaPannelloRiepilogo(DatiAgenda eventoSelezionato) { Esito esito = new Esito(); //AbilitaVisualizzazioneStampa(false); lbl_Data.Text = lbl_DataStampa.Text = DateTime.Now.ToString("dd/MM/yyyy ore HH:mm"); lbl_Produzione.Text = lbl_ProduzioneStampa.Text = eventoSelezionato.produzione; lbl_Lavorazione.Text = lbl_LavorazioneStampa.Text = eventoSelezionato.lavorazione; lbl_DataLavorazione.Text = lbl_DataLavorazioneStampa.Text = eventoSelezionato.data_inizio_lavorazione.ToString("dd/MM/yyyy"); Anag_Clienti_Fornitori cliente = Anag_Clienti_Fornitori_BLL.Instance.getAziendaById(eventoSelezionato.id_cliente, ref esito); if (esito.Codice != Esito.ESITO_OK) { basePage.ShowError(esito.Descrizione); return(esito); } lbl_Cliente.Text = lbl_ClienteStampa.Text = cliente.RagioneSociale; lbl_IndirizzoCliente.Text = lbl_IndirizzoClienteStampa.Text = cliente.TipoIndirizzoOperativo + " " + cliente.IndirizzoOperativo + " " + cliente.NumeroCivicoOperativo + " " + cliente.CapOperativo + " " + cliente.ComuneOperativo + " " + cliente.ProvinciaOperativo; lbl_PIvaCliente.Text = lbl_PIvaClienteStampa.Text = string.IsNullOrEmpty(cliente.PartitaIva) ? cliente.CodiceFiscale : cliente.PartitaIva; lbl_CodLavorazione.Text = lbl_CodLavorazioneStampa.Text = eventoSelezionato.codice_lavoro; List <DatiArticoli> listaDatiArticoli = RichiediListaArticoli().Where(x => x.Stampa).ToList <DatiArticoli>(); gvArticoli.DataSource = listaDatiArticoli; try { gvArticoli.DataBind(); } catch (Exception e) { basePage.ShowError(e.Message); } decimal totPrezzo = 0; decimal totIVA = 0; foreach (DatiArticoli art in listaDatiArticoli) { totPrezzo += art.Prezzo * art.Quantita; totIVA += (art.Prezzo * art.Iva / 100) * art.Quantita; } totale.Text = totaleStampa.Text = string.Format("{0:N2}", totPrezzo); totaleIVA.Text = totaleIVAStampa.Text = string.Format("{0:N2}", totIVA); totaleEuro.Text = totaleEuroStampa.Text = string.Format("{0:N2}", totPrezzo + totIVA); int idTipoProtocollo = UtilityTipologiche.getElementByNome(UtilityTipologiche.caricaTipologica(EnumTipologiche.TIPO_PROTOCOLLO), "offerta", ref esito).id; List <Protocolli> listaProtocolli = Protocolli_BLL.Instance.getProtocolliByCodLavIdTipoProtocollo(eventoSelezionato.codice_lavoro, idTipoProtocollo, ref esito, true); string protocollo = listaProtocolli.Count == 0 ? "N.D." : listaProtocolli.First().Numero_protocollo + "-" + eventoSelezionato.codice_lavoro; lbl_Protocollo.Text = lbl_ProtocolloStampa.Text = protocollo; NoteOfferta noteOfferta = Offerta_BLL.Instance.getNoteOffertaByIdDatiAgenda(eventoSelezionato.id, ref esito); // se non viene trovata una notaOfferta (vecchi eventi) viene creata e salvata if (noteOfferta.Id == 0) { List <DatiBancari> datiBancari = Config_BLL.Instance.getListaDatiBancari(ref esito); noteOfferta = new NoteOfferta { Id_dati_agenda = eventoSelezionato.id, Banca = datiBancari[0].DatiCompleti, Pagamento = cliente.Pagamento, NotaPagamento = cliente.NotaPagamento, Consegna = cliente.TipoIndirizzoLegale + " " + cliente.IndirizzoLegale + " " + cliente.NumeroCivicoLegale + Environment.NewLine + cliente.CapLegale + " " + cliente.ComuneLegale + " " + cliente.ProvinciaLegale + " " }; // "Unicredit Banca: IBAN: IT39H0200805198000103515620", Pagamento = cliente.Pagamento, Consegna = cliente.TipoIndirizzoLegale + " " + cliente.IndirizzoLegale + " " + cliente.NumeroCivicoLegale + " " + cliente.CapLegale + " " + cliente.ProvinciaLegale + " " }; Offerta_BLL.Instance.CreaNoteOfferta(noteOfferta, ref esito); } ViewState["NoteOfferta"] = noteOfferta; val_bancaSchermo.Text = val_bancaStampa.Text = noteOfferta.Banca; // val_pagamentoSchermo.Text = val_pagamentoStampa.Text = noteOfferta.NotaPagamento; // + " gg DFFM"; val_consegnaSchermo.Text = val_consegnaStampa.Text = noteOfferta.Consegna; //ddl_Banca.SelectedValue = noteOfferta.Banca;// commentato perché se non trova l'elemento (e può succedere) schioda txt_Consegna.Text = noteOfferta.Consegna; //try //{ // ComboMod_Pagamento.SelectedValue = noteOfferta.Pagamento.ToString(); //} //catch (Exception ex) //{ // ComboMod_Pagamento.Items.Add(new ListItem(noteOfferta.Pagamento.ToString(), noteOfferta.Pagamento.ToString())); // ComboMod_Pagamento.SelectedValue = noteOfferta.Pagamento.ToString(); //} //tbMod_Pagamento.Text = noteOfferta.Pagamento.ToString(); tbMod_Pagamento.Text = noteOfferta.NotaPagamento.ToString(); //ComboMod_Pagamento.Text = noteOfferta.Pagamento.ToString(); if (string.IsNullOrEmpty(noteOfferta.Note)) { //note.Text = ""; note.Text = ""; txt_Note.Text = ""; } else { //note.Text = noteOfferta.Note.Trim(); note.Text = BasePage.trimNote(noteOfferta.Note, 5); note.Text = note.Text.Trim().Replace("\n", "<br/>"); txt_Note.Text = noteOfferta.Note.Trim(); } DivFramePdf.Visible = true; framePdf.Visible = true; return(esito); }
public Esito AggiornaNoteOfferta(NoteOfferta noteOfferta) { Anag_Utenti utente = ((Anag_Utenti)HttpContext.Current.Session[SessionManager.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("UpdateNoteOfferta")) { 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", noteOfferta.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_dati_agenda = new SqlParameter("@id_dati_agenda", noteOfferta.Id_dati_agenda); id_dati_agenda.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(id_dati_agenda); SqlParameter banca = new SqlParameter("@banca", noteOfferta.Banca); banca.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(banca); SqlParameter pagamento = new SqlParameter("@pagamento", noteOfferta.Pagamento); pagamento.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(pagamento); SqlParameter notaPagamento = new SqlParameter("@notaPagamento", noteOfferta.NotaPagamento); notaPagamento.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(notaPagamento); SqlParameter consegna = new SqlParameter("@consegna", noteOfferta.Consegna); consegna.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(consegna); SqlParameter note = new SqlParameter("@note", noteOfferta.Note); note.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(note); StoreProc.Connection.Open(); int iReturn = StoreProc.ExecuteNonQuery(); } } } } catch (Exception ex) { esito.Codice = Esito.ESITO_KO_ERRORE_SCRITTURA_TABELLA; esito.Descrizione = "Offerta_DAL.cs - AggiornaNoteOfferta " + Environment.NewLine + ex.Message; log.Error(ex.Message + Environment.NewLine + ex.StackTrace); } return(esito); }
public int CreaNoteOfferta(NoteOfferta noteOfferta, ref Esito esito) { Anag_Utenti utente = ((Anag_Utenti)HttpContext.Current.Session[SessionManager.UTENTE]); try { using (SqlConnection con = new SqlConnection(sqlConstr)) { using (SqlCommand StoreProc = new SqlCommand("InsertNoteOfferta")) { 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_dati_agenda = new SqlParameter("@id_dati_agenda", noteOfferta.Id_dati_agenda); id_dati_agenda.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(id_dati_agenda); SqlParameter banca = new SqlParameter("@banca", noteOfferta.Banca); banca.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(banca); SqlParameter pagamento = new SqlParameter("@pagamento", noteOfferta.Pagamento); pagamento.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(pagamento); SqlParameter consegna = new SqlParameter("@consegna", noteOfferta.Consegna); consegna.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(consegna); if (string.IsNullOrEmpty(noteOfferta.Note)) { noteOfferta.Note = string.Empty; } SqlParameter note = new SqlParameter("@note", noteOfferta.Note); note.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(note); SqlParameter notaPagamento = new SqlParameter("@notaPagamento", noteOfferta.NotaPagamento); notaPagamento.Direction = ParameterDirection.Input; StoreProc.Parameters.Add(notaPagamento); 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 = "Offerta_DAL.cs - CreaNoteOfferta " + Environment.NewLine + ex.Message; log.Error(ex.Message + Environment.NewLine + ex.StackTrace); } return(0); }