GetSectionInfo use local value rather than using the cache

Added Property HasStepCheckOffs
This commit is contained in:
Rich 2014-11-05 14:34:53 +00:00
parent 3daa13f4b6
commit 2d7c25d2d2

View File

@ -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()
{