From 8cb0c787300cce0334efc5602c9b98e0624d3e3f Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 5 Apr 2012 20:57:44 +0000 Subject: [PATCH] Added Error Log if Word File Could not be created Select section node after it is created Don't allow an empty procedure to be printed --- PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs | 3 +-- PROMS/Volian.Controls.Library/vlnTreeView.cs | 1 + PROMS/Volian.Print.Library/PromsPrinter.cs | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 118eebf8..dd6cd2eb 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -340,6 +340,7 @@ namespace VEPROMS.CSLA.Library } catch (Exception ex) { + _MyLog.Error("***** Could not create " + _MyFile.FullName, ex); Console.WriteLine(ex.Message); } } @@ -526,9 +527,7 @@ namespace VEPROMS.CSLA.Library //ItemInfo sect = doc.DocumentEntries[0].MyContent.ContentItems[0]; return ToPDFReplaceROs(sect, false, roids); } - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public static string ToPDFReplaceROs(ItemInfo sect, bool openPdf, List roids) //, System.Drawing.Color overrideColor, System.Windows.Forms.Form myForm) { string fileName = GetFileName(sect); diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 43654113..651a1236 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -1175,6 +1175,7 @@ namespace Volian.Controls.Library { tn = new VETreeNode(_LastSectionInfo); SelectedNode.Nodes.Add(tn); // add tree node to end of list. + OnNodeSelect(this, new vlnTreeEventArgs(tn)); } else { diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 1887537a..465b2584 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -321,6 +321,11 @@ namespace Volian.Print.Library OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before); cb.PdfDocument.NewPage(); // Start of print OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage); + if (myProcedure.Sections == null) + { + MessageBox.Show("This procedure has no content and will not be printed.", "Empty Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information); + return null; + } OnStatusChanged(myProcedure.DisplayNumber, PromsPrinterStatusType.ProgressSetup, myProcedure.Sections.Count); int progress = 0; int finalMessageSectionID = GetFinalMessageSectionID(myProcedure, doingFoldout);