Пример #1
0
 private string NonBinaryCriterionString(Criterion criterion)
 {
     if (criterion.GetType() == typeof(EqualCriterion))
     {
         return($"{((EqualCriterion)criterion).Col} = '{((EqualCriterion)criterion).Value}'");
     }
     if (criterion.GetType() == typeof(LikeCriterion))
     {
         return($"{((LikeCriterion)criterion).Col} like '{((LikeCriterion)criterion).Value}%'");
     }
     return(criterion.ToString());
 }
Пример #2
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            var currentValue    = (IComparable)value;
            var comparisonValue = GetComparableValue(validationContext);

            ErrorMessage = $"value must be {criterion.ToString()} than {comparisonValue}";

            if (currentValue == null || comparisonValue == null)
            {
                return(ValidationResult.Success);
            }
            var result = currentValue.CompareTo(comparisonValue);

            return(comparingFuncs[criterion](result) ? ValidationResult.Success : new ValidationResult(ErrorMessage));
        }
Пример #3
0
            protected override IEnumerable <Series> FilterResults(IEnumerable <Series> results)
            {
                var criterion = DicomStringHelper.GetStringArray(Criterion.ToString());

                return(results.Where(s => criterion.Contains(s.SeriesInstanceUid)));
            }