public GetGridRecordsResponse GetGridRecords(bool ignorePages) { if (DynamicGridViewModel.HasPaging && !ignorePages) { var conditions = new[] { new Condition(LinkedRecordLookup, ConditionType.Equal, RecordForm.RecordId) }; return(DynamicGridViewModel.GetGridRecordPage(conditions, null)); } else { return(new GetGridRecordsResponse(GetRecordService().GetLinkedRecords(LinkedRecordType, RecordForm.RecordType, LinkedRecordLookup, RecordForm.RecordId))); } }
public GetGridRecordsResponse GetGridRecords(bool ignorePages, IEnumerable <string> fields = null) { var isValid = ValidateCurrentSearch(); if (!isValid) { return(new GetGridRecordsResponse(new IRecord[0])); } var query = GenerateQuery(); query.Fields = fields; var notInList = new HashSet <string>(); if (IncludeNotIn) { DateTime notInThreshold; notInList = GetNotInIds(out notInThreshold); AdjustQueryForCreatedThreshold(query, notInThreshold); } if (!DynamicGridViewModel.HasPaging || ignorePages) { var loadingVm = DynamicGridViewModel.LoadingViewModel; var records = new List <IRecord>(); DynamicGridViewModel.RecordService.ProcessResults(query, (r) => { records.AddRange(r.Where(t => !notInList.Contains(t.Id))); if (loadingVm != null) { loadingVm.LoadingMessage = "Running Main Query - " + records.Count; } }); if (loadingVm != null) { loadingVm.LoadingMessage = "Populating Empty Lookups"; } records.PopulateEmptyLookups(RecordService, null); if (loadingVm != null) { loadingVm.LoadingMessage = "Please Wait While Loading"; } return(new GetGridRecordsResponse(records)); } else { return(DynamicGridViewModel.GetGridRecordPage(query, notInList)); } }
public GetGridRecordsResponse GetGridRecords(bool ignorePages) { var anyNotValid = ValidateCurrentSearch(); if (anyNotValid) { return(new GetGridRecordsResponse(new IRecord[0])); } var query = GenerateQuery(); if (!DynamicGridViewModel.HasPaging || ignorePages) { var records = DynamicGridViewModel.RecordService.RetreiveAll(query); return(new GetGridRecordsResponse(records)); } else { return(DynamicGridViewModel.GetGridRecordPage(query)); } }
public LookupGridViewModel(IReferenceFieldViewModel referenceField, Action <IRecord> onRecordSelected) : base(referenceField.RecordEntryViewModel.ApplicationController) { OnRecordSelected = onRecordSelected; Func <bool, GetGridRecordsResponse> getGridRecords = (ignorePages) => { var query = new QueryDefinition(referenceField.RecordTypeToLookup); query.IsQuickFind = true; query.QuickFindText = referenceField.EnteredText; if (!string.IsNullOrWhiteSpace(referenceField.EnteredText)) { var quickFindFields = DynamicGridViewModel.RecordService.GetStringQuickfindFields(referenceField.RecordTypeToLookup); query.RootFilter.ConditionOperator = FilterOperator.Or; query.RootFilter.Conditions.AddRange(quickFindFields.Select(f => new Condition(f, ConditionType.BeginsWith, referenceField.EnteredText))); } if (!DynamicGridViewModel.HasPaging || ignorePages) { var records = DynamicGridViewModel.RecordService.RetreiveAll(query); return(new GetGridRecordsResponse(records)); } else { return(DynamicGridViewModel.GetGridRecordPage(query)); } }; DynamicGridViewModel = new DynamicGridViewModel(ApplicationController) { PageSize = MaxRecordsForLookup, GetGridRecords = getGridRecords, OnDoubleClick = OnDoubleClick, ViewType = ViewType.LookupView, RecordService = referenceField.LookupService, FormController = new FormController(referenceField.LookupService, null, referenceField.RecordEntryViewModel.ApplicationController), RecordType = referenceField.RecordTypeToLookup, IsReadOnly = true, }; }
public GetGridRecordsResponse GetGridRecords(bool ignorePages) { if (DynamicGridViewModel.HasPaging && !ignorePages) { var conditions = new[] { new Condition(LinkedRecordLookup, ConditionType.Equal, RecordForm.RecordId) }; return(DynamicGridViewModel.GetGridRecordPage(conditions, null)); } else { var lastSortExpression = DynamicGridViewModel.GetLastSortExpression(); var records = GetRecordService().GetLinkedRecords(LinkedRecordType, RecordForm.RecordType, LinkedRecordLookup, RecordForm.RecordId).ToList(); if (lastSortExpression != null) { RecordComparer.SortList(records, lastSortExpression); } return(new GetGridRecordsResponse(records)); } }