private void btnStampa_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (grdDischi.SelectedRows.Count > 0) { FolderBrowserDialog selectFolder = new FolderBrowserDialog(); var res = selectFolder.ShowDialog(); if (res == DialogResult.OK) { string path = selectFolder.SelectedPath; using (databaseContext = CreateDatabaseContext()) { HoloDischiManager manager = new HoloDischiManager(databaseContext); List <long> indexes = new List <long>(); for (int i = 0; i < grdDischi.SelectedRows.Count; i++) { indexes.Add((long)grdDischi.SelectedRows[i].Cells["Progressivo"].Value); } List <HoloDisk> itemsToPrint = manager.GetDisksFromNumbers(indexes).ToList(); if (itemsToPrint.Count == 1) { for (int i = 1; i < 10; i++) { itemsToPrint.Add(itemsToPrint[0]); } } CartelliniDatapad cartellini = new CartelliniDatapad(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; }
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; }
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; }
private void btnStampa_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (grdDischi.SelectedRows.Count > 0) { FolderBrowserDialog selectFolder = new FolderBrowserDialog(); var res = selectFolder.ShowDialog(); if (res == DialogResult.OK) { string path = selectFolder.SelectedPath; using (databaseContext = CreateDatabaseContext()) { HoloDischiManager manager = new HoloDischiManager(databaseContext); List<long> indexes = new List<long>(); for (int i = 0; i < grdDischi.SelectedRows.Count; i++) { indexes.Add((long)grdDischi.SelectedRows[i].Cells["Progressivo"].Value); } List<HoloDisk> itemsToPrint = manager.GetDisksFromNumbers(indexes).ToList(); if (itemsToPrint.Count == 1) { for (int i = 1; i < 10; i++) { itemsToPrint.Add(itemsToPrint[0]); } } CartelliniDatapad cartellini = new CartelliniDatapad(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; }