Beispiel #1
0
        private void amount_TextChanged(object sender, EventArgs e)
        {
            try
            {
                var x = decimal.Parse(amount.Text);
                error_lbl.Visible = false;

                if (x > fromAccount.getBalance())
                {
                    transfer.Enabled = false;
                }
                if (x <= fromAccount.getBalance())
                {
                    transfer.Enabled = true;
                }
            }
            catch (FormatException)
            {
                error_lbl.Visible = true;
            }
        }
 internal bool accountIsOverdrawn(Account a)
 {
     {
         if (a.getBalance() < 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Beispiel #3
0
        private void updateAccountInformation()
        {
            masterForm.setAccount(account);
            listView1.Items.Clear();
            reveal.Enabled = true;
            decimal trx    = 0;
            decimal dep    = 0;
            decimal with   = 0;
            decimal fees   = 0;
            decimal pay    = 0;
            decimal credit = 0;

            foreach (Activity act in account.getActivity())
            {
                listView1.Items.Add(new ListViewItem(new string[5] {
                    act.Date.ToShortDateString(),
                    act.Description, act.Type.ToString(), act.Amount.ToString("0.00"), act.BalanceNow.ToString("0.00")
                }));
                if (act.Type == Type.TRANSACTION)
                {
                    trx += act.Amount;
                }
                if (act.Type == Type.DEPOSIT)
                {
                    dep += act.Amount;
                }
                if (act.Type == Type.WITHDRAWAL)
                {
                    with += act.Amount;
                }
                if (act.Type == Type.FEE)
                {
                    fees += act.Amount;
                }
                if (act.Type == Type.PAYMENT)
                {
                    pay += act.Amount;
                }
                if (act.Type == Type.CREDIT)
                {
                    credit += act.Amount;
                }
            }

            label3.Text      = account.getAccountType().ToString();
            account_num.Text = "XXXXXX" + account.getAccountNumber().ToString().Substring(masterForm.getHolder().getAccountList()[0].getAccountNumber().ToString().Length - 4);
            decimal total = trx + dep - with - fees + pay + credit;

            balance.Text   = account.getBalance().ToString("0.00");
            openDate.Text  = account.getOpenDate().ToShortDateString();
            trxs.Text      = decimal.Round(trx, 2).ToString("0.00");
            depos.Text     = decimal.Round(dep, 2).ToString("0.00");
            withdraw.Text  = decimal.Round(with, 2).ToString("0.00");
            fee.Text       = decimal.Round(fees, 2).ToString("0.00");
            payments.Text  = decimal.Round(pay, 2).ToString("0.00");
            total_lbl.Text = decimal.Round(total, 2).ToString("0.00");
            if (account.isClosed())
            {
                closeDate.Text          = account.getCloseDate().ToShortDateString();
                closed_notifyer.Visible = true;
            }
        }