private static void PrepareTreeNodeRecursively(PC.SCSimpleObject parentOrg, DeluxeTreeNode parentTreeNode, Dictionary <string, PC.SCSimpleObject> parentsList, bool godMode, DateTime timePoint, string[] requiredPermissions, string excludeId, string exceptID) { if (excludeId != parentOrg.ID) { PC.SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentOrg.ID }, false, true, false, timePoint); PC.Permissions.SCContainerAndPermissionCollection permissions = null; if (requiredPermissions != null) { permissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, relations.ToIDArray()); } BindObjectsToTreeNodes(relations, parentTreeNode.Nodes, godMode, requiredPermissions, permissions, excludeId, exceptID); foreach (DeluxeTreeNode childNode in parentTreeNode.Nodes) { PC.SCSimpleObject obj = null; if (parentsList.TryGetValue(childNode.Value, out obj)) { childNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal; childNode.Expanded = true; PrepareTreeNodeRecursively(obj, childNode, parentsList, godMode, timePoint, requiredPermissions, excludeId, exceptID); } } } }
protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext) { var excludeSubTree = this.Request.QueryString["superOf"]; var exceptOrg = this.Request.QueryString["exceptOrg"]; var exceptID = excludeSubTree ?? exceptOrg; bool godBehavior = callBackContext == "godMode"; if (excludeSubTree != parentNode.Value) { PC.SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentNode.Value }, false, true, false, DateTime.MinValue); var pmLimitString = this.Request.QueryString.Get("permission"); var requiredPermissions = pmLimitString != null?pmLimitString.Split(',') : null; PC.Permissions.SCContainerAndPermissionCollection permissions = null; if (requiredPermissions != null) { permissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, relations.ToIDArray()); } BindObjectsToTreeNodes(relations, result, godBehavior, requiredPermissions, permissions, excludeSubTree, exceptID); } }