コード例 #1
0
        public List <SecurityInformationViewModel> GetSecuritiesInformationViewModels(
            [ModelBinder(typeof(TypeSafeEnumModelBinder))] StockBoard tradeSector = null, string securityCode = null)
        {
            List <SecurityInformation> entities = _marketDataProvider.GetSecuritiesInformation(tradeSector, securityCode);

            return(AutoMapper.Mapper.Map <List <SecurityInformation>, List <SecurityInformationViewModel> >(entities));
        }
コード例 #2
0
        private EntityResponse <List <SecurityInformation> > GetAllSecuritiesInformationFromLibrary()
        {
            var tradeSectorA = Task.Run(() => _marketDataProvider.GetSecuritiesInformation(StockBoard.SHAShares));

            //var tradeSectorB = Task.Run(() => _marketDataProvider.GetSecuritiesInformation(StockBoard.SHBShares));

            //Task.WaitAll(tradeSectorA, tradeSectorB);
            Task.WaitAll(tradeSectorA);

            //if (!tradeSectorA.Result.IsSuccess)
            //{
            //    Logging.Logger.Debug("thread ID:" + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ", GetAllSecuritiesInformationFromLibrary tradeSectorA.Result.IsSuccess: " + tradeSectorA.Result.IsSuccess + ", errorCode is" + tradeSectorA.Result.ErrorCode + ", class is MarketDataProviderCache");
            //    return tradeSectorA.Result;
            //}
            //Logging.Logger.Debug("thread ID:" + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ", GetAllSecuritiesInformationFromLibrary tradeSectorB.Result.IsSuccess: " + tradeSectorB.Result.IsSuccess + ", errorCode is" + tradeSectorB.Result.ErrorCode + ", class is MarketDataProviderCache");
            //if (!tradeSectorB.Result.IsSuccess)
            //{
            //    Logging.Logger.Debug("thread ID:" + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ", GetAllSecuritiesInformationFromLibrary tradeSectorB.Result.IsSuccess: " + tradeSectorB.Result.IsSuccess + ", errorCode is" + tradeSectorB.Result.ErrorCode + ", class is MarketDataProviderCache");
            //    return tradeSectorB.Result;
            //}

            List <SecurityInformation> result = new List <SecurityInformation>();

            if (tradeSectorA.Result.IsSuccess)
            {
                result.AddRange(tradeSectorA.Result.Entity);
            }

            if (result.Count == 0)
            {
                return(tradeSectorA.Result);
            }
            //List<SecurityInformation> result = tradeSectorA.Result.Entity;
            //result.AddRange(tradeSectorB.Result.Entity);
            return(result);
        }