コード例 #1
0
 public static void Analysis(string content, string date)
 {
     if ((content.Contains("尾号") || content.Contains("信用卡")) && content.Contains("消费人民币"))
     {
         string shortNumber = null;
         if (content.Contains("民生银行"))
         {
             shortNumber = content.Substring(content.IndexOf("信用卡") + 3, 4);
         }
         else
         {
             shortNumber = content.Substring(content.IndexOf("尾号") + 2, 4);
         }
         //Console.WriteLine("尾号:{0}", weihao);
         string  xiaofei = content.Substring(content.IndexOf("消费人民币") + 5);
         decimal cost    = isnumeric(xiaofei);
         string  bank    = BankName(content);
         if (bank != "")
         {
             //Console.WriteLine("消费金额:{0}", cost);
             //Console.WriteLine("银行:{0}", type(content));
             var model = new Bill()
             {
                 AddTime     = TimeHelper.ConvertStringToDateTime(date),
                 CostDate    = date,
                 ShortNumber = shortNumber,
                 BankType    = bank,
                 Money       = cost,
                 Content     = content
             };
             var b = billDAL.Add(model);
             if (smsCount <= 10 && b)
             {
                 MessageList.BillList.Insert(0, model);
                 smsCount++;
             }
         }
     }
     else
     {
         //  Console.WriteLine("短信消息没有包含的关键字");
     }
 }
コード例 #2
0
 private void RunTransTimeCommand()
 {
     MessageBox.Show(TimeHelper.ConvertStringToDateTime("1519893203000").ToString("yyyy-MM-dd"));
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: radtek/CoinsPro
        static void Main(string[] args)
        {
            Console.WriteLine("Start collect CryptoCurrency market history hour data......");
            Console.WriteLine("Please input exchange name:");
            string exchangename = Console.ReadLine();

            Console.WriteLine("Please input from symbol to collect:");
            string fromsymbol = Console.ReadLine().ToUpper();

            Console.WriteLine("Please input to symbol to collect:");
            string tosymbol = Console.ReadLine().ToUpper();
            //Console.WriteLine("Please input to time(gmttimestamp) to collect:");

            int    maxcount  = 167;//每周采集一次
            int    totalmax  = 20000;
            int    insertnum = 0;
            double totime    = TimeHelper.GetTimeStamp(DateTime.Now);
            string url       = @"https://min-api.cryptocompare.com/data/histohour?fsym=" + fromsymbol.ToUpper() + "&tsym=" + tosymbol.ToUpper() + "&limit=" + maxcount.ToString() + "&e=" + exchangename + "&toTs=" + totime.ToString();
            //check sql data table

            string sqltablename = "His2Hour_" + exchangename + "_" + fromsymbol + tosymbol + "_RAW";

            if (CheckDataTableName(sqltablename))
            {
                //
                Console.WriteLine(sqltablename + " exist.start collect......");
            }
            else
            {
                Console.WriteLine(sqltablename + " dose not exist.create new table......");
                CreatDataTable(sqltablename);
            }

            bool       flag = true;
            HttpResult hr   = new HttpResult();
            HttpHelper hh   = new HttpHelper();
            HttpItem   hi   = new HttpItem();

            while (flag)
            {
                try
                {
                    hi.URL = url;
                    hr     = hh.GetHtml(hi);
                    string  rawjson = hr.Html;
                    JObject jo      = JObject.Parse(rawjson);

                    string response = jo["Response"].ToString();
                    if (response == "Success")
                    {
                        JArray jlist = JArray.Parse(jo["Data"].ToString()); //JArray解析这个JObject的字符串
                        for (int i = 0; i < jlist.Count; ++i)               //遍历JArray
                        {
                            JObject tempo = JObject.Parse(jlist[i].ToString());
                            string  sql   = "insert into " + sqltablename + " values('" + TimeHelper.ConvertStringToDateTime(tempo["time"].ToString()) + "'," + tempo["close"].ToString() + "," + tempo["high"].ToString() + "," + tempo["open"].ToString() + "," + tempo["low"].ToString() + "," + tempo["volumefrom"].ToString() + "," + tempo["volumeto"].ToString() + ")";
                            try
                            {
                                Console.WriteLine("ts:" + TimeHelper.ConvertStringToDateTime(tempo["time"].ToString()) + "',close:" + tempo["close"].ToString() + ",high:" + tempo["high"].ToString() + ",open:" + tempo["open"].ToString() + ",low:" + tempo["low"].ToString() + ",vf:" + tempo["volumefrom"].ToString() + ",vt:" + tempo["volumeto"].ToString());
                                SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), System.Data.CommandType.Text, sql);
                                insertnum++;
                                if (insertnum >= totalmax)
                                {
                                    flag = false;
                                }
                            }
                            catch (Exception err)
                            {
                                Console.WriteLine(err.Message);
                            }
                        }

                        url = @"https://min-api.cryptocompare.com/data/histohour?fsym=" + fromsymbol.ToUpper() + "&tsym=" + tosymbol.ToUpper() + "&limit=" + maxcount.ToString() + "&e=" + exchangename + "&toTs=" + jo["TimeFrom"].ToString();
                    }
                    else
                    {
                        Console.WriteLine(rawjson);
                    }
                }
                catch
                {
                }
            }
            Console.WriteLine("20000 datas collected press any key to exit......");
            Console.ReadKey();
        }
