コード例 #1
0
ファイル: JsonManager.cs プロジェクト: FlewRian/TourPlanner
 public bool JsonExport(IEnumerable <Tour> tours, IEnumerable <TourLog> tourLogs)
 {
     _saveFileDialog.Filter = "Json Files (*.json) | *.json";
     _saveFileDialog.ShowDialog();
     if (!_saveFileDialog.FileName.Equals(""))
     {
         Tour_LogJson data = new Tour_LogJson(tours, tourLogs);
         string       json = JsonConvert.SerializeObject(data, Formatting.Indented);
         File.WriteAllText(_saveFileDialog.FileName, json);
         return(true);
     }
     return(false);
 }
コード例 #2
0
        public bool GenerateReportPDF(Tour currentTour, IEnumerable <TourLog> tourLogs, bool logSummary)
        {
            _saveFile.Filter = "PDF Files (*.pdf) | *.pdf"; //Here you can filter which all files you wanted allow to open
            _saveFile.ShowDialog();
            if (!_saveFile.FileName.Equals(""))
            {
                var htmlToPdf = new HtmlToPdf();
                var pdf       = htmlToPdf.RenderHtmlAsPdf(ConvertToHTML(currentTour, tourLogs, logSummary));
                pdf.SaveAs(_saveFile.FileName);
                return(true);
            }

            return(false);
        }