Ejemplo n.º 1
0
        // Load stock list specified in the user's portfolio
        protected void LoadPortfolioStock()
        {
            StringCollection stockList = new StringCollection();
            TreeNode         node;

            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            portfolioTbl.Clear();
            myStockCodeTbl.Clear();
            dataLibs.LoadPortfolioByInvestor(portfolioTbl, sysLibs.sysLoginCode, AppTypes.PortfolioTypes.Portfolio);
            stockTV.Nodes.Clear();
            DataView myStockView = new DataView(myStockCodeTbl);

            data.baseDS.stockCodeRow stockRow;
            myStockView.Sort = myStockCodeTbl.codeColumn.ColumnName;

            StringCollection list = new StringCollection();

            for (int idx1 = 0; idx1 < portfolioTbl.Count; idx1++)
            {
                node = stockTV.Nodes.Add(portfolioTbl[idx1].name);

                list.Clear();
                list.Add(portfolioTbl[idx1].code);
                myStockCodeTbl.Clear();
                if (portfolioTbl[idx1].type == (byte)AppTypes.PortfolioTypes.WatchList)
                {
                    dataLibs.LoadStockCode_ByWatchList(myStockCodeTbl, list);
                }
                else
                {
                    dataLibs.LoadStockCode_ByPortfolios(myStockCodeTbl, list);
                }

                stockList.Clear();
                for (int idx2 = 0; idx2 < myStockView.Count; idx2++)
                {
                    stockRow = (data.baseDS.stockCodeRow)myStockView[idx2].Row;
                    //Ignore duplicate stocks
                    if (stockList.Contains(stockRow.tickerCode))
                    {
                        continue;
                    }
                    stockList.Add(stockRow.tickerCode);
                    node.Nodes.Add(stockRow.tickerCode);
                }
                node.Text = node.Text + "(" + node.Nodes.Count.ToString() + ")";
                node.ExpandAll();
            }
        }
Ejemplo n.º 2
0
        // Load stock list specified in the user's portfolio
        protected void LoadPortfolioStock()
        {
            StringCollection stockList = new StringCollection();
            TreeNode node;

            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            portfolioTbl.Clear();
            myStockCodeTbl.Clear();
            dataLibs.LoadPortfolioByInvestor(portfolioTbl, sysLibs.sysLoginCode, AppTypes.PortfolioTypes.Portfolio);
            stockTV.Nodes.Clear();
            DataView myStockView = new DataView(myStockCodeTbl);
            data.baseDS.stockCodeRow stockRow;
            myStockView.Sort = myStockCodeTbl.codeColumn.ColumnName;

            StringCollection list = new StringCollection();
            for (int idx1 = 0; idx1 < portfolioTbl.Count; idx1++)
            {
                node = stockTV.Nodes.Add(portfolioTbl[idx1].name);

                list.Clear();
                list.Add(portfolioTbl[idx1].code);
                myStockCodeTbl.Clear();
                if (portfolioTbl[idx1].type == (byte)AppTypes.PortfolioTypes.WatchList)
                    dataLibs.LoadStockCode_ByWatchList(myStockCodeTbl, list);
                else
                    dataLibs.LoadStockCode_ByPortfolios(myStockCodeTbl, list);

                stockList.Clear();
                for (int idx2 = 0; idx2 < myStockView.Count; idx2++)
                {
                    stockRow = (data.baseDS.stockCodeRow)myStockView[idx2].Row;  
                    //Ignore duplicate stocks
                    if (stockList.Contains(stockRow.tickerCode)) continue;
                    stockList.Add(stockRow.tickerCode);
                    node.Nodes.Add(stockRow.tickerCode);
                }
                node.Text = node.Text + "(" + node.Nodes.Count.ToString() + ")";
                node.ExpandAll();
            }
        }
