コード例 #1
0
        public bool WithdrawAmount(ICardAccount cardAccount, decimal withdrawValue)
        {
            cardAccount.CardCash = cardAccount.CardCash - withdrawValue;
            if (cardAccount.CardCash < 0)
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
        private static bool WithdrawSum(
            AtmEntities dbContext, 
            CardAccountRepository cardAcountRepo,
            TransactionHistoryRepository tarnsactionHystoryRepo, 
            ICardAccount cardAccount)
        {
            var transactionsHandler = new TransactionsHandler(dbContext, cardAcountRepo, tarnsactionHystoryRepo);
            var consoleHandler = ConsoleHandler.Instance;
            consoleHandler.Print("Enter value to withdraw: ");
            var withdrawValueInput = consoleHandler.GetStringInput();
            decimal withdrawValue = new decimal();
            if(!decimal.TryParse(withdrawValueInput, out withdrawValue))
            {
                return false;
            }

            return transactionsHandler.WithdrawTransaction(cardAccount.CardNumber, cardAccount.CardPin, withdrawValue);
        }
コード例 #3
0
ファイル: AtmClientEntry.cs プロジェクト: Nachev/Telerik
        private static bool WithdrawSum(
            AtmEntities dbContext,
            CardAccountRepository cardAcountRepo,
            TransactionHistoryRepository tarnsactionHystoryRepo,
            ICardAccount cardAccount)
        {
            var transactionsHandler = new TransactionsHandler(dbContext, cardAcountRepo, tarnsactionHystoryRepo);
            var consoleHandler      = ConsoleHandler.Instance;

            consoleHandler.Print("Enter value to withdraw: ");
            var     withdrawValueInput = consoleHandler.GetStringInput();
            decimal withdrawValue      = new decimal();

            if (!decimal.TryParse(withdrawValueInput, out withdrawValue))
            {
                return(false);
            }

            return(transactionsHandler.WithdrawTransaction(cardAccount.CardNumber, cardAccount.CardPin, withdrawValue));
        }
コード例 #4
0
 public bool IsCashAmountSufficient(ICardAccount cardAccount, decimal withdrawValue)
 {
     return(cardAccount.CardCash >= withdrawValue);
 }