internal static ValidationCriterion GetValidationCriterion(GridColumnInfo columnInfo, IControlManager cm) { ValidationCriterion cri1 = null; if (!string.IsNullOrEmpty(columnInfo.ValidRegularExpression)) { cri1 = new MyRegularExpressionCriterion(columnInfo.GridColumnName, Xceed.Validation.ValidationLevel.Manual, new System.Text.RegularExpressions.Regex(columnInfo.ValidRegularExpression, System.Text.RegularExpressions.RegexOptions.Singleline), false, true, new Xceed.Validation.CustomValidationMessages()); cri1.CustomValidationMessages.RegularExpression = columnInfo.ValidErrorMessage; } ValidationCriterion cri2 = null; if (!string.IsNullOrEmpty(columnInfo.ValidScript)) { cri2 = new ScriptCriterion(columnInfo.GridColumnName, Xceed.Validation.ValidationLevel.Manual, columnInfo.ValidScript, new Dictionary <string, object> { { "cm", cm } }, false, true, new Xceed.Validation.CustomValidationMessages()); cri2.CustomValidationMessages.RegularExpression = columnInfo.ValidErrorMessage; } ValidationCriterion cri3 = null; if (Authority.AuthorizeByRule(columnInfo.NotNull)) { cri3 = new RequiredFieldCriterion(columnInfo.GridColumnName, Xceed.Validation.ValidationLevel.Manual, GridColumnInfoHelper.CreateType(columnInfo), false, true, new Xceed.Validation.CustomValidationMessages()); } var ret = TryAndValidations(TryAndValidations(cri1, cri2), cri3); if (ret != null) { ret.Name = columnInfo.GridColumnName; } return(ret); }
internal static ValidationCriterion GetValidationCriterion(GridColumnInfo columnInfo, IControlManager cm) { ValidationCriterion cri1 = null; if (!string.IsNullOrEmpty(columnInfo.ValidRegularExpression)) { cri1 = new MyRegularExpressionCriterion(columnInfo.GridColumnName, Xceed.Validation.ValidationLevel.Manual, new System.Text.RegularExpressions.Regex(columnInfo.ValidRegularExpression, System.Text.RegularExpressions.RegexOptions.Singleline), false, true, new Xceed.Validation.CustomValidationMessages()); cri1.CustomValidationMessages.RegularExpression = columnInfo.ValidErrorMessage; } ValidationCriterion cri2 = null; if (!string.IsNullOrEmpty(columnInfo.ValidScript)) { cri2 = new ScriptCriterion(columnInfo.GridColumnName, Xceed.Validation.ValidationLevel.Manual, columnInfo.ValidScript, new Dictionary<string, object> { { "cm", cm } }, false, true, new Xceed.Validation.CustomValidationMessages()); cri2.CustomValidationMessages.RegularExpression = columnInfo.ValidErrorMessage; } ValidationCriterion cri3 = null; if (Authority.AuthorizeByRule(columnInfo.NotNull)) { cri3 = new RequiredFieldCriterion(columnInfo.GridColumnName, Xceed.Validation.ValidationLevel.Manual, GridColumnInfoHelper.CreateType(columnInfo), false, true, new Xceed.Validation.CustomValidationMessages()); } var ret = TryAndValidations(TryAndValidations(cri1, cri2), cri3); if (ret != null) { ret.Name = columnInfo.GridColumnName; } return ret; }