コード例 #1
0
ファイル: WBRecordsManager.cs プロジェクト: OliSharpe/wbf
        internal void PopulateWithRecordsTypes(WBLocationTreeState treeState, TreeNodeCollection treeNodeCollection, String viewMode, SPFolder parentFolder, WBTerm functionalArea, WBTaxonomy recordsTypesTaxonomy, TermCollection recordsTypeTerms)
        {
            List <Term> sortedTerms = new List <Term>();

            foreach (Term term in recordsTypeTerms)
            {
                sortedTerms.Add(term);
            }
            sortedTerms = sortedTerms.OrderBy(o => o.Name).ToList();

            foreach (Term term in sortedTerms)
            {
                WBRecordsType recordsType = new WBRecordsType(recordsTypesTaxonomy, term);

                bool protectiveZoneOK = true;
                if (!String.IsNullOrEmpty(treeState.MinimumProtectiveZone))
                {
                    protectiveZoneOK = (recordsType.IsZoneAtLeastMinimum(treeState.MinimumProtectiveZone));
                }

                if (recordsType.BranchCanHaveDocuments() && recordsType.IsRelevantToFunctionalArea(functionalArea) && protectiveZoneOK)
                {
                    SPFolder folder = null;
                    if (viewMode != VIEW_MODE__NEW && parentFolder != null)
                    {
                        folder = parentFolder.WBxGetSubFolder(recordsType.Name);
                        if (folder == null)
                        {
                            WBLogging.Debug("Did not find folder for: " + recordsType.Name);
                        }
                    }

                    if (viewMode == VIEW_MODE__NEW || folder != null)
                    {
                        WBRecordsTypeTreeNode recordsTypeTreeNode = new WBRecordsTypeTreeNode(functionalArea, recordsType, folder);
                        TreeNode node = recordsTypeTreeNode.AsTreeNode();

                        if (recordsType.Term.TermsCount > 0 || viewMode != VIEW_MODE__NEW)
                        {
                            if (viewMode == VIEW_MODE__BROWSE_FOLDERS && recordsType.Term.TermsCount == 0)
                            {
                                node.SelectAction = TreeNodeSelectAction.Select;
                            }
                            else
                            {
                                node.SelectAction = TreeNodeSelectAction.Expand;
                            }
                            node.Expanded         = false;
                            node.PopulateOnDemand = true;
                        }
                        else
                        {
                            node.SelectAction     = TreeNodeSelectAction.Select;
                            node.Expanded         = true;
                            node.PopulateOnDemand = false;
                        }

                        treeNodeCollection.Add(node);
                    }
                }
            }
        }