Exemplo n.º 1
0
        private JavaList <AtmUserTransaction> GetTransactions()
        {
            var users        = new AtmUsers();
            var user         = users.GetUser(cardNumber);
            var transactions = user.Transactions.OrderByDescending(i => i.Date).Take(5);

            return(new JavaList <AtmUserTransaction>(transactions));
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.current_balance);

            cardNumber = Intent.GetStringExtra("UserCard") ?? string.Empty;
            var users = new AtmUsers();
            var user  = users.GetUser(cardNumber);

            var balanceLabel    = FindViewById <TextView>(Resource.Id.currentBalanceLabel);
            var lastTransaction = user.Transactions.OrderByDescending(i => i.Date).First();

            balanceLabel.Text = $"Current balance: {lastTransaction.AccountBalance}";
        }
Exemplo n.º 3
0
 private void WithdrawAmount(decimal amount)
 {
     try
     {
         var user = users.GetUser(cardNumber);
         users.AddTransaction(user.Id, amount, "withdrawal from mobile app");
         OpenDashboard();
     }
     catch (TransactionException e)
     {
         var activity = new Intent(this, typeof(ShowMessageActivity));
         activity.PutExtra("UserCard", cardNumber);
         activity.PutExtra("Message", e.Message);
         StartActivity(activity);
     }
 }