public Rule AddValueTypeRule(ValueTypeEnum typeEnum) { ValueTypeRule rule = new ValueTypeRule(ValueTypeEnumHelper.ToValue(typeEnum)); this.Add(rule); return rule; }
public Rule AddValueTypeRule(string valueType) { if (string.IsNullOrEmpty(valueType)) { return null; } ValueTypeRule rule = new ValueTypeRule(valueType); this.Add(rule); return rule; }
public static Rule CreateRule(RuleTypeEnum ruleType) { Rule rule = null; switch (ruleType) { case RuleTypeEnum.MAX_LENGTH_RULE: rule = new MaxLengthRule(); break; case RuleTypeEnum.MIN_LENGTH_RULE: rule = new MinLengthRule(); break; case RuleTypeEnum.MAX_VALUE_RULE: rule = new MaxValueRule(); break; case RuleTypeEnum.MIN_VALUE_RULE: rule = new MinValueRule(); break; case RuleTypeEnum.MAX_INPUT_NUM_RULE: rule = new MaxInputNumRule(); break; case RuleTypeEnum.MIN_INPUT_NUM_RULE: rule = new MinInputNumRule(); break; case RuleTypeEnum.VALUE_TYPE_RULE: rule = new ValueTypeRule(); break; case RuleTypeEnum.REQUIRED_RULE: rule = new RequiredRule(); break; case RuleTypeEnum.DISABLE_RULE: rule = new DisableRule(); break; case RuleTypeEnum.MAX_DECIMAL_DIGITS_RULE: rule = new MaxDecimalDigitsRule(); break; case RuleTypeEnum.MIN_DECIMAL_DIGITS_RULE: rule = new MinDecimalDigitsRule(); break; case RuleTypeEnum.REGEX_RULE: rule = new RegexRule(); break; case RuleTypeEnum.SET_RULE: rule = new SetRule(); break; case RuleTypeEnum.TIP_RULE: rule = new TipRule(); break; case RuleTypeEnum.DEV_TIP_RULE: rule = new DevTipRule(); break; case RuleTypeEnum.READ_ONLY_RULE: rule = new ReadOnlyRule(); break; case RuleTypeEnum.MAX_TARGET_SIZE_RULE: rule = new MaxTargetSizeRule(); break; case RuleTypeEnum.MIN_TARGET_SIZE_RULE: rule = new MinTargetSizeRule(); break; case RuleTypeEnum.MAX_IMAGE_SIZE_RULE: rule = new MaxImageSizeRule(); break; case RuleTypeEnum.MIN_IMAGE_SIZE_RULE: rule = new MinImageSizeRule(); break; } return rule; }