diff --git a/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs b/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs index f1f96999..84144597 100644 --- a/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs +++ b/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs @@ -47,24 +47,24 @@ namespace VEPROMS.CSLA.Library { #region Events public event VETreeNodeEvent LoadingChildrenSQL; - public event VETreeNodeEvent LoadingChildernMax; - public event VETreeNodeEvent LoadingChildernValue; - public event VETreeNodeEvent LoadingChildernDone; + public event VETreeNodeEvent LoadingChildrenMax; + public event VETreeNodeEvent LoadingChildrenValue; + public event VETreeNodeEvent LoadingChildrenDone; private void OnLoadingChildrenSQL(object sender, VETreeNodeEventArgs args) { if (LoadingChildrenSQL != null) LoadingChildrenSQL(sender, args); } private void OnLoadingChildrenMax(object sender, VETreeNodeEventArgs args) { - if (LoadingChildernMax != null) LoadingChildernMax(sender, args); + if (LoadingChildrenMax != null) LoadingChildrenMax(sender, args); } private void OnLoadingChildrenValue(object sender, VETreeNodeEventArgs args) { - if (LoadingChildernValue != null) LoadingChildernValue(sender, args); + if (LoadingChildrenValue != null) LoadingChildrenValue(sender, args); } private void OnLoadingChildrenDone(object sender, VETreeNodeEventArgs args) { - if (LoadingChildernDone != null) LoadingChildernDone(sender, args); + if (LoadingChildrenDone != null) LoadingChildrenDone(sender, args); } #endregion #region Business Methods @@ -223,29 +223,51 @@ namespace VEPROMS.CSLA.Library private void ExpandChildren(IList ol) { int icnt = 0; + bool lastWasSection = false; foreach (IVEDrillDownReadOnly o in ol) { OnLoadingChildrenValue(this, new VETreeNodeEventArgs(++icnt)); //tNext("Cycle"); try { - VETreeNode tmp = new VETreeNode(o,_allParts); - if (o.HasChildren) + bool skipIt = false; + bool isStepPart = (o is PartInfo && (o as PartInfo).PartType == E_FromType.Step); + if (isStepPart) { - if (o is PartInfo) + // get parent section and see if it has the Editable flag set. Only skip + // if this flag is set to "N". + ItemInfo sectInfo = (ItemInfo)(o as PartInfo).ActiveParent; + if (sectInfo != null) { - tmp.Nodes.Clear(); - tmp.ExpandChildren(o.GetChildren()); - tmp._ChildrenLoaded = true; + SectionConfig sc = sectInfo.MyConfig as SectionConfig; + if (sc != null && sc.SubSection_Edit == "N") skipIt = true; } - // OLD: RHM 20100115 : I don't think that the following lines are necessary since the "new VETreeNode(o)" - // above includes a similar function. - //else - // tmp.Nodes.Add(string.Format("dummy: {0}", o.GetType().Name));// Add a Dummy Node so that the item will appear to be expanable. } - else - tmp._ChildrenLoaded = true;// Reset the children loaded flag - this.Nodes.Add(tmp); + if (!skipIt) + { + VETreeNode tmp = new VETreeNode(o, _allParts); + if (o.HasChildren) + { + if (o is PartInfo) + { + tmp.Nodes.Clear(); + tmp.ExpandChildren(o.GetChildren()); + tmp._ChildrenLoaded = true; + } + // OLD: RHM 20100115 : I don't think that the following lines are necessary since the "new VETreeNode(o)" + // above includes a similar function. + //else + // tmp.Nodes.Add(string.Format("dummy: {0}", o.GetType().Name));// Add a Dummy Node so that the item will appear to be expanable. + } + else + tmp._ChildrenLoaded = true;// Reset the children loaded flag + if (lastWasSection) + this.Nodes.Insert(0, tmp); + else + this.Nodes.Add(tmp); + // if last thing was section & this is step, do insert - i.e. so that steps go before sections. + lastWasSection = (o is PartInfo && (o as PartInfo).PartType == E_FromType.Section); + } } catch (Exception ex) {