コード例 #4
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(TimeHelper.ConvertStringToDateTime(value.ToString()).ToString());
 }
コード例 #5
0
    public override Widget build(BuildContext context)
    {
        var inputController = new TextEditingController();

        return(new Column(
                   children: new List <Widget>()
        {
            new Padding(
                padding: EdgeInsets.only(top: 20)
                ),
            new StoreConnector <TodoListState, object>(
                converter: (state => null),
                builder: ((buildContext, _, dispatcher) =>
            {
                return new Flex(
                    direction: Axis.horizontal,
                    children: new List <Widget>()
                {
                    new Expanded(
                        flex: 6,
                        child: new TextField(
                            controller: inputController,
                            decoration: new InputDecoration(hintText: "请输入待办事项"),
                            onSubmitted: (value =>
                    {
                        TodoModel item = new TodoModel(value,
                                                       long.Parse(TimeHelper.GetTimeStamp(DateTime.Now)),
                                                       false);
                        Actions.AddAction action = new Actions.AddAction(item);
                        dispatcher.dispatch(action);
                        inputController.clear();
                    }),
                            onChanged: (value => mCurrentInptu = value)
                            )
                        ),
                    new Expanded(
                        flex: 1,
                        child: new IconButton(icon: new Icon(Icons.add),
                                              onPressed: (() =>
                    {
                        TodoModel item = new TodoModel(mCurrentInptu,
                                                       long.Parse(TimeHelper.GetTimeStamp(DateTime.Now)),
                                                       false);
                        Actions.AddAction action = new Actions.AddAction(item);
                        dispatcher.dispatch(action);
                        mCurrentInptu = string.Empty;
                        inputController.clear();
                    })
                                              )
                        )
                }
                    );
            })
                ),
            new Expanded(
                child: new StoreConnector <TodoListState, List <TodoModel> >(
                    converter: (state =>
            {
                var showState = state.showState;
                var list = state.todoList;
                switch (showState)
                {
                case ShowState.All:
                    return list;

                case ShowState.Finished:
                    return list.Where((mo => mo.isFinish)).ToList();

                case ShowState.UnFinished:
                    return list.Where((mo => (!mo.isFinish))).ToList();

                default:
                    return list;
                }
            }),
                    builder: ((buildContext, model, dispatcher) =>
            {
                return ListView.seperated(
                    itemCount: model.Count,
                    itemBuilder: ((context1, index) =>
                {
                    var item = model[index];
                    var iconColor = item.isFinish ? Colors.blue : Colors.grey;
                    return new ListTile(title: new Text(item.content),
                                        subtitle: new Text(TimeHelper.ConvertStringToDateTime(item.timestamp.ToString())
                                                           .ToString()),
                                        leading: new IconButton(icon: new Icon(Icons.check), iconSize: 20,
                                                                color: iconColor,
                                                                onPressed: (() =>
                    {
                        dispatcher.dispatch(new Actions.UpdateFinishAction(item));
                    })),
                                        trailing: new IconButton(icon: new Icon(Icons.delete), iconSize: 20,
                                                                 onPressed: (() => { dispatcher.dispatch(new Actions.DeleteAction(item)); }))
                                        );
                }),
                    separatorBuilder: ((context1, index) => { return new Divider(color: Colors.blue); })
                    );
            })
                    )
                )
        },
                   mainAxisSize: MainAxisSize.min
                   ));
    }
