Updated to include passing teh selected tree node parent for cases where the only procedure in a folder is being replaced. otherwise i pass null for that as its not really used.

This commit is contained in:
2024-06-19 13:50:52 -04:00
parent c92b888ec2
commit 629fe1b615
3 changed files with 49 additions and 17 deletions

View File

@@ -1309,7 +1309,8 @@ namespace VEPROMS.CSLA.Library
else if (addType == EAddpingPart.Replace) // what about user interface for enhanced pasted steps?
{
ItemInfo enhReplaceItem = ItemInfo.Get(edSource.ItemID);
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid);
TreeNode trn = null;
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid, trn);
}
// update the config data for the new enhanced item (procedure, section or step) to point back to the correct source
@@ -2497,13 +2498,16 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region PasteReplace
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid)
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace)
{
bool tmp= false;
return PasteReplace(itemInfo, copyStartID, chgid, ref tmp);
bool tmp = false;
return PasteReplace(itemInfo, copyStartID, chgid, treeNodeReplace, ref tmp);
}
// B2017-179 return a bool (firstTrans) if we could not replace the step but the user wants to position to the first transition that needs resolved
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, ref bool firstTrans)
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace, ref bool firstTrans)
{
firstTrans = false;
if (!CanDeleteObject())
@@ -2560,7 +2564,14 @@ namespace VEPROMS.CSLA.Library
}
else
{
newItemInfo.MyParent.OnNewChild(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.Child));
//Create tree node for copied procedure when no other procedures exist in the folder
VETreeNode vtn = treeNodeReplace as VETreeNode;
DocVersionInfo dvi = vtn.VEObject as DocVersionInfo;
ItemInfo newProc = dvi.PasteChild(copyStartID);
VETreeNode tn1 = new VETreeNode(newProc);
treeNodeReplace.Nodes.Add(tn1); // add tree node to end of list.
treeNodeReplace = tn1;
}
return newItemInfo;
}