当前位置: 首页>>代码示例>>C#>>正文


C# TermPart类代码示例

本文整理汇总了C#中TermPart的典型用法代码示例。如果您正苦于以下问题:C# TermPart类的具体用法?C# TermPart怎么用?C# TermPart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TermPart类属于命名空间,在下文中一共展示了TermPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDirectContentItems

 public IEnumerable<IContent> GetDirectContentItems(TermPart term, int skip = 0, int count = 0, string fieldName = null)
 {
     return GetDirectContentItemsQuery(term, fieldName)
         .Join<CommonPartRecord>()
         .OrderByDescending(x => x.CreatedUtc)
         .Slice(skip, count);
 }
开发者ID:Devqon,项目名称:Devq.Sellit,代码行数:7,代码来源:CategoryService.cs

示例2: BuildTag

 private static Tag BuildTag(TermPart term, bool leavesOnly, IEnumerable<TermPart> terms) {
     return new Tag {
         Value = term.Id,
         Label = term.Name,
         Disabled = !term.Selectable || (leavesOnly && terms.Any(t => t.Path.Contains(term.Path + term.Id))),
         Levels = term.GetLevels()
     };
 }
开发者ID:Higea,项目名称:Orchard,代码行数:8,代码来源:TagsController.cs

示例3: CreateTerm

        public void CreateTerm(TermPart termPart)
        {
            if (GetTermByName(termPart.TaxonomyId, termPart.Name) == null) {
                _authorizationService.CheckAccess(Permissions.CreateTerm, _services.WorkContext.CurrentUser, null);

                termPart.As<ICommonPart>().Container = GetTaxonomy(termPart.TaxonomyId).ContentItem;
                _contentManager.Create(termPart);
            }
            else {
                _notifier.Warning(T("The term {0} already exists in this taxonomy", termPart.Name));
            }
        }
开发者ID:CloudMetal,项目名称:CloudMetal-Pipeline-Deploy,代码行数:12,代码来源:TaxonomyService.cs

示例4: ProcessTerm

        private void ProcessTerm(TermPart termPart, ICollection<int> processedTermPartRecordIds)
        {
            termPart.Count = (int)_taxonomyService.GetContentItemsCount(termPart);
            processedTermPartRecordIds.Add(termPart.Id);

            // Look for a parent term that has not yet been processed
            if (termPart.Container != null) {
                var parentTerm = termPart.Container.As<TermPart>();
                if (parentTerm != null && !processedTermPartRecordIds.Contains(parentTerm.Id)) {
                    ProcessTerm(parentTerm, processedTermPartRecordIds);
                }
            }
        }
开发者ID:Higea,项目名称:Orchard,代码行数:13,代码来源:TermCountProcessor.cs

示例5: GetCategoriesWithAssociatedContentItems

 public List<string> GetCategoriesWithAssociatedContentItems(TermPart packageTypeTerm) {
     var categoriesList = new List<string>();
     //TODO:Check
     var categories = _taxonomyService.GetChildren(packageTypeTerm)
         .Where(ct => _taxonomyService.GetContentItems(ct).Any())
         .Select(c => c.Name).OrderBy(c => c);
     if (categories.Count() > 0)
     {
         categoriesList.Add("All Categories");
         categoriesList.AddRange(categories);
     }
     return categoriesList;
 }
开发者ID:NickAndersonX,项目名称:xodb,代码行数:13,代码来源:CategoryGetter.cs

示例6: CreateChildTermFor

        public TermPart CreateChildTermFor(TaxonomyPart taxonomy, TermPart parent, string termName, string termSlug)
        {
            var existingTerm = _taxonomyService.GetTermByName(taxonomy.Id, termName);

            if (existingTerm != null)
                return existingTerm;

            var term = _taxonomyService.NewTerm(taxonomy, parent);
            _contentManager.Create(term, VersionOptions.Draft);

            term.Weight = 0;
            term.Name = termName.Trim();

            if (!string.IsNullOrEmpty(termSlug) || !string.IsNullOrWhiteSpace(termSlug))
                term.Slug = termSlug.Trim();

            _contentManager.Publish(term.ContentItem);

            return term;
        }
开发者ID:rtpHarry,项目名称:ACMEMedicalTheme,代码行数:20,代码来源:TaxonomyImportService.cs

