public WithdrawInternal ( |
||
parent | ||
amount | decimal | |
description | string | |
insufficientFundsMessage | string | |
return | void |
void WithdrawInternal(Parent parent, decimal amount, string description, string insufficientFundsMessage)
{
if (parent == null)
{
throw new ArgumentNullException("parent");
}
if (description == null)
{
throw new ArgumentNullException("description");
}
if (!parent.HasChild(this))
{
throw new CashWithdrawException("Not Your Parent");
}
if (amount > Account.Balance)
{
throw new CashWithdrawException(insufficientFundsMessage);
}
Account.AddTransaction(description, -amount);
}