Fixed issue with how sections with both sections and steps as children were being loaded
This commit is contained in:
parent
7a29281284
commit
f994210ea6
@ -329,17 +329,13 @@ namespace DataLoader
|
|||||||
// addpart = false;
|
// addpart = false;
|
||||||
//}
|
//}
|
||||||
//FrType = 0;
|
//FrType = 0;
|
||||||
|
Console.WriteLine("'before',{0},{1},{2},{3}", SectItm == null ? "" : SectItm.DisplayNumber, parentitem.DisplayNumber, level, dicSecCount.Count > 0 ? dicSecCount[level] : 0);
|
||||||
dicSecParentItem[level] = SectItm;
|
dicSecParentItem[level] = SectItm;
|
||||||
|
int subSecs = drw["Sequence"].ToString().PadRight(12, ' ')[5] - 48;
|
||||||
if (level > 0)
|
if (level > 0)
|
||||||
{
|
{
|
||||||
if ((dicSecCount[level]) == 1)
|
|
||||||
// shift up a level, i.e. give me the parent for the previous level
|
|
||||||
SectItm = dicSecParentItem[--level];
|
|
||||||
else
|
|
||||||
dicSecCount[level]--; // decrements number of sections to process
|
dicSecCount[level]--; // decrements number of sections to process
|
||||||
}
|
}
|
||||||
// get number of subsections for this section
|
|
||||||
int subSecs = drw["Sequence"].ToString().PadRight(12, ' ')[5] - 48;
|
|
||||||
if (subSecs > 0)
|
if (subSecs > 0)
|
||||||
{
|
{
|
||||||
dicSecCount[++level] = subSecs;
|
dicSecCount[++level] = subSecs;
|
||||||
@ -348,6 +344,20 @@ namespace DataLoader
|
|||||||
addpart = true;
|
addpart = true;
|
||||||
SectItm = null; // no previous sibling for the first child node.
|
SectItm = null; // no previous sibling for the first child node.
|
||||||
}
|
}
|
||||||
|
if (level > 0)
|
||||||
|
{
|
||||||
|
while (level > 0 && dicSecCount[level] == 0)
|
||||||
|
{
|
||||||
|
// shift up a level, i.e. give me the parent for the previous level
|
||||||
|
dicSecCount.Remove(level);
|
||||||
|
SectItm = dicSecParentItem[--level];
|
||||||
|
if (level > 0)
|
||||||
|
parentitem = dicSecParentItem[level - 1];
|
||||||
|
else
|
||||||
|
parentitem = itm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Console.WriteLine("'after',{0},{1},{2},{3}", SectItm == null ? "" : SectItm.DisplayNumber, parentitem.DisplayNumber, level, dicSecCount.Count > 0 ? dicSecCount[level] : 0);
|
||||||
}
|
}
|
||||||
dv.Dispose();
|
dv.Dispose();
|
||||||
//foreach (Item secItm in dicSecParentItem.Values)
|
//foreach (Item secItm in dicSecParentItem.Values)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user