Use ActiveFormat rather than FormatStepData.MyFormat (this works for Steps/Sections and Procedures)
This commit is contained in:
parent
45e663f2d3
commit
ba4f16b7e1
@ -3619,19 +3619,19 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public bool IsInTemplate() // is this step defined by template, i.e. included in template list
|
||||
{
|
||||
if (IsStep && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes != null && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes.ContainsKey((int)MyContent.Type - 20001)) return true;
|
||||
if (IsStep && ActiveFormat.PlantFormat.FormatData.TopTemplateTypes != null && ActiveFormat.PlantFormat.FormatData.TopTemplateTypes.ContainsKey((int)MyContent.Type - 20001)) return true;
|
||||
return false;
|
||||
}
|
||||
public bool IsWithInSingleColumnTemplate() // is this step within a step defined by a 'single-column' template item
|
||||
{
|
||||
if (IsStep && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes != null)
|
||||
if (IsStep && ActiveFormat.PlantFormat.FormatData.TopTemplateTypes != null)
|
||||
{
|
||||
ItemInfo tmp = this;
|
||||
while (tmp.IsStep)
|
||||
{
|
||||
if (tmp.TemplateIndex > 0)
|
||||
{
|
||||
if (FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tmp.TemplateIndex].nocolm==0) return true;
|
||||
if (ActiveFormat.PlantFormat.FormatData.Templates[tmp.TemplateIndex].nocolm == 0) return true;
|
||||
return false;
|
||||
}
|
||||
tmp = tmp.MyParent;
|
||||
@ -3641,8 +3641,8 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public int GetSmartTemplateTopLevelIndxOfThisType(int oftype) // used for inserting steps
|
||||
{
|
||||
if (FormatStepData == null) return -1;
|
||||
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
|
||||
if (ActiveFormat == null) return -1;
|
||||
FormatData formatData = ActiveFormat.PlantFormat.FormatData;
|
||||
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
|
||||
if (formatData.TopTemplateTypes.ContainsKey(oftype - 20001)) return formatData.TopTemplateTypes[oftype - 20001];
|
||||
return -1;
|
||||
@ -3650,7 +3650,7 @@ namespace VEPROMS.CSLA.Library
|
||||
public int GetSmartTemplateTopLevelIndx()
|
||||
{
|
||||
if (FormatStepData == null) return -1;
|
||||
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
|
||||
FormatData formatData = ActiveFormat.PlantFormat.FormatData;
|
||||
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
|
||||
ItemInfo tmp = this;
|
||||
while (!tmp.IsSection)
|
||||
@ -3662,7 +3662,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public int GetSmartTemplateIndex(int topIndx, int curStepType)
|
||||
{
|
||||
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
|
||||
FormatData formatData = ActiveFormat.PlantFormat.FormatData;
|
||||
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
|
||||
int indx = topIndx;
|
||||
int curType = curStepType - 20001;
|
||||
@ -3681,8 +3681,8 @@ namespace VEPROMS.CSLA.Library
|
||||
public int GetSmartTemplateIndex(int topIndx, string strtxt)
|
||||
{
|
||||
string txt = strtxt.Replace(@"\u160?"," ");
|
||||
if (FormatStepData == null) return -1;
|
||||
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
|
||||
if (ActiveFormat == null) return -1;
|
||||
FormatData formatData = ActiveFormat.PlantFormat.FormatData;
|
||||
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
|
||||
int indx = topIndx;
|
||||
while (indx < formatData.Templates.Count)
|
||||
|
@ -312,8 +312,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
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 level = ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].level;
|
||||
string tmptext = ActiveFormat.PlantFormat.FormatData.NewTemplateFormat ? text : ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||
int prevlevel = level;
|
||||
while (level > 0)
|
||||
{
|
||||
@ -331,7 +331,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (level == prevlevel) addPart = EAddpingPart.After;
|
||||
if (level < prevlevel)
|
||||
{
|
||||
if (FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
|
||||
if (ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
|
||||
{
|
||||
fromType = E_FromType.RNO;
|
||||
addPart = EAddpingPart.Child;
|
||||
@ -343,15 +343,15 @@ namespace VEPROMS.CSLA.Library
|
||||
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);
|
||||
tmptext = /*ActiveFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": */ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||
tmp = NewItemInfoFetch(newItemID, addPart, null, tmptext, ActiveFormat.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;
|
||||
level = tpIndx < ActiveFormat.PlantFormat.FormatData.Templates.Count ?
|
||||
ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].level : -1;
|
||||
}
|
||||
tmp = firstSmart;
|
||||
}
|
||||
@ -368,8 +368,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
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 level = ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].level;
|
||||
string tmptext = ActiveFormat.PlantFormat.FormatData.NewTemplateFormat ? text : ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||
int prevlevel = level;
|
||||
while (level > 0)
|
||||
{
|
||||
@ -386,7 +386,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (level == prevlevel) addPart = EAddpingPart.After;
|
||||
if (level < prevlevel)
|
||||
{
|
||||
if (FormatStepData.MyFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
|
||||
if (ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].type == 39)
|
||||
{
|
||||
fromType = E_FromType.RNO;
|
||||
addPart = EAddpingPart.Child;
|
||||
@ -398,15 +398,15 @@ namespace VEPROMS.CSLA.Library
|
||||
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);
|
||||
tmptext = /*ActiveFormat.PlantFormat.FormatData.NewTemplateFormat ? " ": */ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].text;
|
||||
tmp = NewItemInfoFetch(newItemID, addPart, null, tmptext, ActiveFormat.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;
|
||||
level = tpIndx < ActiveFormat.PlantFormat.FormatData.Templates.Count ?
|
||||
ActiveFormat.PlantFormat.FormatData.Templates[tpIndx].level : -1;
|
||||
}
|
||||
tmp = firstSmart;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user