public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (FromDate.AsDateTime() > ToDate.AsDateTime()) { yield return(new ValidationResult(ReportInputParametersResources.FromDateBeforeToDate, new[] { "FromDate" })); } if (string.IsNullOrEmpty(SelectedTextField) || SelectedTextField != "-1") { if (string.IsNullOrEmpty(SelectedTextField)) { yield return (new ValidationResult(ReportInputParametersResources.TextFieldRequired, new[] { "SelectedTextField" })); } if (!string.IsNullOrEmpty(SelectedTextField) && string.IsNullOrEmpty(SelectedOperator)) { yield return (new ValidationResult(ReportInputParametersResources.TextFieldOperatorRequired, new[] { "SelectedOperator" })); } if (!string.IsNullOrEmpty(SelectedTextField) && string.IsNullOrEmpty(TextSearch)) { yield return (new ValidationResult(ReportInputParametersResources.TextSearchRequired, new[] { "TextSearch" })); } } }