public ManagementServiceImpl(ArticleContext articleContext, ClassificationContext classificationContext , CommentContext commentContext, UserContext userContext, TagContext tagContext) { _articleContext = articleContext; _classificationContext = classificationContext; _commentContext = commentContext; _userContext = userContext; _tagContext = tagContext; }
public ArticleServiceImpl(ArticleContext articleContext, ClassificationContext classificationContext , CommentContext commentContext, TagContext tagContext , UserContext userContext , ReplyContext replyContext) { _articleContext = articleContext; _classificationContext = classificationContext; _commentContext = commentContext; _tagContext = tagContext; _userContext = userContext; _replyContext = replyContext; }
private static async Task FindParent( IServiceProvider serviceProvider, string selectId, List <string> outList) { var classInfo = await ClassificationContext.GetInfo(serviceProvider, selectId); if (classInfo.IsEmpty()) { return; } outList.Add(classInfo.GetKey()); await FindParent(serviceProvider, classInfo.GetEntity().ParentID, outList); }
protected override Task Context() { sut = new ClassificationMapper(); _classification = new OSPSuite.Core.Domain.Classification { ClassificationType = ClassificationType.ObservedData }.WithName("A Name"); _subClassification = new OSPSuite.Core.Domain.Classification { ClassificationType = ClassificationType.ObservedData, Parent = _classification }.WithName("Sub NAme"); _subSubClassification = new OSPSuite.Core.Domain.Classification { ClassificationType = ClassificationType.ObservedData, Parent = _subClassification }.WithName("Sub Sub Name"); _context = new ClassificationContext { Classifications = new List <OSPSuite.Core.Domain.Classification> { _classification, _subClassification, _subSubClassification }, Classifiables = new List <IClassifiableWrapper>() }; return(Task.FromResult(true)); }
public DataPointRepository(ClassificationContext context) : base(context) { }
/// <summary> /// 拉取分类树 /// </summary> /// <param name="useType"></param> /// <param name="selectIds"></param> /// <param name="serviceProvider">依赖注入</param> /// <returns></returns> public static async Task <List <Dictionary <string, object> > > PullTree( this IServiceProvider serviceProvider, int useType, params string[] selectIds) { var parentKeyList = new Dictionary <string, List <string> >(); var resultForSelectIds = await Task.WhenAll(selectIds.Select(async T => { List <string> outList = new List <string>(); await FindParent(serviceProvider, T, outList); return(T, outList); })); foreach (var resultInfo in resultForSelectIds) { if (resultInfo.T.IsNullOrEmpty()) { continue; } if (parentKeyList.ContainsKey(resultInfo.T)) { continue; } parentKeyList.TryAdd(resultInfo.T, resultInfo.outList); } var classList = await ClassificationContext.GetListPageWithUseType_ParentID( serviceProvider, new NetCore.PageInfo(0, 10000), useType, ClassificationContext.EmptyContext(serviceProvider)); List <Dictionary <string, object> > outTree = new List <Dictionary <string, object> >(); await JsTree.LoadWithzTree( serviceProvider, classList, outTree, async (treeData, itree) => { var treeId = await itree.TreeId(); if (parentKeyList.ContainsKey(treeId)) { treeData["selected"] = true; treeData["expanded"] = true; } else { treeData["selected"] = false; var result = from KV in parentKeyList where KV.Value.Exists(V => V == treeId) select true; if (result.Count() > 0) { treeData["expanded"] = true; } else { treeData["expanded"] = false; } } treeData["title"] = await itree.TreeName(); treeData["key"] = await itree.TreeId(); }, true); return(outTree); }
protected GenericRepository(ClassificationContext context) { this.Context = context; this.dbSet = context.Set <TEntity>(); }