private void btnDeposit_Click(object sender, EventArgs e) { string accName = listBoxAccounts.SelectedItem.ToString(); decimal amount = Decimal.Parse(txtDepositAmount.Text); accService.Deposit(accName, amount); decimal balance = accService.GetAccountBalance(accName); txtBalance.Text = balance.ToString(); int RewardPoints = accService.GetRewardPoints(accName); txtReward.Text = RewardPoints.ToString(); }
private void btnDeposit_Click(object sender, EventArgs e) { // this will get the account name found on the form String accountName = listBoxAccounts.GetItemText(listBoxAccounts.SelectedItem); // getting balance and deposti amount from form and then display the new balance on the form Decimal balance = Decimal.Parse(txtBalance.Text); Decimal deposit = Decimal.Parse(txtDepositAmount.Text); // if the deposit amount is negative, display a alert letting the user know that it is not allowed, // the balance and reward should not change if (deposit < 0) { MessageBox.Show("You cannot make a negative deposit, please use the withdrawl button to do this transcation."); } else { txtBalance.Text = (balance + deposit).ToString(); // this changes the deposit amount in the database, not the form accService.Deposit(accountName, deposit); // get the reward points from the DB and displays it on the form decimal points = accService.GetRewardPoints(accountName); txtBox_RewardPts.Text = points.ToString(); } }
/// <summary> /// Add Desposit to account /// </summary> /// <param name="amount">The amount value</param> public void AddDeposit(int amount) { if (amount > 0) { _accountServices.Deposit(amount); } }
private void btn_Deposit_Click(object sender, EventArgs e) { string acctName = lstBox_CurrentAccts.SelectedItem.ToString(); Decimal depositAmt = Decimal.Parse(txtBox_Deposit.Text.ToString()); accService.Deposit(acctName, depositAmt); // this will change the balance on the form txtBox_Balance.Text = accService.GetAccountBalance(acctName).ToString(); }
// Enables the user to make a deposit into their account. Called when the // deposit button is clicked. Updates the balance to reflect the change. private void depositBtn_Click(object sender, EventArgs e) { string selectedAcct = currentAcctsList.SelectedItem.ToString(); decimal depositAmount = decimal.Parse(depositTxt.Text); acctServices.Deposit(selectedAcct, depositAmount); depositTxt.ResetText(); updateBalanceText(); }
private void btnAdd_Click(object sender, EventArgs e) { string accountName = accName.Text; decimal accountBalance; //prevents an error if nothing is put in the balance box if (accBalance.Text == "") { accountBalance = 0; } else { accountBalance = Decimal.Parse(accBalance.Text); } lbAccounts.Items.Add(accountName); accService.CreateAccount(accountName, AccountType.Silver); accService.Deposit(accountName, accountBalance); }
/// <summary> /// Adds the amount to deposit into the selected account. /// Updates the account balance text box and the rewards points text box. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDeposit_Click_1(object sender, EventArgs e) { string selectedAcct = listBoxAccounts.SelectedItem.ToString(); decimal depositAmount = decimal.Parse(txtDepositAmount.Text); accService.Deposit(selectedAcct, depositAmount); txtDepositAmount.ResetText(); updateBalanceText(selectedAcct); updateRewardsPointsText(selectedAcct); }
/// <summary> /// Deposit Button gets user input from textbox, sets amount in account name that is selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DepositButton_Click(object sender, EventArgs e) { Decimal amount = Decimal.Parse(DepositTextBox.Text); string accName = CurrentAccountListBox1.SelectedItem.ToString(); accServices.Deposit(accName, amount); DepositTextBox.Text = ""; Decimal bal = accServices.GetAccountBalance(accName); AccountBalTextBox.Text = bal.ToString(); }
private void btnDeposit_Click(object sender, EventArgs e) { string accName = lbxCurrent.SelectedItem.ToString(); //get the selected account name Decimal deposit = Decimal.Parse(txtDeposit.Text); //get the deposit amount accService.Deposit(accName, deposit); //call the deposit method on the account txtDeposit.Text = ""; //remove the txt from the box //update the balance in the box Decimal balance = accService.GetAccountBalance(accName); txtBalance.Text = balance.ToString(); }
/// <summary> /// deposits money into the selected account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDeposit_Click(object sender, EventArgs e) { //gets account name string accName = listBoxAccounts.SelectedItem.ToString(); //gets the deposit amount if there is one there decimal depositAmount; Decimal.TryParse(txtDepositAmount.Text, out (depositAmount)); //deposits the money into the account accService.Deposit(accName, depositAmount); //sets the text boxes txtBalance.Text = accService.GetAccountBalance(accName).ToString(); txtReward.Text = accService.GetRewardPoints(accName).ToString(); txtDepositAmount.Text = ""; }