Calvert: copied steps/sections have change ids

This commit is contained in:
2014-09-17 16:44:31 +00:00
parent 373634318b
commit e785302c9e
5 changed files with 82 additions and 18 deletions

View File

@@ -874,7 +874,7 @@ namespace Volian.Controls.Library
}
private void PromptForChangeId(ItemInfo myItemInfo, DisplayTabItem pg)
{
dlgChgId dlgCI = new dlgChgId(this);
dlgChgId dlgCI = new dlgChgId(this); //, null);
dlgCI.ShowDialog(this);
ItemsChangeIds.Add(myItemInfo.MyProcedure.ItemID, ChgId);
SetChangeId(ChgId, pg, myItemInfo);
@@ -882,12 +882,12 @@ namespace Volian.Controls.Library
private void SetChangeId(string chgid, DisplayTabItem pg, ItemInfo ii)
{
if (pg == null || pg.MyStepTabPanel == null)
{
ChgId = null;
return;
}
pg.MyStepTabPanel.MyStepTabRibbon.SetChangeId(chgid, ii);
//if (pg == null || pg.MyStepTabPanel == null)
//{
// ChgId = null;
// return;
//}
if (pg != null && pg.MyStepTabPanel != null) pg.MyStepTabPanel.MyStepTabRibbon.SetChangeId(chgid, ii);
ChgId = chgid;
}
/// <summary>

View File

@@ -1178,8 +1178,10 @@ namespace Volian.Controls.Library
#region CopyPaste
public void PasteSiblingBefore(int copyStartID)
{
ItemInfo newItemInfo = MyItemInfo.PasteSiblingBefore(copyStartID);
ItemInfo newItemInfo = MyItemInfo.PasteSiblingBefore(copyStartID, GetChangeId(MyItemInfo));
if (newItemInfo.ItemID == MyItemInfo.ItemID) return;
EditItem newEditItem = null;
switch (_MyChildRelation)
{
@@ -1199,9 +1201,18 @@ namespace Volian.Controls.Library
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Before, newItemInfo.MyContent.Type));
}
private string GetChangeId(ItemInfo iiDest)
{
// get the change id for the destination's procedure's change id.
string chgid = null;
if (iiDest.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds)
chgid = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ItemsChangeIds[iiDest.MyProcedure.ItemID];
return chgid;
}
public void PasteSiblingAfter(int copyStartID)
{
ItemInfo newItemInfo = MyItemInfo.PasteSiblingAfter(copyStartID);
ItemInfo newItemInfo = MyItemInfo.PasteSiblingAfter(copyStartID, GetChangeId(MyItemInfo));
if (newItemInfo.ItemID == MyItemInfo.ItemID) return;
EditItem newEditItem = null;
switch (_MyChildRelation)
@@ -1241,7 +1252,7 @@ namespace Volian.Controls.Library
ItemInfo newItemInfo = null;
try
{
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID);
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo));
}
//catch (System.Data.SqlClient.SqlException ex)
catch (Exception ex)

View File

@@ -30,6 +30,7 @@ namespace Volian.Controls.Library
public delegate void vlnTreeViewSectionInfoEvent(object sender, vlnTreeSectionInfoEventArgs args);
public delegate void WordSectionDeletedEvent(object sender, WordSectionEventArgs args);
public delegate void vlnTreeViewPdfEvent(object sender, vlnTreeViewPdfArgs args);
public delegate string vlnTreeViewGetChangeIdEvent(object sender, vlnTreeItemInfoEventArgs args);
public partial class vlnTreeSectionInfoEventArgs
{
private bool _IsDeleting = false;
@@ -336,6 +337,12 @@ namespace Volian.Controls.Library
ItemInfo _LastItemInfo = null;
#endregion
#region Events
public event vlnTreeViewGetChangeIdEvent GetChangeId;
private string OnGetChangeId(object sender, vlnTreeItemInfoEventArgs args)
{
if (GetChangeId != null) return GetChangeId(sender, args);
return null;
}
public event vlnTreeViewPdfEvent ViewPDF;
private void OnViewPDF(object sender, vlnTreeViewPdfArgs args)
{
@@ -1488,11 +1495,13 @@ namespace Volian.Controls.Library
if (ii.IsProcedure || !OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, pasteOpt, ii.MyContent.Type)))
{
// The parent step was not open in the step editor, just paste step (in data) and add treenode.
// first, check if a changeid is required.
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
ItemInfo newItemInfo = null;
if (newtype == MenuSelections.StepBefore)
newItemInfo = ii.PasteSiblingBefore(copyStartID);
newItemInfo = ii.PasteSiblingBefore(copyStartID, chgId);
else
newItemInfo = ii.PasteSiblingAfter(copyStartID);
newItemInfo = ii.PasteSiblingAfter(copyStartID, chgId);
}
SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode);
}
@@ -1503,8 +1512,9 @@ namespace Volian.Controls.Library
ItemInfo ii = tn.VEObject as ItemInfo;
if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type)))
{
//return;
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID);
// first, check if a changeid is required.
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId);
}
SelectedNode = (VETreeNode)((prevtn != null) ? prevtn.NextNode : partn.FirstNode);
}