Exemplo n.º 1
0
        public static void PlayDemo()
        {
            Account     marysAccount             = new Account("Mary", "ACN190209");
            Transaction depositToMarysAccount    = new Deposit(marysAccount, 50);
            Transaction withdrawFromMarysAccount = new Withdraw(marysAccount, 10);

            TransactionManager transactionManager = new TransactionManager();

            transactionManager.Add(depositToMarysAccount);
            transactionManager.Add(withdrawFromMarysAccount);
            transactionManager.ExecuteAllTransactions();

            Account     natesAccount           = new Account("Nate", "ACN827899");
            Transaction transferfromMaryToNate = new Transfer(marysAccount, natesAccount, 10);

            transactionManager.Add(transferfromMaryToNate);
            transactionManager.ExecuteAllTransactions();

            transferfromMaryToNate = new Transfer(marysAccount, natesAccount, 100);
            transactionManager.Add(transferfromMaryToNate);
            TransactionResult result = transactionManager.Execute();

            if (result.Status == TransactionStatus.InsufficientFunds)
            {
                depositToMarysAccount = new Deposit(marysAccount, 200);
                transactionManager.Add(depositToMarysAccount);
                transactionManager.Execute();
            }

            // Try again the transfer transaction
            transactionManager.RetryTransaction(result.TransactionId);

            // undo all the transactions
            transactionManager.UndoAllTransactions();
        }
 public void UpdateData(DbTransaction transaction, DataSet dataSet, List <string> skipTables)
 {
     executeTransaction = new TransactionManager(transaction);
     foreach (TableItem item in tables)
     {
         if (dataSet.Tables.Contains(item.TableName))
         {
             executeTransaction.Add(new TransactionItem(dataSet.Tables[item.TableName]));
         }
         else
         {
             skipTables.Add(item.TableName);
         }
     }
     executeTransaction.UpdateData();
 }
Exemplo n.º 3
0
 public void Post([FromBody] Transaction customer)
 {
     _repo.Add(customer);
 }
Exemplo n.º 4
0
 public void Post([FromBody] Transaction transaction)
 {
     _repo.Add(transaction);
 }