Exemplo n.º 1
0
        /// <summary>
        /// Query the <see cref="SimpleParameterValue"/> if it exists or create a new one
        /// </summary>
        /// <param name="req">The <see cref="Requirement"/> container</param>
        /// <param name="simpleParameterValue">The queried <see cref="SimpleParameterValue"/></param>
        /// <returns>A value indicating if the <see cref="SimpleParameterValue"/> existed</returns>
        private bool TryQueryOrderParameterOrCreate(Requirement req, out SimpleParameterValue simpleParameterValue)
        {
            var parameterValue = this.QueryOrderParameter(req);

            if (parameterValue != null)
            {
                simpleParameterValue = parameterValue;
                return(true);
            }

            var iteration = req.GetContainerOfType <Iteration>();
            Tuple <DomainOfExpertise, Participant> domainTuple;

            if (!this.session.OpenIterations.TryGetValue(iteration, out domainTuple) || domainTuple.Item1 == null)
            {
                throw new InvalidOperationException("The domain is null.");
            }

            simpleParameterValue = new SimpleParameterValue(Guid.NewGuid(), null, null)
            {
                ParameterType = this.reqOrderParameterType,
                Value         = new ValueArray <string>(new [] { int.MaxValue.ToString() }),
            };

            return(false);
        }