Example #1
0
        protected override void DoStart()
        {
            foreach (var flatFormulaCriteria in _flatDynamicFormulaCriteriaRepository.All())
            {
                var rateKey = new RateKey(flatFormulaCriteria.CalculationMethod, flatFormulaCriteria.Rate);

                if (!_criteria.Contains(rateKey))
                {
                    _criteria.Add(new DynamicFormulaCriteria(rateKey));
                }

                var criteria = _criteria[rateKey];
                criteria.DescriptorCriteria.Add(_descriptorConditionMapper.MapFrom(flatFormulaCriteria.Condition, flatFormulaCriteria.Tag));
            }
        }
Example #2
0
        private DescriptorCriteria containerCriteriaFor(int containerId, string parameterName)
        {
            var allConditions = _flatContainerParameterDescriptorConditionRepository.All()
                                .Where(x => x.ContainerId == containerId && x.ParameterName == parameterName)
                                .ToList();

            if (!allConditions.Any())
            {
                return(null);
            }

            var operators = allConditions.Select(x => x.Operator).Distinct().ToList();

            if (operators.Count != 1)
            {
                throw new ArgumentException(PKSimConstants.Error.MultipleOperatorFoundForContainer(containerId, parameterName));
            }

            var criteria = new DescriptorCriteria();

            allConditions.Each(x => criteria.Add(_descriptorConditionMapper.MapFrom(x.Condition, x.Tag)));
            criteria.Operator = allConditions.First().Operator;
            return(criteria);
        }