当前位置: 首页>>代码示例>>C#>>正文


C# BsonArray.ToString方法代码示例

本文整理汇总了C#中BsonArray.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# BsonArray.ToString方法的具体用法?C# BsonArray.ToString怎么用?C# BsonArray.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BsonArray的用法示例。


在下文中一共展示了BsonArray.ToString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: insert_trade

    public static void insert_trade(string result, string pair)
    {
        StringBuilder sb = new StringBuilder();
        BsonArray list = MongoHelper.get_array_from_str(result);
        BsonArray sell=new BsonArray();
        BsonArray buy=new BsonArray();
        for (int i = 0; i < list.Count; i++)
        {
            BsonDocument doc_item = new BsonDocument();
            doc_item["id"] = list[i]["tid"].ToString();
            doc_item["time"] = list[i]["date"].ToString();
            doc_item["price"] = list[i]["price"].ToString();
            doc_item["qty"] = list[i]["amount"].ToString();

            if (list[i]["type"].ToString() == "sell")
            {
                sell.Add(doc_item);
            }
            if (list[i]["type"].ToString() == "buy")
            {
                buy.Add(doc_item);
            }
        }
        BtcHelper.insert_trade_log("btcchina", pair, "sell", "btc", sell.ToString());
        BtcHelper.insert_trade_log("btcchina", pair, "buy", "btc", buy.ToString());
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:26,代码来源:BtcchinaData.cs

示例2: get_depth_all

    public string get_depth_all()
    {
        string sql = "select max(id) from depth_log where website='btcchina' and type='sell' ";
        string max_id = SQLServerHelper.get_table(sql).Rows[0][0].ToString();

        sql = "select * from depth_log where id={0}";
        sql = string.Format(sql, max_id);
        string result_sell = SQLServerHelper.get_table(sql).Rows[0]["text"].ToString();

        sql = "select max(id) from depth_log where website='btcchina' and type='buy' ";
        max_id = SQLServerHelper.get_table(sql).Rows[0][0].ToString();

        sql = "select * from depth_log where id={0}";
        sql = string.Format(sql, max_id);
        string result_buy = SQLServerHelper.get_table(sql).Rows[0]["text"].ToString();

        BsonArray array_sell = MongoHelper.get_array_from_str(result_sell);
        BsonArray array_buy = MongoHelper.get_array_from_str(result_buy);

        BsonArray list = new BsonArray();

        BsonDocument doc_buy = new BsonDocument();
        doc_buy.Add("name", "SELL");
        BsonArray list_buy = new BsonArray();
        for (int i = array_buy.Count-1; i >=0; i--)
        {
            BsonDocument doc_item = new BsonDocument();
            doc_item.Add("x", array_buy[i][0]);
            doc_item.Add("y", array_buy[i][1]);
            list_buy.Add(doc_item);
        }
        doc_buy.Add("data", list_buy);

        BsonDocument doc_sell = new BsonDocument();
        doc_sell.Add("name", "SELL");
        BsonArray list_sell = new BsonArray();
        for (int i =array_sell.Count-1; i>=0; i--)
        {
            BsonDocument doc_item = new BsonDocument();
            doc_item.Add("x", array_sell[i][0]);
            doc_item.Add("y", array_sell[i][1]);
            list_sell.Add(doc_item);
        }
        doc_sell.Add("data", list_sell);

        list.Add(doc_buy);
        list.Add(doc_sell);

        return list.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:50,代码来源:response.aspx.cs

示例3: SetValue

        /// <summary>
        ///     使用属性会发生一些MONO上的移植问题
        /// </summary>
        /// <returns></returns>
        public void SetValue(BsonValue value, BsonValueEx.BasicType DataType = BsonValueEx.BasicType.BsonUndefined)
        {
            txtBsonValue.Visible = false;
            txtBsonValue.Text = string.Empty;
            txtBsonValue.ReadOnly = false;
            radTrue.Visible = false;
            radFalse.Visible = false;
            radFalse.Checked = true;
            dateTimePicker.Visible = false;
            NumberPick.Visible = false;

            if (value.IsString)
            {
                txtBsonValue.Visible = true;
                txtBsonValue.Text = value.ToString();
            }

            if (value.IsInt32)
            {
                NumberPick.Visible = true;
                NumberPick.Value = value.AsInt32;
            }

            if (value.IsInt64)
            {
                NumberPick.Visible = true;
                NumberPick.Value = value.AsInt64;
            }

            if (value.IsDecimal128)
            {
                NumberPick.Visible = true;
                NumberPick.Value = value.AsDecimal;
            }

            if (value.IsDouble)
            {
                txtBsonValue.Visible = true;
                txtBsonValue.Text = value.AsDouble.ToString();
            }

            if (value.IsValidDateTime)
            {
                dateTimePicker.Visible = true;
                dateTimePicker.Value = value.ToUniversalTime();
            }

            if (value.IsBsonMaxKey || value.IsBsonMinKey)
            {
                txtBsonValue.Visible = true;
                txtBsonValue.Enabled = false;
                txtBsonValue.Text = value.ToString();
            }

            if (value.IsBoolean)
            {
                radTrue.Visible = true;
                radFalse.Visible = true;
                if (value.AsBoolean)
                {
                    radTrue.Checked = true;
                }
                else
                {
                    radFalse.Checked = true;
                }
            }
            if (value.IsBsonArray)
            {
                if (GetArray == null)
                {
                    MessageBox.Show("GetArray委托不存在!");
                    return;
                }
                if (DataType == BsonValueEx.BasicType.BsonLegacyPoint)
                {
                    //地理
                    var t = GetGeoPoint();
                    if (t != null)
                    {
                        _mBsonArray = t;
                        txtBsonValue.Visible = true;
                        txtBsonValue.Text = _mBsonArray.ToString();
                        txtBsonValue.ReadOnly = true;
                    }
                }
                else
                {
                    //普通数组
                    var t = GetArray();
                    if (t != null)
                    {
                        _mBsonArray = t;
                        txtBsonValue.Visible = true;
                        txtBsonValue.Text = _mBsonArray.ToString();
                        txtBsonValue.ReadOnly = true;
//.........这里部分代码省略.........
开发者ID:magicdict,项目名称:MongoCola,代码行数:101,代码来源:ctlBsonValue.cs

示例4: setValue

 /// <summary>
 /// 使用属性会发生一些MONO上的移植问题
 /// </summary>
 /// <returns></returns>
 public void setValue(BsonValue value)
 {
     txtBsonValue.Visible = false;
     txtBsonValue.Text = String.Empty;
     txtBsonValue.ReadOnly = false;
     radTrue.Visible = false;
     radFalse.Visible = false;
     radFalse.Checked = true;
     dateTimePicker.Visible = false;
     NumberPick.Visible = false;
     if (value.IsString)
     {
         cmbDataType.SelectedIndex = 0;
         txtBsonValue.Visible = true;
         txtBsonValue.Text = value.ToString();
     }
     if (value.IsInt32)
     {
         cmbDataType.SelectedIndex = 1;
         NumberPick.Visible = true;
         NumberPick.Value = value.AsInt32;
     }
     if (value.IsValidDateTime)
     {
         dateTimePicker.Visible = true;
         dateTimePicker.Value = value.ToUniversalTime();
         cmbDataType.SelectedIndex = 2;
     }
     if (value.IsBoolean)
     {
         radTrue.Visible = true;
         radFalse.Visible = true;
         if (value.AsBoolean)
         {
             radTrue.Checked = true;
         }
         else
         {
             radFalse.Checked = true;
         }
         cmbDataType.SelectedIndex = 3;
     }
     if (value.IsBsonArray)
     {
         frmArrayCreator frmInsertArray = new frmArrayCreator();
         SystemManager.OpenForm(frmInsertArray, false, true);
         if (frmInsertArray.mBsonArray != null)
         {
             mBsonArray = frmInsertArray.mBsonArray;
             txtBsonValue.Visible = true;
             txtBsonValue.Text = mBsonArray.ToString();
             txtBsonValue.ReadOnly = true;
             cmbDataType.SelectedIndex = 4;
         }
     }
     if (value.IsBsonDocument)
     {
         frmNewDocument frmInsertDoc = new frmNewDocument();
         SystemManager.OpenForm(frmInsertDoc, false, true);
         if (frmInsertDoc.mBsonDocument != null)
         {
             mBsonDocument = frmInsertDoc.mBsonDocument;
             txtBsonValue.Visible = true;
             txtBsonValue.Text = mBsonDocument.ToString();
             txtBsonValue.ReadOnly = true;
             cmbDataType.SelectedIndex = 5;
         }
     }
 }
开发者ID:huchao007,项目名称:MagicMongoDBTool,代码行数:73,代码来源:ctlBsonValue.cs

示例5: SetValue

 /// <summary>
 ///     使用属性会发生一些MONO上的移植问题
 /// </summary>
 /// <returns></returns>
 public void SetValue(BsonValue value)
 {
     txtBsonValue.Visible = false;
     txtBsonValue.Text = string.Empty;
     txtBsonValue.ReadOnly = false;
     radTrue.Visible = false;
     radFalse.Visible = false;
     radFalse.Checked = true;
     dateTimePicker.Visible = false;
     NumberPick.Visible = false;
     if (value.IsString)
     {
         cmbDataType.SelectedIndex = 0;
         txtBsonValue.Visible = true;
         txtBsonValue.Text = value.ToString();
     }
     if (value.IsInt32)
     {
         cmbDataType.SelectedIndex = 1;
         NumberPick.Visible = true;
         NumberPick.Value = value.AsInt32;
     }
     if (value.IsValidDateTime)
     {
         dateTimePicker.Visible = true;
         dateTimePicker.Value = value.ToUniversalTime();
         cmbDataType.SelectedIndex = 2;
     }
     if (value.IsBoolean)
     {
         radTrue.Visible = true;
         radFalse.Visible = true;
         if (value.AsBoolean)
         {
             radTrue.Checked = true;
         }
         else
         {
             radFalse.Checked = true;
         }
         cmbDataType.SelectedIndex = 3;
     }
     if (value.IsBsonArray)
     {
         var t = GetArray();
         if (t != null)
         {
             _mBsonArray = t;
             txtBsonValue.Visible = true;
             txtBsonValue.Text = _mBsonArray.ToString();
             txtBsonValue.ReadOnly = true;
             cmbDataType.SelectedIndex = 4;
         }
     }
     if (value.IsBsonDocument)
     {
         var t = GetDocument();
         if (t != null)
         {
             _mBsonDocument = t;
             txtBsonValue.Visible = true;
             txtBsonValue.Text = _mBsonDocument.ToString();
             txtBsonValue.ReadOnly = true;
             cmbDataType.SelectedIndex = 5;
         }
     }
 }
开发者ID:lizhi5753186,项目名称:MongoCola,代码行数:71,代码来源:ctlBsonValue.cs

示例6: get_series

    public string get_series()
    {
        string sql = "";
        double rate = CurrencyHelper.get_rate("usd", "cny");
        BsonArray datas = new BsonArray();
        foreach (string website in websites)
        {

            BsonDocument doc = new BsonDocument();
            doc.Add("name", website);

            BsonArray data = new BsonArray();
            sql = " select * " +
                 " from (select top 1002 * from ticker_log where  currency like  '%btc%' and  website='{0}'  order by id desc) a" +
                 " order by id ";
            sql = string.Format(sql, website);
            DataTable dt = SQLServerHelper.get_table(sql);
            foreach (DataRow row in dt.Rows)
            {
                DateTime date = Convert.ToDateTime(row["timespan"].ToString().Substring(0, 19));
                TimeSpan span = date - new System.DateTime(1970, 1, 1);
                BsonArray data_item = new BsonArray();
                data_item.Add(Math.Round(span.TotalSeconds).ToString() + "000");

                if (row["currency"].ToString().Contains("usd"))
                {
                    data_item.Add(Math.Round(Convert.ToDouble(row["last"].ToString()) * rate, 2));
                }
                else
                {
                    data_item.Add(Convert.ToDouble(row["last"].ToString()));
                }
                data.Add(data_item);
            }
            doc.Add("data", data);
            datas.Add(doc);
        }
        return datas.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:39,代码来源:response.aspx.cs

示例7: get_new_data_test

    public string get_new_data_test()
    {
        Random randm = new Random();

        BsonArray data = new BsonArray();

        TimeSpan span = DateTime.Now - new System.DateTime(1970, 1, 1);

        BsonArray data_item = new BsonArray();
        data_item.Add(0);
        data_item.Add((Math.Round(span.TotalSeconds)).ToString() + "000");
        data_item.Add(1000+randm.Next(400));

        BsonArray data_item1 = new BsonArray();
        data_item1.Add(1);
        data_item1.Add((Math.Round(span.TotalSeconds)).ToString() + "000");
        data_item1.Add(900+randm.Next(100));

        data.Add(data_item);
        data.Add(data_item1);
        return data.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:22,代码来源:response.aspx.cs

示例8: get_new_data

    public string get_new_data()
    {
        string sql = "";
        double rate = CurrencyHelper.get_rate("usd", "cny");
        BsonArray data = new BsonArray();

        string max_id = get_max_id();
        sql = "select * from ticker_log where id >{0} and timespan>'{1}' and currency like '%btc%'";
        sql = string.Format(sql, max_id, DateTime.Now.AddSeconds(-10).ToString("yyyy-MM-dd HH:mm:ss"));
        DataTable dt = SQLServerHelper.get_table(sql);
        if (dt.Rows.Count > 0)
        {
            Application["stock_dynamic_max_id"] = dt.Rows[dt.Rows.Count - 1]["id"].ToString();
        }
        //0 btctrade,1,btcchina
        foreach (DataRow row in dt.Rows)
        {
            BsonArray data_item = new BsonArray();

            bool is_has = false;
            for (int i = 0; i < websites.Length; i++)
            {
                if (websites[i].ToString() == row["website"].ToString())
                {
                    data_item.Add(i);
                    is_has = true;
                }
            }
            if (is_has == false) continue;

            DateTime date = Convert.ToDateTime(row["timespan"].ToString().Substring(0, 19));
            TimeSpan span = date - new System.DateTime(1970, 1, 1);
            data_item.Add(Math.Round(span.TotalSeconds).ToString() + "000");

            if (row["currency"].ToString().Contains("usd"))
            {
                data_item.Add(Math.Round(Convert.ToDouble(row["last"].ToString()) * rate, 2));
            }
            else
            {
                data_item.Add(Convert.ToDouble(row["last"].ToString()));
            }
            data.Add(data_item);
        }

        return data.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:47,代码来源:response.aspx.cs

示例9: get_depth_sell

    public string get_depth_sell()
    {
        string sql = "select max(id) from depth_log where website='btcchina' and type='sell' ";
        string max_id = SQLServerHelper.get_table(sql).Rows[0][0].ToString();

        sql = "select * from depth_log where id={0}";
        sql = string.Format(sql, max_id);
        string result = SQLServerHelper.get_table(sql).Rows[0]["text"].ToString();
        BsonArray array_data = MongoHelper.get_array_from_str(result);

        BsonArray list = new BsonArray();
        BsonDocument doc = new BsonDocument();
        doc.Add("name", "Depth");
        doc.Add("color", "#434348");
        BsonArray list_item = new BsonArray();
        for (int i = array_data.Count-1; i>=0; i--)
        {
            BsonDocument doc_item = new BsonDocument();
            doc_item.Add("x", array_data[i][0]);
            doc_item.Add("y", array_data[i][1]);
            list_item.Add(doc_item);
        }
        doc.Add("data", list_item);
        list.Add(doc);

        return list.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:27,代码来源:response.aspx.cs

示例10: get_stock_candle

    public string get_stock_candle()
    {
        DateTime dt_start = DateTime.Now.AddSeconds(-150000);
        dt_start = UnixTime.get_local_time_long(1422500764000);
        DateTime dt_end = dt_start.AddDays(0.5);
        dt_end = dt_start.AddMinutes(50);
        BsonArray list_result = new BsonArray();
        BsonArray list = BtcCompute.get_candle("", dt_start, dt_end, 60);

        for (int i = 0; i < list.Count; i++)
        {
            BsonDocument doc = list[i].AsBsonDocument;
            BsonArray item = new BsonArray();
            item.Add(Convert.ToUInt64(doc["start_time"].ToString()));
            item.Add(Convert.ToDouble(doc["open"].ToString()));
            item.Add(Convert.ToDouble(doc["hight"].ToString()));
            item.Add(Convert.ToDouble(doc["low"].ToString()));
            item.Add(Convert.ToDouble(doc["close"].ToString()));
            list_result.Add(item);
        }

        return list_result.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:23,代码来源:response.aspx.cs

示例11: get_analyse_depth_depth

    public string get_analyse_depth_depth(string time)
    {
        string sql = "select max(id) from depth_log where website='btcchina' and type='sell' and time>={0} ";
        sql = string.Format(sql, time);
        string max_id = SQLServerHelper.get_table(sql).Rows[0][0].ToString();

        sql = "select * from depth_log where id={0}";
        sql = string.Format(sql, max_id);
        string result_sell = SQLServerHelper.get_table(sql).Rows[0]["text"].ToString();

        sql = "select max(id) from depth_log where website='btcchina' and type='buy'  and time >={0}";
        sql = string.Format(sql, time);
        max_id = SQLServerHelper.get_table(sql).Rows[0][0].ToString();

        sql = "select * from depth_log where id={0}";
        sql = string.Format(sql, max_id);
        string result_buy = SQLServerHelper.get_table(sql).Rows[0]["text"].ToString();

        BsonArray array_sell = MongoHelper.get_array_from_str(result_sell);
        BsonArray array_buy = MongoHelper.get_array_from_str(result_buy);

        double middle = Convert.ToDouble(array_buy[0][0].ToString());
        double min = middle - 20;
        double max = middle + 20;

        BsonArray list = new BsonArray();

        BsonDocument doc_buy = new BsonDocument();
        doc_buy.Add("name", "SELL");
        BsonArray list_buy = new BsonArray();
        for (int i = array_buy.Count - 1; i >= 0; i--)
        {
            if (Convert.ToDouble(array_buy[i][0].ToString()) > min && Convert.ToDouble(array_buy[i][0].ToString()) < max)
            {
                BsonDocument doc_item = new BsonDocument();
                doc_item.Add("x", array_buy[i][0]);
                doc_item.Add("y", array_buy[i][1]);
                list_buy.Add(doc_item);
            }
        }
        doc_buy.Add("data", list_buy);

        BsonDocument doc_sell = new BsonDocument();
        doc_sell.Add("name", "SELL");
        BsonArray list_sell = new BsonArray();
        for (int i = array_sell.Count - 1; i >= 0; i--)
        {
            if (Convert.ToDouble(array_sell[i][0].ToString()) > min && Convert.ToDouble(array_sell[i][0].ToString()) < max)
            {
                BsonDocument doc_item = new BsonDocument();
                doc_item.Add("x", array_sell[i][0]);
                doc_item.Add("y", array_sell[i][1]);
                list_sell.Add(doc_item);
            }
        }
        doc_sell.Add("data", list_sell);
        list.Add(doc_buy);
        list.Add(doc_sell);

        return list.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:61,代码来源:response.aspx.cs

示例12: get_depth_buy

    public string get_depth_buy()
    {
        string sql = "select max(id) from depth_log where website='btcchina' and type='buy' ";
        string max_id = SQLServerHelper.get_table(sql).Rows[0][0].ToString();

        sql = "select * from depth_log where id={0}";
        sql = string.Format(sql, max_id);
        string result = SQLServerHelper.get_table(sql).Rows[0]["text"].ToString();
        BsonArray array_data = MongoHelper.get_array_from_str(result);

        sql = "select * from ticker where website='btcchina'";
        DataTable dt_ticker = SQLServerHelper.get_table(sql);
        double min = Convert.ToDouble(dt_ticker.Rows[0]["buy"].ToString()) - 20;
        double max = Convert.ToDouble(dt_ticker.Rows[0]["sell"].ToString()) + 20;

        BsonArray list = new BsonArray();
        BsonDocument doc = new BsonDocument();
        doc.Add("name", "Depth");

        BsonArray list_item=new BsonArray();
        for (int i = array_data.Count-1; i >=0;i-- )
        {
            if (Convert.ToDouble(array_data[i][0]) > min && Convert.ToDouble(array_data[i][0]) < max)
            {
                BsonDocument doc_item = new BsonDocument();
                doc_item.Add("x", array_data[i][0]);
                doc_item.Add("y", array_data[i][1]);
                list_item.Add(doc_item);
            }
        }
        doc.Add("data", list_item);
        list.Add(doc);

        return list.ToString();
    }
开发者ID:topomondher,项目名称:web_helper,代码行数:35,代码来源:response.aspx.cs


注:本文中的BsonArray.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。