Esempio n. 1
0
        public static void LoadStockCode_ByWatchList(data.tmpDS.stockCodeDataTable stockCodeTbl, StringCollection codes)
        {
            StringCollection retList = new StringCollection();
            StringCollection list;

            data.tmpDS.stockCodeDataTable  tmpTbl       = new data.tmpDS.stockCodeDataTable();
            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            data.baseDS.portfolioRow       portfolioRow;
            for (int idx1 = 0; idx1 < codes.Count; idx1++)
            {
                portfolioRow = SysLibs.FindAndCache(portfolioTbl, codes[idx1]);
                if (portfolioRow == null)
                {
                    continue;
                }
                list = common.MultiValueString.String2List(portfolioRow.interestedStock);
                if (list.Count <= 0)
                {
                    continue;
                }
                tmpTbl.Clear();
                LoadStockCode_ByCodeList(tmpTbl, list);
                for (int idx2 = 0; idx2 < tmpTbl.Count; idx2++)
                {
                    if (stockCodeTbl.FindBycode(tmpTbl[idx2].code) == null)
                    {
                        stockCodeTbl.ImportRow(tmpTbl[idx2]);
                    }
                }
            }
            portfolioTbl.Dispose();
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
 public static data.baseDS.portfolioRow UpdateData(data.baseDS.portfolioRow row)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     tbl.ImportRow(row);
     myClient.UpdatePortfolio(ref tbl);
     row.AcceptChanges();
     return(tbl[0]);
 }
Esempio n. 4
0
        public string GetSQL()
        {
            data.baseDS.portfolioDataTable  portfolioTbl  = new data.baseDS.portfolioDataTable();
            data.baseDS.tradeAlertDataTable tradeAlertTbl = new data.baseDS.tradeAlertDataTable();
            string condCmd = "";

            condCmd += (condCmd == "" ? "" : " AND ") +
                       "(" + tradeAlertTbl.portfolioColumn.ColumnName +
                       " IN (" +
                       " SELECT " + portfolioTbl.codeColumn.ColumnName +
                       " FROM " + portfolioTbl.TableName +
                       " WHERE " + portfolioTbl.investorCodeColumn.ColumnName + "=N'" + commonClass.SysLibs.sysLoginCode + "'))";

            if (dateRangeChk.Checked)
            {
                condCmd += (condCmd == "" ? "" : " AND ") +
                           "(" + tradeAlertTbl.onTimeColumn.ColumnName +
                           " BETWEEN '" + common.system.ConvertToSQLDateString(dateRange.frDate, false) + "' AND '" +
                           common.system.ConvertToSQLDateString(dateRange.toDate.AddDays(1).AddSeconds(-1), false) + "')";
            }
            if (statusChk.Checked)
            {
                condCmd += (condCmd == "" ? "" : " AND ") +
                           "(" + tradeAlertTbl.statusColumn.ColumnName + " & " + ((byte)statusCb.myValue).ToString() + ">0)";
            }

            if (portfolioChk.Checked)
            {
                condCmd += (condCmd == "" ? "" : " AND ") +
                           "(" + tradeAlertTbl.portfolioColumn.ColumnName + "=N'" + portfolioCb.myValue + "')";
            }

            if (strategyChk.Checked)
            {
                condCmd += (condCmd == "" ? "" : " AND ") +
                           "(" + tradeAlertTbl.strategyColumn.ColumnName + "=N'" + strategyCb.myValue + "')";
            }


            if (timeScaleChk.Checked)
            {
                condCmd += (condCmd == "" ? "" : " AND ") +
                           "(" + tradeAlertTbl.timeScaleColumn.ColumnName + "='" + timeScaleCb.myValue.Code + "')";
            }

            if (codeChk.Checked)
            {
                condCmd += (condCmd == "" ? "" : " AND ") +
                           "(" + tradeAlertTbl.stockCodeColumn.ColumnName + "=N'" + codeEd.Text.Trim() + "')";
            }

            string sqlCmd = "SELECT * FROM " + tradeAlertTbl.TableName +
                            (condCmd == "" ? "" : " WHERE " + condCmd) +
                            " ORDER BY " + tradeAlertTbl.onTimeColumn.ColumnName + " DESC";

            return(sqlCmd);
        }
