コード例 #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();
        }
コード例 #2
0
 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();
 }
コード例 #3
0
 public void Post([FromBody] Transaction customer)
 {
     _repo.Add(customer);
 }
コード例 #4
0
 public void Post([FromBody] Transaction transaction)
 {
     _repo.Add(transaction);
 }