private void LoadTemplateStock(int archiveId)
        {
            if (archiveId < 0)
            {
                return;
            }

            _secuDataSource.Clear();
            var stocks = _templateBLL.GetStocks(archiveId);

            if (stocks != null)
            {
                foreach (var stock in stocks)
                {
                    var secuInfo = SecurityInfoManager.Instance.Get(stock.SecuCode, Model.SecurityInfo.SecurityType.Stock);
                    if (secuInfo != null)
                    {
                        stock.SecuName = secuInfo.SecuName;
                        stock.Exchange = SecurityItemHelper.GetExchange(secuInfo.ExchangeCode);
                    }

                    _secuDataSource.Add(stock);
                }
            }
        }
        public void Test_GetExchange()
        {
            var actual = SecurityItemHelper.GetExchange(Exchange.SHSE);

            Assert.AreEqual("上交所", actual);

            actual = SecurityItemHelper.GetExchange(Exchange.SZSE);

            Assert.AreEqual("深交所", actual);

            actual = SecurityItemHelper.GetExchange(Exchange.CFFEX);

            Assert.AreEqual("中金所", actual);
        }
Пример #3
0
        public List <TemplateStock> GetStocks(int templateId)
        {
            int loginUserId = LoginManager.Instance.GetUserId();

            _userActionTrackingBLL.Create(loginUserId, Model.UsageTracking.ActionType.Get, ResourceType.SpotTemplate, templateId, 1, Model.UsageTracking.ActionStatus.Normal, "stocks");

            var stocks = _stockdbdao.Get(templateId);

            if (stocks != null)
            {
                stocks.ForEach(p => {
                    var secuInfo = SecurityInfoManager.Instance.Get(p.SecuCode, Model.SecurityInfo.SecurityType.Stock);
                    if (secuInfo != null)
                    {
                        p.SecuName = secuInfo.SecuName;
                        p.Exchange = SecurityItemHelper.GetExchange(secuInfo.ExchangeCode);
                    }
                });
            }

            return(stocks);
        }