示例7: GetDirectContentItemsQuery

        public IContentQuery<TermsPart, TermsPartRecord> GetDirectContentItemsQuery(TermPart term, string fieldName = null)
        {
            var query = _contentManager
                .Query<TermsPart, TermsPartRecord>();

            if (String.IsNullOrWhiteSpace(fieldName))
            {
                query = query.Where(
                    tpr => tpr.Terms.Any(tr =>
                        tr.TermRecord.Id == term.Id));
            }
            else
            {
                query = query.Where(
                    tpr => tpr.Terms.Any(tr =>
                        tr.Field == fieldName
                         && (tr.TermRecord.Id == term.Id)));
            }

            return query;
        }
开发者ID:Devqon,项目名称:Devq.Sellit,代码行数:21,代码来源:CategoryService.cs

示例8: GetContentItemsQuery

        public IContentQuery<TermsPart, TermsPartRecord> GetContentItemsQuery(TermPart term, string fieldName = null) {
            var rootPath = term.FullPath + "/";

            var query = _contentManager
                .Query<TermsPart, TermsPartRecord>()
                .WithQueryHints(new QueryHints().ExpandRecords<AutoroutePartRecord, TitlePartRecord, CommonPartRecord>());

            if (String.IsNullOrWhiteSpace(fieldName)) {
                query = query.Where(
                    tpr => tpr.Terms.Any(tr =>
                        tr.TermRecord.Id == term.Id
                        || tr.TermRecord.Path.StartsWith(rootPath)));
            } else {
                query = query.Where(
                    tpr => tpr.Terms.Any(tr =>
                        tr.Field == fieldName
                         && (tr.TermRecord.Id == term.Id || tr.TermRecord.Path.StartsWith(rootPath))));
            }

            return query;
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:21,代码来源:TaxonomyService.cs

示例9: DeleteTerm

        public void DeleteTerm(TermPart termPart) {
            _contentManager.Remove(termPart.ContentItem);

            foreach(var childTerm in GetChildren(termPart)) {
                _contentManager.Remove(childTerm.ContentItem);
            }

            // delete termContentItems
            var termContentItems = _termContentItemRepository
                .Fetch(t => t.TermRecord == termPart.Record)
                .ToList();

            foreach (var termContentItem in termContentItems) {
                _termContentItemRepository.Delete(termContentItem);
            }
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:16,代码来源:TaxonomyService.cs

示例10: GetChildren

        public IEnumerable<TermPart> GetChildren(TermPart term, bool includeParent) {
            var rootPath = term.FullPath + "/";

            var result = _contentManager.Query<TermPart, TermPartRecord>()
                .Where(x => x.Path.StartsWith(rootPath))
                .List();

            if (includeParent) {
                result = result.Concat(new[] { term });
            }

            return TermPart.Sort(result);
        }
开发者ID:mikmakcar,项目名称:orchard_fork_learning,代码行数:13,代码来源:TaxonomyService.cs

示例11: GetTermNode

 private TreeNode GetTermNode(TermPart term) {
     return new TreeNode {
         Title = term.Name,
         Type = "taxonomy-term",
         Id = term.Id.ToString(CultureInfo.InvariantCulture),
         Url = _url.ItemEditUrl(term)
     };
 }
开发者ID:fengweijp,项目名称:Orchard-Nwazet.Tree,代码行数:8,代码来源:TaxonomyTreeNodeProvider.cs

示例12: GetDirectChildren

        public IEnumerable<TermPart> GetDirectChildren(TermPart term) {
            var directChildren = GetContainables(term.Record.ContentItemRecord);

            return directChildren.List();
        }
开发者ID:Devqon,项目名称:Devq.Sellit,代码行数:5,代码来源:CategoryService.cs

示例13: GetParents

 public IEnumerable<TermPart> GetParents(TermPart term) {
     return term.Path.Split(new [] {'/'}, StringSplitOptions.RemoveEmptyEntries).Select(id => GetTerm(int.Parse(id)));
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:3,代码来源:TaxonomyService.cs

示例14: ProcessPath

 public void ProcessPath(TermPart term) {
     var parentTerm = term.Container.As<TermPart>();
     term.Path = parentTerm != null ? parentTerm.FullPath + "/": "/";
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:4,代码来源:TaxonomyService.cs

示例15: GetHierarchyAlternates

        public IEnumerable<string> GetHierarchyAlternates(TermPart part)
        {
            TermPart parent = part;

            do {
                yield return parent.Slug;
            } while (null != (parent = parent.Container.As<TermPart>()));
        }
开发者ID:Timbioz,项目名称:SciGitAzure,代码行数:8,代码来源:Shapes.cs


注:本文中的TermPart类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。