private async Task <IEnumerable <AccountModel> > GetAvaibleAccounts() { string email = txblEmailFO.Text; var allAccounts = await AccountProvider.GetAccounts(); return(allAccounts.Where(x => !x.Email.Contains(email))); }
public static async Task Run( [ServiceBusTrigger("datalockprocessor", Connection = "ServiceBusConnection")] string myQueueItem, [OrchestrationClient] DurableOrchestrationClient client, TraceWriter log) { try { log.Info("DataLockProcessor Starting"); // DI var commitmentProvider = new CommitmentProvider(); var accountProvider = new AccountProvider(); var earnings = JsonConvert.DeserializeObject <List <Earning> >(myQueueItem); var ukprn = earnings.Select(x => x.Ukprn).FirstOrDefault(); var commitments = commitmentProvider.GetCommitments(ukprn, earnings).ToList(); var accounts = accountProvider.GetAccounts(commitments.Select(x => x.EmployerAccountId).Distinct().ToList()); var input = new EarningsInput(ukprn, commitments, earnings, accounts); await client.StartNewAsync(nameof(EarningsOrchestrator), input); log.Info("DataLockProcessor Finishing"); } catch (Exception e) { log.Error("Error sending learner info", e); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if ((string)e.Parameter == CommonPageCommand.CannotGoBackLoginPage) { btnGoBack.Visibility = Visibility.Collapsed; } webLogin.Navigate(new Uri(GoogleLoginLink)); savedLogin.SetAccountPool(await AccountProvider.GetAccounts()); }
public void GetAccounts_ReturnsExpectedResults() { // TODO: add a couple env accounts and verify Environment.SetEnvironmentVariable("MyStorageAccount", "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=GTfc0SIUd4Mg6n8wBzCRy29wnx2VVd+90MQKnJtgoCj4rB8LAIQ=="); var accounts = AccountProvider.GetAccounts(); Assert.True(accounts.ContainsKey("AzureWebJobsStorage")); Assert.True(accounts.ContainsKey("AzureWebJobsDashboard")); var account = accounts["MyStorageAccount"]; Assert.Equal("myaccount", account.Credentials.AccountName); }
public static CloudStorageAccount GetStorageAccount(this FunctionInstanceArgument functionInstanceArgument) { if (functionInstanceArgument == null) { throw new ArgumentNullException("functionInstanceArgument"); } string storageAccountName = functionInstanceArgument.AccountName; if (storageAccountName != null) { // Try to find specific connection string CloudStorageAccount specificAccount = AccountProvider.GetAccount(storageAccountName); if (specificAccount != null) { return(specificAccount); } } // If not found, try the dashboard connection string CloudStorageAccount storageAccount = AccountProvider.GetAccount(ConnectionStringNames.Dashboard); if (AccountProvider.AccountNameMatches(storageAccountName, storageAccount)) { return(storageAccount); } // If still not found, try the default storage connection string storageAccount = AccountProvider.GetAccount(ConnectionStringNames.Storage); if (AccountProvider.AccountNameMatches(storageAccountName, storageAccount)) { return(storageAccount); } // If still not found, try a final search through all known accounts // matching on account name var accountMap = AccountProvider.GetAccounts(); foreach (var currAccount in accountMap.Values) { if (AccountProvider.AccountNameMatches(storageAccountName, currAccount)) { return(currAccount); } } return(null); }
async Task <Account> GetAccount(AccountProvider provider, bool allowFallback, LoginOptions options) { List <Account> accounts; options.TryReportProgress(provider.ProgressWhileAuthenticating); try { // Now, let's get accounts for current provider. // For different services and login methods, this may launch Safari, show iOS 6 prompt or just query ACAccounts. accounts = (await provider.GetAccounts()).ToList(); } finally { options.TryReportProgress(LoginProgress.Authorizing); } if (accounts.Count == 0) { throw new InvalidOperationException("No accounts found for this service."); } if (accounts.Count == 1) { return(accounts [0]); } // If there is more than a single account, present an interface to choose one. // If fallback is available, add it to the list of options with null value. var choiceUI = options.AccountChoiceProvider; if (choiceUI == null) { throw new InvalidOperationException("There is more than one account, but no accountChoiceProvider was specified."); } // Add "Other" option that falls back to next provider if (allowFallback) { accounts.Add(null); } // Show chooser interface options.TryReportProgress(LoginProgress.PresentingAccountChoice); try { return(await choiceUI.ChooseAsync(accounts, a => (a != null)?a.Username : "******")); } finally { options.TryReportProgress(LoginProgress.Authorizing); } }
public ActionResult SearchBlob(string path) { ViewBag.Path = path; if (String.IsNullOrEmpty(path)) { return(View()); } if (_account == null) { TempData["Message.Text"] = "Account not found"; TempData["Message.Level"] = "danger"; return(View()); } ICloudBlob blob = null; try { BlobPath parsed = BlobPath.Parse(path); LocalBlobDescriptor descriptor = new LocalBlobDescriptor { ContainerName = parsed.ContainerName, BlobName = parsed.BlobName }; IReadOnlyDictionary <string, CloudStorageAccount> accounts = AccountProvider.GetAccounts(); foreach (var account in accounts.Values) { blob = descriptor.GetBlockBlob(account); if (blob.Exists()) { break; } else { blob = null; } } } catch (FormatException e) { TempData["Message.Text"] = e.Message; TempData["Message.Level"] = "danger"; return(View()); } catch { blob = null; } if (blob == null) { TempData["Message.Text"] = "No invocation found for: " + path; TempData["Message.Level"] = "warning"; return(View()); } Guid?guid; try { guid = BlobCausalityReader.GetParentId(blob); } catch { guid = null; } if (!guid.HasValue) { TempData["Message.Text"] = "No invocation found for: " + path; TempData["Message.Level"] = "warning"; return(View()); } TempData["Message.Text"] = "Invocation found for: " + path; TempData["Message.Level"] = "info"; return(Redirect("~/#/functions/invocations/" + guid)); }
async Task<Account> GetAccount (AccountProvider provider, bool allowFallback, LoginOptions options) { List<Account> accounts; options.TryReportProgress (provider.ProgressWhileAuthenticating); try { // Now, let's get accounts for current provider. // For different services and login methods, this may launch Safari, show iOS 6 prompt or just query ACAccounts. accounts = (await provider.GetAccounts ()).ToList (); } finally { options.TryReportProgress (LoginProgress.Authorizing); } if (accounts.Count == 0) throw new InvalidOperationException ("No accounts found for this service."); if (accounts.Count == 1) return accounts [0]; // If there is more than a single account, present an interface to choose one. // If fallback is available, add it to the list of options with null value. var choiceUI = options.AccountChoiceProvider; if (choiceUI == null) throw new InvalidOperationException ("There is more than one account, but no accountChoiceProvider was specified."); // Add "Other" option that falls back to next provider if (allowFallback) accounts.Add (null); // Show chooser interface options.TryReportProgress (LoginProgress.PresentingAccountChoice); try { return await choiceUI.ChooseAsync (accounts, a => (a != null) ? a.Username : "******"); } finally { options.TryReportProgress (LoginProgress.Authorizing); } }