FreeMoney.BitcoinTransaction.Populate C# (CSharp) Method

Populate() private method

private Populate ( string by ) : bool
by string
return bool
        private bool Populate(string by)
        {
            string query = "SELECT payee, item_name, transaction_code, original_amount, btc_amount, notify_url, btc_address, num_confirmations_required, created_ts, payment_detected_ts, num_confirmations_received, confirmation_sent_ts FROM opensim_btc_transactions";

            if (by == "transaction_code") {
                query += " WHERE transaction_code=?transaction_code";
            } else if (by == "btc_address") {
                query += " WHERE btc_address=?btc_address";
            } else {
                // not supported
                return false;
            }

            using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
            {

                dbcon.Open();

                MySqlCommand cmd = new MySqlCommand( query, dbcon);

                bool found = false;

                try
                {
                    using (cmd)
                    {
                        if (by == "transaction_code") {
                            cmd.Parameters.AddWithValue("?transaction_code", m_transaction_code);
                        } else {
                            cmd.Parameters.AddWithValue("?btc_address", m_btc_address);
                        }

                        using (MySqlDataReader dbReader = cmd.ExecuteReader())
                        {
                            if (dbReader.Read())
                            {
                                m_payee = (string)dbReader["payee"];
                                m_item_name = (string)dbReader["item_name"];
                                m_transaction_code = (string)dbReader["transaction_code"];
                                m_original_amount = (decimal)dbReader["original_amount"];
                                m_btc_amount = (decimal)dbReader["btc_amount"];
                                m_notify_url = (string)dbReader["notify_url"];
                                m_btc_address = (string)dbReader["btc_address"];
                                m_num_confirmations_required = (int)dbReader["num_confirmations_required"];
                                m_created_ts = (int)dbReader["created_ts"];
                                m_payment_detected_ts = (int)dbReader["payment_detected_ts"];
                                m_num_confirmations_received = (int)dbReader["num_confirmations_received"];
                                m_num_confirmations_received = (int)dbReader["num_confirmations_received"];
                                m_confirmation_sent_ts = (int)dbReader["confirmation_sent_ts"];

                                found = true;
                            }
                        }

                        cmd.Dispose();

                        return found;

                    }
                }
                catch (Exception)
                {
                    //m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
                }

            }

            return false;
        }