Tree node fixes when deleting nodes

This commit is contained in:
2010-01-15 17:05:41 +00:00
parent 61c9d01516
commit cdf14f6328
5 changed files with 120 additions and 82 deletions

View File

@@ -1078,7 +1078,7 @@ namespace VEPROMS.CSLA.Library
string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((MyContent.Number ?? "") == "" ? MyContent.Text : MyContent.Number));
ItemInfo parent = this;
while (parent.MyPrevious != null) parent = parent.MyPrevious;
if (parent.ItemPartCount == 0)
if (parent.ItemPartCount <= 0 || parent.ItemParts.Count == 0)
return null;
else
{

View File

@@ -183,6 +183,20 @@ namespace VEPROMS.CSLA.Library
internal void OnDeleted(object sender)
{
if (Deleted != null) Deleted(sender);
if (MyParent != null) MyParent.OnChildrenDeleted(sender);
}
public event ItemInfoEvent ChildrenDeleted;
internal void OnChildrenDeleted(object sender)
{
if (_CacheByPrimaryKey.ContainsKey(ItemID.ToString()))
{
List<ItemInfo> itmlst = _CacheByPrimaryKey[ItemID.ToString()];
foreach (ItemInfo itm in itmlst)
if (itm.ChildrenDeleted != null)
{
itm.ChildrenDeleted(itm);
}
}
}
public event ItemInfoInsertEvent NewSiblingAfter;
internal void OnNewSiblingAfter(object sender, ItemInfoInsertEventArgs args)