Ejemplo n.º 1
0
        protected override IList <Term> GetTaxonomyMultiInternal(string fieldName, TermStore termStore)
        {
            if (this.ListItemAdapater != null)
            {
                return(this.ListItemAdapater.GetTaxonomyMulti(fieldName, termStore));
            }
            Collection <Term> collection = new Collection <Term>();
            object            value      = this[fieldName];

            if (value != null)
            {
                try {
                    SPFieldLookupValueCollection values = new SPFieldLookupValueCollection(value.ToString());
                    foreach (SPFieldLookupValue u in values)
                    {
                        Term term = termStore.GetTermByWssId(this.Site, u.LookupId);
                        if (term != null)
                        {
                            collection.Add(term);
                        }
                    }
                } catch { }
            }
            return(collection);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets value from a Taxonomy field.
        /// </summary>
        /// <param name="fieldName">Field name.</param>
        /// <param name="termStore">Term store object.</param>
        /// <returns>Value in the specified field.</returns>
        public override Term GetTaxonomy(string fieldName, TermStore termStore)
        {
            if (this.ListItemAdapater != null)
            {
                return(this.ListItemAdapater.GetTaxonomy(fieldName, termStore));
            }
            object value = this[fieldName];

            if (value != null)
            {
                SPFieldLookupValue typedValue = new SPFieldLookupValue(value.ToString());
                return(termStore.GetTermByWssId(this.Site, typedValue.LookupId));
            }
            return(null);
        }