Ejemplo n.º 1
0
        /// <summary>
        /// 导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (repository == null)
            {
                repository = new IndicatorRepository(textBox2.Text);
                repository.Initilization();
            }

            List <SecurityProperties> sps = null;

            if (radioButton1.Checked)
            {
                sps = new SHTrader().LoadStockAInfo(this.textBox1.Text);
            }
            else if (radioButton2.Checked)
            {
                sps = new SZTrader().LoadStockInfo(this.textBox1.Text, "主板");
            }
            else if (radioButton3.Checked)
            {
                sps = new SZTrader().LoadStockInfo(this.textBox1.Text, "创业板");
            }
            else if (radioButton4.Checked)
            {
                sps = new SZTrader().LoadStockInfo(this.textBox1.Text, "中小板");
            }
            else
            {
                MessageBox.Show("需选择导入类型");
                return;
            }
            if (sps == null)
            {
                MessageBox.Show("没有需要导入的数据");
                return;
            }

            SecurityPropertiesSet securities = repository.Securities;

            securities.Merge(sps);
            repository.SaveSecuritiesInfo();
            MessageBox.Show("导入完成");
        }