From 530e41a44fdb0e2f6cd48a35b8d5b161e84152f2 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 15 Oct 2010 16:36:41 +0000 Subject: [PATCH] --- .../Extension/TransitionExt.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index 69d55135..f3191331 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -624,18 +624,23 @@ namespace VEPROMS.CSLA.Library } private static bool AddOptionalTranGetSectionHdr(bool textAdded, TransitionBuilder tb, string token, string nonToken) { - // output from 16-bit code looks like section header - // token is passed in for future use, i.e. if text is placed between "?" and "." to - // request other processing. + // If section is not a procedure step section, add it. + // If Procedure going to has only 1 step section, do not add it. + // If procedure going to has more than 1 step section and is NOT same procedure + // and going to default section, do not add it. + // If procedure going to has more than 1 step section and going to non-default section, add it. - // If in same procedure, the section header is put out if not in the same section. - // If in a different procedure, the section header is put out if the 'to' item is not the - // default (or start) section. - if (tb._FromItem.MyProcedure.ItemID == tb._ToItem.MyProcedure.ItemID) - { - if (TranGetSectionItem(tb._FromItem).ItemID == TranGetSectionItem(tb._ToItem).ItemID) return textAdded ? true : false; - } - else if (TranGetSectionItem(tb._ToItem).IsDefaultSection) return textAdded ? true : false; + // first handle 'to' non-step section. Always add it. + if (tb._ToItem.IsSection && !tb._ToItem.IsStepSection)return AddTranGetSectionHdr(textAdded, tb, token, nonToken); + + // Now, handle case where 'to' procedure only has one step section OR going 'to' the default section of a + // different procedure. It is NOT added. + int cntsect = 0; + ItemInfo sect = TranGetSectionItem(tb._ToItem); + foreach (ItemInfo ii in tb._ToItem.MyProcedure.Sections) if (ii.IsStepSection) cntsect++; + if (cntsect == 1 || (sect != null && sect.IsDefaultSection && tb._ToItem.IsStep) + || (tb._ToItem.MyProcedure != tb._FromItem.MyProcedure && sect != null && sect.IsDefaultSection && tb._ToItem.IsSection) + || tb._ToItem.IsProcedure) return textAdded ? true : false; return AddTranGetSectionHdr(textAdded, tb, token, nonToken); } private static bool AddTranGetSectionHdr(bool textAdded, TransitionBuilder tb, string token, string nonToken)