コード例 #1
0
        public async void Submit()
        {
            TransactionsHandler handler = new TransactionsHandler();

            handler.Filename = @"../../../DataBase/Transaction/transactions.json";
            await handler.Change(_currentTransaction.Transaction);
        }
コード例 #2
0
        public async void Remove()
        {
            if (CurrentTransaction != null)
            {
                TransactionsHandler handler = new TransactionsHandler();
                handler.Filename = @"../../../DataBase/Transaction/transactions.json";
                await handler.Remove(_currentTransaction.Transaction.Guid);

                CurrentInfo.Wallet.RemoveTransaction(_currentTransaction.Transaction);
                Transactions.Remove(_currentTransaction);

                CurrentTransaction = null;
            }
        }
コード例 #3
0
        private async Task LoadAsync()
        {
            TransactionsHandler transactionsHandler = new TransactionsHandler();

            transactionsHandler.Filename = @"../../../DataBase/Transaction/transactions.json";
            var transactions = await transactionsHandler.Find(CurrentInfo.Wallet.Guid);

            CurrentInfo.Wallet.Transactions = new List <Transaction>();
            CurrentInfo.Wallet.Balance      = CurrentInfo.Wallet.StartBalance;
            //trouble here?
            foreach (var t in transactions)
            {
                CurrentInfo.Wallet.MakeTransaction(new Transaction(t.Sum, t.Currency, t.Date, t.Description, t.TransactionGuid));
            }
        }
コード例 #4
0
        public void TestAddingTransactions()
        {
            //
            var categoriesTest = new Category("one", "", "", "");
            var guiTest        = Guid.NewGuid();

            //
            TransactionsHandler handler = new TransactionsHandler();

            handler.Filename = @"../../../DataBase/Transaction/transactions.json";
            handler.write(new DBTransaction(guiTest, "", 0, DateTime.Now, "UAH", ""));

            ////
            Assert.NotNull(handler.Find(guiTest, true));
        }
コード例 #5
0
        public void TestRemovingTransactions()
        {
            //
            var categoriesTest = new Category("one", "", "", "");
            var guiTest        = Guid.NewGuid();

            //
            TransactionsHandler handler = new TransactionsHandler();

            handler.Filename = @"../../../DataBase/Transaction/transactions.json";
            handler.write(new DBTransaction(guiTest, "", 0, DateTime.Now, "UAH", ""));
            handler.Remove(guiTest);

            ////
            var ex = Assert.Throws <AggregateException>(() => handler.Find(guiTest).Result);

            Assert.NotNull(ex);
        }
コード例 #6
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));
        }