Пример #1
0
 private void btnStampa_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     if (grdEventi.SelectedRows.Count == 1)
     {
         FolderBrowserDialog selectFolder = new FolderBrowserDialog();
         var res = selectFolder.ShowDialog();
         if (res == DialogResult.OK)
         {
             string path     = selectFolder.SelectedPath;
             long   cdEvento = (long)grdEventi.SelectedRows[0].Cells["Numero"].Value;
             using (databaseContext = CreateDatabaseContext())
             {
                 EventiManagerNew   manager           = new EventiManagerNew(databaseContext);
                 IList <NewOggetti> allPrintableItems = manager.GetPrintableItems(cdEvento);
                 if (allPrintableItems.Count > 0)
                 {
                     CartelliniOggetto cartelliniOggetti = new CartelliniOggetto(path + @"\Oggetti-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableItems);
                     cartelliniOggetti.Save();
                 }
                 IList <NewSostanze> allPrintableSubstances = manager.GetPrintableSubstances(cdEvento);
                 if (allPrintableSubstances.Count > 0)
                 {
                     CartelliniSostanze cartelliniSostanze = new CartelliniSostanze(path + @"\Sostanze-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableSubstances);
                     cartelliniSostanze.Save();
                 }
                 IList <NewSostanze> allPrintableIngredients = manager.GetPrintableIngredients(cdEvento);
                 if (allPrintableIngredients.Count > 0)
                 {
                     CartelliniIngredienti cartelliniIngredienti = new CartelliniIngredienti(path + @"\Ingredienti-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableIngredients);
                     cartelliniIngredienti.Save();
                 }
                 IList <HoloDisk> allPrintableDatapad = manager.GetPrintableHolodisks(cdEvento);
                 if (allPrintableDatapad.Count > 0)
                 {
                     CartelliniDatapad cartelliniDatapad = new CartelliniDatapad(path + @"\Datapad-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableDatapad);
                     cartelliniDatapad.Save();
                 }
             }
             MessageBox.Show("Stampa avvenuta");
             OpenFolder(path);
         }
     }
     Cursor.Current = Cursors.Default;
 }
Пример #2
0
 private void btnStampa_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     if (grdSostanze.SelectedRows.Count > 0)
     {
         FolderBrowserDialog selectFolder = new FolderBrowserDialog();
         var res = selectFolder.ShowDialog();
         if (res == DialogResult.OK)
         {
             string path         = selectFolder.SelectedPath;
             long   tipoSostanze = (long)cmbTipoSostanza.SelectedValue;
             using (databaseContext = CreateDatabaseContext())
             {
                 SostanzeManager manager = new SostanzeManager(databaseContext);
                 List <long>     indexes = new List <long>();
                 for (int i = 0; i < grdSostanze.SelectedRows.Count; i++)
                 {
                     indexes.Add((long)grdSostanze.SelectedRows[i].Cells["Progressivo"].Value);
                 }
                 List <NewSostanze> itemsToPrint = manager.GetSubstancesFromNumbers(indexes).ToList <NewSostanze>();
                 if (itemsToPrint.Count == 1 && chkMultiplePrint.Checked)
                 {
                     for (int i = 1; i < 10; i++)
                     {
                         itemsToPrint.Add(itemsToPrint[0]);
                     }
                 }
                 if (tipoSostanze == 0)
                 {
                     CartelliniIngredienti cartellini = new CartelliniIngredienti(path + @"\" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", itemsToPrint);
                     cartellini.Save();
                 }
                 else
                 {
                     CartelliniSostanze cartellini = new CartelliniSostanze(path + @"\" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", itemsToPrint);
                     cartellini.Save();
                 }
             }
             MessageBox.Show("Stampa avvenuta");
             OpenFolder(path);
         }
     }
     Cursor.Current = Cursors.Default;
 }
Пример #3
0
 private void btnStampa_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     if (grdSostanze.SelectedRows.Count > 0)
     {
         FolderBrowserDialog selectFolder = new FolderBrowserDialog();
         var res = selectFolder.ShowDialog();
         if (res == DialogResult.OK)
         {
             string path = selectFolder.SelectedPath;
             long tipoSostanze = (long)cmbTipoSostanza.SelectedValue;
             using (databaseContext = CreateDatabaseContext())
             {
                 SostanzeManager manager = new SostanzeManager(databaseContext);
                 List<long> indexes = new List<long>();
                 for (int i = 0; i < grdSostanze.SelectedRows.Count; i++)
                 {
                     indexes.Add((long)grdSostanze.SelectedRows[i].Cells["Progressivo"].Value);
                 }
                 List<NewSostanze> itemsToPrint = manager.GetSubstancesFromNumbers(indexes).ToList<NewSostanze>();
                 if (itemsToPrint.Count == 1 && chkMultiplePrint.Checked)
                 {
                     for (int i = 1; i < 10; i++)
                     {
                         itemsToPrint.Add(itemsToPrint[0]);
                     }
                 }
                 if (tipoSostanze == 0)
                 {
                     CartelliniIngredienti cartellini = new CartelliniIngredienti(path + @"\" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", itemsToPrint);
                     cartellini.Save();
                 }
                 else
                 {
                     CartelliniSostanze cartellini = new CartelliniSostanze(path + @"\" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", itemsToPrint);
                     cartellini.Save();
                 }
             }
             MessageBox.Show("Stampa avvenuta");
             OpenFolder(path);
         }
     }
     Cursor.Current = Cursors.Default;
 }
Пример #4
0
 private void btnStampa_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     if (grdEventi.SelectedRows.Count == 1)
     {
         FolderBrowserDialog selectFolder = new FolderBrowserDialog();
         var res = selectFolder.ShowDialog();
         if (res == DialogResult.OK)
         {
             string path = selectFolder.SelectedPath;
             long cdEvento = (long)grdEventi.SelectedRows[0].Cells["Numero"].Value;
             using (databaseContext = CreateDatabaseContext())
             {
                 EventiManagerNew manager = new EventiManagerNew(databaseContext);
                 IList<NewOggetti> allPrintableItems = manager.GetPrintableItems(cdEvento);
                 if (allPrintableItems.Count > 0)
                 {
                     CartelliniOggetto cartelliniOggetti = new CartelliniOggetto(path + @"\Oggetti-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableItems);
                     cartelliniOggetti.Save();
                 }
                 IList<NewSostanze> allPrintableSubstances = manager.GetPrintableSubstances(cdEvento);
                 if (allPrintableSubstances.Count > 0)
                 {
                     CartelliniSostanze cartelliniSostanze = new CartelliniSostanze(path + @"\Sostanze-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableSubstances);
                     cartelliniSostanze.Save();
                 }
                 IList<NewSostanze> allPrintableIngredients = manager.GetPrintableIngredients(cdEvento);
                 if (allPrintableIngredients.Count > 0)
                 {
                     CartelliniIngredienti cartelliniIngredienti = new CartelliniIngredienti(path + @"\Ingredienti-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableIngredients);
                     cartelliniIngredienti.Save();
                 }
                 IList<HoloDisk> allPrintableDatapad = manager.GetPrintableHolodisks(cdEvento);
                 if (allPrintableDatapad.Count > 0)
                 {
                     CartelliniDatapad cartelliniDatapad = new CartelliniDatapad(path + @"\Datapad-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second + ".pdf", allPrintableDatapad);
                     cartelliniDatapad.Save();
                 }
             }
             MessageBox.Show("Stampa avvenuta");
             OpenFolder(path);
         }
     }
     Cursor.Current = Cursors.Default;
 }