private void CaricaCertificatiPiombo(string filtro) { _DS.CDC_CERTIFICATIPIOMBO.Clear(); CDCBLL bll = new CDCBLL(); bll.FillCDC_CERTIFICATIPIOMBO(_DS); lstCertificatiDaAssociare.Items.Clear(); List<CDCDS.CDC_CERTIFICATIPIOMBORow> certificati = _DS.CDC_CERTIFICATIPIOMBO.ToList(); foreach (CDCDS.CDC_CERTIFICATIPIOMBORow certificato in certificati) { decimal volume = 0; decimal pesoSpecifico = 8.40m; if (certificato.MATERIALE == "OTTONE SENZA PIOMBO") pesoSpecifico = 8.36m; decimal peso = volume * pesoSpecifico; CertificatoPiombo cp = new CertificatoPiombo() { Descrizione = certificato.CODICE, IDCERTIFICATIPIOMBO = certificato.IDCERTIFICATIPIOMBO, Peso = peso, Volume = volume, DataCertificato = certificato.DATACERTIFICATO, path = certificato.IsPATHFILENull() ? string.Empty : certificato.PATHFILE }; if (!string.IsNullOrEmpty(filtro) && !cp.ToString().Contains(filtro)) continue; lstCertificatiDaAssociare.Items.Add(cp); } }
static void Main(string[] args) { string pathTemporaneo = @"c:\temp\piombo\"; string filename = @"C:\VSProgetti\CDCMetal\CDCMetal\CDCMetal\Resources\logo_tf_autodichiarazione.png"; Bitmap firma = (Bitmap)Bitmap.FromFile(filename); // Bitmap firma = Properties.Resources.logo_tf_autodichiarazione; ImageConverter converter = new ImageConverter(); byte[] image = (byte[])converter.ConvertTo(firma, typeof(byte[])); CDCBLL bll = new CDCBLL(); CDCDS ds = new CDCDS(); bll.FillCDC_CERTIFICATIPIOMBO(ds); 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, pathTemporaneo, image); files.AppendLine(path); } }