protected void LoadStockList(data.tmpDS.stockCodeDataTable toTbl, string[] watchCodes)
        {
            //Load stocks in portfolio
            data.tmpDS.stockCodeDataTable myStockCodeTbl = null;
            switch (this.watchType)
            { 
                case AppTypes.PortfolioTypes.Portfolio:
                     myStockCodeTbl = DataAccess.Libs.GetStock_InPortfolio(common.system.List2Collection(watchCodes));
                     break;
                case AppTypes.PortfolioTypes.WatchList:
                     myStockCodeTbl = DataAccess.Libs.GetStock_ByWatchList(common.system.List2Collection(watchCodes));
                     break;
                default:
                     common.system.ThrowException("Invalid WatchType"); 
                     break;
            }

            DataView myStockView = new DataView(myStockCodeTbl);
            data.baseDS.stockCodeRow stockRow;
            myStockView.Sort = myStockCodeTbl.codeColumn.ColumnName + "," + myStockCodeTbl.stockExchangeColumn.ColumnName;
            data.tmpDS.stockCodeRow reportRow;
            for (int idx1 = 0; idx1 < myStockView.Count; idx1++)
            {
                stockRow = (data.baseDS.stockCodeRow)myStockView[idx1].Row;
                //Ignore duplicate stocks
                reportRow = toTbl.FindBycode(stockRow.code);
                if (reportRow != null) continue;
                reportRow = toTbl.NewstockCodeRow();
                commonClass.AppLibs.InitData(reportRow);
                reportRow.code = stockRow.code;
                reportRow.stockExchange = stockRow.stockExchange;
                toTbl.AddstockCodeRow(reportRow);
            }
        }
Esempio n. 2
0
 public static data.baseDS.stockCodeRow AddNewCode(string comCode, string stockEchangeCode,
                                                        data.baseDS.stockCodeDataTable toStockCodeTbl)
 {
     data.baseDS.stockCodeRow stockCodeRow;
     stockCodeRow = libs.FindAndCache(toStockCodeTbl, comCode);
     if (stockCodeRow == null)
     {
         stockCodeRow = toStockCodeTbl.NewstockCodeRow();
         commonClass.AppLibs.InitData(stockCodeRow);
         stockCodeRow.code = comCode;
         stockCodeRow.name = "<New>";
         stockCodeRow.code = comCode;
         stockCodeRow.tickerCode = comCode;
         stockCodeRow.stockExchange = stockEchangeCode;
         stockCodeRow.regDate = DateTime.Today;
         toStockCodeTbl.AddstockCodeRow(stockCodeRow);
     }
     return stockCodeRow;
 }