public override bool IsMetBy(FieldWithValue fieldValue, IEnumerable<FieldWithValue> allCollectedFieldValues, IPublishedContent content) { return ( fieldValue != null && fieldValue.HasSubmittedValue ? fieldValue.SubmittedValue : string.Empty ).Equals(ExpectedFieldValue ?? string.Empty, StringComparison.InvariantCultureIgnoreCase); }
public override bool IsMetBy(FieldWithValue fieldValue, IEnumerable<FieldWithValue> allCollectedFieldValues, IPublishedContent content) { if (fieldValue == null) { // no such field - we'll say it's empty :) return true; } return fieldValue.HasSubmittedValue == false; }
// test if the condition is met by a submitted field value public override bool IsMetBy(FieldWithValue fieldValue, IEnumerable<FieldWithValue> allCollectedFieldValues, IPublishedContent content) { if(fieldValue == null || fieldValue.HasSubmittedValue == false) { // no such field or no submitted field value - the condition is met (LessThan will always be >= 1) return true; } // the condition is met if the length of the submitted value is less than the value defined for LessThan return fieldValue.SubmittedValue.Length < LessThan; }
public override bool IsMetBy(FieldWithValue fieldValue, IEnumerable<FieldWithValue> allCollectedFieldValues, IPublishedContent content) { return !base.IsMetBy(fieldValue, allCollectedFieldValues, content); }
private static FieldData ToFieldData(FieldWithValue f) { return new FieldData { Name = f.Name, FormSafeName = f.FormSafeName, SubmittedValue = f.SubmittedValue, Invalid = f.Invalid }; }
public abstract bool IsMetBy(FieldWithValue fieldValue, IEnumerable<FieldWithValue> allCollectedFieldValues, IPublishedContent content);
private string FormatForIndexAndSanitize(FieldWithValue field, IPublishedContent content, Guid rowId) { var value = field.FormatSubmittedValueForIndex(content, rowId); if (string.IsNullOrWhiteSpace(value) || StripHtml == false || field.SupportsStripHtml == false) { return value; } var doc = new HtmlAgilityPack.HtmlDocument { OptionAutoCloseOnEnd = true }; doc.LoadHtml(value); return doc.DocumentNode.InnerText; }
private static Data.Field ToDataField(Func<FieldWithValue, string, Storage.Row, string> valueFormatter, FieldWithValue field, Storage.Row row) { return new Data.Field { Name = field.Name, FormSafeName = field.FormSafeName, Type = field.Type, Value = valueFormatter != null ? valueFormatter(field, row.Fields.ContainsKey(field.FormSafeName) ? row.Fields[field.FormSafeName] : null, row) : null }; }