protected override bool Validate(IRadzenFormComponent component)
        {
            var compareResult = Compare(component.GetValue());

            switch (Operator)
            {
            case CompareOperator.Equal:
                return(compareResult == 0);

            case CompareOperator.NotEqual:
                return(compareResult != 0);

            case CompareOperator.GreaterThan:
                return(compareResult > 0);

            case CompareOperator.GreaterThanEqual:
                return(compareResult >= 0);

            case CompareOperator.LessThan:
                return(compareResult < 0);

            case CompareOperator.LessThanEqual:
                return(compareResult <= 0);

            default:
                return(true);
            }
        }
 /// <inheritdoc />
 public void AddComponent(IRadzenFormComponent component)
 {
     if (components.IndexOf(component) == -1)
     {
         components.Add(component);
     }
 }
Exemple #3
0
        /// <inheritdoc />
        protected override bool Validate(IRadzenFormComponent component)
        {
            var value         = component.GetValue();
            var valueAsString = value as string;

            if (string.IsNullOrEmpty(valueAsString))
            {
                return(true);
            }

            var email = new EmailAddressAttribute();

            return(email.IsValid(valueAsString));
        }
        /// <inheritdoc />
        protected override bool Validate(IRadzenFormComponent component)
        {
            string value = component.GetValue() as string;

            if (Min.HasValue && ((value != null && value.Length < Min) || value == null))
            {
                return(false);
            }

            if (Max.HasValue && (value != null && value.Length > Max))
            {
                return(false);
            }

            return(true);
        }
        protected override bool Validate(IRadzenFormComponent component)
        {
            dynamic value = component.GetValue();

            if (Min != null && ((value != null && value < Min) || value == null))
            {
                return(false);
            }

            if (Max != null && (value != null && value > Max))
            {
                return(false);
            }

            return(true);
        }
 /// <inheritdoc />
 protected override bool Validate(IRadzenFormComponent component)
 {
     return(new RegularExpressionAttribute(Pattern).IsValid(component.GetValue()));
 }
 /// <inheritdoc />
 public void RemoveComponent(IRadzenFormComponent component)
 {
     components.Remove(component);
 }
Exemple #8
0
 /// <summary>
 /// Runs validation against the specified component.
 /// </summary>
 /// <param name="component">The component to validate.</param>
 /// <returns><c>true</c> if validation is successful, <c>false</c> otherwise.</returns>
 protected abstract bool Validate(IRadzenFormComponent component);
 /// <inheritdoc />
 protected override bool Validate(IRadzenFormComponent component)
 {
     return(component.HasValue && !object.Equals(DefaultValue, component.GetValue()));
 }
Exemple #10
0
        protected override bool Validate(IRadzenFormComponent component)
        {
            var email = new EmailAddressAttribute();

            return(email.IsValid(component.GetValue()));
        }