diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs index d8b47465..61ae95d2 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs @@ -56,9 +56,9 @@ namespace VEPROMS.CSLA.Library if (args.AncestorLookup || ParentLookup) { string retval; - //ProcedureInfo proc = _Procedure.MyProcedureInfo; + // There may be levels of procedures, i.e. procedures within a procedure. ProcedureInfo proc = _Procedure != null ? _Procedure.MyProcedureInfo : _ProcedureInfo; - while (proc.ActiveParent.GetType() == typeof(ProcedureInfo)) + while (proc.ActiveParent.IsProcedure) { retval = proc.ProcedureConfig.GetValue(args.Group, args.Item); if (retval != string.Empty) return retval; diff --git a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs index 6088df02..4dd9e385 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs @@ -63,18 +63,19 @@ namespace VEPROMS.CSLA.Library if (args.AncestorLookup || ParentLookup) { string retval; + // There may be levels of sections, i.e. sections within a section. SectionInfo sect = _Section != null ? _Section.MySectionInfo : _SectionInfo; - while (sect.ActiveParent.GetType() == typeof(SectionInfo)) + while (sect.ActiveParent.IsSection) { retval = sect.SectionConfig.GetValue(args.Group, args.Item); if (retval != string.Empty) return retval; - sect = (SectionInfo)sect.ActiveParent; + sect = (sect.ActiveParent as SectionInfo) ?? SectionInfo.Get((sect.ActiveParent as ItemInfo).ItemID); } + // There may be levels of procedures, i.e. procedures within a procedure. ProcedureInfo proc = ProcedureInfo.Get(((ItemInfo)sect.ActiveParent).ItemID); - //ProcedureInfo proc = (ProcedureInfo)sect.ActiveParent; retval = proc.ProcedureConfig.GetValue(args.Group, args.Item); if (retval != string.Empty) return retval; - while (proc.ActiveParent.GetType() == typeof(ProcedureInfo)) + while (proc.ActiveParent.IsProcedure) { retval = proc.ProcedureConfig.GetValue(args.Group, args.Item); if (retval != string.Empty) return retval;