Provides the structure required for sub area of law term. It includes sub area of law, area of law, folders, folder structure flag, id , wssid and document template.
        /// <summary>
        /// Load practice group term set from term store 
        /// </summary>
        /// <param name="termSet">Term set containing term set data</param>
        /// <param name="customPropertyName">Custom property name</param>
        /// <returns>Term sets</returns>
        internal static TermSets GetPracticeGroupTermSetHierarchy(TermSet termSet, string customPropertyName)
        {
            TermSets tempTermSet = new TermSets();
            string practiceGroupCustomPropertyFolderNames = ConfigurationManager.AppSettings["PracticeGroupCustomPropertyFolderNames"];
            string areaCustomPropertyFolderNames = ConfigurationManager.AppSettings["AreaCustomPropertyFolderNames"];
            string subAreaCustomPropertyFolderNames = ConfigurationManager.AppSettings["SubAreaCustomPropertyFolderNames"];
            string subAreaCustomPropertyisNoFolderStructurePresent = ConfigurationManager.AppSettings["SubAreaCustomPropertyisNoFolderStructurePresent"];
            string subAreaOfLawDocumentTemplates = ConfigurationManager.AppSettings["SubAreaOfLawDocumentTemplates"];

            try
            {
                tempTermSet.Name = termSet.Name;
                ////Retrieve the Terms - level 1
                tempTermSet.PGTerms = new List<PracticeGroupTerm>();
                TermCollection termColl = termSet.Terms;
                foreach (Term term in termColl)
                {
                    PracticeGroupTerm tempTermPG = new PracticeGroupTerm();
                    tempTermPG.TermName = term.Name;
                    tempTermPG.Id = Convert.ToString(term.Id, CultureInfo.InvariantCulture);
                    tempTermPG.ParentTermName = termSet.Name;
                    /////Retrieve the custom property for Terms at level 1
                    foreach (KeyValuePair<string, string> customProperty in term.CustomProperties)
                    {
                        tempTermPG.FolderNames = (customProperty.Key.Equals(practiceGroupCustomPropertyFolderNames, StringComparison.OrdinalIgnoreCase)) ? customProperty.Value : string.Empty;
                    }
                    tempTermSet.PGTerms.Add(tempTermPG);
                    ///// Retrieve the Terms - level 2
                    tempTermPG.AreaTerms = new List<AreaTerm>();
                    TermCollection termCollArea = term.Terms;
                    foreach (Term termArea in termCollArea)
                    {
                        AreaTerm tempTermArea = new AreaTerm();
                        tempTermArea.TermName = termArea.Name;
                        tempTermArea.Id = Convert.ToString(termArea.Id, CultureInfo.InvariantCulture);
                        tempTermArea.ParentTermName = term.Name;
                        /////Retrieve the custom property for Terms at level 2
                        foreach (KeyValuePair<string, string> customProperty in termArea.CustomProperties)
                        {
                            tempTermArea.FolderNames = (customProperty.Key.Equals(areaCustomPropertyFolderNames, StringComparison.OrdinalIgnoreCase)) ? customProperty.Value : string.Empty;
                        }
                        tempTermPG.AreaTerms.Add(tempTermArea);
                        /////Retrieve the Terms - level 3
                        tempTermArea.SubareaTerms = new List<SubareaTerm>();
                        TermCollection termCollSubArea = termArea.Terms;
                        foreach (Term termSubArea in termCollSubArea)
                        {
                            SubareaTerm tempTermSubArea = new SubareaTerm();
                            tempTermSubArea.TermName = termSubArea.Name;
                            tempTermSubArea.Id = Convert.ToString(termSubArea.Id, CultureInfo.InvariantCulture);
                            tempTermSubArea.ParentTermName = termArea.Name;
                            /////Retrieve the custom property for Terms at level 3

                            tempTermSubArea.DocumentTemplates = string.Empty;
                            foreach (KeyValuePair<string, string> customProperty in termSubArea.CustomProperties)
                            {
                                if (customProperty.Key.Equals(customPropertyName, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.ContentTypeName = customProperty.Value;
                                }
                                else if (customProperty.Key.Equals(subAreaCustomPropertyFolderNames, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.FolderNames = customProperty.Value;
                                }
                                else if (customProperty.Key.Equals(subAreaCustomPropertyisNoFolderStructurePresent, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.IsNoFolderStructurePresent = customProperty.Value;
                                }
                                else if (customProperty.Key.Equals(subAreaOfLawDocumentTemplates, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.DocumentTemplates = customProperty.Value;
                                }
                            }
                            tempTermArea.SubareaTerms.Add(tempTermSubArea);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                DisplayAndLogError(errorFilePath, "Message: " + exception.Message + "\nStacktrace: " + exception.StackTrace);
                tempTermSet = null;
            }
            return tempTermSet;
        }
Beispiel #2
0
        /// <summary>
        /// Load practice group term set from term store
        /// </summary>
        /// <param name="termSet">Term set containing term set data</param>
        /// <param name="customPropertyName">Custom property name</param>
        /// <returns>Term sets</returns>
        internal static TermSets GetPracticeGroupTermSetHierarchy(TermSet termSet, string customPropertyName)
        {
            TermSets tempTermSet = new TermSets();
            string   practiceGroupCustomPropertyFolderNames          = ConfigurationManager.AppSettings["PracticeGroupCustomPropertyFolderNames"];
            string   areaCustomPropertyFolderNames                   = ConfigurationManager.AppSettings["AreaCustomPropertyFolderNames"];
            string   subAreaCustomPropertyFolderNames                = ConfigurationManager.AppSettings["SubAreaCustomPropertyFolderNames"];
            string   subAreaCustomPropertyisNoFolderStructurePresent = ConfigurationManager.AppSettings["SubAreaCustomPropertyisNoFolderStructurePresent"];
            string   subAreaOfLawDocumentTemplates                   = ConfigurationManager.AppSettings["SubAreaOfLawDocumentTemplates"];

            try
            {
                tempTermSet.Name = termSet.Name;
                ////Retrieve the Terms - level 1
                tempTermSet.PGTerms = new List <PracticeGroupTerm>();
                TermCollection termColl = termSet.Terms;
                foreach (Term term in termColl)
                {
                    PracticeGroupTerm tempTermPG = new PracticeGroupTerm();
                    tempTermPG.TermName       = term.Name;
                    tempTermPG.Id             = Convert.ToString(term.Id, CultureInfo.InvariantCulture);
                    tempTermPG.ParentTermName = termSet.Name;
                    /////Retrieve the custom property for Terms at level 1
                    foreach (KeyValuePair <string, string> customProperty in term.CustomProperties)
                    {
                        tempTermPG.FolderNames = (customProperty.Key.Equals(practiceGroupCustomPropertyFolderNames, StringComparison.OrdinalIgnoreCase)) ? customProperty.Value : string.Empty;
                    }
                    tempTermSet.PGTerms.Add(tempTermPG);
                    ///// Retrieve the Terms - level 2
                    tempTermPG.AreaTerms = new List <AreaTerm>();
                    TermCollection termCollArea = term.Terms;
                    foreach (Term termArea in termCollArea)
                    {
                        AreaTerm tempTermArea = new AreaTerm();
                        tempTermArea.TermName       = termArea.Name;
                        tempTermArea.Id             = Convert.ToString(termArea.Id, CultureInfo.InvariantCulture);
                        tempTermArea.ParentTermName = term.Name;
                        /////Retrieve the custom property for Terms at level 2
                        foreach (KeyValuePair <string, string> customProperty in termArea.CustomProperties)
                        {
                            tempTermArea.FolderNames = customProperty.Key.Equals(areaCustomPropertyFolderNames, StringComparison.OrdinalIgnoreCase) ? customProperty.Value : string.Empty;
                        }
                        tempTermPG.AreaTerms.Add(tempTermArea);
                        /////Retrieve the Terms - level 3
                        tempTermArea.SubareaTerms = new List <SubareaTerm>();
                        TermCollection termCollSubArea = termArea.Terms;
                        foreach (Term termSubArea in termCollSubArea)
                        {
                            SubareaTerm tempTermSubArea = new SubareaTerm();
                            tempTermSubArea.TermName       = termSubArea.Name;
                            tempTermSubArea.Id             = Convert.ToString(termSubArea.Id, CultureInfo.InvariantCulture);
                            tempTermSubArea.ParentTermName = termArea.Name;
                            /////Retrieve the custom property for Terms at level 3

                            tempTermSubArea.DocumentTemplates = string.Empty;
                            foreach (KeyValuePair <string, string> customProperty in termSubArea.CustomProperties)
                            {
                                if (customProperty.Key.Equals(customPropertyName, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.ContentTypeName = customProperty.Value;
                                }
                                else if (customProperty.Key.Equals(subAreaCustomPropertyFolderNames, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.FolderNames = customProperty.Value;
                                }
                                else if (customProperty.Key.Equals(subAreaCustomPropertyisNoFolderStructurePresent, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.IsNoFolderStructurePresent = customProperty.Value;
                                }
                                else if (customProperty.Key.Equals(subAreaOfLawDocumentTemplates, StringComparison.OrdinalIgnoreCase))
                                {
                                    tempTermSubArea.DocumentTemplates = customProperty.Value;
                                }
                            }
                            tempTermArea.SubareaTerms.Add(tempTermSubArea);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Utility.DisplayAndLogError(Utility.ErrorFilePath, "Message: " + exception.Message + "\nStacktrace: " + exception.StackTrace);
                tempTermSet = null;
            }
            return(tempTermSet);
        }