Added logic to warn the user if they are going to revert from an approved stage to an unapproved stage.
Added code to assure that consistency checks and versions have the same DTS.
This commit is contained in:
parent
31b5ba8c7b
commit
9f0e986c7d
@ -917,6 +917,24 @@ namespace VEPROMS
|
|||||||
public bool Approve(Point location)
|
public bool Approve(Point location)
|
||||||
{
|
{
|
||||||
ViewPDF = ViewPDF && MyProcedures.Count == 1;
|
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)
|
foreach (ApprovalProcedure ap in MyProcedures)
|
||||||
{
|
{
|
||||||
ProcedureInfo pi = ap.ProcInfo;
|
ProcedureInfo pi = ap.ProcInfo;
|
||||||
@ -956,7 +974,8 @@ namespace VEPROMS
|
|||||||
revision.RevisionDate = ap.RevDate;
|
revision.RevisionDate = ap.RevDate;
|
||||||
revision = revision.Save();
|
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
|
//make pdf with promsprinter and get byte stream
|
||||||
string pdfTmp = string.Format(@"{0}.pdf", pi.DisplayNumber);
|
string pdfTmp = string.Format(@"{0}.pdf", pi.DisplayNumber);
|
||||||
string pdfPath = string.Format(@"{0}\{1}", VlnSettings.TemporaryFolder, pdfTmp);
|
string pdfPath = string.Format(@"{0}\{1}", VlnSettings.TemporaryFolder, pdfTmp);
|
||||||
@ -972,7 +991,7 @@ namespace VEPROMS
|
|||||||
byte[] buf = new byte[pdfFile.Length];
|
byte[] buf = new byte[pdfFile.Length];
|
||||||
fs.Read(buf, 0, buf.Length);
|
fs.Read(buf, 0, buf.Length);
|
||||||
fs.Close();
|
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);
|
StageInfo si = StageInfo.Get(RevStage);
|
||||||
if (si.IsApproved == 1)
|
if (si.IsApproved == 1)
|
||||||
UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, DateTime.Now);
|
UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, DateTime.Now);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user