Fix B2016-034: New Procedure/New Word Section creation causes new procedure to disappear from tree view

This commit is contained in:
Kathy Ruffing 2016-02-12 16:35:15 +00:00
parent fffcdc8eca
commit 006d194d01
3 changed files with 25 additions and 3 deletions

View File

@ -173,7 +173,7 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("MyItem", true);
if (_MyItem == null && _ItemID != null) _MyItem = ItemInfo.Get((int)_ItemID);
if (_MyItem == null && _ItemID != null) _MyItem = ProcedureInfo.Get((int)_ItemID);
return _MyItem;
}
}

View File

@ -128,7 +128,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("MyPrevious", true);
if (_MyPrevious == null && _PreviousID != null) _MyPrevious = ItemInfo.Get((int)_PreviousID);
if (_MyPrevious == null && _PreviousID != null)
{
if (this is ProcedureInfo)
_MyPrevious = ProcedureInfo.Get((int)_PreviousID);
else if (this is SectionInfo)
_MyPrevious = SectionInfo.Get((int)_PreviousID);
else if (this is StepInfo)
_MyPrevious = StepInfo.Get((int)_PreviousID);
else
_MyPrevious = ItemInfo.Get((int)_PreviousID);
}
return _MyPrevious;
}
set
@ -430,7 +440,15 @@ namespace VEPROMS.CSLA.Library
#region Factory Methods
private static int _ItemInfoUnique = 0;
private static int ItemInfoUnique
{ get { return ++_ItemInfoUnique; } }
{
get
{
int ui = ++_ItemInfoUnique;
//Useful for debug to identify where item is being created:
//if (ui == 73) Console.WriteLine("here");
return ui;
}
}
private int _MyItemInfoUnique = ItemInfoUnique;
public int MyItemInfoUnique // Absolutely Unique ID - Info
{ get { return _MyItemInfoUnique; } }

View File

@ -2203,6 +2203,8 @@ namespace Volian.Controls.Library
procedure.Save();
tn = new VETreeNode(_LastProcedureInfo);
SelectedNode.Nodes.Add(tn); // add tree node to end of list.
// The following line will allow for a refresh of the procedure list on the Working Draft's treenodes docversion (B2016-034)
if (((SelectedNode as VETreeNode).VEObject as DocVersionInfo) != null) ((SelectedNode as VETreeNode).VEObject as DocVersionInfo).ResetProcedures();
if (procedure.MyProcedureInfo.CreateEnhanced)
{
procedure.MyProcedureInfo.CreateEnhanced = false;
@ -2232,6 +2234,8 @@ namespace Volian.Controls.Library
tn = new VETreeNode(_LastProcedureInfo);
TreeNode par = SelectedNode.Parent;
par.Nodes.Insert(tvindex + ((newtype == MenuSelections.ProcedureBefore) ? 0 : 1), tn);
// The following line will allow for a refresh of the procedure list on the Working Draft's treenodes docversion (B2016-034)
if (((par as VETreeNode).VEObject as DocVersionInfo) != null) ((par as VETreeNode).VEObject as DocVersionInfo).ResetProcedures();
if (procedure.MyProcedureInfo.CreateEnhanced)
{
procedure.MyProcedureInfo.CreateEnhanced = false;