protected override void SaveData()
        {
            data.baseDS.portfolioDetailDataTable defaultStrategyTbl = DataAccess.Libs.GetPortfolioDetail_ByCode(DataAccess.Libs.GetPortfolio_DefaultStrategy().code);

            data.baseDS.portfolioDetailDataTable portfolioDetailTbl;
            for (int portfolioIdx = 0; portfolioIdx < watchListLb.myCheckedValues.Count; portfolioIdx++)
            {
                data.baseDS.portfolioRow portfolioRow = DataAccess.Libs.GetPortfolio_ByCode(watchListLb.myCheckedValues[portfolioIdx]);
                if (portfolioRow == null)
                {
                    continue;
                }
                portfolioDetailTbl      = DataAccess.Libs.GetPortfolioDetail_ByCode(portfolioRow.code);
                mvString.myFormatString = portfolioRow.interestedStock;
                for (int stockIdx = 0; stockIdx < myStockCodes.Count; stockIdx++)
                {
                    if (!mvString.Add(myStockCodes[stockIdx]))
                    {
                        continue;
                    }
                    mvString.Add(myStockCodes[stockIdx]);
                    //Add default portfolio data
                    DeletePortfolioData(portfolioDetailTbl, portfolioRow.code, myStockCodes[stockIdx]);
                    commonClass.AppLibs.CopyPortfolioData(defaultStrategyTbl, portfolioDetailTbl, portfolioRow.code, myStockCodes[stockIdx]);
                }
                portfolioRow.interestedStock = mvString.myFormatString;
                DataAccess.Libs.UpdateData(portfolioRow);
                DataAccess.Libs.UpdateData(portfolioDetailTbl);
            }
            common.system.ShowMessage(Languages.Libs.GetString("dataSaved"));
        }
Пример #2
0
        protected override void SaveData()
        {
            common.MultiValueString                   mvString     = new common.MultiValueString();
            databases.baseDS.portfolioDataTable       portfolioTbl = new databases.baseDS.portfolioDataTable();
            databases.baseDS.portfolioDetailDataTable portfolioDataTbl;
            portfolioTbl.Clear();
            for (int portfolioIdx = 0; portfolioIdx < watchListLb.myCheckedValues.Count; portfolioIdx++)
            {
                databases.baseDS.portfolioRow portfolioRow = DataAccess.Libs.GetPortfolio_ByCode(watchListLb.myCheckedValues[portfolioIdx]);
                if (portfolioRow == null)
                {
                    continue;
                }
                mvString.myFormatString = portfolioRow.interestedStock;
                mvString.Add(codeEd.Text);
                portfolioRow.interestedStock = mvString.myFormatString;

                portfolioDataTbl = DataAccess.Libs.GetPortfolioDetail_ByCode(portfolioRow.code);
                databases.baseDS.portfolioDetailRow dataRow;
                for (int idx = 0; idx < myStrategyCodes.Count; idx++)
                {
                    dataRow = portfolioDataTbl.FindByportfoliocodesubCode(portfolioRow.code, this.codeEd.Text, this.myStrategyCodes[idx]);
                    if (dataRow == null)
                    {
                        dataRow = portfolioDataTbl.NewportfolioDetailRow();
                        databases.AppLibs.InitData(dataRow);
                        dataRow.portfolio = portfolioRow.code;
                        dataRow.code      = codeEd.Text;
                        dataRow.subCode   = this.myStrategyCodes[idx];
                        portfolioDataTbl.AddportfolioDetailRow(dataRow);
                    }
                    mvString.myFormatString = dataRow.data;
                    mvString.Add(timeScaleCb.myValue.Code);
                    dataRow.data = mvString.myFormatString;
                }
                DataAccess.Libs.UpdateData(portfolioRow);
                DataAccess.Libs.UpdateData(portfolioDataTbl);
            }
            common.system.ShowMessage(Languages.Libs.GetString("dataSaved"));
        }
        protected override void SaveData()
        {
            common.MultiValueString mvString = new common.MultiValueString();
            databases.baseDS.portfolioDataTable portfolioTbl = new databases.baseDS.portfolioDataTable();
            databases.baseDS.portfolioDetailDataTable portfolioDataTbl;
            portfolioTbl.Clear();
            for (int portfolioIdx = 0; portfolioIdx < watchListLb.myCheckedValues.Count; portfolioIdx++)
            {
                databases.baseDS.portfolioRow portfolioRow = DataAccess.Libs.GetPortfolio_ByCode(watchListLb.myCheckedValues[portfolioIdx]);
                if (portfolioRow == null) continue;
                mvString.myFormatString = portfolioRow.interestedStock;
                mvString.Add(codeEd.Text);
                portfolioRow.interestedStock = mvString.myFormatString;

                portfolioDataTbl = DataAccess.Libs.GetPortfolioDetail_ByCode(portfolioRow.code);
                databases.baseDS.portfolioDetailRow dataRow;
                for (int idx = 0; idx < myStrategyCodes.Count; idx++)
                {
                    dataRow = portfolioDataTbl.FindByportfoliocodesubCode(portfolioRow.code, this.codeEd.Text, this.myStrategyCodes[idx]);
                    if (dataRow == null)
                    {
                        dataRow = portfolioDataTbl.NewportfolioDetailRow();
                        databases.AppLibs.InitData(dataRow);
                        dataRow.portfolio = portfolioRow.code;
                        dataRow.code = codeEd.Text;
                        dataRow.subCode = this.myStrategyCodes[idx];
                        portfolioDataTbl.AddportfolioDetailRow(dataRow);
                    }
                    mvString.myFormatString = dataRow.data;
                    mvString.Add(timeScaleCb.myValue.Code);
                    dataRow.data = mvString.myFormatString;
                }
                DataAccess.Libs.UpdateData(portfolioRow);
                DataAccess.Libs.UpdateData(portfolioDataTbl);
            }
            common.system.ShowMessage(Languages.Libs.GetString("dataSaved"));
        }