コード例 #1
0
        private void CreaDsPerAntiallergico()
        {
            _dsServizio = new DataSet();
            DataTable dtCartelle = _dsServizio.Tables.Add();

            dtCartelle.TableName = tableName;
            dtCartelle.Columns.Add("IDDETTAGLIO", Type.GetType("System.Decimal"));
            dtCartelle.Columns.Add("IDPRENOTAZIONE", Type.GetType("System.Decimal")).ReadOnly = true;
            dtCartelle.Columns.Add("ACCESSORISTA", Type.GetType("System.String")).ReadOnly    = true;

            dtCartelle.Columns.Add("DATACOLLAUDO", Type.GetType("System.DateTime")).ReadOnly = true;
            dtCartelle.Columns.Add("PREFISSO", Type.GetType("System.String")).ReadOnly       = true;
            dtCartelle.Columns.Add("PARTE", Type.GetType("System.String")).ReadOnly          = true;
            dtCartelle.Columns.Add("COLORE", Type.GetType("System.String")).ReadOnly         = true;
            dtCartelle.Columns.Add("COMMESSA", Type.GetType("System.String")).ReadOnly       = true;
            dtCartelle.Columns.Add("QUANTITA", Type.GetType("System.String")).ReadOnly       = true;
            dtCartelle.Columns.Add("DATAPRODUZIONE", Type.GetType("System.DateTime"));
            dtCartelle.Columns.Add("ANTIALLERGICO", Type.GetType("System.Boolean"));
            dtCartelle.Columns.Add("NICHELFREE", Type.GetType("System.Boolean"));


            foreach (CDCDS.CDC_DETTAGLIORow dettaglio in _DS.CDC_DETTAGLIO)
            {
                DataRow riga = dtCartelle.NewRow();

                riga[0] = dettaglio.IDDETTAGLIO;
                riga[1] = dettaglio.IDPRENOTAZIONE;
                riga[2] = dettaglio.ACCESSORISTA;
                riga[3] = dettaglio.DATACOLLAUDO;
                riga[4] = dettaglio.PREFISSO;
                riga[5] = dettaglio.PARTE;
                riga[6] = dettaglio.COLORE;
                riga[7] = dettaglio.COMMESSAORDINE;
                riga[8] = dettaglio.QUANTITA;

                CDCDS.CDC_ANTIALLERGICORow antiallergico = _DS.CDC_ANTIALLERGICO.Where(x => x.IDDETTAGLIO == dettaglio.IDDETTAGLIO).FirstOrDefault();
                if (antiallergico != null)
                {
                    riga[9]  = antiallergico.DATAPRODUZIONE;
                    riga[10] = antiallergico.NICHELFREE == "S" ? false : true;
                    riga[11] = antiallergico.NICHELFREE == "S" ? true : false;
                }
                else
                {
                    riga[9]  = DateTime.Today;
                    riga[10] = false;
                    riga[11] = false;
                }

                dtCartelle.Rows.Add(riga);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        private void CreaDsPerAntiallergico()
        {
            _dsServizio = new DataSet();
            DataTable dtCartelle = _dsServizio.Tables.Add();

            dtCartelle.TableName = tableName;
            dtCartelle.Columns.Add("IDNICHELFREE", Type.GetType("System.Decimal"));
            dtCartelle.Columns.Add("IDDETTAGLIO", Type.GetType("System.Decimal"));
            dtCartelle.Columns.Add("IDPRENOTAZIONE", Type.GetType("System.Decimal")).ReadOnly = true;
            dtCartelle.Columns.Add("ACCESSORISTA", Type.GetType("System.String")).ReadOnly    = true;

            dtCartelle.Columns.Add("DATACOLLAUDO", Type.GetType("System.DateTime")).ReadOnly = true;
            dtCartelle.Columns.Add("PREFISSO", Type.GetType("System.String")).ReadOnly       = true;
            dtCartelle.Columns.Add("PARTE", Type.GetType("System.String")).ReadOnly          = true;
            dtCartelle.Columns.Add("COLORE", Type.GetType("System.String")).ReadOnly         = true;

            dtCartelle.Columns.Add("SEQUENZA", Type.GetType("System.Int32"));
            dtCartelle.Columns.Add("DESCRIZIONE", Type.GetType("System.String"));
            dtCartelle.Columns.Add("COLORECOMPONENTE", Type.GetType("System.String"));

            dtCartelle.Columns.Add("COMMESSA", Type.GetType("System.String")).ReadOnly = true;
            dtCartelle.Columns.Add("QUANTITA", Type.GetType("System.String")).ReadOnly = true;
            dtCartelle.Columns.Add("DATAPRODUZIONE", Type.GetType("System.DateTime"));
            dtCartelle.Columns.Add("ANTIALLERGICO", Type.GetType("System.Boolean"));
            dtCartelle.Columns.Add("NICHELFREE", Type.GetType("System.Boolean"));


            foreach (CDCDS.CDC_DETTAGLIORow dettaglio in _DS.CDC_DETTAGLIO)
            {
                string PARTE  = dettaglio.PARTE;
                string COLORE = dettaglio.COLORE;
                List <CDCDS.CDC_ARTICOLIRow> articoli = _DS.CDC_ARTICOLI.Where(x => x.PARTE == PARTE && x.COLORE == COLORE).OrderBy(x => x.SEQUENZA).ToList();


                if (articoli.Count == 0)
                {
                    DataRow riga = dtCartelle.NewRow();

                    riga[1] = dettaglio.IDDETTAGLIO;
                    riga[2] = dettaglio.IDPRENOTAZIONE;
                    riga[3] = dettaglio.ACCESSORISTA;
                    riga[4] = dettaglio.DATACOLLAUDO;
                    riga[5] = dettaglio.PREFISSO;
                    riga[6] = dettaglio.PARTE;
                    riga[7] = dettaglio.COLORE;

                    riga[11] = dettaglio.COMMESSAORDINE;
                    riga[12] = dettaglio.QUANTITA;

                    dtCartelle.Rows.Add(riga);
                }
                else
                {
                    foreach (CDCDS.CDC_ARTICOLIRow articolo in articoli)
                    {
                        DataRow riga = dtCartelle.NewRow();

                        riga[1] = dettaglio.IDDETTAGLIO;
                        riga[2] = dettaglio.IDPRENOTAZIONE;
                        riga[3] = dettaglio.ACCESSORISTA;
                        riga[4] = dettaglio.DATACOLLAUDO;
                        riga[5] = dettaglio.PREFISSO;
                        riga[6] = dettaglio.PARTE;
                        riga[7] = dettaglio.COLORE;


                        riga[8]  = articolo.SEQUENZA;
                        riga[9]  = articolo.DESCRIZIONE;
                        riga[10] = articolo.COLORECOMPONENTE;

                        riga[11] = dettaglio.COMMESSAORDINE;
                        riga[12] = dettaglio.QUANTITA;

                        CDCDS.CDC_ANTIALLERGICORow antiallergico = _DS.CDC_ANTIALLERGICO.Where(x => x.IDDETTAGLIO == dettaglio.IDDETTAGLIO && x.SEQUENZA == articolo.SEQUENZA).FirstOrDefault();
                        if (antiallergico != null)
                        {
                            riga[0]  = antiallergico.IDNICHELFREE;
                            riga[13] = antiallergico.DATAPRODUZIONE;
                            riga[14] = antiallergico.NICHELFREE == "S" ? false : true;
                            riga[15] = antiallergico.NICHELFREE == "S" ? true : false;
                        }
                        else
                        {
                            riga[0]  = -1;
                            riga[13] = DateTime.Today;
                            riga[14] = false;
                            riga[15] = false;
                        }

                        dtCartelle.Rows.Add(riga);
                    }
                }
            }
        }