コード例 #6
0
        public ActionResult SearchRoute()
        {
            OTSClient  _oTSClient = OTSHelper.GetOTSClientRoute(_tableStoreModel);
            PrimaryKey pk         = new PrimaryKey();

            pk.Add("d", new ColumnValue(Convert.ToInt64(Request.Form["d"])));
            pk.Add("s", new ColumnValue(TimeHelper.ConvertDateTimeToInt(Convert.ToDateTime(Request.Form["s"]))));
            GetRowRequest  getRowRequest      = new GetRowRequest("Route", pk);
            GetRowResponse response           = _oTSClient.GetRow(getRowRequest);
            StringBuilder  sbAttributeColumns = new StringBuilder();

            foreach (var item in response.Attribute)
            {
                switch (item.Key)
                {
                case "e":
                    sbAttributeColumns.Append(item.Key + ":" + item.Value.IntegerValue + "【" + TimeHelper.ConvertStringToDateTime(item.Value.IntegerValue.ToString()).ToString("yyyy-MM-dd HH:mm:ss fff") + "】;");
                    break;

                case "r":
                    byte[] lbyte = item.Value.BinaryValue;
                    Dictionary <string, int> dictionary = ByteIntHelper.GetRouteByByte(lbyte);
                    foreach (var dic in dictionary)
                    {
                        sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; ");
                    }
                    break;

                case "ds":
                    byte[] ds = item.Value.BinaryValue;
                    Dictionary <string, int> dsDic = ByteIntHelper.GetDurationstatsByByte(ds);
                    foreach (var dic in dsDic)
                    {
                        sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; ");
                    }
                    break;

                case "es":
                    byte[] es = item.Value.BinaryValue;
                    Dictionary <string, int> esDic = ByteIntHelper.GetEventStatsByByte(es);
                    foreach (var dic in esDic)
                    {
                        sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; ");
                    }
                    break;
                }
            }
            ViewData["pk"]  = "设备:" + Request.Form["d"] + " 开始时间:" + Request.Form["s"];
            ViewData["att"] = sbAttributeColumns.ToString();
            return(View("Search", ViewBag));
        }
コード例 #7
0
        public ActionResult SearchEvent()
        {
            OTSClient  _oTSClient = OTSHelper.GetOTSClientEvent(_tableStoreModel);
            PrimaryKey pk         = new PrimaryKey();

            pk.Add("d", new ColumnValue(Convert.ToInt64(Request.Form["d"])));
            pk.Add("et", new ColumnValue(TimeHelper.ConvertDateTimeToInt(Convert.ToDateTime(Request.Form["et"]))));
            pk.Add("ei", new ColumnValue(ByteIntHelper.intToBytes2(Convert.ToInt64(Request.Form["ei"]), 1)));
            GetRowRequest  getRowRequest      = new GetRowRequest("E_100000000", pk);
            GetRowResponse response           = _oTSClient.GetRow(getRowRequest);
            StringBuilder  sbAttributeColumns = new StringBuilder();

            foreach (var item in response.Attribute)
            {
                switch (item.Key)
                {
                case "ep":
                    //事件参数字段暂不做处理
                    //byte[] ep = item.Value.BinaryValue;
                    break;

                case "t":
                    sbAttributeColumns.Append(item.Key + ":" + item.Value.IntegerValue + "【" + TimeHelper.ConvertStringToDateTime(item.Value.IntegerValue.ToString()).ToString("yyyy-MM-dd HH:mm:ss fff") + "】;");
                    break;

                case "l":
                    byte[] lbyte = item.Value.BinaryValue;
                    Dictionary <string, int> dictionary = ByteIntHelper.GetLocationByByte(lbyte);
                    foreach (var dic in dictionary)
                    {
                        sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; ");
                    }
                    break;
                }
            }

            ViewData["pk"]  = "设备:" + Request.Form["d"] + " 事件时间:" + Request.Form["et"] + " 事件ID:" + Request.Form["ei"];
            ViewData["att"] = sbAttributeColumns.ToString();
            return(View("Search", ViewBag));
        }