Esempio n. 1
0
        public void PayIn(CAccount acc, decimal amount)
        {
            PayIn      payin = new PayIn(amount, acc);
            IOperation oper  = payin;

            acc.DoOperation(oper);
            acc.GetHistory().AddToHistory(payin);
        }
Esempio n. 2
0
        public Transfer Transfer(CAccount from, CAccount to, decimal amount)
        {
            Transfer   transfer = new Transfer(to, amount, from);
            IOperation oper     = transfer;

            from.DoOperation(oper);
            from.GetHistory().AddToHistory(transfer);
            // to.GetHistory().AddToHistory(transfer);
            return(transfer);
        }
Esempio n. 3
0
        public bool WithDraw(CBank bank, CAccount acc, decimal amount)
        {
            bool       positive = false;
            WithDraw   withdraw = new WithDraw(amount, acc);
            IOperation oper     = withdraw;

            if (acc.GetSaldo() >= amount)
            {
                acc.DoOperation(oper);
                acc.GetHistory().AddToHistory(withdraw);
                positive = true;
            }
            return(positive);
        }
Esempio n. 4
0
        public bool WithDraw(CBank bank, CAccount acc, decimal amount)
        {
            if (this.bank.WithDraw(bank, acc, amount))
            {
                return(true);
            }
            else
            {
                WithDraw   withdraw = new WithDraw(amount, acc);
                IOperation oper     = withdraw;

                acc.DoOperation(oper);
                acc.GetHistory().AddToHistory(withdraw);
                return(true);
            }
        }