Пример #1
0
 public ManagementServiceImpl(ArticleContext articleContext, ClassificationContext classificationContext
                              , CommentContext commentContext, UserContext userContext, TagContext tagContext)
 {
     _articleContext        = articleContext;
     _classificationContext = classificationContext;
     _commentContext        = commentContext;
     _userContext           = userContext;
     _tagContext            = tagContext;
 }
Пример #2
0
 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;
 }
Пример #3
0
        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);
        }
Пример #4
0
        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));
        }
Пример #5
0
 public DataPointRepository(ClassificationContext context) : base(context)
 {
 }
Пример #6
0
        /// <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);
        }
Пример #7
0
 protected GenericRepository(ClassificationContext context)
 {
     this.Context = context;
     this.dbSet   = context.Set <TEntity>();
 }