private void SalvaCertificatoPiombo() { CDCDS ds = new CDCDS(); CDCDS.CDC_CERTIFICATIPIOMBORow cPiombo = ds.CDC_CERTIFICATIPIOMBO.NewCDC_CERTIFICATIPIOMBORow(); cPiombo.ELEMENTO = ddlElemento.SelectedItem as string; cPiombo.CODICE = txtCodice.Text; Materiale materiale = ddlMateriale.SelectedItem as Materiale; cPiombo.MATERIALE = materiale.Nome; cPiombo.LOTTO = txtLotto.Text; cPiombo.LUNGHEZZA = nLunghezza.Value; cPiombo.LARGHEZZA = nLarghezza.Value; cPiombo.SPESSORE = nSpessore.Value; cPiombo.METODO = txtMetodo.Text; cPiombo.PESOCAMPIONE = nPesoCampione.Value; cPiombo.MATRACCIOLO = nMatracciolo.Value; cPiombo.CONCENTRAZIONE = nConcentrazione.Value; cPiombo.PBPPM = nPd.Value; cPiombo.CDPPM = nCd.Value; cPiombo.ESITO = txtEsito.Text; cPiombo.DATACERTIFICATO = dtDataCertificato.Value; cPiombo.UTENTE = Contesto.Utente.FULLNAMEUSER; cPiombo.DATAINSERIMENTO = DateTime.Now; ds.CDC_CERTIFICATIPIOMBO.AddCDC_CERTIFICATIPIOMBORow(cPiombo); CDCBLL bll = new CDCBLL(); bll.SalvaCertificatiPiombo(ds); }
private void btnCreaPdf_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; foreach (CDCDS.CDC_CERTIFICATIPIOMBORow riga in _DS.CDC_CERTIFICATIPIOMBO) { if (string.IsNullOrEmpty(riga.LOTTO)) { MessageBox.Show("La colonna LOTTO deve essere valorizzata", "ERRORE", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } Bitmap firma = Properties.Resources.logo_tf_autodichiarazione; ImageConverter converter = new ImageConverter(); byte[] image = (byte[])converter.ConvertTo(firma, typeof(byte[])); CDCBLL bll = new CDCBLL(); StringBuilder files = new StringBuilder(); foreach (CDCDS.CDC_CERTIFICATIPIOMBORow riga in _DS.CDC_CERTIFICATIPIOMBO) { decimal nPd = riga.PBPPM; Color colore; bll.CalcolaEsitoAnalisiPiombo(nPd, out colore); string spessore = string.Empty; string lunghezza = string.Empty; string larghezza = string.Empty; string elemento = string.Empty; if (!riga.IsELEMENTONull()) { elemento = riga.ELEMENTO.ToString(); } if (!riga.IsLUNGHEZZANull()) { lunghezza = riga.LUNGHEZZA.ToString(); } if (!riga.IsLARGHEZZANull()) { larghezza = riga.LARGHEZZA.ToString(); } if (!riga.IsSPESSORENull()) { spessore = riga.SPESSORE.ToString(); } string path = bll.CreaPDFCertificatoPiombo(elemento, lunghezza, larghezza, spessore.ToString(), riga.CODICE, riga.LOTTO, riga.ESITO, colore, riga.METODO, riga.DATACERTIFICATO, riga.PBPPM, riga.CDPPM, Contesto.PathAnalisiPiombo, image); files.AppendLine(path); riga.PATHFILE = path.Length > 300 ? path.Substring(0, 300) : path; } //List<CDCDS.CDC_CERTIFICATIPIOMBORow> certificati = _DS.CDC_CERTIFICATIPIOMBO.Where(x => x.IsLUNGHEZZANull()).ToList(); //foreach (CDCDS.CDC_CERTIFICATIPIOMBORow certificato in certificati) // certificato.Delete(); bll.SalvaCertificatiPiombo(_DS); MessageBox.Show("Operazionbe eseguita con successo", "INFORMAZIONE", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MainForm.LogScriviErrore("ERRORE IN CREA PDF", ex); ExceptionFrm frm = new ExceptionFrm(ex); frm.ShowDialog(); } finally { Cursor.Current = Cursors.Default; } }