Exemple #1
0
        //拼接股票URL
        private void stock_appendurl(string stock, ref string stockurl, string url, bool ispicture)
        {
            GeneralClass gc   = new GeneralClass();
            string       head = stock.Substring(0, 2);
            Stock_Index  si   = new Stock_Index();

            if (!gc.stock_checkout(stock, ref si))
            {
                return;
            }

            StringBuilder s = new StringBuilder(url);

            switch (si.market)
            {
            case FlagDef.SH:     //上海
                s.Append("sh");
                break;

            case FlagDef.SZ:     //深证
                s.Append("sz");
                break;

            default:
                return;
            }

            s.Append(stock);
            if (ispicture)
            {
                s.Append(".gif");
            }

            stockurl = s.ToString();
        }
Exemple #2
0
        /// <summary>
        /// 自选股增加功能101
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddStockbt_Click(object sender, EventArgs e)
        {
            GeneralClass gc = new GeneralClass();
            string stkcode = stockntb.Text;
            Stock_Index si = new Stock_Index();

            //校验是否重复
            foreach (string s in CfgStruct.lns)
            {
                string _stkcode = s.Split(' ')[0];
                if (_stkcode == stkcode)
                {
                    MessageBox.Show("自选股列表存在该股票,请勿重复添加");
                    return;
                }
            }
            //校验stkcode
            if (!gc.stock_checkout(stkcode, ref si))
            {
                MessageBox.Show("e-101001股票代码有误");
                //stockntb.Text = "";
                return;
            }

            if(!gc.ModiUserStocklistFromDB(CfgStruct.curuserid, stkcode, FlagDef.ADD))
            {
                MessageBox.Show("e-101002向数据库增加个股失败");
                return;
            }

            RefreshOptionlist();
            stockntb.Text = "";
            stockntb.Focus();
        }
Exemple #3
0
        /// <summary>
        /// 自选股删除功能102
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteStockbt_Click(object sender, EventArgs e)
        {
            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            string            sdel       = "确定要删除" + CfgStruct.stockcur + "吗?";
            DialogResult      dr         = MessageBox.Show(sdel, "删除确定", messButton);

            if (dr == DialogResult.Cancel)  //如果点击“Cancel”按钮
            {
                return;
            }

            GeneralClass gc      = new GeneralClass();
            string       stkcode = stockntb.Text;
            Stock_Index  si      = new Stock_Index();

            //校验stkcode
            if (!gc.stock_checkout(stkcode, ref si))
            {
                MessageBox.Show("e-102001股票代码有误");
                //stockntb.Text = "";
                return;
            }

            //在数据库中删除
            if (!gc.ModiUserStocklistFromDB(CfgStruct.curuserid, stkcode, FlagDef.REMOVE))
            {
                MessageBox.Show("e-102002向数据库删除个股失败");
                return;
            }

            RefreshOptionlist();
            stockntb.SelectAll();
            stockntb.Focus();
        }
Exemple #4
0
        /// <summary>
        /// 自选股增加功能101
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddStockbt_Click(object sender, EventArgs e)
        {
            GeneralClass gc      = new GeneralClass();
            string       stkcode = stockntb.Text;
            Stock_Index  si      = new Stock_Index();

            //校验是否重复
            foreach (string s in CfgStruct.lns)
            {
                string _stkcode = s.Split(' ')[0];
                if (_stkcode == stkcode)
                {
                    MessageBox.Show("自选股列表存在该股票,请勿重复添加");
                    return;
                }
            }
            //校验stkcode
            if (!gc.stock_checkout(stkcode, ref si))
            {
                MessageBox.Show("e-101001股票代码有误");
                //stockntb.Text = "";
                return;
            }

            if (!gc.ModiUserStocklistFromDB(CfgStruct.curuserid, stkcode, FlagDef.ADD))
            {
                MessageBox.Show("e-101002向数据库增加个股失败");
                return;
            }

            RefreshOptionlist();
            stockntb.Text = "";
            stockntb.Focus();
        }