Esempio n. 5
0
 public static data.baseDS.portfolioRow GetPortfolio_ByCode(string code)
 {
     data.baseDS.portfolioDataTable tbl = myClient.GetPortfolio_ByCode(code);
     if (tbl.Count == 0)
     {
         return(null);
     }
     return(tbl[0]);
 }
Esempio n. 6
0
 public static data.baseDS.portfolioRow GetPortfolio(string portfolioCode)
 {
     data.baseDS.portfolioDataTable tbl = portfolioTA.GetByCode(portfolioCode);
     if (tbl.Count == 0)
     {
         return(null);
     }
     return(tbl[0]);
 }
Esempio n. 7
0
        public string GetSQL()
        {
            string investorCode = commonClass.SysLibs.sysLoginCode;

            data.baseDS.transactionsDataTable transactionsTbl = new data.baseDS.transactionsDataTable();
            data.baseDS.stockCodeDataTable    stockCodeTbl    = new data.baseDS.stockCodeDataTable();
            data.baseDS.portfolioDataTable    portfolioTbl    = new data.baseDS.portfolioDataTable();
            string sqlCmd = "SELECT * FROM " + transactionsTbl.TableName;
            string filter = "";

            string portfolioCond = "";

            if (investorCode.Trim() != "")
            {
                portfolioCond += (portfolioCond == "" ? "" : " AND ") +
                                 portfolioTbl.investorCodeColumn.ColumnName + "=N'" + investorCode.Trim() + "'";
            }
            if (portfolioCond != "")
            {
                filter += (filter == "" ? "" : " AND ") +
                          transactionsTbl.portfolioColumn.ColumnName + " IN " + common.Consts.constCRLF +
                          "(SELECT " + portfolioTbl.codeColumn.ColumnName + " FROM " + portfolioTbl.TableName +
                          " WHERE " + portfolioCond + ")";
            }

            if (this.stockExchangeChk.Checked && this.stockExchangeCb.myValue != "")
            {
                filter += (filter == "" ? "" : " AND ") +
                          transactionsTbl.stockCodeColumn.ColumnName + " IN (SELECT " + stockCodeTbl.codeColumn.ColumnName +
                          " FROM " + stockCodeTbl.TableName + " WHERE " + stockCodeTbl.stockExchangeColumn.ColumnName + "=N'" + this.stockExchangeCb.myValue.Trim() + "')";
            }
            if (this.dateRangeChk.Checked && this.dateRange.GetDateRange())
            {
                filter += (filter == "" ? "" : " AND ") +
                          "(" + transactionsTbl.onTimeColumn.ColumnName +
                          " BETWEEN '" + common.system.ConvertToSQLDateString(this.dateRange.frDate) + "' AND '" +
                          common.system.ConvertToSQLDateString(this.dateRange.toDate) + "')";
            }
            if (this.stockCodeEd.Enabled && this.stockCodeEd.Text.Trim() != "")
            {
                filter += (filter == "" ? "" : " AND ") +
                          transactionsTbl.stockCodeColumn.ColumnName + " =N'" + this.stockCodeEd.Text.Trim() + "'";
            }

            if (portfolioChk.Checked && portfolioCb.myValue.Trim() != "")
            {
                filter += (filter == "" ? "" : " AND ") +
                          transactionsTbl.portfolioColumn.ColumnName + " =N'" + portfolioCb.myValue.Trim() + "'";
            }
            if (filter != "")
            {
                sqlCmd += " WHERE " + filter;
            }
            return(sqlCmd);
        }
Esempio n. 8
0
 public void UpdatePortfolio(ref data.baseDS.portfolioDataTable tbl)
 {
     for (int idx = 0; idx < tbl.Count; idx++)
     {
         if (tbl[idx].code.Trim() == Consts.constNotMarkerNEW)
         {
             common.myAutoKeyInfo info = application.SysLibs.GetAutoKey(tbl.TableName, false);
             tbl[idx].code = info.value.ToString().PadLeft(tbl.codeColumn.MaxLength, '0');
         }
     }
     DbAccess.UpdateData(tbl);
 }
