From 1d6fb249c715e8baa231cc154de8af30db26eed6 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 14 Jun 2013 14:19:50 +0000 Subject: [PATCH] --- PROMS/DataLoader/Procedures.cs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/PROMS/DataLoader/Procedures.cs b/PROMS/DataLoader/Procedures.cs index dcea6621..25bbf375 100644 --- a/PROMS/DataLoader/Procedures.cs +++ b/PROMS/DataLoader/Procedures.cs @@ -386,26 +386,28 @@ namespace DataLoader } ds.Dispose(); da.Dispose(); - // now read in the HLS's and set their config to the appropriate foldout: - int cnt = 1; - foreach (int hlsItemId in FloatingFoldoutHLS) + // now read in the HLS's and set their config to the appropriate foldout. + // stpFoldSeq contains 16 bit step to foldout associations, i.e. an integer step + // number (ordinal) and string sequence of foldout. + // FloatingFoldoutHLS contains each 16bit ordinal step number (all steps, whether + // they have a foldout or not) and the associated itemid in 32bit + // FoldoutStpSeq contains all foldouts, i.e. the string representing the sequence + // number if 16bit and the resulting 32bit itemid. + foreach (KeyValuePair kvp in stpFoldSeq) { + int hlsItemId = FloatingFoldoutHLS[kvp.Key-1]; // -1 for indexes starting at 0 (not 1) using (Item itmF = Item.Get(hlsItemId)) { // be sure that the dictionaries contain the key. // Some data may be 'corrupt' and not have the appropriate linkages // to floating foldouts. - if (stpFoldSeq.ContainsKey(cnt)) + if (FoldoutStpSeq.ContainsKey(kvp.Value)) { - string fldstr = stpFoldSeq[cnt]; - if (FoldoutStpSeq.ContainsKey(fldstr)) - { - int fldItemId = FoldoutStpSeq[fldstr]; - ConfigInfo ciFold = new ConfigInfo(itmF.MyContent.Config); - ciFold.AddItem("Step", "FloatingFoldout", fldItemId.ToString()); - itmF.MyContent.Config = ciFold.ToString(); - itmF.Save(); - } + int fldItemId = FoldoutStpSeq[kvp.Value]; + ConfigInfo ciFold = new ConfigInfo(itmF.MyContent.Config); + ciFold.AddItem("Step", "FloatingFoldout", fldItemId.ToString()); + itmF.MyContent.Config = ciFold.ToString(); + itmF.Save(); } } }