This commit is contained in:
parent
f75c68d4a5
commit
b07dc77100
@ -210,51 +210,51 @@ namespace DataLoader
|
|||||||
Item parentitem = itm;
|
Item parentitem = itm;
|
||||||
//if (ProcNumber == "001-002")
|
//if (ProcNumber == "001-002")
|
||||||
// Console.WriteLine("proc 001-002");
|
// Console.WriteLine("proc 001-002");
|
||||||
foreach (DataRowView drw in dv)
|
foreach (DataRowView drw in dv)
|
||||||
{
|
|
||||||
//if (ProcNumber == "016-001") //"017-001") //"082-002AB")
|
|
||||||
// Console.WriteLine("016-001"); //("017-001"); //"082-002AB");
|
|
||||||
SectItm = MigrateSection(parentitem, ProcNumber, cn, drw, ds.Tables["Steps"], SectItm, dicSecCount.Count > 0 ? true : false, pth, docver, activeFormat);
|
|
||||||
// if no children, add first child (cont)
|
|
||||||
if (addpart)
|
|
||||||
{
|
{
|
||||||
// ContentsParts.Add can use 'fromtype', item - fromtype here = 2, section
|
//if (ProcNumber == "016-001") //"017-001") //"082-002AB")
|
||||||
cont.ContentParts.Add(2, SectItm);
|
// Console.WriteLine("016-001"); //("017-001"); //"082-002AB");
|
||||||
if (cont.MyZContent.OldStepSequence == null || cont.MyZContent.OldStepSequence == "") cont.MyZContent.OldStepSequence = ProcNumber;
|
SectItm = MigrateSection(parentitem, ProcNumber, cn, drw, ds.Tables["Steps"], SectItm, dicSecCount.Count > 0 ? true : false, pth, docver, activeFormat);
|
||||||
if (!cont.IsSavable) ErrorRpt.ErrorReport(cont);
|
// if no children, add first child (cont)
|
||||||
cont.Save();
|
if (addpart)
|
||||||
addpart = false;
|
{
|
||||||
|
// ContentsParts.Add can use 'fromtype', item - fromtype here = 2, section
|
||||||
|
cont.ContentParts.Add(2, SectItm);
|
||||||
|
if (cont.MyZContent.OldStepSequence == null || cont.MyZContent.OldStepSequence == "") cont.MyZContent.OldStepSequence = ProcNumber;
|
||||||
|
if (!cont.IsSavable) ErrorRpt.ErrorReport(cont);
|
||||||
|
cont.Save();
|
||||||
|
addpart = false;
|
||||||
|
}
|
||||||
|
//FrType = 0;
|
||||||
|
dicSecParentItem[level] = SectItm;
|
||||||
|
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
|
||||||
|
}
|
||||||
|
// get number of subsections for this section
|
||||||
|
int subSecs = drw["Sequence"].ToString().PadRight(12, ' ')[5] - 48;
|
||||||
|
if (subSecs > 0)
|
||||||
|
{
|
||||||
|
dicSecCount[++level] = subSecs;
|
||||||
|
cont = SectItm.MyContent;
|
||||||
|
parentitem = SectItm;
|
||||||
|
addpart = true;
|
||||||
|
SectItm = null; // no previous sibling for the first child node.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//FrType = 0;
|
// need section start
|
||||||
dicSecParentItem[level] = SectItm;
|
if (EditSectId != 0)
|
||||||
if (level > 0)
|
|
||||||
{
|
{
|
||||||
if ((dicSecCount[level]) == 1)
|
if (ci == null) ci = new ConfigInfo(null);
|
||||||
// shift up a level, i.e. give me the parent for the previous level
|
ci.AddItem("Procedure", "SectionStart", string.Format("{0}", EditSectId));
|
||||||
SectItm = dicSecParentItem[--level];
|
itm.MyContent.Config = (ci == null) ? null : ci.ToString();
|
||||||
else
|
if (!itm.IsSavable) ErrorRpt.ErrorReport(itm);
|
||||||
dicSecCount[level]--; // decrements number of sections to process
|
itm.Save();
|
||||||
}
|
}
|
||||||
// get number of subsections for this section
|
|
||||||
int subSecs = drw["Sequence"].ToString().PadRight(12, ' ')[5] - 48;
|
|
||||||
if (subSecs > 0)
|
|
||||||
{
|
|
||||||
dicSecCount[++level] = subSecs;
|
|
||||||
cont = SectItm.MyContent;
|
|
||||||
parentitem = SectItm;
|
|
||||||
addpart = true;
|
|
||||||
SectItm = null; // no previous sibling for the first child node.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// need section start
|
|
||||||
if (EditSectId != 0)
|
|
||||||
{
|
|
||||||
if (ci == null) ci = new ConfigInfo(null);
|
|
||||||
ci.AddItem("Procedure", "SectionStart", string.Format("{0}", EditSectId));
|
|
||||||
itm.MyContent.Config = (ci == null) ? null : ci.ToString();
|
|
||||||
if (!itm.IsSavable) ErrorRpt.ErrorReport(itm);
|
|
||||||
itm.Save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ds.Dispose();
|
ds.Dispose();
|
||||||
return itm;
|
return itm;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user