Exemple #1
0
        public static data.baseDS.portfolioRow GetPortfolio_DefaultStrategy()
        {
            string cacheKey = MakeCacheKey("SysPortfolio", "DefaultStrategy");
            object obj      = GetCache(cacheKey);

            if (obj != null)
            {
                return((data.baseDS.portfolioRow)obj);
            }
            data.baseDS.portfolioRow       row = null;
            data.baseDS.portfolioDataTable tbl = myClient.GetPortfolio_ByType(AppTypes.PortfolioTypes.PortfolioDefaultStrategy);
            if (tbl.Count == 0)
            {
                row = tbl.NewportfolioRow();
                commonClass.AppLibs.InitData(row);
                row.type         = (byte)AppTypes.PortfolioTypes.PortfolioDefaultStrategy;
                row.code         = Consts.constNotMarkerNEW;
                row.investorCode = commonClass.SysLibs.sysLoginCode;
                tbl.AddportfolioRow(row);
                myClient.UpdatePortfolio(ref tbl);
            }
            row = tbl[0];
            AddCache(cacheKey, row);
            return(row);
        }
 protected void SaveData()
 {
     data.baseDS.portfolioRow portfolioRow;
     if (myPortfolioTbl.Count == 0)
     {
         portfolioRow = myPortfolioTbl.NewportfolioRow();
         commonClass.AppLibs.InitData(portfolioRow);
         portfolioRow.code = commonClass.Consts.constNotMarkerNEW;
         myPortfolioTbl.AddportfolioRow(portfolioRow);
     }
     else
     {
         portfolioRow = myPortfolioTbl[0];
     }
     portfolioRow.type         = (byte)this.myPortfolioType;
     portfolioRow.investorCode = this.myInvestorCode;
     portfolioRow.name         = nameEd.Text;
     portfolioRow.description  = descriptionEd.Text;
     portfolioRow = DataAccess.Libs.UpdateData(myPortfolioTbl[0]);
     codeEd.Text  = portfolioRow.code;
 }
        public void LoadData(string investorCode, bool AddAllItem)
        {
            data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
            if (AddAllItem)
            {
                data.baseDS.portfolioRow row = tbl.NewportfolioRow();
                commonClass.AppLibs.InitData(row);
                row.investorCode = investorCode;
                row.name = commonClass.Settings.sysString_All_Description;
                row.code = commonClass.Settings.sysString_All_Code;
                tbl.AddportfolioRow(row);
            }
            data.baseDS.portfolioDataTable tmpTbl = DataAccess.Libs.GetPortfolio_ByInvestor(investorCode);
            for (int idx = 0; idx < tmpTbl.Count; idx++) tbl.ImportRow(tmpTbl[idx]);


            this.DisplayMember = tbl.nameColumn.ColumnName;
            this.ValueMember = tbl.codeColumn.ColumnName;
            this.DataSource = tbl;
            if (tbl.Count > 0) this.MaxDropDownItems = tbl.Count;
        }