public MainForm() { Me = this; InitializeComponent(); // TheWebSocketServer.Start(); var skinName = Utils.GetSysInfo(DB.Global(), "SkinName", ""); if (skinName != "") { skinEngine_ = new Sunisoft.IrisSkin.SkinEngine(); MainForm.Me.skinEngine_.SkinFile = Path.Combine(Dist.binPath_, "Skins", skinName); } msgText.Text = ""; toolStripStatusLabel1_.Text = DataStore.DataMode ? "Partial" : "Full"; toolStripStatusLabel2_.Text = ""; App.host_ = this; LUtils.InitItemListView(selectListView_); autoSelectModeToolStripMenuItem.Checked = true; startupTime_ = DateTime.Now; timer_.Start(); SelectTask.Init(); int nSendCount = DB.Global().ExecuteScalar <int>("Select Count(*) From already_send_sms"); int nAllCount = Utils.ToType <int>(Utils.GetSysInfo(DB.Global(), "Sms.Count", "0")); if (nSendCount > nAllCount - 100) { Sms.SendMsgIfTodayNotSend("No sms quickly!"); } }
public static SelectTask QueryTask() { String sSelectingID = DB.Global().ExecuteScalar <String>("Select ID From select_task Where startTime is null Order by ID limit 1"); if (sSelectingID == null) { return(null); } SelectTask ret = new SelectTask(); ret.sSelectingID_ = sSelectingID; return(ret); }
private void timer__Tick(object sender, EventArgs e) { if (bIsSucStart_ || isBusy_) { return; } App.host_.uiSetTradeDay(); DateTime curTime = DateTime.Now; SelectTask.AutoSelect(autoSelectModeToolStripMenuItem.Checked && Utils.NowIsTradeDay() && Utils.IsTradeTime(curTime.Hour, curTime.Minute)); if ((curTime.Year != startupTime_.Year || curTime.Month != startupTime_.Month || curTime.Day != startupTime_.Day) && curTime.Hour >= 6) { Process.Start(Assembly.GetExecutingAssembly().Location, "reset"); Close(); } }
private void selectWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (reSelect_ != null && reSelect_.selItems_.Count > 0) { if (autoSelectMode()) { var selMsgArr = new List <String>(); foreach (var item in reSelect_.selItems_) { if (item.strategyName_ == "LF_M_T" || item.strategyName_ == "LF_M_NEW") { sendSMS(String.Format("验证码: {0}", item.code_)); } selMsgArr.Add(String.Format("{0}: {1}", item.code_, item.getColumnVal("name"))); } reportSelectMsg(String.Join("$n", selMsgArr), true); } Action action; Invoke(action = () => { LUtils.FillListViewData(selectListView_, reSelect_.selItems_); }); DateTime curTime = DateTime.Now; foreach (var item in reSelect_.selItems_) { Dictionary <String, Object> selectItem = new Dictionary <string, object>(); selectItem["code"] = item.code_; selectItem["name"] = item.getColumnVal("name"); selectItem["date"] = item.date_; selectItem["straname"] = item.strategyName_; selectItem["zf"] = item.getColumnVal("zf"); selectItem["close"] = item.getColumnVal("close"); selectItem["pubrank"] = item.getColumnVal("pubrank"); selectItem["prirank"] = item.getColumnVal("prirank"); selectItem["selecttime"] = Utils.ToTimeDesc(curTime); DB.Global().Insert("autoselect", selectItem); } } else { if (autoSelectMode()) { reportSelectMsg("No candidate", false); } } if (reSelect_ != null) { if (Utils.NowIsTradeDay()) { showRuntimeInfo(); } } showForm("TabSelect"); reportSelectMsg("Select completed at " + DateTime.Now.ToString("yyyy/MM/dd-HH:mm:ss"), false); isBusy_ = false; if (autoSelectMode()) { try { selectTask_.end(); selectTask_ = null; DateTime curTime = DateTime.Now; if (Utils.IsTradeTime(curTime.Hour, curTime.Minute)) { Action action; Invoke(action = () => { readMinuteSelectToolStripMenuItem_Click(null, null); }); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); return; } } }