Esempio n. 9
0
        public static data.baseDS.portfolioDataTable GetSystemWatchList()
        {
            string cacheKey = MakeCacheKey("SysWatchList", "List");
            object obj      = GetCache(cacheKey);

            if (obj != null)
            {
                return((data.baseDS.portfolioDataTable)obj);
            }
            data.baseDS.portfolioDataTable tbl = myClient.GetPortfolio_ByType(AppTypes.PortfolioTypes.SysWatchList);
            AddCache(cacheKey, tbl);
            return(tbl);
        }
        public string GetSQL()
        {
            string investorCode = commonClass.SysLibs.sysLoginCode;

            data.baseDS.transactionsDataTable transactionsTbl = new data.baseDS.transactionsDataTable();
            data.baseDS.stockCodeDataTable stockCodeTbl = new data.baseDS.stockCodeDataTable();
            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            string sqlCmd = "SELECT * FROM " + transactionsTbl.TableName;
            string filter = "";

            string portfolioCond = "";
            if (investorCode.Trim() != "")
            {
                portfolioCond +=(portfolioCond == "" ? "" : " AND ") +
                                 portfolioTbl.investorCodeColumn.ColumnName + "=N'" + investorCode.Trim() + "'";
            }
            if (portfolioCond != "")
            {
                filter += (filter == "" ? "" : " AND ") +
                          transactionsTbl.portfolioColumn.ColumnName + " IN " + common.Consts.constCRLF +
                          "(SELECT " + portfolioTbl.codeColumn.ColumnName + " FROM " + portfolioTbl.TableName +
                          " WHERE " + portfolioCond + ")";
            }

            if (this.stockExchangeChk.Checked && this.stockExchangeCb.myValue != "")
            {
                filter += (filter == "" ? "" : " AND ") +  
                transactionsTbl.stockCodeColumn.ColumnName + " IN (SELECT " +stockCodeTbl.codeColumn.ColumnName +
                " FROM " + stockCodeTbl.TableName  + " WHERE " + stockCodeTbl.stockExchangeColumn.ColumnName + "=N'" + this.stockExchangeCb.myValue.Trim() + "')";
            }
            if (this.dateRangeChk.Checked && this.dateRange.GetDateRange())
            {
                filter += (filter == "" ? "" : " AND ") +
                           "("+ transactionsTbl.onTimeColumn.ColumnName +
                           " BETWEEN '" + common.system.ConvertToSQLDateString(this.dateRange.frDate) + "' AND '" +
                           common.system.ConvertToSQLDateString(this.dateRange.toDate) + "')";
            }
            if (this.stockCodeEd.Enabled && this.stockCodeEd.Text.Trim()!="")
            {
                filter += (filter == "" ? "" : " AND ") +
                           transactionsTbl.stockCodeColumn.ColumnName + " =N'" + this.stockCodeEd.Text.Trim() + "'";
            }

            if (portfolioChk.Checked && portfolioCb.myValue.Trim() != "")
            {
                filter += (filter == "" ? "" : " AND ") +
                           transactionsTbl.portfolioColumn.ColumnName + " =N'" + portfolioCb.myValue.Trim() + "'";
            }
            if (filter != "") sqlCmd += " WHERE " + filter;
            return sqlCmd;
        }
