private bool ValidateValue(MobeelizerFieldAccessor field, double doubleValue, IDictionary <string, string> options, MobeelizerErrorsHolder errors) { bool includeMaxValue = GetIncludeMaxValue(options); bool includeMinValue = GetIncludeMinValue(options); Double minValue = Double.Parse(GetMinValue(options)); Double maxValue = Double.Parse(GetMaxValue(options)); if (includeMaxValue && doubleValue > maxValue) { errors.AddFieldMustBeLessThanOrEqualTo(field.Name, maxValue); return(false); } if (!includeMaxValue && doubleValue >= Double.MaxValue) { errors.AddFieldMustBeLessThan(field.Name, maxValue); return(false); } if (includeMinValue && doubleValue < minValue) { errors.AddFieldMustBeGreaterThanOrEqual(field.Name, minValue); return(false); } if (!includeMinValue && doubleValue <= Double.MinValue) { errors.AddFieldMustBeGreaterThan(field.Name, minValue); return(false); } return(true); }
private bool ValidateValue(MobeelizerFieldAccessor field, long longValue, IDictionary <string, string> options, MobeelizerErrorsHolder errors) { int maxValue = GetMaxValue(options); int minValue = GetMinValue(options); if (longValue > maxValue) { errors.AddFieldMustBeLessThan(field.Name, (long)maxValue); return(false); } if (longValue < minValue) { errors.AddFieldMustBeGreaterThan(field.Name, (long)minValue); return(false); } return(true); }
private bool ValidateValue(MobeelizerFieldAccessor field, long longValue, IDictionary<string, string> options, MobeelizerErrorsHolder errors) { int maxValue = GetMaxValue(options); int minValue = GetMinValue(options); if (longValue > maxValue) { errors.AddFieldMustBeLessThan(field.Name, (long)maxValue); return false; } if (longValue < minValue) { errors.AddFieldMustBeGreaterThan(field.Name, (long)minValue); return false; } return true; }
private bool ValidateValue(MobeelizerFieldAccessor field, double doubleValue, IDictionary<string, string> options, MobeelizerErrorsHolder errors) { bool includeMaxValue = GetIncludeMaxValue(options); bool includeMinValue = GetIncludeMinValue(options); Double minValue = Double.Parse(GetMinValue(options)); Double maxValue = Double.Parse(GetMaxValue(options)); if (includeMaxValue && doubleValue > maxValue) { errors.AddFieldMustBeLessThanOrEqualTo(field.Name, maxValue); return false; } if (!includeMaxValue && doubleValue >= Double.MaxValue) { errors.AddFieldMustBeLessThan(field.Name, maxValue); return false; } if (includeMinValue && doubleValue < minValue) { errors.AddFieldMustBeGreaterThanOrEqual(field.Name, minValue); return false; } if (!includeMinValue && doubleValue <= Double.MinValue) { errors.AddFieldMustBeGreaterThan(field.Name, minValue); return false; } return true; }