diff --git a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs index 388d01c3..05f48bd3 100644 --- a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs +++ b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs @@ -917,6 +917,24 @@ namespace VEPROMS public bool Approve(Point location) { ViewPDF = ViewPDF && MyProcedures.Count == 1; + StringBuilder sb = new StringBuilder(); + StageInfo nsi = StageInfo.Get(RevStage); + foreach (ApprovalProcedure ap in MyProcedures) //spin thru looking for updating current revision + { + RevisionInfo ric = RevisionInfo.GetCurrentByItemID(ap.ProcInfo.ItemID); + VersionInfo vi = ric.LatestVersion; + if (ap.RevNumber == ric.RevisionNumber && nsi.IsApproved == 0 && vi.MyStage.IsApproved == 1) + sb.AppendLine(string.Format("{0} - '{1}'", ap.ProcInfo.DisplayNumber, vi.MyStage.Name)); + } + if (sb.Length > 0) + { + sb.Insert(0, string.Format("The following procedures will be reverted to '{0}'\r\n\r\n", nsi.Name)); + sb.AppendLine("\r\nThis will restore change bars and summary of change results!"); + sb.AppendLine("\r\nIf you do not want this to occur, answer No to this dialog \r\nand then change the revision number to create a new revision."); + sb.Append(string.Format("\r\nAre you sure you want to revert to '{0}'?",nsi.Name)); + if (MessageBox.Show(sb.ToString(),string.Format("Revert to {0}",nsi.Name),MessageBoxButtons.YesNo,MessageBoxIcon.Stop) == DialogResult.No) + return false; + } foreach (ApprovalProcedure ap in MyProcedures) { ProcedureInfo pi = ap.ProcInfo; @@ -956,7 +974,8 @@ namespace VEPROMS revision.RevisionDate = ap.RevDate; revision = revision.Save(); } - Check check = Check.MakeCheck(revision, Stage.Get(RevStage), RevisionInfo.BuildRevisionChecks(pi)); + DateTime currentDTS = DateTime.Now; + Check check = Check.MakeCheck(revision, Stage.Get(RevStage), RevisionInfo.BuildRevisionChecks(pi), currentDTS, VlnSettings.UserID); //make pdf with promsprinter and get byte stream string pdfTmp = string.Format(@"{0}.pdf", pi.DisplayNumber); string pdfPath = string.Format(@"{0}\{1}", VlnSettings.TemporaryFolder, pdfTmp); @@ -972,7 +991,7 @@ namespace VEPROMS byte[] buf = new byte[pdfFile.Length]; fs.Read(buf, 0, buf.Length); fs.Close(); - VEPROMS.CSLA.Library.Version version = VEPROMS.CSLA.Library.Version.MakeVersion(revision, Stage.Get(RevStage), buf, summaryBuf, DateTime.Now, VlnSettings.UserID); + VEPROMS.CSLA.Library.Version version = VEPROMS.CSLA.Library.Version.MakeVersion(revision, Stage.Get(RevStage), buf, summaryBuf, currentDTS, VlnSettings.UserID); StageInfo si = StageInfo.Get(RevStage); if (si.IsApproved == 1) UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, DateTime.Now);