Esempio n. 11
0
        // Load stock list specified in the user's portfolio
        protected void LoadPortfolioStock()
        {
            StringCollection stockList = new StringCollection();
            TreeNode         node;

            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            portfolioTbl.Clear();
            myStockCodeTbl.Clear();
            dataLibs.LoadPortfolioByInvestor(portfolioTbl, sysLibs.sysLoginCode, AppTypes.PortfolioTypes.Portfolio);
            stockTV.Nodes.Clear();
            DataView myStockView = new DataView(myStockCodeTbl);

            data.baseDS.stockCodeRow stockRow;
            myStockView.Sort = myStockCodeTbl.codeColumn.ColumnName;

            StringCollection list = new StringCollection();

            for (int idx1 = 0; idx1 < portfolioTbl.Count; idx1++)
            {
                node = stockTV.Nodes.Add(portfolioTbl[idx1].name);

                list.Clear();
                list.Add(portfolioTbl[idx1].code);
                myStockCodeTbl.Clear();
                if (portfolioTbl[idx1].type == (byte)AppTypes.PortfolioTypes.WatchList)
                {
                    dataLibs.LoadStockCode_ByWatchList(myStockCodeTbl, list);
                }
                else
                {
                    dataLibs.LoadStockCode_ByPortfolios(myStockCodeTbl, list);
                }

                stockList.Clear();
                for (int idx2 = 0; idx2 < myStockView.Count; idx2++)
                {
                    stockRow = (data.baseDS.stockCodeRow)myStockView[idx2].Row;
                    //Ignore duplicate stocks
                    if (stockList.Contains(stockRow.tickerCode))
                    {
                        continue;
                    }
                    stockList.Add(stockRow.tickerCode);
                    node.Nodes.Add(stockRow.tickerCode);
                }
                node.Text = node.Text + "(" + node.Nodes.Count.ToString() + ")";
                node.ExpandAll();
            }
        }
Esempio n. 12
0
 public static data.baseDS.portfolioRow FindAndCache(data.baseDS.portfolioDataTable tbl, string code)
 {
     data.baseDS.portfolioRow row = tbl.FindBycode(code);
     if (row != null)
     {
         return(row);
     }
     data.baseDSTableAdapters.portfolioTA dataTA = new data.baseDSTableAdapters.portfolioTA();
     dataTA.ClearBeforeFill = false;
     dataTA.FillByCode(tbl, code);
     row = tbl.FindBycode(code);
     if (row != null)
     {
         return(row);
     }
     return(null);
 }
Esempio n. 13
0
        protected override void SaveData()
        {
            common.MultiValueString              mvString     = new common.MultiValueString();
            data.baseDS.portfolioDataTable       portfolioTbl = new data.baseDS.portfolioDataTable();
            data.baseDS.portfolioDetailDataTable portfolioDataTbl;
            portfolioTbl.Clear();
            for (int portfolioIdx = 0; portfolioIdx < watchListLb.myCheckedValues.Count; portfolioIdx++)
            {
                data.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);
                data.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();
                        commonClass.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"));
        }
Esempio n. 14
0
        // Load stock list specified in the user's portfolio
        protected void LoadPortfolioStock()
        {
            StringCollection stockList = new StringCollection();
            TreeNode node;

            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            portfolioTbl.Clear();
            myStockCodeTbl.Clear();
            dataLibs.LoadPortfolioByInvestor(portfolioTbl, sysLibs.sysLoginCode, AppTypes.PortfolioTypes.Portfolio);
            stockTV.Nodes.Clear();
            DataView myStockView = new DataView(myStockCodeTbl);
            data.baseDS.stockCodeRow stockRow;
            myStockView.Sort = myStockCodeTbl.codeColumn.ColumnName;

            StringCollection list = new StringCollection();
            for (int idx1 = 0; idx1 < portfolioTbl.Count; idx1++)
            {
                node = stockTV.Nodes.Add(portfolioTbl[idx1].name);

                list.Clear();
                list.Add(portfolioTbl[idx1].code);
                myStockCodeTbl.Clear();
                if (portfolioTbl[idx1].type == (byte)AppTypes.PortfolioTypes.WatchList)
                    dataLibs.LoadStockCode_ByWatchList(myStockCodeTbl, list);
                else
                    dataLibs.LoadStockCode_ByPortfolios(myStockCodeTbl, list);

                stockList.Clear();
                for (int idx2 = 0; idx2 < myStockView.Count; idx2++)
                {
                    stockRow = (data.baseDS.stockCodeRow)myStockView[idx2].Row;  
                    //Ignore duplicate stocks
                    if (stockList.Contains(stockRow.tickerCode)) continue;
                    stockList.Add(stockRow.tickerCode);
                    node.Nodes.Add(stockRow.tickerCode);
                }
                node.Text = node.Text + "(" + node.Nodes.Count.ToString() + ")";
                node.ExpandAll();
            }
        }
        protected override void SaveData()
        {
            common.MultiValueString mvString = new common.MultiValueString();
            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            data.baseDS.portfolioDetailDataTable portfolioDataTbl;
            portfolioTbl.Clear();
            for (int portfolioIdx = 0; portfolioIdx < watchListLb.myCheckedValues.Count; portfolioIdx++)
            {
                data.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);
                data.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();
                        commonClass.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"));
        }
