コード例 #1
0
        /// <summary>	Executes the push transactions action. </summary>
        ///
        /// <remarks>	Paul, 20/02/2015. </remarks>
        ///
        /// <param name="newTrans">	The new transaction. </param>
        /// <param name="database">	The database. </param>
        void OnPushTransactions(List <TransactionsRow> newTrans, MySqlData database)
        {
            Dictionary <string, uint> lastSeen = new Dictionary <string, uint>();

            try
            {
                database.BeginTransaction();

                foreach (TransactionsRow r in newTrans)
                {
                    // this may have problems with partial transactions
                    database.InsertTransaction(r.symbol_pair, r.deposit_address, r.order_type, r.received_txid, r.sent_txid, r.amount, r.price, r.fee, r.status, r.date, r.notes, TransactionPolicy.REPLACE);

                    if (lastSeen.ContainsKey(r.symbol_pair))
                    {
                        lastSeen[r.symbol_pair] = Math.Max(r.uid, lastSeen[r.symbol_pair]);
                    }
                    else
                    {
                        lastSeen[r.symbol_pair] = r.uid;
                    }
                }

                // keep the site upto date with last seen transastion uids
                foreach (KeyValuePair <string, uint> kvp in lastSeen)
                {
                    database.UpdateLastSeenTransactionForSite(kvp.Key, kvp.Value);
                }

                database.EndTransaction();
            }
            catch (Exception)
            {
                database.RollbackTransaction();
                throw;
            }
        }
コード例 #2
0
ファイル: DaemonMySql.cs プロジェクト: wildbunny/metaexchange
        // ------------------------------------------------------------------------------------------------------------

        /// <summary>	Inserts a transaction. </summary>
        ///
        /// <remarks>	Paul, 05/02/2015. </remarks>
        ///
        /// <param name="symbolPair">   The symbol pair. </param>
        /// <param name="orderType">    Type of the order. </param>
        /// <param name="receivedTxid">	The received txid. </param>
        /// <param name="sentTxid">	    The sent txid. </param>
        /// <param name="amount">	    The amount. </param>
        /// <param name="type">		    The type. </param>
        /// <param name="notes">	    (Optional) the notes. </param>
        void InsertTransaction(string symbolPair, string depositAddress, MetaOrderType orderType,
                               string receivedTxid, string sentTxid, decimal amount, decimal price, decimal fee,
                               MetaOrderStatus status, DateTime date, string notes = null)
        {
            m_dataAccess.InsertTransaction(symbolPair, depositAddress, orderType, receivedTxid, sentTxid, amount, price, fee, status, date, notes);
        }