private static _ProductInfo CreateProductInfo(string exchangeName, string dataSource, Product product, AbstractProductProperty property) { _ProductInfo cProductInfo = new _ProductInfo() { CommodityId = (property == null) ? string.Empty : property.CommodityId, Description = (property == null) ? string.Empty : property.Description, DataSource = (dataSource == null) ? string.Empty : dataSource, ExchangeName = exchangeName, ProductId = product.SymbolId, ProductName = product.SymbolName }; return cProductInfo; }
private void LoadProducts(string dataSource) { List<AbstractExchange> cExchanges = ProductManager.Manager.Exchanges; int iCount = cExchanges.Count; if (iCount > 0) { for (int i = 0; i < iCount; i++) { AbstractExchange cExchange = cExchanges[i]; int iIndex = 0; string sExchangeName = cExchange.ShortName; ESymbolCategory[] cCategorys = Enum.GetValues(typeof(ESymbolCategory)) as ESymbolCategory[]; foreach (ESymbolCategory cCategory in cCategorys) { List<string> cSymbols = cExchange.GetProductClassify(cCategory); if (cSymbols != null && cSymbols.Count > 0) { ++iIndex; tabControl_Products.TabPages.Add(cCategory.ToString()); if (iIndex == __cSources.Count) { __cSources.Add(new SimpleBoundList<_ProductInfo>(cSymbols.Count)); } foreach (string sSymbolId in cSymbols) { AbstractProductProperty cProperty = cExchange.GetProperty(sSymbolId, dataSource); if (cProperty != null) { _ProductInfo cProductInfo = new _ProductInfo() { ProductId = sSymbolId, Description = cProperty.Description, ExchangeName = sExchangeName }; __cSources[0].Add(cProductInfo); __cSources[iIndex].Add(cProductInfo); } } } } } } }