This commit is contained in:
Kathy Ruffing 2011-11-21 16:45:59 +00:00
parent 5e59fc2c34
commit 4c49f001ac

View File

@ -47,24 +47,24 @@ namespace VEPROMS.CSLA.Library
{ {
#region Events #region Events
public event VETreeNodeEvent LoadingChildrenSQL; public event VETreeNodeEvent LoadingChildrenSQL;
public event VETreeNodeEvent LoadingChildernMax; public event VETreeNodeEvent LoadingChildrenMax;
public event VETreeNodeEvent LoadingChildernValue; public event VETreeNodeEvent LoadingChildrenValue;
public event VETreeNodeEvent LoadingChildernDone; public event VETreeNodeEvent LoadingChildrenDone;
private void OnLoadingChildrenSQL(object sender, VETreeNodeEventArgs args) private void OnLoadingChildrenSQL(object sender, VETreeNodeEventArgs args)
{ {
if (LoadingChildrenSQL != null) LoadingChildrenSQL(sender, args); if (LoadingChildrenSQL != null) LoadingChildrenSQL(sender, args);
} }
private void OnLoadingChildrenMax(object sender, VETreeNodeEventArgs 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) 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) private void OnLoadingChildrenDone(object sender, VETreeNodeEventArgs args)
{ {
if (LoadingChildernDone != null) LoadingChildernDone(sender, args); if (LoadingChildrenDone != null) LoadingChildrenDone(sender, args);
} }
#endregion #endregion
#region Business Methods #region Business Methods
@ -223,13 +223,29 @@ namespace VEPROMS.CSLA.Library
private void ExpandChildren(IList ol) private void ExpandChildren(IList ol)
{ {
int icnt = 0; int icnt = 0;
bool lastWasSection = false;
foreach (IVEDrillDownReadOnly o in ol) foreach (IVEDrillDownReadOnly o in ol)
{ {
OnLoadingChildrenValue(this, new VETreeNodeEventArgs(++icnt)); OnLoadingChildrenValue(this, new VETreeNodeEventArgs(++icnt));
//tNext("Cycle"); //tNext("Cycle");
try try
{ {
VETreeNode tmp = new VETreeNode(o,_allParts); bool skipIt = false;
bool isStepPart = (o is PartInfo && (o as PartInfo).PartType == E_FromType.Step);
if (isStepPart)
{
// 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)
{
SectionConfig sc = sectInfo.MyConfig as SectionConfig;
if (sc != null && sc.SubSection_Edit == "N") skipIt = true;
}
}
if (!skipIt)
{
VETreeNode tmp = new VETreeNode(o, _allParts);
if (o.HasChildren) if (o.HasChildren)
{ {
if (o is PartInfo) if (o is PartInfo)
@ -245,7 +261,13 @@ namespace VEPROMS.CSLA.Library
} }
else else
tmp._ChildrenLoaded = true;// Reset the children loaded flag tmp._ChildrenLoaded = true;// Reset the children loaded flag
if (lastWasSection)
this.Nodes.Insert(0, tmp);
else
this.Nodes.Add(tmp); 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) catch (Exception ex)
{ {