public void ProjectDataSubstractTest()
        {
            var left   = new ProjectIndexData(new int?[] { 1, 2 });
            var right  = new ProjectIndexData(new int?[] { 1, 2, 3 });
            var result = ProjectIndexData.Substract(right, left);

            result.ProjectIds.Should(Be.EquivalentTo(new[] { 3 }));
        }
        public Maybe <QueryPlan> BuildProjectContextPlan(IEnumerable <int> projectIds, bool includeNoProject, DocumentIndexTypeToken projectIndexTypeToken)
        {
            ProjectIndexData projectIdsIndexData  = projectIds != null ? new ProjectIndexData(projectIds.Cast <int?>().ToList()) : ProjectIndexData.Empty;
            ProjectIndexData nullProjectIndexData = includeNoProject ? new ProjectIndexData(new int?[] { null }) : ProjectIndexData.Empty;
            var    result = ProjectIndexData.Sum(projectIdsIndexData, nullProjectIndexData);
            string query  = result.ToString();

            if (string.IsNullOrEmpty(query))
            {
                return(Maybe.Nothing);
            }
            IDocumentIndex projectContextIndex = _documentIndexProvider.GetOrCreateDocumentIndex(_pluginContext, projectIndexTypeToken);

            return(projectContextIndex.BuildExecutionPlan(new ParsedQuery(words: query), _profile.Initialized));
        }
예제 #3
0
        public async Task OnGetAsync(string id, string TechniciaNID)
        {
            IndexData = new ProjectIndexData();
            IndexData.ProjectsIndex = await _context.Project.Where(s => !string.IsNullOrEmpty(SearchString)?
                                                                   s.Title.Contains(SearchString) : true)
                                      .Include(c => c.Postulations).ThenInclude(c => c.Technician)
                                      .AsNoTracking().ToListAsync();


            if (id != null)
            {
                ProjectId = id;
                Project project = IndexData.ProjectsIndex.Where(p => p.ProjectID == id).Single();
                IndexData.TechniciansIndex = project.Postulations.Select(t => t.Technician);
            }
            if (TechniciaNID != null)
            {
                TechniciaNID = id;
            }
        }