Ejemplo n.º 1
0
 public void add(CommodityBasic c)
 {
     if (!cbList.Contains(c))
     {
         cbList.Add(c);
     }
 }
Ejemplo n.º 2
0
        /*public static void updateWarrantUnderlying() {
         *  loadCommodityData();
         *  refreshCommodityBasics();
         * }*/

        public static CommodityBasicList GetCommodityBasics()
        {
            CommodityBasicList cBL = new CommodityBasicList();

            try {
                string        sql   = "SELECT [股票代號], [股票名稱], isNull([上市上櫃],'1') 市場, IsNull([公司名稱], '') 公司名稱, IsNull([統一編號], '00000000') 統一編號 FROM [上市櫃公司基本資料] WHERE ";
                List <string> datas = new List <string>();
                //DataView dv = DeriLib.Util.ExecSqlQry("SELECT WRTCAN_CMONEY_ID FROM [V_CANDIDATE] ORDER BY WRTCAN_CMONEY_ID", LoginSet.warrantSysSqlConnString);
                DataTable dv   = MSSQL.ExecSqlQry("SELECT WRTCAN_CMONEY_ID FROM [CANDIDATE] WHERE WRTCAN_DATE = (select max(WRTCAN_DATE) from [WAFT].[dbo].[CANDIDATE]) ORDER BY WRTCAN_CMONEY_ID", LoginSet.warrantSysSqlConnString);//V_CANDIDATE
                string    cStr = "";
                foreach (DataRow dr in dv.Rows)
                {
                    cStr += "'" + dr["WRTCAN_CMONEY_ID"].ToString() + "',";
                }
                if (cStr.Length > 0)
                {
                    cStr = cStr.Substring(0, cStr.Length - 1);
                }

                sql += "[股票代號] IN (" + cStr + ") ORDER BY [股票代號]";
                ADODB.Recordset rs = cn.CMExecute(ref arg, srvLocation, cnPort, sql);

                for (; !rs.EOF; rs.MoveNext())
                {
                    string cid  = Convert.ToString(rs.Fields["股票代號"].Value);
                    string cnm  = Convert.ToString(rs.Fields["股票名稱"].Value);
                    string mktN = Convert.ToString(rs.Fields["市場"].Value);
                    string mkt  = "";
                    if (mktN == "1")
                    {
                        mkt = "TSE";
                    }
                    else if (mktN == "2")
                    {
                        mkt = "OTC";
                    }
                    else
                    {
                        mkt = "";
                    }
                    string uid = Convert.ToString(rs.Fields["統一編號"].Value);
                    string fnm = Convert.ToString(rs.Fields["公司名稱"].Value);

                    if (uid != null && cid != null && cnm != null && mkt != null && fnm != null && uid != "00000000" && uid != "0" && uid != "" && !datas.Contains(uid))
                    {
                        CommodityBasic b = new CommodityBasic(cid, cnm, mkt, uid, fnm);
                        datas.Add(uid);
                        cBL.add(b);
                    }
                }
            } catch (Exception ex) {
                MessageBox.Show("GetCommodityBasics" + ex.Message);
                //GlobalVar.errProcess.Add(1, "[CMoneyWork_getCommodityBasics][" + ex.Message + "][" + ex.StackTrace + "]");
            }

            return(cBL);
        }
Ejemplo n.º 3
0
        public CommodityBasic getByUnifiedID(string id)
        {
            CommodityBasic basic = null;

            foreach (CommodityBasic cb in cbList)
            {
                if (cb.unifiedID == id)
                {
                    basic = cb;
                    break;
                }
            }

            return(basic);
        }