Sub Area of Laws Class Inheriting Terms Value
Inheritance: Terms
Exemple #1
0
        /// <summary>
        /// Initializing Practice Group List By Loading TermGroup
        /// </summary>
        /// <param name="clientContext">Client Context</param>
        /// <param name="termGroup">Term Group</param>
        /// <param name="termSetName">Term Set Name</param>
        /// <returns>Practice Group List</returns>
        public static List <PracticeGroup> IntializePracticeGroupObject(ClientContext clientContext, TermGroup termGroup, string termSetName)
        {
            PracticeGroup        practiceGroup;
            SubAreaOfLaw         subAreaOfLawTerm;
            AreaOfLaw            areaOfLawTerm;
            TermSet              termSet        = termGroup.TermSets.GetByName(termSetName);
            TermCollection       termColl       = termSet.Terms;
            List <PracticeGroup> practiceGroups = new List <PracticeGroup>();

            LoadExecute(clientContext, termColl);
            foreach (Term prctcGrp in termColl)
            {
                // Initializing Practice Group
                practiceGroup           = new PracticeGroup();
                practiceGroup.Name      = prctcGrp.Name;
                practiceGroup.Id        = Convert.ToString(prctcGrp.Id, CultureInfo.InvariantCulture);
                practiceGroup.AreaOfLaw = new List <AreaOfLaw>();
                practiceGroups.Add(practiceGroup);
                foreach (Term areaLaw in prctcGrp.Terms)
                {
                    // Initializing Area of Law
                    areaOfLawTerm              = new AreaOfLaw();
                    areaOfLawTerm.Name         = areaLaw.Name;
                    areaOfLawTerm.Id           = Convert.ToString(areaLaw.Id, CultureInfo.InvariantCulture);
                    areaOfLawTerm.SubareaOfLaw = new List <SubAreaOfLaw>();
                    practiceGroup.AreaOfLaw.Add(areaOfLawTerm);

                    foreach (Term subAreaOfLaw in areaLaw.Terms)
                    {
                        subAreaOfLawTerm      = new SubAreaOfLaw();
                        subAreaOfLawTerm.Name = subAreaOfLaw.Name;
                        subAreaOfLawTerm.Id   = Convert.ToString(subAreaOfLaw.Id, CultureInfo.InvariantCulture);
                        foreach (KeyValuePair <string, string> termProperty in subAreaOfLaw.CustomProperties)
                        {
                            if (termProperty.Key.Equals(Constants.ContentTypeDictKey))
                            {
                                subAreaOfLawTerm.ContentType = termProperty.Value;
                            }
                        }
                        areaOfLawTerm.SubareaOfLaw.Add(subAreaOfLawTerm);
                    }
                }
            }
            return(practiceGroups);
        }
Exemple #2
0
        /// <summary>
        /// Initializing Practice Group List By Loading TermGroup
        /// </summary>
        /// <param name="clientContext">Client Context</param>
        /// <param name="termGroup">Term Group</param>
        /// <param name="termSetName">Term Set Name</param>
        /// <returns>Practice Group List</returns>
        public static List<PracticeGroup> IntializePracticeGroupObject(ClientContext clientContext, TermGroup termGroup, string termSetName)
        {
            PracticeGroup practiceGroup;
            SubAreaOfLaw subAreaOfLawTerm;
            AreaOfLaw areaOfLawTerm;
            TermSet termSet = termGroup.TermSets.GetByName(termSetName);
            TermCollection termColl = termSet.Terms;
            List<PracticeGroup> practiceGroups = new List<PracticeGroup>();
            LoadExecute(clientContext, termColl);
            foreach (Term prctcGrp in termColl)
            {
                // Initializing Practice Group
                practiceGroup = new PracticeGroup();
                practiceGroup.Name = prctcGrp.Name;
                practiceGroup.Id = Convert.ToString(prctcGrp.Id, CultureInfo.InvariantCulture);
                practiceGroup.AreaOfLaw = new List<AreaOfLaw>();
                practiceGroups.Add(practiceGroup);
                foreach (Term areaLaw in prctcGrp.Terms)
                {
                    // Initializing Area of Law
                    areaOfLawTerm = new AreaOfLaw();
                    areaOfLawTerm.Name = areaLaw.Name;
                    areaOfLawTerm.Id = Convert.ToString(areaLaw.Id, CultureInfo.InvariantCulture);
                    areaOfLawTerm.SubareaOfLaw = new List<SubAreaOfLaw>();
                    practiceGroup.AreaOfLaw.Add(areaOfLawTerm);

                    foreach (Term subAreaOfLaw in areaLaw.Terms)
                    {
                        subAreaOfLawTerm = new SubAreaOfLaw();
                        subAreaOfLawTerm.Name = subAreaOfLaw.Name;
                        subAreaOfLawTerm.Id = Convert.ToString(subAreaOfLaw.Id, CultureInfo.InvariantCulture);
                        foreach (KeyValuePair<string, string> termProperty in subAreaOfLaw.CustomProperties)
                        {
                            if (termProperty.Key.Equals(Constants.ContentTypeDictKey))
                            {
                                subAreaOfLawTerm.ContentType = termProperty.Value;
                            }
                        }
                        areaOfLawTerm.SubareaOfLaw.Add(subAreaOfLawTerm);
                    }
                }
            }
            return practiceGroups;
        }