From b07dc77100f358397653e39c7d8d2a5d64f1bcf4 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 4 Jun 2010 19:42:17 +0000 Subject: [PATCH] --- PROMS/DataLoader/Procedures.cs | 82 +++++++++++++++++----------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/PROMS/DataLoader/Procedures.cs b/PROMS/DataLoader/Procedures.cs index d0294f1b..84749c1d 100644 --- a/PROMS/DataLoader/Procedures.cs +++ b/PROMS/DataLoader/Procedures.cs @@ -210,51 +210,51 @@ namespace DataLoader Item parentitem = itm; //if (ProcNumber == "001-002") // Console.WriteLine("proc 001-002"); - 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) + foreach (DataRowView drw in dv) { - // 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; + //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 + 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; - dicSecParentItem[level] = SectItm; - if (level > 0) + // need section start + if (EditSectId != 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 + 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(); } - // 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(); return itm;