Esempio n. 16
0
 public data.baseDS.portfolioDataTable GetPortfolio_ByType(AppTypes.PortfolioTypes type)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     DbAccess.LoadData(tbl, type);
     return(tbl);
 }
Esempio n. 17
0
 public static void LoadPortfolioByInvestor(data.baseDS.portfolioDataTable tbl, string investorCode, AppTypes.PortfolioTypes type)
 {
     portfolioTA.ClearBeforeFill = false;
     portfolioTA.FillByInvestorCodeAndTypeMask(tbl, investorCode, ((byte)type).ToString());
 }
Esempio n. 18
0
 public static void LoadPortfolioByInvestor(data.baseDS.portfolioDataTable tbl, string investorCode)
 {
     portfolioTA.ClearBeforeFill = false;
     portfolioTA.FillByInvestorCode(tbl, investorCode);
 }
Esempio n. 19
0
 public static void UpdateData(data.baseDS.portfolioDataTable tbl)
 {
     portfolioTA.Update(tbl);
     tbl.AcceptChanges();
 }
Esempio n. 20
0
 public data.baseDS.portfolioDataTable GetPortfolio_ByCode(string code)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     DbAccess.LoadData(tbl, code);
     return tbl;
 }
Esempio n. 21
0
 public static void LoadData(data.baseDS.portfolioDataTable tbl, string code)
 {
     portfolioTA.ClearBeforeFill = false;
     portfolioTA.FillByCode(tbl, code);
 }
Esempio n. 22
0
        public string GetSQL()
        {
            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            data.baseDS.tradeAlertDataTable tradeAlertTbl = new data.baseDS.tradeAlertDataTable();
            string condCmd = "";
            condCmd += (condCmd == "" ? "" : " AND ") +
                "(" + tradeAlertTbl.portfolioColumn.ColumnName +
                    " IN (" +
                    " SELECT " + portfolioTbl.codeColumn.ColumnName +
                    " FROM " + portfolioTbl.TableName +
                    " WHERE " + portfolioTbl.investorCodeColumn.ColumnName + "=N'" + commonClass.SysLibs.sysLoginCode + "'))";

            if (dateRangeChk.Checked)
                condCmd += (condCmd == "" ? "" : " AND ") +
                    "(" + tradeAlertTbl.onTimeColumn.ColumnName + 
                    " BETWEEN '" + common.system.ConvertToSQLDateString(dateRange.frDate,false) + "' AND '"+
                                   common.system.ConvertToSQLDateString(dateRange.toDate.AddDays(1).AddSeconds(-1),false) + "')";
            if (statusChk.Checked)
                condCmd += (condCmd == "" ? "" : " AND ") +
                    "(" + tradeAlertTbl.statusColumn.ColumnName + " & " + ((byte)statusCb.myValue).ToString() + ">0)";

            if (portfolioChk.Checked)
                condCmd += (condCmd == "" ? "" : " AND ") +
                    "(" + tradeAlertTbl.portfolioColumn.ColumnName + "=N'" + portfolioCb.myValue + "')";

            if (strategyChk.Checked)
                condCmd += (condCmd == "" ? "" : " AND ") +
                    "(" + tradeAlertTbl.strategyColumn.ColumnName + "=N'" + strategyCb.myValue + "')";

            
            if (timeScaleChk.Checked)
                condCmd += (condCmd == "" ? "" : " AND ") +
                    "(" + tradeAlertTbl.timeScaleColumn.ColumnName + "='" + timeScaleCb.myValue.Code + "')";

            if (codeChk.Checked)
                condCmd += (condCmd == "" ? "" : " AND ") +
                    "(" + tradeAlertTbl.stockCodeColumn.ColumnName + "=N'" + codeEd.Text.Trim() + "')";

            string sqlCmd = "SELECT * FROM " + tradeAlertTbl.TableName +
                            (condCmd == "" ? "" : " WHERE " + condCmd) +
                            " ORDER BY " + tradeAlertTbl.onTimeColumn.ColumnName + " DESC";
            return sqlCmd;
        }
