コード例 #1
0
        public int StartDataSource()
        {
            _logger.Info(Title, "开始连接数据源!");
            if (_dataAdapter.Start() == 0 && _dataAdapter.IsRunning)
            {
                _logger.Warn(Title, "数据源已连接!");
                _logger.Info(Title, "开始获取代码列表!");
                List <MarketCode> codes;
                int count = _dataAdapter.GetCodeTable(out codes);
                if (count > 0)
                {
                    StockCodeManager.GetInstance.UpdateMarketCodes(codes);
                    _logger.Warn(Title, "获取代码列表成功!");

                    RestoreDataSource();
                    return(0);
                }
                _logger.Error(Title, "代码列表获取失败!");
            }
            _logger.Error(Title, "数据源连接失败!");
            return(1);
        }