support pasting of step into section and section into procedure; when updating transition text, refresh transinfo
This commit is contained in:
parent
7e12ec0e09
commit
d4be18b454
@ -416,6 +416,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region PasteChangeId
|
||||
public static void PasteSetChangeId(ItemInfo ii, string chgid)
|
||||
{
|
||||
if (!ii.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds) return;
|
||||
if (ii.IsProcedure)
|
||||
{
|
||||
return; // copy over change bars & change ids as they exist.
|
||||
@ -428,6 +429,8 @@ namespace VEPROMS.CSLA.Library
|
||||
else if (ii.IsStep)
|
||||
{
|
||||
StepConfig sc = ii.MyConfig as StepConfig;
|
||||
if (chgid != null && sc.Step_ChangeID != chgid)
|
||||
{
|
||||
sc.Step_ChangeID = chgid;
|
||||
using (Item itm = ii.Get())
|
||||
{
|
||||
@ -437,6 +440,7 @@ namespace VEPROMS.CSLA.Library
|
||||
itm.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
// handle all of the children
|
||||
if (ii.Cautions != null) foreach (ItemInfo chldc in ii.Cautions) PasteSetChangeId(chldc, chgid);
|
||||
if (ii.Notes != null) foreach (ItemInfo chldn in ii.Notes) PasteSetChangeId(chldn, chgid);
|
||||
@ -446,7 +450,35 @@ namespace VEPROMS.CSLA.Library
|
||||
if (ii.Steps != null) foreach (ItemInfo chlds in ii.Steps) PasteSetChangeId(chlds, chgid);
|
||||
}
|
||||
#endregion
|
||||
#region PasteSiblingBefore
|
||||
#region Paste
|
||||
public ItemInfo PasteChild(int copyStartID, string chgid)
|
||||
{
|
||||
// To determine 'type' of pasted item, if it's a step (type >=20000), use the originating
|
||||
// item, i.e. item inserting after. If it's a section or procedure, use the copied item's type.
|
||||
ItemInfo cpItem = ItemInfo.Get(copyStartID);
|
||||
int? type = MyContent.Type >= 20000 ? MyContent.Type : cpItem.MyContent.Type;
|
||||
int? fromtype = MyContent.Type >= 20000 ? MyContent.Type
|
||||
: ((int?)(IsProcedure ? E_FromType.Section
|
||||
: (cpItem.IsSection ? E_FromType.Section : E_FromType.Step)));
|
||||
try
|
||||
{
|
||||
ItemInfo tmp = CopyPasteItemInfoFetch(copyStartID, this.ItemID, type, fromtype, EAddpingPart.Child);
|
||||
using (Item item = Get()) ItemInfo.Refresh(item);
|
||||
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);
|
||||
RefreshNextItems();
|
||||
tmp.UpdateTransitionText();
|
||||
tmp.UpdatePastedStepTransitionText();
|
||||
PasteSetChangeId(tmp, chgid);
|
||||
OnNewChild(new ItemInfoInsertEventArgs(tmp, EAddpingPart.Child));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!HandleSqlExceptionOnCopy(ex))
|
||||
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.", "Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
public ItemInfo PasteSiblingBefore(int copyStartID, string chgid)
|
||||
{
|
||||
// To determine 'type' of pasted item, if it's a step (type >=20000), use the originating
|
||||
@ -623,6 +655,8 @@ namespace VEPROMS.CSLA.Library
|
||||
#region B2012-071 fix JCB
|
||||
foreach (TransitionInfo tran in trans)
|
||||
{
|
||||
using (Transition trn = tran.Get())
|
||||
TransitionInfo.Refresh(trn);
|
||||
Content oldContent = null;
|
||||
using (Content content = tran.MyContent.Get())
|
||||
{
|
||||
@ -731,8 +765,8 @@ namespace VEPROMS.CSLA.Library
|
||||
switch (criteria.AddType)
|
||||
{
|
||||
case EAddpingPart.Child:
|
||||
//cm.CommandText = "addItemChild";
|
||||
//cm.Parameters.AddWithValue("@FromType", criteria.FromType); //--C
|
||||
cm.CommandText = "PasteItemChild";
|
||||
cm.Parameters.AddWithValue("@FromType", criteria.FromType); //--C
|
||||
break;
|
||||
case EAddpingPart.Before:
|
||||
cm.CommandText = "PasteItemSiblingBefore";
|
||||
|
Loading…
x
Reference in New Issue
Block a user