Esempio n. 23
0
 public virtual void LoadData(string investorCode, bool checkedAll)
 {
     dataTbl = DataAccess.Libs.GetPortfolio_ByInvestorAndType(investorCode, this.WatchType);
     this.Items.Clear();
     for (int idx = 0; idx < dataTbl.Count; idx++)
         this.Items.Add(new common.myComboBoxItem(dataTbl[idx].name.Trim(), dataTbl[idx].code.Trim()), checkedAll);
     SaveItems();
 }
Esempio n. 24
0
 public static void LoadData(data.baseDS.portfolioDataTable tbl, AppTypes.PortfolioTypes type)
 {
     portfolioTA.ClearBeforeFill = false;
     portfolioTA.FillByTypeMask(tbl, ((byte)type).ToString());
 }
Esempio n. 25
0
 public data.baseDS.portfolioDataTable GetPortfolio_ByInvestorAndType(string investorCode, AppTypes.PortfolioTypes type)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     DbAccess.LoadPortfolioByInvestor(tbl, investorCode, type);
     return tbl;
 }
Esempio n. 26
0
 public data.baseDS.portfolioDataTable GetPortfolio_ByInvestor(string investorCode)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     DbAccess.LoadPortfolioByInvestor(tbl, investorCode);
     return tbl;
 }
Esempio n. 27
0
 public data.baseDS.portfolioDataTable GetPortfolio_ByCode(string code)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     DbAccess.LoadData(tbl, code);
     return(tbl);
 }
Esempio n. 28
0
 public static data.baseDS.portfolioRow UpdateData(data.baseDS.portfolioRow row)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     tbl.ImportRow(row);
     myClient.UpdatePortfolio(ref tbl);
     row.AcceptChanges();
     return tbl[0];
 }
Esempio n. 29
0
 public data.baseDS.portfolioDataTable GetPortfolio_ByInvestor(string investorCode)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     DbAccess.LoadPortfolioByInvestor(tbl, investorCode);
     return(tbl);
 }
Esempio n. 30
0
        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;
        }
Esempio n. 31
0
        public static void LoadStockCode_ByWatchList(data.tmpDS.stockCodeDataTable stockCodeTbl, StringCollection codes)
        {
            StringCollection retList = new StringCollection();
            StringCollection list;

            data.tmpDS.stockCodeDataTable tmpTbl = new data.tmpDS.stockCodeDataTable();
            data.baseDS.portfolioDataTable portfolioTbl = new data.baseDS.portfolioDataTable();
            data.baseDS.portfolioRow portfolioRow;
            for (int idx1 = 0; idx1 < codes.Count; idx1++)
            {
                portfolioRow = SysLibs.FindAndCache(portfolioTbl, codes[idx1]);
                if (portfolioRow == null) continue;
                list = common.MultiValueString.String2List(portfolioRow.interestedStock);
                if (list.Count <= 0) continue;
                tmpTbl.Clear();
                LoadStockCode_ByCodeList(tmpTbl, list);
                for (int idx2 = 0; idx2 < tmpTbl.Count; idx2++)
                {
                    if (stockCodeTbl.FindBycode(tmpTbl[idx2].code)==null) stockCodeTbl.ImportRow(tmpTbl[idx2]);
                }
            }
            portfolioTbl.Dispose();
        }
Esempio n. 32
0
 public data.baseDS.portfolioDataTable GetPortfolio_ByType(AppTypes.PortfolioTypes type)
 {
     data.baseDS.portfolioDataTable tbl = new data.baseDS.portfolioDataTable();
     DbAccess.LoadData(tbl, type);
     return tbl;
 }