Ejemplo n.º 1
0
        //string getHash(string phone, string comment) =>
        //    CryptoHelper.ComputeSha256Hash(phone + comment + Now());

        public BtcAddressEntity getByHash(string hash)
        {
            SQLiteParameter[] parameters = { new SQLiteParameter("@hash", hash) };
            DbDataReader      reader     = db.All("SELECT * " +
                                                  "FROM " + TABLE_NAME + " " +
                                                  "WHERE hash LIKE @hash " +
                                                  "LIMIT 1;", parameters);

            if (reader == null)
            {
                return(null);
            }

            reader.Read();

            try {
                return(new BtcAddressEntity()
                {
                    id = reader.GetValue(0).ToString(),
                    hash = reader.GetValue(1).ToString(),
                    btc_addr = reader.GetValue(2).ToString(),
                    phone = reader.GetValue(3).ToString(),
                    comment = reader.GetValue(4).ToString(),
                    income_balance = MoneyParser.ParseString(reader.GetValue(5).ToString()),
                    wait_balance = MoneyParser.ParseString(reader.GetValue(6).ToString()),
                    created_at = int.Parse(reader.GetValue(7).ToString()),
                    updated_at = int.Parse(reader.GetValue(8).ToString()),
                    client = reader.GetValue(9).ToString(),
                    paid_from = reader.GetValue(10).ToString()
                });
            } catch (Exception) { }

            return(null);
        }
Ejemplo n.º 2
0
        public bm_ratesData Get()
        {
            try
            {
                var list = row.Split(';');
                return(new bm_ratesData()
                {
                    cource = MoneyParser.ParseString(list[3]),
                    balance = MoneyParser.ParseString(list[5]),
                });
            }
            catch (Exception) { }

            return(null);
        }
Ejemplo n.º 3
0
        public List <KeyValuePair <EmailIdentity, TicketClientCreateResponse> > GetLastByClient(TicketClientSettingsData client)
        {
            List <KeyValuePair <EmailIdentity, TicketClientCreateResponse> > list = new List <KeyValuePair <EmailIdentity, TicketClientCreateResponse> >();

            foreach (var email in emails)
            {
                var text = email.ToMailMessage().Body;

                if (text.IndexOf(client.email_parser.is_client) == -1)
                {
                    continue;
                }

                string matchCodeRow = Regex.Match(text, client.email_parser.code[0]).Value;
                string matchCode    = Regex.Match(matchCodeRow, client.email_parser.code[1]).Value;

                string matchFromRow = Regex.Match(text, client.email_parser.from[0]).Value;
                string matchFrom    = Regex.Match(matchFromRow, client.email_parser.from[1]).Value;

                string matchToRow = Regex.Match(text, client.email_parser.to[0]).Value;
                string matchTo    = Regex.Match(matchToRow, client.email_parser.to[1]).Value;

                string matchBtcAmountRow = Regex.Match(text, client.email_parser.btc_amount[0]).Value;
                string matchBtcAmount    = Regex.Match(matchBtcAmountRow, client.email_parser.btc_amount[1]).Value;

                string matchBtcAddressRow = Regex.Match(text, client.email_parser.btc_address[0]).Value;
                string matchBtcAddress    = Regex.Match(matchBtcAddressRow, client.email_parser.btc_address[1]).Value;

                list.Add(new KeyValuePair <EmailIdentity, TicketClientCreateResponse>(
                             new EmailIdentity()
                {
                    btcAddr   = HTMLHelper.StripHTML(matchBtcAddress).Trim(),
                    phoneFrom = HTMLHelper.StripHTML(matchFrom).Trim()
                },
                             new TicketClientCreateResponse()
                {
                    account    = HTMLHelper.StripHTML(matchTo).Trim(),
                    comment    = HTMLHelper.StripHTML(matchCode).Trim(),
                    btc_amount = MoneyParser.ParseString(HTMLHelper.StripHTML(matchBtcAmount)),
                    email      = email.ToMailMessage().To.ToString().Trim()
                }
                             ));
            }

            return(list);
        }