From 2d7c25d2d2a677c44663111aa5f3ea93540c58f1 Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 5 Nov 2014 14:34:53 +0000 Subject: [PATCH] GetSectionInfo use local value rather than using the cache Added Property HasStepCheckOffs --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index b69e2e72..2911bed8 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -324,6 +324,21 @@ namespace VEPROMS.CSLA.Library #region ItemInfo public partial class ItemInfo : IVEDrillDownReadOnly { + public SectionInfo GetSectionInfo() + { + if (this is SectionInfo) return this as SectionInfo; + return SectionInfo.Get(ItemID); + } + public StepInfo GetStepInfo() + { + if (this is StepInfo) return this as StepInfo; + return StepInfo.Get(ItemID); + } + public ProcedureInfo GetProcedureInfo() + { + if (this is ProcedureInfo) return this as ProcedureInfo; + return ProcedureInfo.Get(ItemID); + } public bool InList(params int[] IDs) { foreach (int id in IDs) @@ -3336,7 +3351,7 @@ namespace VEPROMS.CSLA.Library _MyHeader.Justify = ContentAlignment.MiddleCenter; _MyHeader.Text = (!FormatStepData.TabData.NoTrim) ? tbformat.Replace("\\xA0", " ").Trim() : tbformat.Replace("\\xA0", " "); _MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text); - // if there is only step in the group or we have a change in step type (caution/note) when there is + // if there is only step in the group or we have a change in step type (caution/note) when there is // use of the MixCautionsAndNotes format flag - no bullet is used, if more that one replace the tab // with a bullet. Also, if only one in group and tab text ends with 'S', remove it: bool mixCandN = MixCautionNotesDiffType(); @@ -5378,6 +5393,28 @@ namespace VEPROMS.CSLA.Library [Serializable()] public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly { + private bool? _HasStepCheckOffs = null; + public bool HasStepCheckOffs + { + get + { + if (_HasStepCheckOffs == null) + { + _HasStepCheckOffs = GetStepCheckOff(this); + //Console.WriteLine("{0},'{1}','{2}'", ItemID, ShortPath, _HasStepCheckOffs); + } + return (bool)_HasStepCheckOffs; + } + } + private static bool GetStepCheckOff(ItemInfo ii) + { + if (ii is StepInfo && ((ii as StepInfo).MyConfig as StepConfig).Step_CheckOffIndex > 1) return true; + if(ii.MyContent.ContentParts != null) + foreach(PartInfo pi in ii.MyContent.ContentParts) + foreach(ItemInfo iic in pi.MyItems) + if(GetStepCheckOff(iic)) return true; + return false; + } //private int? _TemplateColumnMode public override void SetupTags() {