private void textBox证券代码_Leave(object sender, EventArgs e) { if (this.textBox证券代码.Text.Length > 0) { string stockID = this.textBox证券代码.Text.Trim(); int market = CommonUtils.GetCodeMarket(stockID); this.comboBox市场.SelectedIndex = market; Task.Run(() => { int marketNet; string stockName; try { if (StockPosition.StockInfoUtils.GetStockNameMarket(this.textBox证券代码.Text, out marketNet, out stockName)) { this.BeginInvoke(new Action(() => { this.comboBox市场.SelectedIndex = marketNet; textBox证券名称.Text = stockName; textBox拼音缩写.Text = Regex.Replace(PinYin.PinYinConvertor.GetFirstPinyin(textBox证券名称.Text), "[^a-zA-Z]", ""); })); } } catch (Exception) { } }); } }
private void button添加交易额度_Click(object sender, EventArgs e) { if (this.numericUpDown手续费率.Value == 0) { var market = CommonUtils.GetCodeMarket(this.textBox证券代码.Text); if (this.comboBox市场.SelectedIndex != market) { var isSave = MessageBox.Show("选择的市场与根据股票代码检测到的市场不匹配,是否保存?", "提示", MessageBoxButtons.OKCancel); if (isSave == System.Windows.Forms.DialogResult.Cancel) { return; } } var result = MessageBox.Show("手续费率为0,是否保存?", "提示", MessageBoxButtons.OKCancel); if (result != System.Windows.Forms.DialogResult.OK) { return; } } Program.AASServiceClient.AddTradeLimit(this.comboBox交易员.Text, this.textBox证券代码.Text, this.comboBox组合号.Text, (byte)this.comboBox市场.SelectedIndex, this.textBox证券名称.Text, this.textBox拼音缩写.Text, (买模式)this.comboBox买模式.SelectedIndex, (卖模式)this.comboBox卖模式.SelectedIndex, this.numericUpDown交易额度.Value, this.numericUpDown手续费率.Value); this.DialogResult = System.Windows.Forms.DialogResult.OK; }