• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TermPart类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetChildren

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

            return _contentManager.Query<TermPart, TermPartRecord>()
                .Where(x => x.Path.StartsWith(rootPath))
                .List()
                .OrderBy(t => t);
        }
开发者ID:ThinkPublishing,项目名称:Summit.Core,代码行数:8,代码来源:TaxonomyService.cs


示例17: GetContentItemsCount

 public long GetContentItemsCount(TermPart term, string fieldName = null) {
     return GetContentItemsQuery(term, fieldName).Count();
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:3,代码来源:TaxonomyService.cs


示例18: CreateMediaFolder

        private MediaFolder CreateMediaFolder(TermPart termPart) {
            if (termPart == null) {
                return null;
            }

            return new MediaFolder{
                Name = termPart.Name,
                MediaPath = termPart.FullPath,
                TermId = termPart.Id,
                ParentTermId = termPart.Container != null ? termPart.Container.Id : default(int?)
            };
        }
开发者ID:bigfont,项目名称:CertifiedOverheadCrane,代码行数:12,代码来源:MediaLibraryService.cs


示例19: GetChildren

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

            var result = _contentManager.Query<TermPart, TermPartRecord>()
                .WithQueryHints(new QueryHints().ExpandRecords<AutoroutePartRecord, TitlePartRecord, CommonPartRecord>())
                .List()
                .Where(x => x.Path.StartsWith(rootPath));

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


示例20: GetPackageCategoryTerm

 private TermPart GetPackageCategoryTerm(TermPart packageTypeTerm, string packageCategory) {
     return _taxonomyService.GetChildren(packageTypeTerm).Where(t => t.Name == packageCategory).FirstOrDefault();
 }
开发者ID:NickAndersonX,项目名称:xodb,代码行数:3,代码来源:PackagesController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TermStore类代码示例发布时间:2022-05-24
下一篇:
C# Term类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap