public void PayIn(CAccount acc, decimal amount) { PayIn payin = new PayIn(amount, acc); IOperation oper = payin; acc.DoOperation(oper); acc.GetHistory().AddToHistory(payin); }
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); }
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); }
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); } }