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