logic to save word sections with resolved RO values for exporting the approved procedure
Better memory management and commented out debug statements to help evaluate memory usage
This commit is contained in:
parent
8cd75c0c14
commit
d7643f4721
@ -607,16 +607,23 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new System.Security.SecurityException("User not authorized to update a Pdf");
|
||||
try
|
||||
{
|
||||
BuildRefreshList();
|
||||
Pdf pdf = base.Save();
|
||||
RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
|
||||
AddToCache(pdf);//Refresh the item in AllList
|
||||
ProcessRefreshList();
|
||||
BuildRefreshList();
|
||||
Pdf pdf = base.Save();
|
||||
RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
|
||||
AddToCache(pdf);//Refresh the item in AllList
|
||||
ProcessRefreshList();
|
||||
return pdf;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on CSLA Save", ex);
|
||||
if (MSWordToPDF.DocReplace != null) // if creating an Approved export then ignore the error
|
||||
{
|
||||
_MyLog.WarnFormat("here");
|
||||
GC.Collect(); // memory garbage collection
|
||||
return this;
|
||||
}
|
||||
else
|
||||
throw new DbCslaException("Error on CSLA Save", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -228,8 +228,13 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
CanReadProperty("RevisionVersionCount", true);
|
||||
//_MyLog.WarnFormat("RevisionVersionCount 1 - {0}", GC.GetTotalMemory(true));
|
||||
if (_RevisionVersionCount < 0)
|
||||
{
|
||||
_RevisionVersionCount = RevisionVersions.Count;
|
||||
//_MyLog.WarnFormat("RevisionVersionCount 2 (after setting count) - {0}", GC.GetTotalMemory(true));
|
||||
}
|
||||
//_MyLog.WarnFormat("RevisionVersionCount 3 (before return) - {0}", GC.GetTotalMemory(true));
|
||||
return _RevisionVersionCount;
|
||||
}
|
||||
}
|
||||
@ -241,10 +246,23 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
CanReadProperty("RevisionVersions", true);
|
||||
//_MyLog.WarnFormat("RevisionVersions 1 - {0}", GC.GetTotalMemory(true));
|
||||
if (_RevisionVersionCount < 0 || (_RevisionVersionCount > 0 && _RevisionVersions == null))
|
||||
_RevisionVersions = VersionInfoList.GetByRevisionID(_RevisionID);
|
||||
{
|
||||
//_MyLog.WarnFormat("RevisionVersions 2 (before using) - {0} count {1}", GC.GetTotalMemory(true),_RevisionVersionCount);
|
||||
using (VersionInfoList vil = VersionInfoList.GetByRevisionID(_RevisionID))
|
||||
{
|
||||
//_MyLog.WarnFormat("RevisionVersions 3 (using) - {0}", GC.GetTotalMemory(true));
|
||||
_RevisionVersions = vil;
|
||||
}
|
||||
}
|
||||
//_MyLog.WarnFormat("RevisionVersions 4 (after using) - {0}", GC.GetTotalMemory(true));
|
||||
if (_RevisionVersionCount < 0)
|
||||
{
|
||||
_RevisionVersionCount = _RevisionVersions.Count;
|
||||
//_MyLog.WarnFormat("RevisionVersions 4 (after setting count) - {0}", GC.GetTotalMemory(true));
|
||||
}
|
||||
//_MyLog.WarnFormat("RevisionVersions 5 (before return) - {0}", GC.GetTotalMemory(true));
|
||||
return _RevisionVersions;
|
||||
}
|
||||
}
|
||||
|
@ -620,7 +620,10 @@ namespace Volian.Controls.Library
|
||||
// Display Menu
|
||||
ToolStripMenuItem mi = new ToolStripMenuItem();
|
||||
ContextMenu cm = new ContextMenu();
|
||||
//_MyLog.WarnFormat("Context Menu 1 - {0}",GC.GetTotalMemory(true));
|
||||
UserInfo ui = UserInfo.GetByUserID(VlnSettings.UserID);
|
||||
//_MyLog.WarnFormat("Context Menu 1a - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
if (ui == null)
|
||||
{
|
||||
MessageBox.Show("Security has not been defined for PROMS. All functionality has been defaulted to the lowest level for all users until security is defined.", "no security defined", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
@ -644,6 +647,7 @@ namespace Volian.Controls.Library
|
||||
if (DoSpecificInfo)
|
||||
cm.MenuItems.Add("Folder Specific Information", new EventHandler(mi_Click));
|
||||
}
|
||||
//_MyLog.WarnFormat("Context Menu 1b - {0}", GC.GetTotalMemory(true));
|
||||
if (ui.IsAdministrator() || ui.IsSetAdministrator(fi))
|
||||
{
|
||||
if (fi.MyParent != null) // don't allow insert before/after if at top node
|
||||
@ -660,6 +664,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else if (tn.VEObject as DocVersionInfo != null) // DocVersions can only contain procs
|
||||
{
|
||||
//_MyLog.WarnFormat("Context Menu 1c - {0}", GC.GetTotalMemory(true));
|
||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||
if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi))
|
||||
{
|
||||
@ -701,6 +706,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
//_MyLog.WarnFormat("Context Menu 1d - {0}", GC.GetTotalMemory(true));
|
||||
cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click));
|
||||
cm.MenuItems.Add("Approve All Procedures", new EventHandler(mi_Click));
|
||||
cm.MenuItems.Add("Approve Some Procedures", new EventHandler(mi_Click));
|
||||
@ -709,6 +715,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
//_MyLog.WarnFormat("Context Menu 1e - {0}", GC.GetTotalMemory(true));
|
||||
OwnerInfoList.Reset();
|
||||
oil = OwnerInfoList.GetByVersionID(dvi.VersionID);
|
||||
cm.MenuItems.Add("Refresh Checked Out Procedures", new EventHandler(mi_Click));
|
||||
@ -732,6 +739,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
//_MyLog.WarnFormat("Context Menu 1f - {0}", GC.GetTotalMemory(true));
|
||||
cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click));
|
||||
}
|
||||
}
|
||||
@ -742,10 +750,12 @@ namespace Volian.Controls.Library
|
||||
//}
|
||||
if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi) || ui.IsROEditor(dvi))
|
||||
{
|
||||
//_MyLog.WarnFormat("Context Menu 1g - {0}", GC.GetTotalMemory(true));
|
||||
cm.MenuItems.Add("Run RO Editor", new EventHandler(mi_Click));
|
||||
}
|
||||
if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi))
|
||||
{
|
||||
//_MyLog.WarnFormat("Context Menu 1h - {0}", GC.GetTotalMemory(true));
|
||||
MenuItem urv = cm.MenuItems.Add("Update RO Values", new EventHandler(mi_Click));
|
||||
urv.Enabled = dvi.NewerRoFst;
|
||||
}
|
||||
@ -799,7 +809,9 @@ namespace Volian.Controls.Library
|
||||
cm.MenuItems.Add("Create Continuous Action Summary", new EventHandler(mi_Click));
|
||||
cm.MenuItems.Add("Print", new EventHandler(mi_Click));
|
||||
cm.MenuItems.Add("Approve", new EventHandler(mi_Click));
|
||||
//_MyLog.WarnFormat("Context Menu 1 before - {0}", GC.GetTotalMemory(true));
|
||||
AddApprovedRevisions(cm.MenuItems, pri);
|
||||
//_MyLog.WarnFormat("Context Menu 1 after - {0}", GC.GetTotalMemory(true));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -875,6 +887,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//_MyLog.WarnFormat("Context Menu 2 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
#region Menu_Open
|
||||
if (!tn.IsExpanded && tn.VEObject as SectionInfo != null)
|
||||
{
|
||||
@ -891,6 +905,8 @@ namespace Volian.Controls.Library
|
||||
else
|
||||
cm.MenuItems.Add("Collapse Procedures", new EventHandler(mi_Click));
|
||||
#endregion
|
||||
//_MyLog.WarnFormat("Context Menu 3 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
#region Menu_CutCopy
|
||||
// For initial release, copy is not available for folders or docversions
|
||||
if (tn.VEObject as ItemInfo != null)
|
||||
@ -903,6 +919,8 @@ namespace Volian.Controls.Library
|
||||
cm.MenuItems.Add("Copy", new EventHandler(mi_Click));
|
||||
}
|
||||
#endregion
|
||||
//_MyLog.WarnFormat("Context Menu 4 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
#region Menu_Paste
|
||||
bool ok = false;
|
||||
if (tn.VEObject is FolderInfo && (ui.IsAdministrator() || ui.IsSetAdministrator(tn.VEObject as FolderInfo)))
|
||||
@ -914,6 +932,8 @@ namespace Volian.Controls.Library
|
||||
if(ok)
|
||||
Menu_Paste(tn, cm);
|
||||
#endregion
|
||||
//_MyLog.WarnFormat("Context Menu 5 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
#region Menu_Delete
|
||||
if (ok)
|
||||
{
|
||||
@ -940,6 +960,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//_MyLog.WarnFormat("Context Menu 6 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
#region Menu_Properties
|
||||
// Add Properties to the menu unless at the very 'top' node or on a grouping (partinfo)
|
||||
// node (RNOs, Steps, Cautions, Notes) or at the step level.
|
||||
@ -949,6 +971,8 @@ namespace Volian.Controls.Library
|
||||
if (ok)
|
||||
if (pia == null && tn.VEObject as StepInfo == null) cm.MenuItems.Add("Properties...", new EventHandler(mi_Click));
|
||||
#endregion
|
||||
//_MyLog.WarnFormat("Context Menu 7 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
if (oil != null && oil.Count > 0 && tn.VEObject as DocVersionInfo != null)
|
||||
{
|
||||
/*
|
||||
@ -992,6 +1016,8 @@ namespace Volian.Controls.Library
|
||||
--step level
|
||||
all of them
|
||||
*/
|
||||
//_MyLog.WarnFormat("Context Menu 8 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
if (tn.VEObject as ProcedureInfo != null)
|
||||
{
|
||||
foreach (MenuItem itm in cm.MenuItems)
|
||||
@ -1011,6 +1037,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
this.Cursor = Cursors.Default;
|
||||
//_MyLog.WarnFormat("Context Menu 9 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
cm.Show(this, new Point(e.X, e.Y));
|
||||
}
|
||||
}
|
||||
@ -1066,51 +1094,59 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void AddApprovedRevisions(Menu.MenuItemCollection menuItemCollection, ProcedureInfo pri)
|
||||
{
|
||||
RevisionInfoList ril = null;
|
||||
try
|
||||
{
|
||||
ril = RevisionInfoList.GetByItemID(pri.ItemID);
|
||||
//_MyLog.WarnFormat("Context Menu 1 before GET - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
using (RevisionInfoList ril = RevisionInfoList.GetByItemID(pri.ItemID))
|
||||
{
|
||||
//_MyLog.WarnFormat("Context Menu 1 After GET - {0}", GC.GetTotalMemory(true));
|
||||
if (ril.Count == 0) return;
|
||||
MenuItem mi = menuItemCollection.Add("Versions");
|
||||
int lastApprovedRevisionID = 0;
|
||||
foreach (RevisionInfo ri in ril)
|
||||
{
|
||||
MenuItem mir = mi.MenuItems.Add(ri.ToString());
|
||||
mir.Tag = ri;
|
||||
bool addImportMI = false;
|
||||
if (ri.LatestVersion.MyStage.IsApproved > 0 && (ri.RevisionID > lastApprovedRevisionID))
|
||||
{
|
||||
lastApprovedRevisionID = ri.RevisionID;
|
||||
addImportMI = true;
|
||||
}
|
||||
//mir.Click += new EventHandler(ApprovedRevision_Click);
|
||||
//added jcb 20111031
|
||||
//_MyLog.WarnFormat("Context Menu 1 b4ViewProc- {0}", GC.GetTotalMemory(true));
|
||||
if (ri.LatestVersion.PDF != null)
|
||||
{
|
||||
MenuItem mirp = mir.MenuItems.Add("View Procedure");
|
||||
mirp.Tag = ri;
|
||||
mirp.Click += new EventHandler(ApprovedRevision_Click);
|
||||
}
|
||||
//_MyLog.WarnFormat("Context Menu 1 b4viewSum- {0}", GC.GetTotalMemory(true));
|
||||
if (ri.LatestVersion.SummaryPDF != null)
|
||||
{
|
||||
MenuItem mirs = mir.MenuItems.Add("View Summary of Changes");
|
||||
mirs.Tag = ri;
|
||||
mirs.Click += new EventHandler(SummaryOfChanges_Click);
|
||||
}
|
||||
//_MyLog.WarnFormat("Context Menu 1 b4 import - {0}", GC.GetTotalMemory(true));
|
||||
if (addImportMI && ri.LatestVersion.ApprovedXML != null)
|
||||
{
|
||||
MenuItem miri = mir.MenuItems.Add("Create Procedure to Import");
|
||||
miri.Tag = ri;
|
||||
miri.Click += new EventHandler(ImportProcedure_Click);
|
||||
}
|
||||
//_MyLog.WarnFormat("Context Menu 1 after import- {0}", GC.GetTotalMemory(true));
|
||||
//end added jcb 20111031
|
||||
mi.Tag = lastApprovedRevisionID;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ril.Count == 0) return;
|
||||
MenuItem mi = menuItemCollection.Add("Versions");
|
||||
int lastApprovedRevisionID = 0;
|
||||
foreach (RevisionInfo ri in ril)
|
||||
{
|
||||
MenuItem mir = mi.MenuItems.Add(ri.ToString());
|
||||
mir.Tag = ri;
|
||||
bool addImportMI = false;
|
||||
if (ri.LatestVersion.MyStage.IsApproved > 0 && (ri.RevisionID > lastApprovedRevisionID))
|
||||
{
|
||||
lastApprovedRevisionID = ri.RevisionID;
|
||||
addImportMI = true;
|
||||
}
|
||||
//mir.Click += new EventHandler(ApprovedRevision_Click);
|
||||
//added jcb 20111031
|
||||
if (ri.LatestVersion.PDF != null)
|
||||
{
|
||||
MenuItem mirp = mir.MenuItems.Add("View Procedure");
|
||||
mirp.Tag = ri;
|
||||
mirp.Click += new EventHandler(ApprovedRevision_Click);
|
||||
}
|
||||
if (ri.LatestVersion.SummaryPDF != null)
|
||||
{
|
||||
MenuItem mirs = mir.MenuItems.Add("View Summary of Changes");
|
||||
mirs.Tag = ri;
|
||||
mirs.Click += new EventHandler(SummaryOfChanges_Click);
|
||||
}
|
||||
if (addImportMI && ri.LatestVersion.ApprovedXML != null)
|
||||
{
|
||||
MenuItem miri = mir.MenuItems.Add("Create Procedure to Import");
|
||||
miri.Tag = ri;
|
||||
miri.Click += new EventHandler(ImportProcedure_Click);
|
||||
}
|
||||
//end added jcb 20111031
|
||||
mi.Tag = lastApprovedRevisionID;
|
||||
}
|
||||
}
|
||||
|
||||
void ImportProcedure_Click(object sender, EventArgs e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user