public void AddSelectedItems(IEnumerable <PicklistOption> selectedItems, RecordEntryViewModelBase recordForm, string subGridReference) { var gridField = GetEntryViewModel(recordForm).GetEnumerableFieldViewModel(subGridReference); var targetPropertyname = GetTargetProperty(recordForm, subGridReference).Name; foreach (var item in selectedItems) { var newRecord = recordForm.RecordService.NewRecord(GetEnumeratedType(recordForm, subGridReference).AssemblyQualifiedName); var newPicklistOption = TargetPropertyType.CreateFromParameterlessConstructor(); newPicklistOption.SetPropertyValue(nameof(PicklistOption.Key), item.Key); newPicklistOption.SetPropertyValue(nameof(PicklistOption.Value), item.Value); newRecord.SetField(targetPropertyname, newPicklistOption, recordForm.RecordService); InsertNewItem(recordForm, subGridReference, newRecord); } }
public TargetPropertyDataAttribute(TargetPropertyType propType) { PropertyType = propType; }