Inheritance: ITransaction
コード例 #1
0
        ITransaction FinishEndTransaction(MySqlTransaction SQLTransaction, IBankAccount ToAccount, Money Amount, string Message)
        {
            MySQLTransaction trans    = null;
            IBankAccount     account  = null;
            long             identity = -1;
            string           query    = @"insert into `bank_account_transaction` 
								(bank_account_fk, amount, message, flags, flags2, transaction_date_utc)
							values (@0, @1, @2, @3, @4, @5);"                            ;

            if ((account = GetBankAccount(ToAccount.BankAccountK)) == null)
            {
                return(null);
            }

            trans = new MySQLTransaction(account)
            {
                Amount             = Amount,
                BankAccountFK      = account.BankAccountK,
                Flags              = BankAccountTransactionFlags.FundsAvailable,
                Message            = Message,
                TransactionDateUtc = DateTime.UtcNow
            };

            try {
                SQLTransaction.Connection.QueryIdentityTransaction(SQLTransaction, query, out identity, trans.BankAccountFK, (long)trans.Amount, trans.Message,
                                                                   (int)BankAccountTransactionFlags.FundsAvailable, 0, DateTime.UtcNow);
            } catch (Exception ex) {
                TShock.Log.ConsoleError(" seconomy mysql: Database error in FinishEndTransaction: " + ex.Message);
                return(null);
            }

            trans.BankAccountTransactionK = identity;
            return(trans);
        }
コード例 #2
0
		ITransaction FinishEndTransaction(MySqlTransaction SQLTransaction, IBankAccount ToAccount, Money Amount, string Message)
		{
			MySQLTransaction trans = null;
			IBankAccount account = null;
			long identity = -1;
			string query = @"insert into `bank_account_transaction` 
								(bank_account_fk, amount, message, flags, flags2, transaction_date_utc)
							values (@0, @1, @2, @3, @4, @5);";
			if ((account = GetBankAccount(ToAccount.BankAccountK)) == null) {
				return null;
			}

			trans = new MySQLTransaction(account) {
				Amount = Amount,
				BankAccountFK = account.BankAccountK,
				Flags = BankAccountTransactionFlags.FundsAvailable,
				Message = Message,
				TransactionDateUtc = DateTime.UtcNow
			};

			try {
				SQLTransaction.Connection.QueryIdentityTransaction(SQLTransaction, query, out identity, trans.BankAccountFK, (long)trans.Amount, trans.Message,
					(int)BankAccountTransactionFlags.FundsAvailable, 0, DateTime.UtcNow);
			} catch (Exception ex) {
				TShock.Log.ConsoleError(" seconomy mysql: Database error in FinishEndTransaction: " + ex.Message);
				return null;
			}

			trans.BankAccountTransactionK = identity;
			return trans;
		}