This commit is contained in:
parent
6f36c5da6c
commit
1081d01da2
@ -283,7 +283,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public ItemInfo InsertSiblingBefore(string text, string number)
|
public ItemInfo InsertSiblingBefore(string text, string number)
|
||||||
{
|
{
|
||||||
ItemInfo tmp = NewItemInfoFetch(ItemID, EAddpingPart.Before, number, text, null, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
ItemInfo tmp = null;
|
||||||
|
if (FormatStepData.UseSmartTemplate || MyHLS.FormatStepData.UseSmartTemplate)
|
||||||
|
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.Before, (int)MyContent.Type);
|
||||||
|
else
|
||||||
|
tmp = NewItemInfoFetch(ItemID, EAddpingPart.Before, number, text, null, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
|
|
||||||
// this item is updated in SQL so we have to manually force the iteminfo updates
|
// this item is updated in SQL so we have to manually force the iteminfo updates
|
||||||
// Refresh ItemInfo to update Previous
|
// Refresh ItemInfo to update Previous
|
||||||
using (Item item = Get()) ItemInfo.Refresh(item);
|
using (Item item = Get()) ItemInfo.Refresh(item);
|
||||||
@ -293,6 +298,41 @@ namespace VEPROMS.CSLA.Library
|
|||||||
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
|
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ItemInfo InsertSmartTemplateSteps(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
|
||||||
|
{
|
||||||
|
int newItemID = 0;
|
||||||
|
// this step type may be a template step, if so, we need to put out edit windows for
|
||||||
|
// the template, by making these 'empty' (one space) steps:
|
||||||
|
int tpIndx = GetSmartTemplateIndex();
|
||||||
|
if (tpIndx != -1)
|
||||||
|
{
|
||||||
|
bool firstInsert = true;
|
||||||
|
ItemInfo tmpSmart = null;
|
||||||
|
ItemInfo subSmart = null;
|
||||||
|
int level = FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level;
|
||||||
|
while (level > 0)
|
||||||
|
{
|
||||||
|
if (firstInsert)
|
||||||
|
{
|
||||||
|
subSmart = NewItemInfoFetch(ItemID, adPart, number, text, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
|
tmpSmart = subSmart;
|
||||||
|
firstInsert = false;
|
||||||
|
newItemID = subSmart.ItemID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp = NewItemInfoFetch(newItemID, EAddpingPart.Child, null, " ", FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type + 20001, (int?)E_FromType.Step, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
|
newItemID = tmp.ItemID;
|
||||||
|
}
|
||||||
|
tpIndx++;
|
||||||
|
level = tpIndx < FormatStepData.MyFormat.PlantFormat.FormatData.Templates.Count ?
|
||||||
|
FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level : -1;
|
||||||
|
}
|
||||||
|
tmp = tmpSmart;
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region PasteSiblingBefore
|
#region PasteSiblingBefore
|
||||||
public ItemInfo PasteSiblingBefore(int copyStartID)
|
public ItemInfo PasteSiblingBefore(int copyStartID)
|
||||||
@ -369,8 +409,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public ItemInfo InsertSiblingAfter(string text, string number, int? type)
|
public ItemInfo InsertSiblingAfter(string text, string number, int? type)
|
||||||
{
|
{
|
||||||
ItemInfo tmp = NewItemInfoFetch(ItemID, EAddpingPart.After, number, text, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
ItemInfo tmp = null;
|
||||||
//tmp = DataPortal.Fetch<StepInfo>(new AddingPartCriteria(ItemID, EAddpingPart.After, number, text, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
|
if (FormatStepData.UseSmartTemplate || MyHLS.FormatStepData.UseSmartTemplate)
|
||||||
|
tmp = InsertSmartTemplateSteps(text, number, tmp, EAddpingPart.After, (int)MyContent.Type);
|
||||||
|
else
|
||||||
|
tmp = NewItemInfoFetch(ItemID, EAddpingPart.After, number, text, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
// if next exists, it is updated in SQL so we have to manually force the iteminfo updates
|
// if next exists, it is updated in SQL so we have to manually force the iteminfo updates
|
||||||
// Refresh ItemInfo to update PreviousID field
|
// Refresh ItemInfo to update PreviousID field
|
||||||
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);
|
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user