private async Task AddDynamicOptions(IElement element, FormAnswers convertedAnswers) { LookupSource submitDetails = element.Properties.LookupSources .SingleOrDefault(x => x.EnvironmentName .Equals(_environment.EnvironmentName, StringComparison.OrdinalIgnoreCase)); if (submitDetails is null) { throw new Exception("DynamicLookupPageTransformFactory::AddDynamicOptions, No Environment specific details found"); } RequestEntity request = _actionHelper.GenerateUrl(submitDetails.URL, convertedAnswers); if (string.IsNullOrEmpty(submitDetails.Provider)) { throw new Exception("DynamicLookupPageTransformFactory::AddDynamicOptions, No Provider name given in LookupSources"); } var lookupProvider = _lookupProviders.Get(submitDetails.Provider); List <Option> lookupOptions = await lookupProvider.GetAsync(request.Url, submitDetails.AuthToken); if (!lookupOptions.Any()) { throw new Exception("DynamicLookupPageTransformFactory::AddDynamicOptions, Provider returned no options"); } element.Properties.Options.AddRange(lookupOptions); }
public void DisplayOwnedCardsFromSet(MagicSetDefinition setDefinition) { var old = CardLookup.SearchAsYouType; CardLookup.SearchAsYouType = false; LookupSource = LookupSource.ActiveBinder; CardLookup.Reset(); CardLookup.SearchSet = setDefinition; CardLookup.SearchAsYouType = old; LookupCards(); }
public PhysicalCountInspectorInfo GetBlankInspector(PhysicalCountInfo physicalCount) { Guid inspectorId = (Guid)LookupSource.GetLookup("Inspector").Keys.FirstOrDefault(); if ((inspectorId == null) || (inspectorId == Guid.Empty)) { throw new Exception("No Physical Count Inspector has been configured"); } return(new PhysicalCountInspectorInfo() { Id = Guid.NewGuid(), PhysicalCountId = physicalCount.Id, IsSupervisor = false, UserId = inspectorId }); }