private void btnCreaPDF_Click(object sender, EventArgs e) { string filename = string.Empty; string brand = ((DataCollaudo)ddlDataCollaudo.SelectedItem).Brand; try { Cursor.Current = Cursors.WaitCursor; lblMessaggio.Text = string.Empty; if (_dsServizio.Tables[tblAggregati].Rows.Count == 0) { lblMessaggio.Text = "Creare i campioni per la misura"; return; } if (_dettaglio == null) { lblMessaggio.Text = "Selezionare un collaudo"; return; } if (string.IsNullOrEmpty(txtApplicazione.Text) && CDCBrands.Gucci == brand) { lblMessaggio.Text = "Il campo applicazione è vuoto impossibile procedere"; return; } if (string.IsNullOrEmpty(txtSpessoreRichiesto.Text) && CDCBrands.Gucci == brand) { lblMessaggio.Text = "Il campo spessore richiesto è vuoto impossibile procedere"; return; } decimal IDDETTAGLIO = _dettaglio.IDDETTAGLIO; CDCDS.CDC_SPESSORERow spessore = _DS.CDC_SPESSORE.Where(x => x.RowState != DataRowState.Deleted && x.PARTE == _dettaglio.PARTE && x.COLORE == _dettaglio.COLORE && x.SEQUENZA == 0).FirstOrDefault(); if (spessore == null) { lblMessaggio.Text = "Impossibile individuare lo spessore richiesto. Impossibile procedere"; return; } if (spessore.DENOMINATORE == 0) { lblMessaggio.Text = "Denominatore a zero. Impossibile procedere"; return; } if (nMisurePerCampione.Value == 0) { lblMessaggio.Text = "Numero misure per campioni non può essere zero"; return; } CDCBLL bll = new CDCBLL(); int misurePerCampione = (int)nMisurePerCampione.Value; CDCDS.CDC_APPLICAZIONERow applicazioneRow = _DS.CDC_APPLICAZIONE.Where(x => x.PARTE == _dettaglio.PARTE && x.COLORE == _dettaglio.COLORE).FirstOrDefault(); if (applicazioneRow == null) { applicazioneRow = _DS.CDC_APPLICAZIONE.NewCDC_APPLICAZIONERow(); applicazioneRow.PARTE = _dettaglio.PARTE; applicazioneRow.COLORE = _dettaglio.COLORE; applicazioneRow.APPLICAZIONE = txtApplicazione.Text; applicazioneRow.NUMEROCAMPIONI = nMisurePerCampione.Value; applicazioneRow.SPESSORE = txtSpessoreRichiesto.Text; applicazioneRow.CERTIFICATO = tipoCertificato; _DS.CDC_APPLICAZIONE.AddCDC_APPLICAZIONERow(applicazioneRow); } else { applicazioneRow.APPLICAZIONE = txtApplicazione.Text; applicazioneRow.NUMEROCAMPIONI = nMisurePerCampione.Value; applicazioneRow.SPESSORE = txtSpessoreRichiesto.Text; } decimal IDGALVANICA = bll.InserisciCDCGalvanica(_DS, txtSpessoreRichiesto.Text, IDDETTAGLIO, txtApplicazione.Text, Contesto.StrumentoSpessore, misurePerCampione, Contesto.Utente.FULLNAMEUSER, tipoCertificato); List <CDCDS.CDC_MISURERow> idMisuraDaCancellare = _DS.CDC_MISURE.Where(x => x.RowState != DataRowState.Deleted && x.IDGALVANICA == IDGALVANICA).ToList(); foreach (CDCDS.CDC_MISURERow misura in idMisuraDaCancellare) { misura.Delete(); } foreach (DataRow riga in _dsServizio.Tables[tblMisure].Rows) { for (int j = 0; j < _dsServizio.Tables[tblMisure].Columns.Count - 3; j++) { CDCDS.CDC_MISURERow misura = _DS.CDC_MISURE.NewCDC_MISURERow(); int nMisura = (int)riga[2]; misura.NMISURA = nMisura; misura.DATAMISURA = DateTime.Today; misura.IDGALVANICA = IDGALVANICA; string tipo = _dsServizio.Tables[tblMisure].Columns[j + 3].ColumnName; string valore = (riga[3 + j]).ToString(); misura.NCOLONNA = j; misura.TIPOMISURA = tipo; misura.VALORE = valore; _DS.CDC_MISURE.AddCDC_MISURERow(misura); } } bll.SalvaTabelleSpessori(_DS); _DS.AcceptChanges(); Bitmap logoSpessori = Properties.Resources.logo_spessori_v2; ImageConverter converter = new ImageConverter(); byte[] iLogo = (byte[])converter.ConvertTo(logoSpessori, typeof(byte[])); Bitmap bowman = Properties.Resources.Bowman; converter = new ImageConverter(); byte[] iBowman = (byte[])converter.ConvertTo(bowman, typeof(byte[])); List <string> medie = new List <string>(); List <string> Std = new List <string>(); List <string> Pct = new List <string>(); List <string> range = new List <string>(); List <string> minimo = new List <string>(); List <string> massimo = new List <string>(); DataRow rigaMedie = _dsServizio.Tables[tblAggregati].Rows[0]; DataRow rigaStd = _dsServizio.Tables[tblAggregati].Rows[1]; DataRow rigaPct = _dsServizio.Tables[tblAggregati].Rows[2]; DataRow rigarange = _dsServizio.Tables[tblAggregati].Rows[3]; DataRow rigaMinimo = _dsServizio.Tables[tblAggregati].Rows[4]; DataRow rigaMassimo = _dsServizio.Tables[tblAggregati].Rows[5]; for (int ncol = 0; ncol < _dsServizio.Tables[tblAggregati].Columns.Count; ncol++) { medie.Add(rigaMedie[ncol].ToString()); Std.Add(rigaStd[ncol].ToString()); Pct.Add(rigaPct[ncol].ToString()); range.Add(rigarange[ncol].ToString()); minimo.Add(rigaMinimo[ncol].ToString()); massimo.Add(rigaMassimo[ncol].ToString()); } filename = bll.CreaPDFSpessore(IDDETTAGLIO, tipoCertificato, _DS, Contesto.PathCollaudo, iLogo, iBowman, chkCopiaReferto.Checked, Contesto.GetPathRefertiLaboratorio(brand), medie, Std, Pct, range, minimo, massimo, brand, txtNumeroCampioni.Text); if (chkApriPDF.Checked) { Process.Start(filename); } evidenziaPDFFatti(); } catch (Exception ex) { MostraEccezione(ex, "Errore in crea PDF"); } finally { Cursor.Current = Cursors.Default; } }
private void btnCreaPDF_Click(object sender, EventArgs e) { string fileCreati = string.Empty; try { Cursor.Current = Cursors.WaitCursor; bool esito = true; lblMessaggio.Text = ""; foreach (DataRow riga in _dsServizio.Tables[tableName].Rows) { if (riga["SEQUENZA"].ToString() != "") { bool aux1 = (bool)riga[14]; bool aux2 = (bool)riga[15]; if (aux1 == aux2) { esito = false; } } } if (!esito) { lblMessaggio.Text = "Impossibile creare i file. La condizione Antiallergico e Nichel Free sono mutuamente esclusive."; return; } List <decimal> idPerPDF = new List <decimal>(); foreach (DataRow riga in _dsServizio.Tables[tableName].Rows) { if (riga["SEQUENZA"].ToString() != "") { decimal idnichelfree = (decimal)riga[0]; if (idnichelfree == -1) { idnichelfree = -100; } // decimal iddettaglio = (decimal)riga[1]; int sequenza = (int)riga["SEQUENZA"]; if (!idPerPDF.Contains(iddettaglio)) { idPerPDF.Add(iddettaglio); } CDCDS.CDC_ANTIALLERGICORow antiallergicoRow = _DS.CDC_ANTIALLERGICO.Where(x => x.IDNICHELFREE == idnichelfree).FirstOrDefault(); if (antiallergicoRow == null) { antiallergicoRow = _DS.CDC_ANTIALLERGICO.NewCDC_ANTIALLERGICORow(); antiallergicoRow.IDDETTAGLIO = iddettaglio; antiallergicoRow.SEQUENZA = sequenza; antiallergicoRow.DESCRIZIONE = riga["DESCRIZIONE"].ToString(); antiallergicoRow.COLORECOMPONENTE = riga["COLORECOMPONENTE"].ToString(); antiallergicoRow.DATAPRODUZIONE = (DateTime)riga["DATAPRODUZIONE"]; // riga[9]; antiallergicoRow.UTENTE = Contesto.Utente.FULLNAMEUSER; antiallergicoRow.DATAINSERIMENTO = DateTime.Now; antiallergicoRow.NICHELFREE = ConvertiBoolInStringa(riga[15]); _DS.CDC_ANTIALLERGICO.AddCDC_ANTIALLERGICORow(antiallergicoRow); } else { antiallergicoRow.IDDETTAGLIO = iddettaglio; antiallergicoRow.SEQUENZA = sequenza; antiallergicoRow.DESCRIZIONE = riga["DESCRIZIONE"].ToString(); antiallergicoRow.COLORECOMPONENTE = riga["COLORECOMPONENTE"].ToString(); antiallergicoRow.DATAPRODUZIONE = (DateTime)riga["DATAPRODUZIONE"]; // riga[9]; antiallergicoRow.UTENTE = Contesto.Utente.FULLNAMEUSER; antiallergicoRow.DATAINSERIMENTO = DateTime.Now; antiallergicoRow.NICHELFREE = ConvertiBoolInStringa(riga[15]); } } } CDCBLL bll = new CDCBLL(); bll.SalvaDatiAntiallergia(_DS); _DS.CDC_ANTIALLERGICO.AcceptChanges(); Bitmap firma = Properties.Resources.logo_tf_autodichiarazione; ImageConverter converter = new ImageConverter(); byte[] image = (byte[])converter.ConvertTo(firma, typeof(byte[])); //fileCreati = bll.CreaPDFAntiallergico(idPerPDF, _DS, Contesto.PathCollaudo, image, chkCopiaFileReferti.Checked, Contesto.GetPathRefertiLaboratorio(((DataCollaudo)ddlDataCollaudo.SelectedItem).Brand)); //fileCreati = bll.CreaPDFAntiallergico(idPerPDF, _DS, Contesto.PathCollaudo, image, chkCopiaFileReferti.Checked, Contesto.GetPathRefertiLaboratorio(ddlBrand.SelectedItem.ToString())); fileCreati = bll.CreaPDFAntiallergico(idPerPDF, _DS, Contesto.PathCollaudo, image, chkCopiaFileReferti.Checked, Contesto.GetPathRefertiLaboratorio(ddlBrand.SelectedItem.ToString())); btnLeggiDati_Click(null, null); } finally { Cursor.Current = Cursors.Default; } StringBuilder sb = new StringBuilder(); sb.AppendLine("Sono stati creati i seguenti file:"); sb.Append(fileCreati); MessageBox.Show(sb.ToString(), "FILE PDF CREATI", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnCreaPDF_Click(object sender, EventArgs e) { string fileCreati = string.Empty; try { Cursor.Current = Cursors.WaitCursor; bool esito = true; lblMessaggio.Text = ""; List <decimal> idPerPDF = new List <decimal>(); foreach (DataRow riga in _dsServizio.Tables[tableName].Rows) { decimal iddettaglio = (decimal)riga[0]; idPerPDF.Add(iddettaglio); string fornitore = ConvertiInStringa(riga[11]); fornitore = fornitore.Length > 25 ? fornitore.Substring(0, 25) : fornitore; CDCDS.CDC_VERNICICOPRENTIRow vCoprenteRow = _DS.CDC_VERNICICOPRENTI.Where(x => x.IDDETTAGLIO == iddettaglio).FirstOrDefault(); if (vCoprenteRow == null) { vCoprenteRow = _DS.CDC_VERNICICOPRENTI.NewCDC_VERNICICOPRENTIRow(); vCoprenteRow.IDDETTAGLIO = iddettaglio; vCoprenteRow.UTENTE = Contesto.Utente.FULLNAMEUSER; vCoprenteRow.DATAINSERIMENTO = DateTime.Now; vCoprenteRow.DATATEST = (DateTime)riga[9]; vCoprenteRow.NUMEROCAMPIONI = (Decimal)riga[10]; vCoprenteRow.FORNITORE = fornitore; vCoprenteRow.TURBULA = ConvertiBoolInStringa(riga[12]); vCoprenteRow.QUADRETTATURA = ConvertiBoolInStringa(riga[13]); _DS.CDC_VERNICICOPRENTI.AddCDC_VERNICICOPRENTIRow(vCoprenteRow); } else { vCoprenteRow.UTENTE = Contesto.Utente.FULLNAMEUSER; vCoprenteRow.DATAINSERIMENTO = DateTime.Now; vCoprenteRow.DATATEST = (DateTime)riga[9]; vCoprenteRow.NUMEROCAMPIONI = (decimal)riga[10]; vCoprenteRow.FORNITORE = fornitore; vCoprenteRow.TURBULA = ConvertiBoolInStringa(riga[12]); vCoprenteRow.QUADRETTATURA = ConvertiBoolInStringa(riga[13]); } } CDCBLL bll = new CDCBLL(); bll.SalvaDatiVerniciaturaCoprente(_DS); _DS.CDC_VERNICICOPRENTI.AcceptChanges(); Bitmap firma = Properties.Resources.logo_spessori_v2; ImageConverter converter = new ImageConverter(); byte[] image = (byte[])converter.ConvertTo(firma, typeof(byte[])); fileCreati = bll.CreaPDFVerniceCoprente(idPerPDF, _DS, Contesto.PathCollaudo, image, chkCopiaFileReferti.Checked, Contesto.GetPathRefertiLaboratorio(((DataCollaudo)ddlDataCollaudo.SelectedItem).Brand)); btnLeggiDati_Click(null, null); } finally { Cursor.Current = Cursors.Default; } StringBuilder sb = new StringBuilder(); sb.AppendLine("Sono stati creati i seguenti file:"); sb.Append(fileCreati); MessageBox.Show(sb.ToString(), "FILE PDF CREATI", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnCreaPDF_Click(object sender, EventArgs e) { string fileCreati = string.Empty; try { Cursor.Current = Cursors.WaitCursor; bool esito = true; lblMessaggio.Text = ""; List <decimal> idPerPDF = new List <decimal>(); foreach (DataRow riga in _dsServizio.Tables[tableName].Rows) { if (riga["SEQUENZA"].ToString() != "") { decimal idtenuta = (decimal)riga[0]; if (idtenuta == -1) { idtenuta = -100; } // decimal iddettaglio = (decimal)riga[1]; int sequenza = (int)riga["SEQUENZA"]; if (!idPerPDF.Contains(iddettaglio)) { idPerPDF.Add(iddettaglio); } string stringa = ConvertiInStringa(riga[15]); stringa = stringa.Length > 25 ? stringa.Substring(0, 25) : stringa; CDCDS.CDC_TENUTACIDONITRICORow tenutaRow = _DS.CDC_TENUTACIDONITRICO.Where(x => x.IDTENUTA == idtenuta).FirstOrDefault(); if (tenutaRow == null) { tenutaRow = _DS.CDC_TENUTACIDONITRICO.NewCDC_TENUTACIDONITRICORow(); tenutaRow.IDDETTAGLIO = iddettaglio; tenutaRow.SEQUENZA = sequenza; tenutaRow.DESCRIZIONE = riga["DESCRIZIONE"].ToString(); tenutaRow.COLORECOMPONENTE = riga["COLORECOMPONENTE"].ToString(); tenutaRow.DATATEST = (DateTime)riga[13]; tenutaRow.NUMEROCAMPIONI = (Decimal)riga[14]; tenutaRow.BOLLA = stringa; if (riga[16] != DBNull.Value) { tenutaRow.DATADDT = (DateTime)riga[16]; } tenutaRow.ESITO = ConvertiBoolInStringa(riga[17]); tenutaRow.UTENTE = Contesto.Utente.FULLNAMEUSER; tenutaRow.DATAINSERIMENTO = DateTime.Now; _DS.CDC_TENUTACIDONITRICO.AddCDC_TENUTACIDONITRICORow(tenutaRow); } else { tenutaRow.IDDETTAGLIO = iddettaglio; tenutaRow.SEQUENZA = sequenza; tenutaRow.DESCRIZIONE = riga["DESCRIZIONE"].ToString(); tenutaRow.COLORECOMPONENTE = riga["COLORECOMPONENTE"].ToString(); tenutaRow.DATATEST = (DateTime)riga[13]; tenutaRow.NUMEROCAMPIONI = (Decimal)riga[14]; tenutaRow.BOLLA = stringa; if (riga[16] != DBNull.Value) { tenutaRow.DATADDT = (DateTime)riga[16]; } tenutaRow.ESITO = ConvertiBoolInStringa(riga[17]); tenutaRow.UTENTE = Contesto.Utente.FULLNAMEUSER; tenutaRow.DATAINSERIMENTO = DateTime.Now; } } } CDCBLL bll = new CDCBLL(); bll.SalvaDatiTenutaAcidoNitrico(_DS); _DS.CDC_TENUTACIDONITRICO.AcceptChanges(); Bitmap firma = Properties.Resources.logo_spessori_v2; ImageConverter converter = new ImageConverter(); byte[] image = (byte[])converter.ConvertTo(firma, typeof(byte[])); //fileCreati = bll.CreaPDFTenutaAcidoNitrico(idPerPDF, _DS, Contesto.PathCollaudo, image, chkCopiaFileReferti.Checked, Contesto.GetPathRefertiLaboratorio(((DataCollaudo)ddlDataCollaudo.SelectedItem).Brand)); fileCreati = bll.CreaPDFTenutaAcidoNitrico(idPerPDF, _DS, Contesto.PathCollaudo, image, chkCopiaFileReferti.Checked, Contesto.GetPathRefertiLaboratorio(ddlBrand.SelectedItem.ToString())); btnLeggiDati_Click(null, null); } finally { Cursor.Current = Cursors.Default; } StringBuilder sb = new StringBuilder(); sb.AppendLine("Sono stati creati i seguenti file:"); sb.Append(fileCreati); MessageBox.Show(sb.ToString(), "FILE PDF CREATI", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnCreaPDF_Click(object sender, EventArgs e) { string fileCreati = string.Empty; try { Cursor.Current = Cursors.WaitCursor; bool esito = true; lblMessaggio.Text = ""; foreach (DataRow riga in _dsServizio.Tables[tableName].Rows) { string richiestL = (string)riga[11]; string richiesta = (string)riga[15]; string richiestb = (string)riga[19]; if (richiestL == string.Empty || richiesta == string.Empty || richiestb == string.Empty) { esito = false; } } if (!esito) { MessageBox.Show("Ci sono delle righe in cui il colore richiesto non è valorizzato. Per queste righe NON verranno salvate e NON verranno creati PDF.", "INFORMAZIONE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } List <decimal> idPerPDF = new List <decimal>(); foreach (DataRow riga in _dsServizio.Tables[tableName].Rows) { string richiestL = (string)riga[11]; string richiesta = (string)riga[15]; string richiestb = (string)riga[19]; if (richiestL == string.Empty || richiesta == string.Empty || richiestb == string.Empty) { continue; } decimal iddettaglio = (decimal)riga[0]; idPerPDF.Add(iddettaglio); DateTime dataInserimento = (DateTime)riga[9]; DateTime dataCalibrazione = (DateTime)riga[10]; CaricaColore(_DS, iddettaglio, CDCTipoColore.L, dataInserimento, dataCalibrazione, ConvertiInStringa(riga[11]), ConvertiInStringa(riga[12]), ConvertiInStringa(riga[13]), ConvertiBoolInStringa(riga[14]), ConvertiInStringa(riga[23])); CaricaColore(_DS, iddettaglio, CDCTipoColore.a, dataInserimento, dataCalibrazione, ConvertiInStringa(riga[15]), ConvertiInStringa(riga[16]), ConvertiInStringa(riga[17]), ConvertiBoolInStringa(riga[18]), ConvertiInStringa(riga[23])); CaricaColore(_DS, iddettaglio, CDCTipoColore.b, dataInserimento, dataCalibrazione, ConvertiInStringa(riga[19]), ConvertiInStringa(riga[20]), ConvertiInStringa(riga[21]), ConvertiBoolInStringa(riga[22]), ConvertiInStringa(riga[23])); } CDCBLL bll = new CDCBLL(); bll.SalvaDatiColore(_DS); _DS.CDC_COLORE.AcceptChanges(); Bitmap firma = Properties.Resources.loghi; ImageConverter converter = new ImageConverter(); byte[] image = (byte[])converter.ConvertTo(firma, typeof(byte[])); fileCreati = bll.CreaPDFColore(idPerPDF, _DS, Contesto.PathCollaudo, image, chkCopiaFileReferti.Checked, Contesto.GetPathRefertiLaboratorio(((DataCollaudo)ddlDataCollaudo.SelectedItem).Brand)); btnLeggiDati_Click(null, null); } finally { Cursor.Current = Cursors.Default; } StringBuilder sb = new StringBuilder(); sb.AppendLine("Sono stati creati i seguenti file:"); sb.Append(fileCreati); MessageBox.Show(sb.ToString(), "FILE PDF CREATI", MessageBoxButtons.OK, MessageBoxIcon.Information); }