コード例 #1
0
        private async void myCloseAccount_Click(object sender, RoutedEventArgs e)
        {
            if (accountList.SelectedItem != null)
            {
                MessageDialog msg = new MessageDialog("Remove account permanently?", "Remove account");

                msg.Commands.Clear();
                msg.Commands.Add(new UICommand {
                    Label = "Yes", Id = 0
                });
                msg.Commands.Add(new UICommand {
                    Label = "Cancel", Id = 1
                });

                var result = await msg.ShowAsync();

                if ((int)result.Id == 0)
                {
                    string rate = AccountLogic.PrintAccountInfo((Account)accountList.SelectedItem);
                    customer.Accounts.Remove((Account)accountList.SelectedItem);
                    MessageDialog msg2 = new MessageDialog(rate, "Deleted account information");
                    await msg2.ShowAsync();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Prints the account information upon removal.
        /// </summary>
        public static string RemoveCustomer(Customer customer)
        {
            string removedCustomer = "Accounts removed: \n";

            try
            {
                foreach (var item in customer.Accounts)
                {
                    removedCustomer += AccountLogic.PrintAccountInfo(item) + "\n";
                }
                Customers.Remove(customer);
            }
            catch (Exception) { }
            return(removedCustomer);
        }
コード例 #3
0
        private async void myWithdraw_Click(object sender, RoutedEventArgs e)
        {
            bool    success = false;
            decimal amount  = 0;

            if (accountList.SelectedIndex != -1)
            {
                decimal.TryParse(amountBox.Text, out amount);
                success = AccountLogic.Withdraw(customer.Accounts[accountList.SelectedIndex], amount);
            }
            MessageDialog withdraw;

            if (success)
            {
                withdraw = new MessageDialog($"{amount} SEK withdrawn", "Withdrawal successful!");
                Frame.Navigate(typeof(AccountPage), customer);
                Frame.GoBack();
            }
            else
            {
                withdraw = new MessageDialog("Withdraw failed...");
            }
            await withdraw.ShowAsync();
        }
コード例 #4
0
        private async void myDeposit_Click(object sender, RoutedEventArgs e)
        {
            bool    success = false;
            decimal amount  = 0;

            if (accountList.SelectedIndex != -1)
            {
                decimal.TryParse(amountBox.Text, out amount);
                success = AccountLogic.Deposit(customer.Accounts[accountList.SelectedIndex], amount);
            }
            MessageDialog deposit;

            if (success)
            {
                deposit = new MessageDialog($"{amount} SEK Deposited", "Deposit Successful!");
                Frame.Navigate(typeof(AccountPage), customer);
                Frame.GoBack();
            }
            else
            {
                deposit = new MessageDialog("Deposit failed...");
            }
            await deposit.ShowAsync();
        }
コード例 #5
0
        }                                  //MÅSTE VARA UNIKT

        public Account(long balance, double interest)
        {
            Balance   = balance;
            Interest  = interest;
            AccountID = AccountLogic.NewAccountID();
        }
コード例 #6
0
 private async void addCredit_Click(object sender, RoutedEventArgs e)
 {
     MessageDialog CreditAccCreation = new MessageDialog($"Account ID: {AccountLogic.AddCreditAccount(customer)}", "Credit Account Created!");
     await CreditAccCreation.ShowAsync();
 }
コード例 #7
0
 private void myDeposit_Click(object sender, RoutedEventArgs e)
 {
     decimal.TryParse(depositBox.Text, out decimal amount);
     AccountLogic.Deposit(customer.Accounts[accountList.SelectedIndex], amount);
 }
コード例 #8
0
 private void myWithdraw_Click(object sender, RoutedEventArgs e)
 {
     decimal.TryParse(withdrawBox.Text, out decimal amount);
     AccountLogic.Withdraw(customer.Accounts[accountList.SelectedIndex], amount);
 }
コード例 #9
0
 private void addCredit_Click(object sender, RoutedEventArgs e)
 {
     AccountLogic.AddCreditAccount(customer);
 }
コード例 #10
0
 private void addSavings_Click(object sender, RoutedEventArgs e)
 {
     AccountLogic.AddSavingsAccount(customer);
 }