Ejemplo n.º 3
0
        protected override void SaveData()
        {
            common.MultiValueString              mvString     = new common.MultiValueString();
            data.baseDS.portfolioDataTable       portfolioTbl = new data.baseDS.portfolioDataTable();
            data.baseDS.portfolioDetailDataTable portfolioDataTbl;
            portfolioTbl.Clear();
            for (int portfolioIdx = 0; portfolioIdx < watchListLb.myCheckedValues.Count; portfolioIdx++)
            {
                data.baseDS.portfolioRow portfolioRow = DataAccess.Libs.GetPortfolio_ByCode(watchListLb.myCheckedValues[portfolioIdx]);
                if (portfolioRow == null)
                {
                    continue;
                }
                mvString.myFormatString = portfolioRow.interestedStock;
                mvString.Add(codeEd.Text);
                portfolioRow.interestedStock = mvString.myFormatString;

                portfolioDataTbl = DataAccess.Libs.GetPortfolioDetail_ByCode(portfolioRow.code);
                data.baseDS.portfolioDetailRow dataRow;
                for (int idx = 0; idx < myStrategyCodes.Count; idx++)
                {
                    dataRow = portfolioDataTbl.FindByportfoliocodesubCode(portfolioRow.code, this.codeEd.Text, this.myStrategyCodes[idx]);
                    if (dataRow == null)
                    {
                        dataRow = portfolioDataTbl.NewportfolioDetailRow();
                        commonClass.AppLibs.InitData(dataRow);
                        dataRow.portfolio = portfolioRow.code;
                        dataRow.code      = codeEd.Text;
                        dataRow.subCode   = this.myStrategyCodes[idx];
                        portfolioDataTbl.AddportfolioDetailRow(dataRow);
                    }
                    mvString.myFormatString = dataRow.data;
                    mvString.Add(timeScaleCb.myValue.Code);
                    dataRow.data = mvString.myFormatString;
                }
                DataAccess.Libs.UpdateData(portfolioRow);
                DataAccess.Libs.UpdateData(portfolioDataTbl);
            }
            common.system.ShowMessage(Languages.Libs.GetString("dataSaved"));
        }
        protected override void SaveData()
        {
            common.MultiValueString mvString = new common.MultiValueString();
            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            data.baseDS.portfolioDetailDataTable portfolioDataTbl;
            portfolioTbl.Clear();
            for (int portfolioIdx = 0; portfolioIdx < watchListLb.myCheckedValues.Count; portfolioIdx++)
            {
                data.baseDS.portfolioRow portfolioRow = DataAccess.Libs.GetPortfolio_ByCode(watchListLb.myCheckedValues[portfolioIdx]);
                if (portfolioRow == null) continue;
                mvString.myFormatString = portfolioRow.interestedStock;
                mvString.Add(codeEd.Text);
                portfolioRow.interestedStock = mvString.myFormatString;

                portfolioDataTbl = DataAccess.Libs.GetPortfolioDetail_ByCode(portfolioRow.code);
                data.baseDS.portfolioDetailRow dataRow;
                for (int idx = 0; idx < myStrategyCodes.Count; idx++)
                {
                    dataRow = portfolioDataTbl.FindByportfoliocodesubCode(portfolioRow.code, this.codeEd.Text, this.myStrategyCodes[idx]);
                    if (dataRow == null)
                    {
                        dataRow = portfolioDataTbl.NewportfolioDetailRow();
                        commonClass.AppLibs.InitData(dataRow);
                        dataRow.portfolio = portfolioRow.code;
                        dataRow.code = codeEd.Text;
                        dataRow.subCode = this.myStrategyCodes[idx];
                        portfolioDataTbl.AddportfolioDetailRow(dataRow);
                    }
                    mvString.myFormatString = dataRow.data;
                    mvString.Add(timeScaleCb.myValue.Code);
                    dataRow.data = mvString.myFormatString;
                }
                DataAccess.Libs.UpdateData(portfolioRow);
                DataAccess.Libs.UpdateData(portfolioDataTbl);
            }
            common.system.ShowMessage(Languages.Libs.GetString("dataSaved"));
        }