private PropertyInfo GetPropertyInfo() { var record = RecordEntryViewModel.GetRecord(); if (!(record is ObjectRecord)) { throw new NotImplementedException(string.Format("Only Implemented For {0} Of Type {1}", typeof(IRecord).Name, typeof(ObjectRecord).Name)); } return(((ObjectRecord)record).Instance.GetType().GetProperty(FieldName)); }
protected override IEnumerable <IRecord> GetSearchResults() { if (LookupService == null) { throw new NullReferenceException(string.Format("Error searching field {0}. {1} is null", FieldName, "LookupService")); } if (UsePicklist) { return(FormService.GetLookupPicklist(FieldName, RecordEntryViewModel.GetRecordType(), RecordEntryViewModel.ParentFormReference, RecordEntryViewModel.GetRecord(), LookupService, RecordTypeToLookup)); } else { var primaryField = LookupService.GetPrimaryField(RecordTypeToLookup); var conditions = FormService.GetLookupConditions(FieldName, RecordEntryViewModel.GetRecordType(), RecordEntryViewModel.ParentFormReference, RecordEntryViewModel.GetRecord()); if (!EnteredText.IsNullOrWhiteSpace()) { conditions = conditions.Union(new[] { new Condition(primaryField, ConditionType.BeginsWith, EnteredText) }); } return(LookupService.GetFirstX(RecordTypeToLookup, UsePicklist ? -1 : MaxRecordsForLookup, null, conditions, new[] { new SortExpression(primaryField, SortType.Ascending) })); } }