Exemple #5
0
        /// <summary>
        /// 选中个股功能100
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void optionallist_SelectedIndexChanged(object sender, EventArgs e)
        {
            string stockget = optionallist.Text.Split(' ')[0];

            Stock_Index  si = new Stock_Index();
            GeneralClass gc = new GeneralClass();

            //检验股票代码是否正确
            if (!gc.stock_checkout(stockget, ref si))
            {
                gc.ModiUserStocklistFromDB(CfgStruct.curuserid, stockget, FlagDef.REMOVE);
                MessageBox.Show("e-100001股票代码不正确,已删除.");
                return;
            }

            stockntb.Text      = stockget;
            CfgStruct.stockcur = stockget;
            lb_syssem.Items.Clear();

            string showstock = "当前选择:" + si.stockname;

            lb_syssem.Items.Add(showstock);

            //实时行情获取
            Cycle_stockmarket(sender, e);
        }
Exemple #6
0
        /// <summary>
        /// 获取股票代码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void okbutton_Click(object sender, EventArgs e)
        {
            GeneralClass gc       = new GeneralClass();
            string       stockget = stockntb.Text;
            Stock_Index  si       = new Stock_Index();

            if (gc.stock_checkout(stockget, ref si))
            {
                AdvStock.mystock   = stockget;
                statusl.Text       = AdvStock.mystock + " Get";
                currentstockl.Text = si.stockname;
            }
            else
            {
                MessageBox.Show("Error: " + stockget + " is not a stock code.");
            }
        }
Exemple #7
0
        //拼接股票URL
        private void stock_appendurl(string stock, ref string stockurl, string url, bool ispicture)
        {
            GeneralClass gc = new GeneralClass();
            string head = stock.Substring(0, 2);
            Stock_Index si = new Stock_Index();

            if (!gc.stock_checkout(stock, ref si))
                return;

            StringBuilder s = new StringBuilder(url);
            switch (si.market)
            {
                case FlagDef.SH: //上海
                    s.Append("sh");
                    break;
                case FlagDef.SZ: //深证
                    s.Append("sz");
                    break;
                default:
                    return;
            }

            s.Append(stock);
            if(ispicture)
                s.Append(".gif");

            stockurl = s.ToString();
        }
Exemple #8
0
        /// <summary>
        /// 选中个股功能100
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void optionallist_SelectedIndexChanged(object sender, EventArgs e)
        {
            string stockget = optionallist.Text.Split(' ')[0];

            Stock_Index si = new Stock_Index();
            GeneralClass gc = new GeneralClass();

            //检验股票代码是否正确
            if (!gc.stock_checkout(stockget, ref si))
            {
                gc.ModiUserStocklistFromDB(CfgStruct.curuserid, stockget, FlagDef.REMOVE);
                MessageBox.Show("e-100001股票代码不正确,已删除.");
                return;
            }

            stockntb.Text = stockget;
            CfgStruct.stockcur = stockget;
            lb_syssem.Items.Clear();

            string showstock = "当前选择:" + si.stockname;
            lb_syssem.Items.Add(showstock);

            //实时行情获取
            Cycle_stockmarket(sender, e);
        }
Exemple #9
0
        /// <summary>
        /// 自选股删除功能102
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteStockbt_Click(object sender, EventArgs e)
        {
            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            string sdel = "确定要删除" + CfgStruct.stockcur + "吗?";
            DialogResult dr = MessageBox.Show(sdel, "删除确定", messButton);
            if (dr == DialogResult.Cancel)  //如果点击“Cancel”按钮
                return;

            GeneralClass gc = new GeneralClass();
            string stkcode = stockntb.Text;
            Stock_Index si = new Stock_Index();

            //校验stkcode
            if (!gc.stock_checkout(stkcode, ref si))
            {
                MessageBox.Show("e-102001股票代码有误");
                //stockntb.Text = "";
                return;
            }

            //在数据库中删除
            if (!gc.ModiUserStocklistFromDB(CfgStruct.curuserid, stkcode, FlagDef.REMOVE))
            {
                MessageBox.Show("e-102002向数据库删除个股失败");
                return;
            }

            RefreshOptionlist();
            stockntb.SelectAll();
            stockntb.Focus();
        }
        /// <summary>
        /// 获取股票代码 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void okbutton_Click(object sender, EventArgs e)
        {
            GeneralClass gc = new GeneralClass();
            string stockget = stockntb.Text;
            Stock_Index si = new Stock_Index();

            if (gc.stock_checkout(stockget, ref si))
            {
                AdvStock.mystock = stockget;
                statusl.Text = AdvStock.mystock + " Get";
                currentstockl.Text = si.stockname;
            }
            else
                MessageBox.Show("Error: " + stockget + " is not a stock code.");
        }