Ejemplo n.º 1
0
 public IEnumerable <ISBSFormField> GetFieldsInExpression(string src, string templateKeyword, ISBSForm form)
 {
     foreach (string fieldName in this.GetFieldNamesInExpression(src, templateKeyword))
     {
         yield return(form.FindField(fieldName));  // yields null if the fieldname is not in the form
     }
 }
Ejemplo n.º 2
0
        public string PerformSubstitutions(string src, ISBSFormField field, ISBSForm form, bool quotedStringValues = false)
        {
            // Don't disturb the original string.
            string sNew = (new StringBuilder(src)).ToString();

            // Process the {value} string
            if (field != null)
            {
                sNew = this.ReplaceStringWithValue(sNew, "${value}", field.Value, quotedStringValues);
            }

            // Process the {field:name} string
            if (form != null)
            {
                sNew = this.SubstituteTerm(sNew, "field", form, fieldName => form.FindField(fieldName)?.Value, quotedStringValues);
            }

            sNew = this.SubstituteTerm(sNew, "config", form, this.FindConfigurationValue, quotedStringValues);

            return(sNew);
        }