Exemple #1
0
        private string ParseBody(string message, Dictionary <Guid, RecordField> dictionary, Record record)
        {
            if (!string.IsNullOrEmpty(FieldMapper))
            {
                Hashtable ht = new Hashtable();

                string[] _fields = FieldMapper.Split(';');
                if (_fields.Length > 0)
                {
                    foreach (string field in _fields)
                    {
                        string[] vals = field.Split(',');
                        if (vals.Length == 3)
                        {
                            string formFieldId = string.Empty;
                            string alias       = vals[0];
                            string value       = string.Empty;

                            if (!string.IsNullOrEmpty(vals[1]))
                            {
                                formFieldId = vals[1];
                            }

                            if (!string.IsNullOrEmpty(formFieldId))
                            {
                                KeyValuePair <Guid, RecordField> formField = dictionary.SingleOrDefault(d => d.Key == new Guid(formFieldId));
                                if (!formField.Equals(default(KeyValuePair <Guid, RecordField>)))
                                {
                                    value = formField.Value.ValuesAsString();
                                }
                            }

                            if (!ht.ContainsKey(alias))
                            {
                                ht.Add(alias, value);
                            }
                        }
                    }

                    return(EvaluateVelocity(message, ht));
                }

                /*
                 * foreach (KeyValuePair<Guid, RecordField> keyValuePair in dictionary)
                 * {
                 *  Guid guid = keyValuePair.Key;
                 *  RecordField field = keyValuePair.Value;
                 *  Field field1 = field.Field;
                 *  Guid keyId = field.Key;
                 *  Guid recordId = field.Record;
                 *  List<object> objects = field.Values;
                 *  string asString = field.ValuesAsString();
                 * }
                 */
            }
            return(message);
        }