Exemple #1
0
 private void DepositBtn_Click(object sender, EventArgs e)
 {
     try
     {
         //if (AccountComBo.SelectedValue.ToString() == "Select Account")
         //throw new Exception("You have not Selected an Account");
         Validation.ValueNotEmpty(AmountBox.Text);
         Validation.ValueNotEmpty(AccountComBo.SelectedItem.ToString());
         Validation.ValueNotEmpty(NoteBox.Text);
         var amount  = decimal.Parse(AmountBox.Text);
         var note    = NoteBox.Text;
         var account = AccountComBo.SelectedItem.ToString();
         var arrStr  = Seperators.TwoStringByDash(account);
         _acct.Deposit(arrStr[1], amount);
         List <string> details = new List <string>()
         {
             arrStr[1], amount.ToString(), note, "deposit"
         };
         _transact.AddTranHistory(details);
         MessageBox.Show("Deposit Transaction Succcessful", "Success Message");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Input Error");
     }
 }
Exemple #2
0
        private void TransferBtn_Click(object sender, EventArgs e)
        {
            try
            {
                //if (AccountComBo.SelectedValue.ToString() == "Select Account")
                //throw new Exception("You have not Selected an Account");
                Validation.ValueNotEmpty(AmountBox.Text);
                Validation.ValueNotEmpty(BenAcctBox.Text);
                Validation.ValueNotEmpty(AccountComBo.SelectedItem.ToString());
                Validation.ValueNotEmpty(NoteBox.Text);
                var amount   = decimal.Parse(AmountBox.Text);
                var note     = NoteBox.Text;
                var account  = AccountComBo.SelectedItem.ToString();
                var benAacct = BenAcctBox.Text;
                var arrStr   = Seperators.TwoStringByDash(account);
                if (arrStr[0] == "Savings")
                {
                    _savings.Transfer(arrStr[1], benAacct, amount);
                }
                else
                {
                    _current.Transfer(arrStr[1], benAacct, amount);
                }

                List <string> details = new List <string>()
                {
                    arrStr[1], amount.ToString(), note, "transfer"
                };
                _transact.AddTranHistory(details);
                MessageBox.Show("Transfer Transaction Succcessful", "Success Message");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Input Error");
            }
        }