diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index cfd70fa8..72e7c793 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -121,13 +121,20 @@ namespace Volian.Print.Library get { return _OpenPDF; } set { _OpenPDF = value; } } + private bool _OverWrite; + + public bool OverWrite + { + get { return _OverWrite; } + set { _OverWrite = value; } + } private ChangeBarDefinition _MyChangeBarDefinition; public ChangeBarDefinition MyChangeBarDefinition { get { return _MyChangeBarDefinition; } set { _MyChangeBarDefinition = value; } } - public PromsPrinter(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, string backgroundFolder,bool openPDF, ChangeBarDefinition cbd) + public PromsPrinter(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, string backgroundFolder,bool openPDF, bool overWrite, ChangeBarDefinition cbd) { _MyItem = myItem; _Rev = rev; @@ -136,6 +143,7 @@ namespace Volian.Print.Library _DebugOutput = debugOutput; _BackgroundFolder = backgroundFolder; _OpenPDF = openPDF; + _OverWrite = overWrite; _MyChangeBarDefinition = cbd; } public string Print(string pdfFolder) @@ -237,6 +245,11 @@ namespace Volian.Print.Library { OnStatusChanged("Print " + myProcedure.DisplayNumber, PromsPrinterStatusType.Start); string outputFileName = pdfFolder + "\\" + CreateFileName(myProcedure.DisplayNumber); + if (!OverWrite && File.Exists(outputFileName)) + { + if (MessageBox.Show(outputFileName + " exists. Overwrite file?", "File Exists", MessageBoxButtons.YesNo) == DialogResult.No) + return null; + } // Create an MSWord Pdf // Setup a pdf Document for printing OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before);