Exemple #1
0
        public virtual IEnumerable <IValidationAction> BuildValidationActions(IValidationAction condition)
        {
            condition = new VerifyFieldPresenceAction(condition, this);
            yield return(condition);

            yield return(new VerifyFieldTitleAction(condition, this));
        }
        public override IEnumerable <IValidationAction> BuildValidationActions(IValidationAction condition)
        {
            IValidationAction fieldCondition = null;

            foreach (IValidationAction action in base.BuildValidationActions(condition))
            {
                if (fieldCondition == null)
                {
                    fieldCondition = action;
                }

                yield return(action);
            }

            Debug.Assert(fieldCondition != null);

            fieldCondition = new VerifySelectListPresenceAction(fieldCondition, this);
            yield return(fieldCondition);

            IValueDefinition  previousValue  = null;
            IValidationAction valueCondition = null;

            foreach (IValueDefinition value in Values)
            {
                foreach (IValidationAction action in value.BuildValidationActions(fieldCondition))
                {
                    if (valueCondition == null)
                    {
                        valueCondition = action;
                    }

                    if (action != fieldCondition)
                    {
                        yield return(action);
                    }
                }

                valueCondition = new VerifySelectOptionPresenceAction(valueCondition, value);
                yield return(valueCondition);

                yield return(new VerifySelectOptionTitleAction(valueCondition, value));

                yield return(new VerifySelectOptionParentAction(valueCondition, value, this));

                yield return(new VerifySelectOptionOrderAction(valueCondition, value, previousValue));

                previousValue  = value;
                valueCondition = fieldCondition;
            }

            Debug.Assert((previousValue == null) == (valueCondition == null));

            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            if (previousValue != null)
            {
                yield return(new VerifySelectOptionOrderAction(fieldCondition, null, previousValue));
            }
            // ReSharper restore ConditionIsAlwaysTrueOrFalse
        }
 public IEnumerable <IValidationAction> BuildValidationActions(IValidationAction condition)
 {
     foreach (IElementDefinition element in Elements)
     {
         foreach (IValidationAction action in element.BuildValidationActions(condition))
         {
             yield return(action);
         }
     }
 }
Exemple #4
0
        public IEnumerable <IValidationAction> BuildValidationActions(IValidationAction condition)
        {
            condition = new VerifyGroupPresenceAction(condition, this);
            yield return(condition);

            yield return(new VerifyGroupTitleAction(condition, this));

            IFieldDefinition  previousField  = null;
            IValidationAction fieldCondition = null;

            foreach (IFieldDefinition field in Fields)
            {
                foreach (IValidationAction action in field.BuildValidationActions(condition))
                {
                    if (fieldCondition == null)
                    {
                        fieldCondition = action;
                    }

                    if (action != condition)
                    {
                        yield return(action);
                    }
                }

                fieldCondition = new VerifyFieldParentAction(fieldCondition, field, this);
                yield return(fieldCondition);

                yield return(new VerifyFieldOrderAction(fieldCondition, field, previousField));

                previousField  = field;
                fieldCondition = condition;
            }

            Debug.Assert((previousField == null) == (fieldCondition == null));

            if (previousField != null)
            {
                yield return(new VerifyFieldOrderAction(fieldCondition, null, previousField));
            }
        }
 public IEnumerable <IValidationAction> BuildValidationActions(IValidationAction condition)
 {
     yield return(condition);
 }
 public VerifySelectOptionParentAction(IValidationAction condition, IValueDefinition value, IFieldDefinition field)
     : base(condition, value)
 {
 }
Exemple #7
0
 public VerifySelectListPresenceAction(IValidationAction condition, IFieldDefinition field)
     : base(condition, field)
 {
 }
 public VerifyGroupTitleAction(IValidationAction condition, IGroupDefinition group)
     : base(condition, group)
 {
 }
 public VerifyFieldTitleAction(IValidationAction condition, IFieldDefinition field)
     : base(condition, field)
 {
 }
Exemple #10
0
 public ValidationAction(IValidationAction condition)
 {
     Condition = condition;
 }
 public GroupValidationAction(IValidationAction condition, IGroupDefinition group)
     : base(condition)
 {
     Group = group;
 }
 public VerifySelectOptionOrderAction(IValidationAction condition, IValueDefinition value, IValueDefinition previousValue)
     : base(condition, value)
 {
 }
Exemple #13
0
 public ValueValidationAction(IValidationAction condition, IValueDefinition value)
     : base(condition)
 {
     Value = value;
 }
 public FieldValidationAction(IValidationAction condition, IFieldDefinition field)
     : base(condition)
 {
     Field = field;
 }
Exemple #15
0
 public VerifyFieldOrderAction(IValidationAction condition, IFieldDefinition field, IFieldDefinition previousField)
     : base(condition, field)
 {
 }
 public VerifySelectOptionTitleAction(IValidationAction condition, IValueDefinition value)
     : base(condition, value)
 {
 }
 public VerifyFieldParentAction(IValidationAction conditionAction, IFieldDefinition field, IGroupDefinition group)
     : base(conditionAction, field)
 {
     Group = group;
 }