public async Task <IEnumerable <TemplateVersion> > FindByFundingStreamAndPeriod(FindTemplateVersionQuery query)
        {
            Guard.IsNullOrWhiteSpace(query.FundingStreamId, nameof(query.FundingStreamId));
            Guard.IsNullOrWhiteSpace(query.FundingPeriodId, nameof(query.FundingPeriodId));

            query.Statuses ??= new List <TemplateStatus>();
            if (query.Statuses.Any())
            {
                return(await CosmosRepository.Query <TemplateVersion>(x =>
                                                                      x.Content.FundingStreamId == query.FundingStreamId &&
                                                                      x.Content.FundingPeriodId == query.FundingPeriodId &&
                                                                      query.Statuses.Contains(x.Content.Status)));
            }

            return(await CosmosRepository.Query <TemplateVersion>(x =>
                                                                  x.Content.FundingStreamId == query.FundingStreamId &&
                                                                  x.Content.FundingPeriodId == query.FundingPeriodId));
        }
        public async Task <IEnumerable <TemplateVersion> > GetSummaryVersionsByTemplate(string templateId,
                                                                                        IEnumerable <TemplateStatus> statuses)
        {
            Guard.IsNullOrWhiteSpace(templateId, nameof(templateId));

            List <TemplateStatus> templateStatuses = statuses.ToList();

            if (templateStatuses.Any())
            {
                return(await CosmosRepository.Query <TemplateVersion>(x =>
                                                                      x.Content.TemplateId == templateId && templateStatuses.Contains(x.Content.Status)));
            }

            IEnumerable <TemplateVersion> versions = await CosmosRepository.Query <TemplateVersion>(x =>
                                                                                                    x.Content.TemplateId == templateId);

            return(versions);
        }
        public async Task <TemplateVersion> GetTemplateVersion(string templateId, int versionNumber)
        {
            Guard.IsNullOrWhiteSpace(templateId, nameof(templateId));

            IEnumerable <TemplateVersion> templateMatches = await CosmosRepository.Query <TemplateVersion>(x =>
                                                                                                           x.Content.TemplateId == templateId && x.Content.Version == versionNumber);

            if (templateMatches == null || !templateMatches.Any())
            {
                return(null);
            }

            if (templateMatches.Count() == 1)
            {
                return(templateMatches.First());
            }

            throw new ApplicationException($"Duplicate templates with TemplateId={templateId}");
        }
Example #4
0
        public Task <IEnumerable <DatasetDefinition> > GetDatasetDefinitions()
        {
            IQueryable <DatasetDefinition> definitions = _cosmosRepository.Query <DatasetDefinition>();

            return(Task.FromResult(definitions.ToList().AsEnumerable()));
        }
Example #5
0
 public async Task <IEnumerable <DatasetDefinition> > GetDatasetDefinitions()
 {
     return(await _cosmosRepository.Query <DatasetDefinition>());
 }
Example #6
0
        public IEnumerable <JobDefinition> GetJobDefinitions()
        {
            IQueryable <JobDefinition> jobDefinitions = _cosmosRepository.Query <JobDefinition>();

            return(jobDefinitions.AsEnumerable());
        }
 public async Task <IEnumerable <DatasetAggregations> > GetDatasetAggregationsForSpecificationId(string specificationId)
 {
     return(await _cosmosRepository.Query <DatasetAggregations>(x => x.Content.SpecificationId == specificationId));
 }
Example #8
0
        public Task <IEnumerable <Calculation> > GetCalculationsBySpecificationId(string specificationId)
        {
            IQueryable <Calculation> calculations = _cosmosRepository.Query <Calculation>().Where(x => x.SpecificationId == specificationId);

            return(Task.FromResult(calculations.AsEnumerable()));
        }
        public Task <TestScenario> GetTestScenarioById(string testScenarioId)
        {
            var scenarios = _cosmosRepository.Query <TestScenario>().Where(m => m.Id == testScenarioId);

            return(Task.FromResult(scenarios.AsEnumerable().FirstOrDefault()));
        }
        public Task <BuildProject> GetBuildProjectBySpecificationId(string specificiationId)
        {
            IEnumerable <BuildProject> buildProjects = _cosmosRepository.Query <BuildProject>().Where(x => x.SpecificationId == specificiationId).ToList();

            return(Task.FromResult(buildProjects.FirstOrDefault()));
        }
        public Task <IEnumerable <DatasetAggregations> > GetDatasetAggregationsForSpecificationId(string specificationId)
        {
            IEnumerable <DatasetAggregations> results = _cosmosRepository.Query <DatasetAggregations>().Where(x => x.SpecificationId == specificationId).ToList();

            return(Task.FromResult(results));
        }
        private Task <IEnumerable <T> > GetVersionsByEntityId(string entityId)
        {
            IQueryable <T> versions = _cosmosRepository.Query <T>().Where(m => m.EntityId == entityId);

            return(Task.FromResult(versions.AsEnumerable()));
        }