Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CollectionPopulated"/> class.
 /// </summary>
 /// <param name="chilCollectionProperties">The child collections properties to check.</param>
 public CollectionPopulated(params IPropertyInfo[] chilCollectionProperties)
 {
     if (InputProperties == null)
     {
         InputProperties = new List <IPropertyInfo>();
     }
     InputProperties.AddRange(chilCollectionProperties);
 }
Esempio n. 2
0
 public RequiredWhenAnyHasValue(IPropertyInfo primaryProperty, params IPropertyInfo[] additionalRequired) : base(primaryProperty)
 {
     if (InputProperties == null)
     {
         InputProperties = new List <IPropertyInfo>();
     }
     InputProperties.AddRange(additionalRequired);
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CalcSum"/> class.
 /// </summary>
 /// <param name="primaryProperty">The primary property.</param>
 /// <param name="inputProperties">The input properties.</param>
 public CalcSum(IPropertyInfo primaryProperty, params IPropertyInfo[] inputProperties)
     : base(primaryProperty)
 {
     if (InputProperties == null)
     {
         InputProperties = new List <IPropertyInfo>();
     }
     InputProperties.AddRange(inputProperties);
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnyRequired"/> class.
 /// </summary>
 /// <param name="primaryProperty">The primary property.</param>
 /// <param name="additionalProperties">The additional properties.</param>
 public AnyRequired(IPropertyInfo primaryProperty, params IPropertyInfo[] additionalProperties)
     : base(primaryProperty)
 {
     if (InputProperties == null)
     {
         InputProperties = new List <IPropertyInfo>();
     }
     InputProperties.AddRange(additionalProperties);
 }
Esempio n. 5
0
 /// <summary>
 /// Creates an instance of the rule.
 /// </summary>
 /// <param name="primaryProperty">Primary property for the rule.</param>
 /// <param name="dependencyProperties">Dependent property.</param>
 /// <remarks>
 /// When rules are run for one of the dependency properties the rules for primary property i rerun.
 /// </remarks>
 public DependencyFrom(Csla.Core.IPropertyInfo primaryProperty, params Csla.Core.IPropertyInfo[] dependencyProperties)
     : base(primaryProperty)
 {
     if (InputProperties == null)
     {
         InputProperties = new List <IPropertyInfo>();
     }
     InputProperties.AddRange(dependencyProperties);
 }
Esempio n. 6
0
 /// <summary>
 /// Creates an instance of the rule.
 /// </summary>
 /// <param name="primaryProperty">Primary property for the rule.</param>
 /// <param name="dependencyProperties">Dependent property.</param>
 /// <remarks>
 /// When rules are run for one of the dependency properties the rules for primary property i rerun.
 /// </remarks>
 public DependencyFrom(Csla.Core.IPropertyInfo primaryProperty, params Csla.Core.IPropertyInfo[] dependencyProperties)
     : base(primaryProperty)
 {
     if (InputProperties == null)
     {
         InputProperties = new List <IPropertyInfo>();
     }
     InputProperties.AddRange(dependencyProperties);
     RuleUri.AddQueryParameter("dependencyfrom", string.Join(",", dependencyProperties.Select(p => p.Name)));
 }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FieldExists"/> class.
        /// </summary>
        /// <param name="primaryProperty">The primary property.</param>
        /// <param name="innerRule">The inner rule.</param>
        public FieldExists(IPropertyInfo primaryProperty, IBusinessRule innerRule)
            : base(primaryProperty)
        {
            if (InputProperties == null)
            {
                InputProperties = new List <IPropertyInfo>();
            }
            InputProperties.Add(primaryProperty);
            InnerRule = innerRule;
            RuleUri.AddQueryParameter("rule", System.Uri.EscapeUriString(InnerRule.RuleName));

            // merge InnerRule input property list into this rule's list
            if (InnerRule.InputProperties != null)
            {
                InputProperties.AddRange(InnerRule.InputProperties);
            }

            // remove any duplicates
            InputProperties = new List <IPropertyInfo>(InputProperties.Distinct());
            AffectedProperties.AddRange(innerRule.AffectedProperties);
        }