Fixed separator location logic, added Template logic for Prairie Island Alarms
Added ChildIndent for use with Callaway Backgounds
This commit is contained in:
@@ -298,6 +298,60 @@ namespace VEPROMS.CSLA.Library
|
||||
((ItemInfo)ActiveParent).MyContent.RefreshContentParts();
|
||||
return tmp;
|
||||
}
|
||||
private ItemInfo InsertSmartTemplateSubStep(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
|
||||
{
|
||||
int newItemID = 0;
|
||||
int topType = GetSmartTemplateTopLevelIndxOfThisType(type);
|
||||
if (topType == -1) return null;
|
||||
int tpIndx = GetSmartTemplateIndex(topType, type);
|
||||
if (tpIndx != -1)
|
||||
{
|
||||
ItemInfo siblingSmart = null;
|
||||
ItemInfo firstSmart = null;
|
||||
int level = FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level;
|
||||
string tmptext = FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat ? text : FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||
int prevlevel = level;
|
||||
while (level > 0)
|
||||
{
|
||||
if (firstSmart == null)
|
||||
{
|
||||
firstSmart = NewItemInfoFetch(ItemID, adPart, number, tmptext, type, null, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||
siblingSmart = firstSmart;
|
||||
newItemID = firstSmart.ItemID;
|
||||
}
|
||||
else
|
||||
{
|
||||
E_FromType fromType = E_FromType.Step;
|
||||
EAddpingPart addPart = EAddpingPart.Child; // level > previous, add a child.
|
||||
if (level == prevlevel) addPart = EAddpingPart.After;
|
||||
if (level < prevlevel)
|
||||
{
|
||||
if (FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
|
||||
{
|
||||
fromType = E_FromType.RNO;
|
||||
addPart = EAddpingPart.Child;
|
||||
}
|
||||
else
|
||||
{
|
||||
addPart = EAddpingPart.After;
|
||||
}
|
||||
newItemID = siblingSmart.ItemID;
|
||||
}
|
||||
|
||||
tmptext = /*FormatStepData.MyFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": */FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||
tmp = NewItemInfoFetch(newItemID, addPart, null, tmptext, FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type + 20001, (int?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||
newItemID = tmp.ItemID;
|
||||
if (level < prevlevel) siblingSmart = tmp;
|
||||
}
|
||||
tpIndx++;
|
||||
prevlevel = level;
|
||||
level = tpIndx < FormatStepData.MyFormat.PlantFormat.FormatData.Templates.Count ?
|
||||
FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].level : -1;
|
||||
}
|
||||
tmp = firstSmart;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private ItemInfo InsertSmartTemplateSteps(string text, string number, ItemInfo tmp, EAddpingPart adPart, int type)
|
||||
{
|
||||
@@ -575,7 +629,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public ItemInfo InsertChild(E_FromType fromType, int type, string text, string number)
|
||||
{
|
||||
ItemInfo tmp = NewItemInfoFetch(ItemID, EAddpingPart.Child, number, text, type, (int?)fromType, null, null, DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
||||
ItemInfo tmp = null;
|
||||
tmp = InsertSmartTemplateSubStep(text, number, tmp, EAddpingPart.After, type);
|
||||
if (tmp == null)
|
||||
tmp = NewItemInfoFetch(ItemID, EAddpingPart.Child, number, text, type, (int?)fromType, 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
|
||||
// Refresh ItemInfo to update PreviousID field
|
||||
if (tmp.NextItem != null) using (Item item = tmp.NextItem.Get()) ItemInfo.Refresh(item);
|
||||
|
Reference in New Issue
Block a user