private void OpenReport(object parameter) { JobCard jobCard = (JobCard)parameter; string path = TermsProvider.GetTempFolderPath() + "\\" + jobCard.AirlineCardNumber + ".pdf"; if (!File.Exists(path)) { UsefulMethods.SaveFileFromByteArray(jobCard.AttachedFile.FileData, path); } Process tempProcess = new Process(); tempProcess.StartInfo = new ProcessStartInfo(path); try { tempProcess.Start(); tempProcess.WaitForExit(); } catch (Exception ex) { Program.Provider.Logger.Log("Error while loading data", ex); } try { TryDeleteFile(path); } catch (Exception ex) { Program.Provider.Logger.Log("Error while deleting data", ex); } }
private void SaveJobCardToFile() { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "Adobe PDF Files|*.pdf"; dialog.FileName = listViewJobCards.SelectedItem.AirlineCardNumber; if (dialog.ShowDialog() == DialogResult.OK) { UsefulMethods.SaveFileFromByteArray(listViewJobCards.SelectedItem.AttachedFile.FileData, dialog.FileName); } }
private void buttonSaveToDisk_Click(object sender, EventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "Select directory where to store files"; if (dialog.ShowDialog() == DialogResult.OK) { List <JobCard> jobCards = new List <JobCard>(subCheck.JobCards); for (int i = 0; i < subCheck.JoinedSubChecks.Count; i++) { jobCards.AddRange(subCheck.JoinedSubChecks[i].JobCards); } for (int i = 0; i < jobCards.Count; i++) { UsefulMethods.SaveFileFromByteArray(jobCards[i].AttachedFile.FileData, dialog.SelectedPath + "\\ " + jobCards[i].AirlineCardNumber + ".pdf"); } Process.Start(dialog.SelectedPath); } }