Esempio n. 1
0
        // 7. 데이터 저장 메소드 추가
        //void stockMember_Received()
        //{
        //    //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : stockMember_Received");
        //    //throw new NotImplementedException();
        //    try
        //    {
        //        if (DateTime.Now >= sDateTime && DateTime.Now <= eDateTime)
        //        {
        //            //WriteMsg("StockMember", LogType.INFORMATION, LogDir, "StockMember 신호 수신", flms["StockMember"]);

        //            SqlDal sd = new SqlDal(dbConnString);
        //            object StockCode = stockMember.GetHeaderValue(0);
        //            object count = stockMember.GetHeaderValue(1);
        //            object time = stockMember.GetHeaderValue(2);

        //            List<object> Params = new List<object>();
        //            object[] objArry;

        //            for (int j = 0; j < int.Parse(count.ToString()); j++)
        //            {
        //                Params.Add(StockCode);
        //                Params.Add(j);
        //                Params.Add(time);

        //                for (int i = 0; i < 4; i++)
        //                {
        //                    object o = stockMember.GetDataValue(i, j);
        //                    if (o == null) o = "0";
        //                    Params.Add(o);
        //                }

        //                objArry = Params.ToArray();
        //                sd.SaveStockMember(objArry);

        //                Params.Clear();
        //            }
        //            //WriteMsg("StockMember", LogType.INFORMATION, LogDir, string.Format("{0} 저장", StockCode), flms["StockMember"]);

        //            sd.Close();
        //            sd = null;

        //            Params = null;
        //            objArry = null;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        //WriteMsg("StockMember", LogType.ERROR, LogDir, ex.ToString(), "StockMember");
        //        EventLog.WriteEntry("SubscribeStocksRunner", ex.ToString());
        //    }
        //}

        //void stockJpBid_Received()
        //{
        //    //throw new NotImplementedException();
        //    try
        //    {
        //        if (DateTime.Now >= sDateTime && DateTime.Now <= eDateTime)
        //        {
        //            //WriteMsg("StockJpbid", LogType.INFORMATION, LogDir, "StockJpbid 신호 수신", flms["StockJpbid"]);

        //            SqlDal sd = new SqlDal(dbConnString);
        //            List<object> Params = new List<object>();
        //            object[] objArry;

        //            for (int i = 0; i < 69; i++)
        //            {
        //                object o = stockJpBid.GetHeaderValue(i);
        //                if (o == null) o = "0";
        //                Params.Add(o);
        //            }

        //            objArry = Params.ToArray();
        //            sd.SaveStockJpbid(objArry);
        //            //WriteMsg("StockJpbid", LogType.INFORMATION, LogDir, "저장", flms["StockJpbid"]);

        //            sd.Close();
        //            sd = null;

        //            Params.Clear();
        //            Params = null;

        //            objArry = null;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        //WriteMsg("StockJpbid", LogType.ERROR, LogDir, ex.ToString(), "StockJpbid");
        //        EventLog.WriteEntry("SubscribeStocksRunner", ex.ToString());
        //    }
        //}

        //void stockIndexIS_Received()
        //{
        //    //throw new NotImplementedException();
        //    try
        //    {
        //        if (DateTime.Now >= sDateTime && DateTime.Now <= eDateTime)
        //        {
        //            //WriteMsg("StockIndexis", LogType.INFORMATION, LogDir, "StockIndexis 신호 수신", flms["StockIndexis"]);

        //            SqlDal sd = new SqlDal(dbConnString);
        //            List<object> Params = new List<object>();
        //            object[] objArry;

        //            for (int i = 1; i < 8; i++)
        //            {
        //                object o = stockIndexIS.GetHeaderValue(i);
        //                if (o == null) o = "0";
        //                Params.Add(o);
        //            }

        //            objArry = Params.ToArray();
        //            sd.SaveStockIndexis(objArry);
        //            //WriteMsg("StockIndexis", LogType.INFORMATION, LogDir, "저장", flms["StockIndexis"]);

        //            sd.Close();
        //            sd = null;

        //            Params.Clear();
        //            Params = null;

        //            objArry = null;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        //WriteMsg("StockIndexis", LogType.ERROR, LogDir, ex.ToString(), "StockIndexis");
        //        EventLog.WriteEntry("SubscribeStocksRunner", ex.ToString());
        //        //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : " + ex.ToString());
        //    }
        //}

        void stockCur_Received()
        {
            //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : stockCur_Received");
            //throw new NotImplementedException();
            try
            {
                if (DateTime.Now >= sDateTime && DateTime.Now <= eDateTime)
                {
                    //WriteMsg("StockCur", LogType.INFORMATION, LogDir, "StockCur 신호 수신", flms["StockCur"]);

                    SqlDal        sd     = new SqlDal(dbConnString);
                    List <object> Params = new List <object>();
                    object[]      objArry;
                    for (int i = 0; i < 29; i++)
                    {
                        if (i == 11 || i == 12)
                        {
                            continue;
                        }

                        object o = stockCur.GetHeaderValue(i);
                        if (o == null)
                        {
                            o = "0";
                        }
                        Params.Add(o);
                    }
                    objArry = Params.ToArray();
                    sd.SaveStockCur(objArry);
                    //WriteMsg("StockCur", LogType.INFORMATION, LogDir, string.Format("{0} 저장", stockCur.GetHeaderValue(1)), flms["StockCur"]);

                    sd.Close();
                    sd = null;

                    Params.Clear();
                    Params = null;

                    objArry = null;
                }
            }
            catch (Exception ex)
            {
                //WriteMsg("StockCur", LogType.ERROR, LogDir, ex.ToString(), "StockCur");
                EventLog.WriteEntry("SubscribeStocksRunner", ex.ToString());
                //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : " + ex.ToString());
            }
        }
