public RegressBuyForm() { InitializeComponent(); LUtils.InitItemListView(mainListView_); LUtils.InitItemListView(subListView_); }
private void regressWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Result == null) { regressingRe_ = null; return; } else { App.regressList_.Add(regressingRe_); RegressSelectForm selectform = (RegressSelectForm)createTabPage(regressingRe_.SelectFormName, new RegressSelectForm()); RegressBuyForm buyform = (RegressBuyForm)createTabPage(regressingRe_.BuyFormName, new RegressBuyForm()); if (regressingRe_.strategyList_.Count > 1) { createTabPage(regressingRe_.StatisStrategyDataFormName, new RegressStatisticsForm(regressingRe_, WantDataType.WD_StrategyData)); } if (regressingRe_.runMode_ == RunMode.RM_Asset) { createTabPage(regressingRe_.StatisBonusFormName, new RegressStatisticsForm(regressingRe_, WantDataType.WD_BonusData)); } else { createTabPage(regressingRe_.StatisBonusFormName, new RegressStatisticsForm(regressingRe_, WantDataType.WD_BonusData)); createTabPage(regressingRe_.StatisRateItemFormName, new RegressStatisticsForm(regressingRe_, WantDataType.WD_RateItemData)); } createTabPage(regressingRe_.StatisHistoryFormName, new RegressStatisticsForm(regressingRe_, WantDataType.WD_HistoryData)); selectform.re_ = buyform.re_ = regressingRe_; LUtils.FillListViewData(selectform.selectItemListView(), regressingRe_.selItems_); LUtils.FillListViewData(buyform.buyItemListView(), regressingRe_.buyItems_); regressingRe_ = null; } }
private void mainListView__ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (e.IsSelected) { int selDate = Utils.ToType <int>(e.Item.SubItems[1].Text); if (daySelectItems_ != null && daySelectItems_[0].date_ == selDate) { return; } daySelectItems_ = SelectResult.OfDate(selDate, re_.selItems_); daySelectItems_.Sort(delegate(SelectItem lhs, SelectItem rhs) { if (re_.buyItems_.Contains(lhs)) { return(-1); } if (re_.buyItems_.Contains(rhs)) { return(1); } return(rhs.getColumnVal("nsl").CompareTo(lhs.getColumnVal("nsl"))); }); LUtils.FillListViewData(subListView_, daySelectItems_); } else { LUtils.RemoveAllListRow(subListView_); daySelectItems_ = null; } }
private void selectWorker_DoWork(object sender, DoWorkEventArgs e) { isBusy_ = true; try { reSelect_ = null; LUtils.RemoveAllListRow(selectListView_); if (!App.ds_.prepareForSelect()) { reportSelectMsg("准备数据工作失败,无法继续执行!", false); if (autoSelectMode()) { selectTask_.reportError("prepare work fail"); } return; } SelectManager manager = new SelectManager(); reSelect_ = manager.selectNow(); } catch (Exception ex) { reSelect_ = null; reportSelectMsg(String.Format("执行发生异常:{0}", ex.Message), false); if (autoSelectMode()) { selectTask_.reportError("raise exception: " + ex.Message); } throw; } }
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 RegressStatisticsForm(RegressResult re, WantDataType wd) { InitializeComponent(); re_ = re; wd_ = wd; menuStrip1.Visible = false; writeAssetToolStripMenuItem.Visible = false; writeAsOptimizeToolStripMenuItem.Visible = false; chart_.Titles.Add("Title"); string sMode = re.runMode_ == RunMode.RM_Asset ? "Asset mode" : "Raw mode"; chart_.Titles[0].Text = String.Format("{0} {1}", re.solutionName_, sMode); switch (wd_) { case WantDataType.WD_BonusData: fillBonusChart(); break; case WantDataType.WD_StrategyData: fillStrategyDataChart(); break; case WantDataType.WD_RateItemData: fillRateItemChart(); menuStrip1.Visible = true; writeAssetToolStripMenuItem.Visible = true; break; case WantDataType.WD_HistoryData: fillHistoryDataChart(); menuStrip1.Visible = true; writeAsOptimizeToolStripMenuItem.Visible = true; if (re_.reHistory_ == null) { break; } historyView.Columns.Add("solution", 80); LUtils.InitListView(historyView, HistoryData.ShowColumnInfos); historyView.Items.Add(re_.reHistory_.toListViewItem(historyView, re_.solutionName_)); addSolutionBestDataToHistoryView(re_.solutionName_, "best"); break; default: throw new ArgumentException("Unknown data type!"); } }
private void mainListView__ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (e.IsSelected) { int selDate = Utils.ToType <int>(e.Item.SubItems[1].Text); if (daySelectItems_ != null && daySelectItems_.Count > 0 && daySelectItems_[0].date_ == selDate) { return; } daySelectItems_ = SelectResult.OfDate(selDate, re_.selItems_); App.grp_.makeDeside(daySelectItems_, selDate, RankBuyDesider.buyer_, false); LUtils.FillListViewData(subListView_, daySelectItems_); } else { LUtils.RemoveAllListRow(subListView_); daySelectItems_ = null; } }
private void readMinuteSelectToolStripMenuItem_Click(object sender, EventArgs e) { if (isBusy_) { return; } List <SelectItem> selectItems = new List <SelectItem>(); var dt = DB.Global().Select("Select * From minute_select"); foreach (DataRow row in dt.Rows) { SelectItem item = new SelectItem(); item.code_ = row["code"].ToString(); item.date_ = Utils.ToType <int>(row["date"].ToString()); item.strategyName_ = row["straname"].ToString(); item.buyNormlizePrice_ = Utils.ToType <int>(row["buyNormlizePrice"].ToString()); item.sigInfo_ = Utils.ToPrice(item.buyNormlizePrice_).ToString() + " at " + row["selecttime"].ToString().Split(' ')[1]; item.allSelectItems_ = new List <SelectItem>(); item.rateItemDict_ = new Dictionary <string, string>(); selectItems.Add(item); } LUtils.FillListViewData(selectListView_, selectItems); }
private void subListView__ColumnClick(object sender, ColumnClickEventArgs e) { LUtils.OnColumnClick(subListView_, e.Column, ref subListViewSortColumn_); }
private void subListView__RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { e.Item = LUtils.RetrieveVirtualItem(subListView_, e.ItemIndex, daySelectItems_); }
private void mainListView__RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { e.Item = LUtils.RetrieveVirtualItem(mainListView_, e.ItemIndex, re_.buyItems_); }
private void historyView_ColumnClick(object sender, ColumnClickEventArgs e) { LUtils.OnColumnClick(historyView, e.Column, ref sortColumn_); }
void fillStrategyDataChart() { if (re_.strategyList_.Count < 2) { return; } Dictionary <String, int> straBuyItemCount = new Dictionary <String, int>(); Dictionary <String, float> straBonusDict = new Dictionary <String, float>(); int nTotalCount = 0; float totalBonus = 0; foreach (var item in re_.selItems_) { if (!item.iamBuyItem_) { continue; } ++nTotalCount; if (straBuyItemCount.ContainsKey(item.strategyName_)) { straBuyItemCount[item.strategyName_]++; } else { straBuyItemCount[item.strategyName_] = 1; } var bonus = item.getColumnVal("bonus"); if (bonus != "") { float bonusValue = Utils.GetBonusValue(bonus); if (straBonusDict.ContainsKey(item.strategyName_)) { straBonusDict[item.strategyName_] += bonusValue; } else { straBonusDict[item.strategyName_] = bonusValue; } totalBonus += bonusValue; } } historyView.Columns.Add("strategy", 80); LUtils.InitListView(historyView, HistoryData.ShowColumnInfos); foreach (var kv in straBuyItemCount) { addSolutionBestDataToHistoryView("$" + kv.Key, kv.Key); } DataTable dt = new DataTable(); dt.Columns.Add("xDesc"); dt.Columns.Add("count"); dt.Columns.Add("bonusValue"); foreach (var kv in straBuyItemCount) { DataRow row = dt.NewRow(); row["xDesc"] = kv.Key; row["count"] = kv.Value; float bonus; if (straBonusDict.TryGetValue(kv.Key, out bonus)) { row["bonusValue"] = bonus; } dt.Rows.Add(row); } chart_.ChartAreas[0].Name = dt.Columns[1].ColumnName; ChartArea area = new ChartArea(dt.Columns[2].ColumnName); chart_.ChartAreas.Add(area); for (int i = 1; i < dt.Columns.Count; ++i) { var col = dt.Columns[i]; var series = new Series(); series.Name = col.ColumnName; series.XValueMember = "xDesc"; series.YValueMembers = col.ColumnName; series.ToolTip = col.ColumnName; series.ChartType = SeriesChartType.Pie; series.ChartArea = col.ColumnName; chart_.Series.Add(series); } chart_.DataSource = dt; }
private void selectList__RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { e.Item = LUtils.RetrieveVirtualItem(selectListView_, e.ItemIndex, reSelect_.selItems_); }
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; } } }
public void doSelectWork() { DB.Global().Execute(String.Format("Delete From autoselect")); LUtils.RemoveAllListRow(selectListView_); selectWorker.RunWorkerAsync(); }