Пример #1
0
        private StringCollection GetStockList()
        {
            StringCollection stockCodeList = new StringCollection();

            //Load stocks in selected subsectors if existed
            data.baseDS.stockCodeDataTable selectedStockCodeTbl = null;
            StringCollection subSectorCodeList = subSectorSelect.myCheckedValues;

            if (subSectorCodeList != null && subSectorCodeList.Count > 0)
            {
                selectedStockCodeTbl = new data.baseDS.stockCodeDataTable();
                dataLibs.LoadStockCode_ByBizSectors(selectedStockCodeTbl, subSectorCodeList);
                if (selectedStockCodeTbl.Count == 0)
                {
                    selectedStockCodeTbl.Dispose();
                    selectedStockCodeTbl = null;
                }
            }

            //User specify screening criteria ??
            data.baseDS.stockCodeDataTable tmpStockCodeTbl = new data.baseDS.stockCodeDataTable();
            bool haveScrList = application.dataLibs.LoadStockCode_ByCriteria(tmpStockCodeTbl, GetScrCriteria());

            if (haveScrList)
            {
                DataView myStockView = new DataView(tmpStockCodeTbl);
                data.baseDS.stockCodeRow stockRow;
                myStockView.Sort = tmpStockCodeTbl.codeColumn.ColumnName + "," + tmpStockCodeTbl.stockExchangeColumn.ColumnName;
                for (int idx = 0; idx < myStockView.Count; idx++)
                {
                    stockRow = (data.baseDS.stockCodeRow)myStockView[idx].Row;
                    //Ignore stock NOT in selected subsectors
                    if (selectedStockCodeTbl != null && selectedStockCodeTbl.FindBycode(stockRow.code) == null)
                    {
                        continue;
                    }
                    //Ignore duplicate stocks
                    if (stockCodeList.Contains(stockRow.code))
                    {
                        continue;
                    }
                    stockCodeList.Add(stockRow.code);
                }
                return(stockCodeList);
            }
            //If user NOT specify screening criteria BUT  specify stock code
            if (selectedStockCodeTbl != null)
            {
                for (int idx = 0; idx < selectedStockCodeTbl.Count; idx++)
                {
                    //Ignore duplicate stocks
                    if (stockCodeList.Contains(selectedStockCodeTbl[idx].code))
                    {
                        continue;
                    }
                    stockCodeList.Add(selectedStockCodeTbl[idx].code);
                }
            }
            return(stockCodeList);
        }
Пример #2
0
        private StringCollection GetStockList()
        {
            StringCollection stockCodeList = new StringCollection();

            //Load stocks in selected subsectors if existed
            data.baseDS.stockCodeDataTable selectedStockCodeTbl = null;
            StringCollection subSectorCodeList = subSectorSelect.myCheckedValues;
            if (subSectorCodeList != null && subSectorCodeList.Count > 0)
            {
                selectedStockCodeTbl = new data.baseDS.stockCodeDataTable();
                dataLibs.LoadStockCode_ByBizSectors(selectedStockCodeTbl, subSectorCodeList);
                if (selectedStockCodeTbl.Count == 0)
                {
                    selectedStockCodeTbl.Dispose();
                    selectedStockCodeTbl = null;
                }
            }

            //User specify screening criteria ??
            data.baseDS.stockCodeDataTable tmpStockCodeTbl = new data.baseDS.stockCodeDataTable();
            bool haveScrList = application.dataLibs.LoadStockCode_ByCriteria(tmpStockCodeTbl, GetScrCriteria());
            if (haveScrList)
            {
                DataView myStockView = new DataView(tmpStockCodeTbl);
                data.baseDS.stockCodeRow stockRow;
                myStockView.Sort = tmpStockCodeTbl.codeColumn.ColumnName + "," + tmpStockCodeTbl.stockExchangeColumn.ColumnName;
                for (int idx = 0; idx < myStockView.Count; idx++)
                {
                    stockRow = (data.baseDS.stockCodeRow)myStockView[idx].Row;
                    //Ignore stock NOT in selected subsectors
                    if (selectedStockCodeTbl != null && selectedStockCodeTbl.FindBycode(stockRow.code) == null) continue;
                    //Ignore duplicate stocks
                    if (stockCodeList.Contains(stockRow.code)) continue;
                    stockCodeList.Add(stockRow.code);
                }
                return stockCodeList;
            }
            //If user NOT specify screening criteria BUT  specify stock code 
            if (selectedStockCodeTbl != null)
            {
                for (int idx = 0; idx < selectedStockCodeTbl.Count; idx++)
                {
                    //Ignore duplicate stocks
                    if (stockCodeList.Contains(selectedStockCodeTbl[idx].code)) continue;
                    stockCodeList.Add(selectedStockCodeTbl[idx].code);
                }
            }
            return stockCodeList;
        }