Esempio n. 2
0
        void cpMarketWatchS_Received()
        {
            //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : cpMarketWatchS_Received");
            //throw new NotImplementedException();
            try
            {
                if (DateTime.Now >= sDateTime && DateTime.Now <= eDateTime)
                {
                    //WriteMsg("CpMarketWatchS", LogType.INFORMATION, LogDir, "CpMarketWatchS 신호 수신", flms["CpMarketWatchS"]);

                    object StockCode = cpMarketWatchS.GetHeaderValue(0);
                    object StockName = cpMarketWatchS.GetHeaderValue(1);
                    object count     = cpMarketWatchS.GetHeaderValue(2);

                    SqlDal        sd     = new SqlDal(dbConnString);
                    List <object> Params = new List <object>();
                    object[]      objArry;
                    for (int i = 0; i < int.Parse(count.ToString()); i++)
                    {
                        Params.Add(StockCode);
                        Params.Add(StockName);
                        Params.Add(cpMarketWatchS.GetDataValue(0, i));
                        Params.Add(cpMarketWatchS.GetDataValue(1, i));
                        Params.Add(cpMarketWatchS.GetDataValue(2, i));

                        objArry = Params.ToArray();
                        sd.SaveCpMarketWatchS(objArry);

                        Params.Clear();
                    }
                    //WriteMsg("CpMarketWatchS", LogType.INFORMATION, LogDir, "저장", flms["CpMarketWatchS"]);

                    sd.Close();
                    sd = null;

                    Params  = null;
                    objArry = null;
                }
            }
            catch (Exception ex)
            {
                //WriteMsg("CpMarketWatchS", LogType.ERROR, LogDir, ex.ToString(), "CpMarketWatchS");
                EventLog.WriteEntry("SubscribeStocksRunner", ex.ToString());
                //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : " + ex.ToString());
            }
        }
Esempio n. 3
0
        private static void UpdateRemainSubscribe()
        {
            //throw new NotImplementedException();
            try
            {
                CPUTILLib.CpCybos ccbos = new CPUTILLib.CpCybos();
                SqlDal            sd    = new SqlDal(dbConnString);
                sd.UpdateRemainSubscribe(new object[] { ccbos.GetLimitRemainCount(CPUTILLib.LIMIT_TYPE.LT_SUBSCRIBE).ToString() });

                sd.Close();
                sd = null;

                ccbos = null;
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("DataCollector", e.ToString());
            }
        }
Esempio n. 4
0
        void cp8091s_Received()
        {
            //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : cp8091s_Received");
            //throw new NotImplementedException();
            try
            {
                if (DateTime.Now >= sDateTime && DateTime.Now <= eDateTime)
                {
                    //WriteMsg("CpSvr8091S", LogType.INFORMATION, LogDir, "CpSvr8091S 신호 수신", flms["CpSvr8091S"]);

                    SqlDal        sd     = new SqlDal(dbConnString);
                    List <object> Params = new List <object>();
                    object[]      objArry;
                    for (int i = 0; i < 9; i++)
                    {
                        object o = cp8091s.GetHeaderValue(i);
                        if (o == null)
                        {
                            o = "0";
                        }
                        Params.Add(o);
                    }
                    objArry = Params.ToArray();
                    sd.SaveCpSvr8091S(objArry);
                    //WriteMsg("CpSvr8091S", LogType.INFORMATION, LogDir, "저장", flms["CpSvr8091S"]);

                    sd.Close();
                    sd = null;

                    Params.Clear();
                    Params = null;

                    objArry = null;
                }
            }
            catch (Exception ex)
            {
                //WriteMsg("CpSvr8091S", LogType.ERROR, LogDir, ex.ToString(), "CpSvr8091S");
                EventLog.WriteEntry("SubscribeStocksRunner", ex.ToString());
                //Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : " + ex.ToString());
            }
        }