public bool Bind() { if (models.Count == 0) { return(false); } foreach (TModel model in models) { UpdateRecordStatus record = new UpdateRecordStatus { Location = modelProperties.GetLocation(model), Module = modelProperties.Module, MergeCriteria = new UpdateRecordStatusMergeCriteria { SetId = ModelIdentifier.GetValue <TModel, long>(model) }, RecordAction = recordAction }; records.Add(record); } return(true); }
public bool Bind() { if (existing == null) { return(false); } if (update == null) { return(false); } if (modelProperties.GetLocation(existing) != modelProperties.GetLocation(update)) { return(false); } SubmitDataRecord record = new SubmitDataRecord { Location = modelProperties.GetLocation(existing), Module = modelProperties.Module, MergeCriteria = new MergeCriteria { SetId = ModelIdentifier.GetValue <TModel, long>(update) } }; List <Field> fields = new List <Field>(); foreach (FieldMapping fieldMapping in amplaViewProperties.GetFieldMappings()) { if (fieldMapping.CanWrite) { string existingField; string updateField; if (fieldMapping.TryResolveValue(modelProperties, existing, out existingField) && fieldMapping.TryResolveValue(modelProperties, update, out updateField)) { if (updateField != existingField) { Field field = new Field { Name = fieldMapping.Name, Value = updateField }; fields.Add(field); } } } } if (fields.Count > 0) { record.Fields = fields.ToArray(); records.Add(record); } return(records.Count > 0); }