Пример #1
0
        /// <summary>Updates the item.</summary>
        /// <param name="itemDefinition">The item definition.</param>
        /// <param name="value">The value.</param>
        public virtual void UpdateItem(ItemDefinition itemDefinition, object value)
        {
            //TODO: Figure out how to make sure item definition is valid for this assessment.

            var itemUpdatedEvent = new ItemUpdatedEvent(Key, Version, itemDefinition.CodedConcept.Code, value, itemDefinition.GetIsRequired());

            AssessmentRuleEngineExecutor.CreateRuleEngineExecutor(this)
            .ForItemInstance(new ItemInstance(itemDefinition.CodedConcept.Code, value, itemDefinition.GetIsRequired()))
            .Execute(() => RaiseEvent(itemUpdatedEvent));
        }
Пример #2
0
        public void UpdateItem(string itemDefinitionCode, object value)
        {
            //TODO: Figure out how to make sure item definition is valid for this assessment.
            //if ( !AssessmentDefinition.ItemDefinitions.Contains ( itemDefinition ) )
            //{
            //    throw new ArgumentException("Assessment Definition does not contain the item definition.","itemDefinition");
            //}
            var itemUpdatedEvent = new ItemUpdatedEvent(Key, Version, itemDefinitionCode, value);

            AssessmentRuleEngineExecutor.CreateRuleEngineExecutor(this)
            .ForItemDefinitionCode(itemDefinitionCode)
            .WithContext(itemUpdatedEvent)
            .Execute(() => RaiseEvent(itemUpdatedEvent));
        }