/// <summary> /// Builds list of Providers /// </summary> /// <remarks> /// This method will attempt to load the list of /// providers from the json file hosted on the ace /// config server and if it cannot then it will append /// only the Custom option to the drop-down menu. /// </remarks> /// <returns>Task</returns> private async Task UpdateProvidersList() { bool status = await LoadJsonProvidersAsync(); if (status) { return; } ProviderService.AddProvider(new VATRPServiceProvider() { Label = "Custom", Address = null }); /* * string[] labels = { "Sorenson", "Purple", "ZVRS", "Convo", "Global" }; * foreach (var label in labels) * { * if (ProviderService.FindProvider(label) == null) * ProviderService.AddProvider(new VATRPServiceProvider() * { * Label = label, * Address = null * }); * } */ }
public void REQ_11_AddNewProvider() { _authentificationService.ConnectStorekeeper("MatMatStock", "brico2000clavy"); var newProvider = _providerService.AddProvider( "Courage", "0606060606", "*****@*****.**", "Middle of", "666", "Nowhere" , new Catalog() ); var providerFound = _providerService.GetProvider(newProvider.Name); Assert.IsNotNull(providerFound); }
/// <summary> /// Fetch the list of Providers from the CDN server. /// </summary> /// <remarks> /// If any provider configurations are returned from the server then /// override the local list of providers with the server's list. /// This methods attemps to download the logo, URL, and other information /// about the provider from the server. /// </remarks> /// <param>void</param> /// <returns>Task<bool></returns> private async Task <bool> LoadJsonProvidersAsync() { var imgCachePath = BuildStoragePath("img"); try { List <VATRPDomain> domains = await Utilities.JsonWebRequest.MakeJsonWebRequestAsync <List <VATRPDomain> >(CDN_DOMAIN_URL); // Added 3/3/2017 fjr Override Local Providers with the server's List if (m_OverRideLocalProvidersList) { if (domains != null && domains.Count > 0) { ProviderService.ClearProvidersList(); VATRPServiceProvider CustomProvider = new VATRPServiceProvider(); CustomProvider.Address = null; CustomProvider.Label = "Custom"; ProviderService.AddProvider(CustomProvider); } } // add these into the cache foreach (VATRPDomain domain in domains) { VATRPServiceProvider provider = ProviderService.FindProviderLooseSearch(domain.name); if (provider == null) { provider = new VATRPServiceProvider(); provider.Label = domain.name; provider.Address = domain.domain; provider.ImageURI = domain.icon2x; provider.IconURI = domain.icon; ProviderService.AddProvider(provider); } else { // update the provider information provider.Label = domain.name; provider.Address = domain.domain; provider.ImageURI = domain.icon2x; provider.IconURI = domain.icon; } if (provider.ImageURI.NotBlank()) { provider.LoadImage(imgCachePath, false); } if (provider.IconURI.NotBlank()) { provider.LoadImage(imgCachePath, true); } } VATRPServiceProvider noLogoProvider = ProviderService.FindProviderLooseSearch("_nologo"); if (noLogoProvider == null) { noLogoProvider = new VATRPServiceProvider(); ProviderService.AddProvider(noLogoProvider); } return(true); } catch (Exception ex) { // either the domains were mal-formed or we are not able to get to the internet. If this is the case, then allow the cached/defaults. return(false); } }