public async Task <PartialViewResult> AccountPartialViewAsync(string address = "") { try { var accountSummaryViewModel = new AccountSummaryViewModel { coinbaseBtcQuoteResult = CoinbaseBtcQuote.Current, transactionsResult = TransactionsResult.Current, delegateResult = DelegateResult.Current, walletAccountResult = await WalletAccountFetcher.FetchRiseWalletAccount(address), delegateVotesResult = await DelegateVotesFetcher.FetchRiseDelegateVotes(address), coinReceivedByAccount = await TransactionsFetcher.FetchTransactions(address) }; return(PartialView("_AccountPartial", accountSummaryViewModel)); } catch (Exception ex) { var log = new Log(); log.LogMessage(ex.Message + " " + ex.StackTrace + " " + ex.InnerException); _appdb.Logger.Add(log); _appdb.SaveChangesAsync().Wait(); return(null); } }
private void HandlePolicyDetailsMessage(AccountSummaryViewModel vm) { // @NOTE(sjv): This is the way we will change pages tabbedPage.CurrentPage = tabbedPage.Children[1]; // Setup the binding context - maybe its the SelectedItem in the VM? }
public async Task <PartialViewResult> AccountSummaryTipBotPartialView() { try { var address = GetCurrentUserAsync().Address; ViewBag.userpic = GetCurrentUserAsync().Photo_Url; var tipAccountSummaryViewModel = new AccountSummaryViewModel { coinQuoteCol = CoinQuoteResult.Current, coinbaseBtcQuoteResult = CoinbaseBtcQuote.Current, transactionsResult = TransactionsResult.Current, delegateResult = DelegateResult.Current, walletAccountResult = await WalletAccountFetcher.FetchRiseWalletAccount(address), coinReceivedByAccount = await TransactionsFetcher.FetchTransactions(address), coinSentByAccount = await TransactionsFetcher.FetchOutgoingTransactions(address) }; return(PartialView("_AccountSummaryTipBotPartial", tipAccountSummaryViewModel)); } catch (Exception ex) { var log = new Log(); log.LogMessage(ex.Message + " " + ex.StackTrace + " " + ex.InnerException); _appdb.Logger.Add(log); _appdb.SaveChangesAsync().Wait(); return(null); } }
/// <summary> /// Loads the Model with Information on ONload of the Page /// </summary> /// <returns></returns> /// <remarks> /// Date: 24/06/2018 /// Author: Stephen McCutcheon /// </remarks> public ActionResult Index() { using (var apiClient = new MyServersApiClient()) { var authInfo = new AuthInfo { Username = Settings.Default.APIUserName, Password = Settings.Default.APIPassword }; //Calls the Web api to Get the Account Summary var accountSummary = apiClient.GetAccountSummary(authInfo); //Populates the apprioprate data into the View Model var viewModels = new AccountSummaryViewModel { Balance = accountSummary.Balance.ToString("C"), NextPaymentAmount = accountSummary.NextPaymentAmount.ToString("C"), NextPaymentDate = accountSummary.NextPaymentDate, OverdueInvoices = accountSummary.OverdueInvoices, UnpaidInvoices = accountSummary.UnpaidInvoices }; //Returns the model to the View return(View(viewModels)); } }
public async Task <PartialViewResult> AccountSummaryAsync(string address) { AccountSummaryViewModel accountSummaryViewModel; try { if (address != null) { var delegate_account = DelegateResult.Current.Delegates.Where(x => x.Username.Contains(address.ToLower()) || x.Address == address).OrderBy(j => j.Username.Length).FirstOrDefault(); if (delegate_account != null) { address = delegate_account.Address; accountSummaryViewModel = new AccountSummaryViewModel { coinQuoteCol = CoinQuoteResult.Current, coinbaseBtcQuoteResult = CoinbaseBtcQuote.Current, transactionsResult = TransactionsResult.Current, delegateResult = DelegateResult.Current, walletAccountResult = await WalletAccountFetcher.FetchRiseWalletAccount(address), delegateVotesResult = await DelegateVotesFetcher.FetchRiseDelegateVotes(address), forgedByAccount = await ForgedByAccountFetcher.FetchForgedByAccount(delegate_account.PublicKey), coinReceivedByAccount = await TransactionsFetcher.FetchTransactions(address), coinSentByAccount = await TransactionsFetcher.FetchOutgoingTransactions(address) }; } else { accountSummaryViewModel = new AccountSummaryViewModel { coinQuoteCol = CoinQuoteResult.Current, coinbaseBtcQuoteResult = CoinbaseBtcQuote.Current, transactionsResult = TransactionsResult.Current, delegateResult = DelegateResult.Current, walletAccountResult = await WalletAccountFetcher.FetchRiseWalletAccount(address), coinReceivedByAccount = await TransactionsFetcher.FetchTransactions(address), coinSentByAccount = await TransactionsFetcher.FetchOutgoingTransactions(address) }; } if (accountSummaryViewModel.walletAccountResult == null) { return(null); } else { return(PartialView("_AccountSummaryPartial", accountSummaryViewModel)); } } } catch (Exception e) { Console.WriteLine("Error:" + e.InnerException); } return(null); }
public ActionResult MakePayment(AccountSummaryViewModel model) { var userId = User.Identity.GetUserId(); var info = _context.UsersInfo.Where(m => m.UserId.Equals(userId)).FirstOrDefault(); info.Balance = 0; _context.SaveChanges(); return(RedirectToAction("AccountSummary")); }
public ActionResult Index(string ReturnUrl) { ReturnUrl = string.Empty; var model = new AccountSummaryViewModel(); var customer = Customers.GetCustomer(Identity.Customer.CustomerID); model.Customer = customer; return(View(model)); }
public static AccountSummaryOutputViewModel FromApiModel(AccountSummaryViewModel model) { return(new AccountSummaryOutputViewModel { Id = model.Id.ToString(), UserId = model.UserId.ToString(), AvailableBalance = model.AvailableBalance, Items = model.Items.Select(BillOutputViewModel.FromApiModel).ToList() }); }
public ActionResult ChangePickUpDay(AccountSummaryViewModel model) { var userId = User.Identity.GetUserId(); var info = _context.UsersInfo.Where(m => m.UserId.Equals(userId)).FirstOrDefault(); if (model.BalanceInfo.PickUpDayId != null) { info.PickUpDayId = model.BalanceInfo.PickUpDayId; _context.SaveChanges(); } return(RedirectToAction("AccountSummary")); }
public async Task <PartialViewResult> PaymentsTableAsync(string address) { var accountSummaryViewModel = new AccountSummaryViewModel { coinbaseBtcQuoteResult = CoinbaseBtcQuote.Current, transactionsResult = TransactionsResult.Current, delegateResult = DelegateResult.Current, walletAccountResult = await WalletAccountFetcher.FetchRiseWalletAccount(address), delegateVotesResult = await DelegateVotesFetcher.FetchRiseDelegateVotes(address), coinReceivedByAccount = await TransactionsFetcher.FetchTransactions(address) }; return(PartialView("_PaymentsTablePartial", accountSummaryViewModel)); }
public ActionResult AccountSummary() { var pickUpDays = _context.PickUpDays.ToList(); var userId = User.Identity.GetUserId(); var balance = _context.UsersInfo.Select(m => m).Where(m => m.UserId.Equals(userId)).FirstOrDefault(); var viewModel = new AccountSummaryViewModel() { PickUpDays = pickUpDays, BalanceInfo = balance, StripeBalance = balance.Balance * 100 }; return(View(viewModel)); }
public async Task <PartialViewResult> PaymentsChartAsync(string address, int minutes) { var accountSummaryViewModel = new AccountSummaryViewModel { coinbaseBtcQuoteResult = CoinbaseBtcQuote.Current, transactionsResult = TransactionsResult.Current, delegateResult = DelegateResult.Current, walletAccountResult = await WalletAccountFetcher.FetchRiseWalletAccount(address), delegateVotesResult = await DelegateVotesFetcher.FetchRiseDelegateVotes(address), coinReceivedByAccount = await TransactionsFetcher.FetchTransactions(address) }; // Show Payments from currentTime - minutes ViewBag.Minutes = minutes; return(PartialView("_PaymentsChartPartial", accountSummaryViewModel)); }
public virtual async Task <OrchestratorResponse <AccountSummaryViewModel> > GetAccountSummary(string hashedAccountId, string externalUserId) { try { var accountResponse = await _mediator.SendAsync(new GetEmployerAccountByHashedIdQuery { HashedAccountId = hashedAccountId, UserId = externalUserId }); var viewModel = new AccountSummaryViewModel { Account = accountResponse.Account }; return(new OrchestratorResponse <AccountSummaryViewModel> { Status = HttpStatusCode.OK, Data = viewModel }); } catch (InvalidRequestException ex) { return(new OrchestratorResponse <AccountSummaryViewModel> { Status = HttpStatusCode.BadRequest, Data = new AccountSummaryViewModel(), Exception = ex }); } catch (UnauthorizedAccessException) { return(new OrchestratorResponse <AccountSummaryViewModel> { Status = HttpStatusCode.Unauthorized }); } }
public AccountSummaryPage() { InitializeComponent(); BindingContext = new AccountSummaryViewModel(); }
public void Arrange() { mockAuthenticationService = new Mock <IAuthenticationService>(); mockMultiVariantTestingService = new Mock <IMultiVariantTestingService>(); mockCookieStorageService = new Mock <ICookieStorageService <FlashMessageViewModel> >(); mockEmployerTeamOrchestrator = new Mock <EmployerTeamOrchestrator>(); mockControllerContext = new Mock <ControllerContext>(); mockHttpContext = new Mock <HttpContextBase>(); mockPrincipal = new Mock <IPrincipal>(); mockClaimsIdentity = new Mock <ClaimsIdentity>(); _userId = "TestUser"; _claims = new List <Claim> { new Claim(ControllerConstants.UserRefClaimKeyName, _userId) }; mockPrincipal.Setup(m => m.Identity).Returns(mockClaimsIdentity.Object); mockClaimsIdentity.Setup(m => m.IsAuthenticated).Returns(_isAuthenticated); mockClaimsIdentity.Setup(m => m.Claims).Returns(_claims); mockHttpContext.Setup(m => m.User).Returns(mockPrincipal.Object); mockControllerContext.Setup(m => m.HttpContext).Returns(mockHttpContext.Object); _hashedAccountId = Guid.NewGuid().ToString(); _account = new Account { PublicHashedId = _hashedAccountId }; _accountViewModel = new AccountDashboardViewModel { Account = _account }; _accountSummaryViewModel = new AccountSummaryViewModel { Account = _account }; _orchestratorResponse = new OrchestratorResponse <AccountDashboardViewModel>() { Status = System.Net.HttpStatusCode.OK, Data = _accountViewModel }; _orchestratorAccountSummaryResponse = new OrchestratorResponse <AccountSummaryViewModel>() { Status = System.Net.HttpStatusCode.OK, Data = _accountSummaryViewModel }; mockEmployerTeamOrchestrator .Setup(m => m.GetAccount(It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(_orchestratorResponse); _controller = new EmployerTeamController( mockAuthenticationService.Object, mockMultiVariantTestingService.Object, mockCookieStorageService.Object, mockEmployerTeamOrchestrator.Object) { ControllerContext = mockControllerContext.Object }; }