Exemple #1
0
        //withdraw cash from bank
        public void WithdrawCash(decimal amount, string note)
        {
            CheckAccount(amount);



            string  date        = DateTime.Now.ToString("MM/dd/yyyy");
            string  type        = "DEBIT";
            decimal cashBalance = Balance - amount;
            int     acctNumber  = this.Acctnumber;

            TransactionClass debit = new TransactionClass(-amount, acctNumber, note, date, this.Name, type, cashBalance);

            allTransaction.Add(debit);
        }
Exemple #2
0
        //deposit cash to bank
        public void DepositCash(decimal amount, int acctnum, string note, string name)
        {
            if (amount < 0)
            {
                throw new ArgumentOutOfRangeException(" Invalid amount ");
            }

            string  date        = DateTime.Now.ToString("MM/dd/yyyy");
            string  type        = "CREDIT";
            decimal cashBalance = Balance + amount;

            TransactionClass credit = new TransactionClass(amount, this.Acctnumber, note, date, name, type, cashBalance);

            allTransaction.Add(credit);
        }