// executes withdrawal private void btnWithdrawGo_Click(object sender, EventArgs e) { if (holderSource == null || accountSource == null) { MessageBox.Show("Enter account details first"); } else { //parse amount of money to transfer int amount; bool parsed; string amountString; amountString = txtAmountToWithdraw.Text; parsed = int.TryParse(amountString, out amount); if (parsed) { // run withdrawal code BLLTransactionMgmt bll = new BLLTransactionMgmt(); // for debugging //MessageBox.Show("Running deposit code"); string result; result = bll.WithdrawMoney(accountSource, amount); MessageBox.Show(result); GetWithdrawalAccount(); txtAmountToWithdraw.Text = ""; } else { MessageBox.Show("Enter amount to withdraw in cents, i.e. 1000 = \u20AC 10"); } } }
// executes deposit (button Proceed clicked) private void btnDepositGo_Click(object sender, EventArgs e) { if (holderDestination == null || accountDestination == null) { MessageBox.Show("Enter account details first"); } else { //parse amount of money to transfer int amount; bool parsed; string amountString; amountString = txtAmountToDeposit.Text; parsed = int.TryParse(amountString, out amount); if (parsed) { // run deposit code BLLTransactionMgmt bll = new BLLTransactionMgmt(); // for debugging: //MessageBox.Show("Running deposit code"); string result; result = bll.SaveDeposit(accountDestination, amount); MessageBox.Show(result); GetDepositAccount(); txtAmountToDeposit.Text = ""; } else { MessageBox.Show("Enter amount to deposit in cents, i.e. 1000 = \u20AC 10"); } } }
// This executes transfer private void btnTransferGo_Click(object sender, EventArgs e) { //parse amount of money to transfer int amount; bool parsed; string amountString; string message; string transactionDescription; transactionDescription = txtDescription.Text; amountString = txtAmountToTransfer.Text; parsed = int.TryParse(amountString, out amount); if (parsed) { // run deposit code BLLTransactionMgmt bll = new BLLTransactionMgmt(); // Depending on whether internal or external transfer use appropriate method if (rdoDBSCreditUnion.Checked) { // for debugging //MessageBox.Show("Executing internal transfer"); message = bll.Transfer(accountSource, accountDestination, amount, transactionDescription); MessageBox.Show(message); // Refresh source account details reloadSource(); txtDescription.Text = string.Empty; txtAmountToTransfer.Text = string.Empty; } else { // for debugging //MessageBox.Show("External transfer"); message = bll.Transfer(accountSource, accountExternal, holderExternal, amount, transactionDescription); MessageBox.Show(message); // Refresh source account details reloadSource(); txtDescription.Text = string.Empty; txtAmountToTransfer.Text = string.Empty; } } else { MessageBox.Show("Enter amount to transfer in cents, i.e. 1000 = \u20AC 10"); } }
// display transactions in the dgv public void PopulateTransactionsDGV() { dgvManAcc.DataSource = null; BLLTransactionMgmt bllTM = new BLLTransactionMgmt(); DataSet ds = bllTM.GetAllTransactionsBLL(); dgvManAcc.DataSource = ds.Tables[0]; dgvManAcc.Columns[0].HeaderCell.Value = "transaction ID"; dgvManAcc.Columns[1].HeaderCell.Value = "transaction date"; dgvManAcc.Columns[2].HeaderCell.Value = "transaction type"; dgvManAcc.Columns[3].HeaderCell.Value = "description"; dgvManAcc.Columns[4].HeaderCell.Value = "amount"; dgvManAcc.Columns[5].HeaderCell.Value = "staff ID"; dgvManAcc.Columns[6].HeaderCell.Value = "source acc. no."; dgvManAcc.Columns[7].HeaderCell.Value = "destination acc. no."; }