BTCAddressForEmail() публичный Метод

public BTCAddressForEmail ( string email_address ) : string
email_address string
Результат string
Пример #1
0
        public string AddressForAvatar(string user_identifier, string user_email)
        {
            string query = "select a.btc_address as btc_address from opensim_btc_addresses a left outer join opensim_btc_transactions t on a.btc_address=t.btc_address where a.user_identifier=?user_identifier AND t.confirmation_sent_ts > 0 OR t.id IS NULL limit 1;";

            using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
            {
                dbcon.Open();

                MySqlCommand cmd = new MySqlCommand(query, dbcon);

                try
                {
                    using (cmd)
                    {
                        cmd.Parameters.AddWithValue("?user_identifier", m_user_identifier);

                        using (MySqlDataReader dbReader = cmd.ExecuteReader())
                        {
                            if (dbReader.Read())
                            {
                                m_btc_address = (string)dbReader["btc_address"];
                            }
                        }

                        cmd.Dispose();

                        return(m_btc_address);
                    }
                }
                catch (Exception e)
                {
                    m_log.Error("[FreeMoney] Error fetching addresses for avatar: " + e.ToString());
                    //m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
                    //return "";
                }
            }

            if (user_email == "")
            {
                return("");
            }

            // No address yet - try to create one with an email service.
            BitcoinAddressForEmailService serv = new BitcoinAddressForEmailService(m_config);
            string new_btc_address             = serv.BTCAddressForEmail(user_email);

            if (new_btc_address != "")
            {
                // create a new object - we may want to make this whole method static.
                BitcoinAddress addr = new BitcoinAddress(m_connectionString, m_config);
                if (addr.Create(user_identifier, new_btc_address))
                {
                    return(new_btc_address);
                }
            }

            return("");
        }
        public string AddressForAvatar(string user_identifier, string user_email)
        {
            string query = "select a.btc_address as btc_address from opensim_btc_addresses a left outer join opensim_btc_transactions t on a.btc_address=t.btc_address where a.user_identifier=?user_identifier AND t.confirmation_sent_ts > 0 OR t.id IS NULL limit 1;";

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

                dbcon.Open();

                MySqlCommand cmd = new MySqlCommand( query, dbcon);

                try
                {
                    using (cmd)
                    {
                        cmd.Parameters.AddWithValue("?user_identifier", m_user_identifier);

                        using (MySqlDataReader dbReader = cmd.ExecuteReader())
                        {
                            if (dbReader.Read())
                            {
                                m_btc_address = (string)dbReader["btc_address"];
                            }
                        }

                        cmd.Dispose();

                        return m_btc_address;

                    }
                }
                catch (Exception e)
                {
                    m_log.Error("[FreeMoney] Error fetching addresses for avatar: "+e.ToString());
                    //m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
                    //return "";
                }

            }

            if (user_email == "") {
                return "";
            }

            // No address yet - try to create one with an email service.
            BitcoinAddressForEmailService serv = new BitcoinAddressForEmailService(m_config);
            string new_btc_address = serv.BTCAddressForEmail(user_email);

            if (new_btc_address != "") {
                // create a new object - we may want to make this whole method static.
                BitcoinAddress addr = new BitcoinAddress(m_connectionString, m_config);
                if (addr.Create(user_identifier, new_btc_address)) {
                    return new_btc_address;
                }
            }

            return "";
        }