private static Dictionary <string, PC.SCSimpleObject> PrepareParentsList(string navOu) { Dictionary <string, PC.SCSimpleObject> result = null; if (navOu != PC.SCOrganization.RootOrganizationID) { Dictionary <string, PC.SCSimpleObjectCollection> parents = PC.Adapters.SCSnapshotAdapter.Instance.LoadAllParentsInfo(true, navOu); if (parents != null && parents.ContainsKey(navOu)) { Dictionary <string, PC.SCSimpleObject> queue = parents[navOu].ToDictionary(); result = parents[navOu].ToDictionary(); } } else { PC.SCOrganization root = PC.SCOrganization.GetRoot(); result = new Dictionary <string, PC.SCSimpleObject>() { { root.ID, root.ToSimpleObject() } }; } return(result); }
protected override void OnPreRender(EventArgs e) { bool godMode = Util.SuperVisiorMode; if (this.mainView.ActiveViewIndex == 1) { this.panMode.Attributes["class"] = string.Empty; this.toggleButton.Attributes["title"] = "切换为列表模式"; PC.SCOrganization root = PC.SCOrganization.GetRoot(); DeluxeTreeNode rootTreeNode = CreateTreeNode(root.ID, root.Name, root.DisplayName, string.Empty, false, false); rootTreeNode.Expanded = true; this.tree.Nodes.Add(rootTreeNode); rootTreeNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal; Dictionary <string, PC.SCSimpleObject> parentsList = PrepareParentsList(PC.SCOrganization.RootOrganizationID); var pmLimitString = this.Request.QueryString.Get("permission"); var requiredPermissions = pmLimitString != null?pmLimitString.Split(',') : null; var excludeID = this.Request.QueryString["superOf"]; var exceptID = this.Request.QueryString["exceptOrg"]; PrepareTreeNodeRecursively(root.ToSimpleObject(), rootTreeNode, parentsList, godMode, DateTime.MinValue, requiredPermissions, excludeID, exceptID); this.tree.CallBackContext = godMode ? "godMode" : "general"; } else { this.panMode.Attributes["class"] = "pc-listmode"; this.toggleButton.Attributes["title"] = "切换为分层模式"; } this.hfMode.Value = this.mainView.ActiveViewIndex.ToString(); this.hfGod.Value = godMode ? "1" : "0"; this.hfSingle.Value = this.Request["mode"] == "single" ? "1" : string.Empty; base.OnPreRender(e); }