C2021-020 Updated the message box that displays when a PDF is open of the same procedure you are trying to approve.
This commit is contained in:
parent
8567015267
commit
822c9136d0
@ -10,6 +10,7 @@ using Volian.Base.Library;
|
||||
using Volian.Print.Library;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Globalization;
|
||||
using DevComponents.DotNetBar;
|
||||
using JR.Utils.GUI.Forms;
|
||||
|
||||
@ -351,7 +352,7 @@ namespace VEPROMS
|
||||
private void btnApprove_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
if(!_MyApproval.Approve(new Point(Left,Bottom)))
|
||||
if(!_MyApproval.Approve(new Point(Left,Bottom),cmbRevisionStage2.Text)) // C2021-020 pass in the revision stage name
|
||||
this.DialogResult = DialogResult.None;
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
@ -1041,7 +1042,8 @@ namespace VEPROMS
|
||||
}
|
||||
return s1.CompareTo(s2);
|
||||
}
|
||||
public bool Approve(Point location)
|
||||
// C2021-020 pass in the name of the revision stage
|
||||
public bool Approve(Point location, string revisionStage)
|
||||
{
|
||||
// The following is a description of the tables used to defined the various revisions of the procedure set.
|
||||
// Revision:
|
||||
@ -1105,8 +1107,8 @@ namespace VEPROMS
|
||||
string summaryPDF = string.Format(@"{0}\{1} Summary of Changes.pdf", VlnSettings.TemporaryFolder, pi.PDFNumber);
|
||||
string pdfTmp = string.Format(@"{0}.pdf", pi.PDFNumber);
|
||||
string pdfPath = string.Format(@"{0}\{1}", VlnSettings.TemporaryFolder, pdfTmp);
|
||||
if (!TryToDelete(summaryPDF)) break;
|
||||
if (!TryToDelete(pdfPath)) break;
|
||||
if (!TryToDelete(summaryPDF, "Change Summary")) break;
|
||||
if (!TryToDelete(pdfPath,revisionStage)) break;
|
||||
procsApproved.Add(ap.ProcInfo.DisplayNumber + " " + ap.ProcInfo.DisplayText);
|
||||
RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID);
|
||||
// RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID);
|
||||
@ -1316,7 +1318,7 @@ namespace VEPROMS
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private bool TryToDelete(string pdfFile)
|
||||
private bool TryToDelete(string pdfFile, string revisionStage)
|
||||
{
|
||||
int cntr = 0;
|
||||
while (File.Exists(pdfFile))
|
||||
@ -1328,19 +1330,20 @@ namespace VEPROMS
|
||||
}
|
||||
catch
|
||||
{
|
||||
// C2021-020 updated the information in the message box when a PDF file of the same name is opened while
|
||||
// we try to create the Revision Stage. Also added the name of revision stage in the message box title.
|
||||
cntr++;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Could not create");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(pdfFile + ".");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("If it is open, close and retry.");
|
||||
if (cntr >= 3)
|
||||
{
|
||||
sb.Insert(0, "PAY ATTENTION!!!\r\n\r\n");
|
||||
sb.AppendLine("\r\n\r\nFIRST CLOSE IT, THEN PRESS THE OK BUTTON!!!");
|
||||
}
|
||||
if(MessageBox.Show(sb.ToString(), "Error on CreatePdf", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
|
||||
sb.AppendLine("If it is open, close it then press the OK button.");
|
||||
if (cntr >= 3) // after two tries offer additional troubleshooting information
|
||||
sb.AppendLine("\r\nIf the PDF file will not close, try ending the process that is holding it open.");
|
||||
TextInfo txInfo = new CultureInfo("en-US", false).TextInfo; // will allow call to method to put the revison stage name in title case
|
||||
string mgTitle = string.Format("Problem Creating the \"{0}\" Revision Stage Pdf", txInfo.ToTitleCase(revisionStage));
|
||||
if (MessageBox.Show(sb.ToString(), mgTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
|
||||
return false;
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user