public static int AddExt(FolderInfo entity) { int num = Folder.Add(entity); if (num > 0) { if (entity.ParentID.Equals(0)) { entity.RootID = num; entity.Depth = 1; entity.ChildCount = 0; } else { FolderInfo dataById = Folder.GetDataById(entity.ParentID); if (dataById != null) { entity.RootID = dataById.RootID; entity.Depth = dataById.Depth + 1; entity.ChildCount = 0; dataById.ChildCount++; Folder.Update(dataById); } } entity.AutoID = num; Folder.Update(entity); } return(num); }
public static bool DeleteExt(int intPrimaryKeyIDValue) { FolderInfo dataById = Folder.GetDataById(intPrimaryKeyIDValue); bool result; if (dataById != null && Folder.Delete(intPrimaryKeyIDValue) && dataById.ParentID > 0) { BizBase.dbo.UpdateTable("update sys_Folder set ChildCount=ChildCount-1 where AutoID=" + dataById.ParentID); result = true; } else { result = false; } return(result); }