示例#1
0
        public bool TransferMoney(IBankAccount otherAccount, decimal amount)
        {
            var fee = CalculateFee(amount, WithDrawType.Transfer);

            if (UpdateBalance(amount + fee))
            {
                otherAccount.DepositMoney(amount);
            }


            return(true);
        }
示例#2
0
        static void Main(string[] args)
        {
            BankAccountFactory localBankAccFact   = new LocalBankAccountFactory();
            BankAccountFactory foreignBankAccFact = new ForeignBankAccountFactory();

            IBankAccount localBankAcc = localBankAccFact.CreateBankAccount();

            localBankAcc.DepositMoney(40);

            IBankAccount foreignBankAcc = foreignBankAccFact.CreateBankAccount();

            foreignBankAcc.DepositMoney(40);

            Console.ReadKey();
        }
示例#3
0
 public bool TransferMoney(IBankAccount otherAccount, decimal amount)
 {
     this.WithDrawMoney(amount);
     otherAccount.DepositMoney(amount);
     return true;
 }
示例#4
0
        public bool TransferMoney(IBankAccount otherAccount, decimal amount)
        {
            var fee = CalculateFee(amount, WithDrawType.Transfer);
            if (UpdateBalance(amount + fee))
            {
                otherAccount.DepositMoney(amount);
            }

            return true;
        }
示例#5
0
 public bool TransferMoney(IBankAccount otherAccount, decimal amount)
 {
     this.WithDrawMoney(amount);
     otherAccount.DepositMoney(amount);
     return(true);
 }