예제 #1
0
        public void MakeDataTable()
        {
            if (_dt != null)
            {
                _dt = null;
                _dt = new DataTable();
            }

            using (ClsColumnSets oBasicDataType = new ClsColumnSets())
            {
                foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10014Index)))
                {
                    int j = 0;
                    j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column10014Index), i));

                    if (_dt.Columns.Contains(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j).ToString()) != true)
                    {
                        _dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j));
                    }
                }
            };
        }
예제 #2
0
        public void MakeDataTable()
        {
            if (_dt != null)
            {
                _dt = null;
                _dt = new DataTable();
            }

            using (ClsColumnSets oBasicDataType = new ClsColumnSets())
            {
                foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10059Index)))
                {
                    _dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)i));
                }
            };
        }
예제 #3
0
        public static void AxKH_OnReceiveTrData(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            //  StopTimer();

            DataTable dt = new DataTable();
            object    handler;
            int       nCnt = 0;

            nCnt = ClsAxKH.AxKH.GetRepeatCnt(e.sTrCode, e.sRQName);

            ClsUtil clsUtil = new ClsUtil();

            //stockCode = clsUtil.Mid(e.sRQName, 1, 6);
            //sRQName = e.sRQName.ToString().Replace(stockCode + "_", "");

            string[] sRQNameArray = e.sRQName.ToString().Trim().Split(',');

            ClsDbLogger.StoreLogger(loggergb: ClsDbLogger.LoggerGb.RecieveLoger, optCallNo: "AxKH_OnReceiveTrData", transText: e.sTrCode.ToString().Trim() + "@" + e.sRQName.ToString().Trim());

            switch (sRQNameArray[0].ToString().Trim())
            {
            case "주식기본정보요청":

                try
                {
                    using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                    {
                        foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10001Index)))
                        {
                            int j = 0;
                            j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column10001Index), i));
                            dt.Columns.Add(oBasicDataType.GetDataColumn10001((ClsColumnSets.ColumnNameIndex)j));
                        }
                    };

                    handler = AxKH_10001_OnReceived;

                    DataRow dr2th = dt.NewRow();
                    for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                    {
                        var type = dt.Columns[intColumName].DataType;

                        dr2th[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, 0, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                    }

                    dt.Rows.Add(dr2th);

                    if (handler != null)
                    {
                        if (Convert.ToInt32(e.sPrevNext) != 2)
                        {
                            //_OptStatus.InitOptCallingStatus();
                        }
                        //AxKH_10081_OnReceived(e.sTrCode, dt, Convert.ToInt32(e.sPrevNext));
                        AxKH_10001_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                        return;
                    }

                    break;
                }
                catch (Exception)
                {
                    AxKH_10001_OnReceived(e.sRQName.ToString().Trim(), null, Convert.ToInt32(e.sPrevNext));
                    throw;
                }

            case "주식일주월시분요청":
                using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                {
                    foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10005Index)))
                    {
                        int j = 0;
                        j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column10005Index), i));
                        dt.Columns.Add(oBasicDataType.GetDataColumn10001((ClsColumnSets.ColumnNameIndex)j));
                    }
                };

                handler = AxKH_10005_OnReceived;


                if (nCnt == 0)
                {
                    if (handler != null)
                    {
                        //_OptStatus.InitOptCallingStatus();
                        AxKH_10005_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                        return;
                    }
                }

                for (int i = 0; i < nCnt; i++)
                {
                    DataRow dr = dt.NewRow();
                    for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                    {
                        var type = dt.Columns[intColumName].DataType;
                        dr[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, i, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                    }

                    dt.Rows.Add(dr);
                }

                if (handler != null)
                {
                    if (Convert.ToInt32(e.sPrevNext) != 2)
                    {
                        //_OptStatus.InitOptCallingStatus();
                    }

                    AxKH_10005_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                    return;
                }


                break;

            case "일별거래상세요청":
                using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                {
                    foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10015Index)))
                    {
                        int j = 0;
                        j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column10015Index), i));
                        dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j));
                    }
                };

                handler = AxKH_10015_OnReceived;

                if (nCnt == 0)
                {
                    if (handler != null)
                    {
                        //_OptStatus.InitOptCallingStatus();
                        AxKH_10015_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                        return;
                    }
                }

                for (int i = 0; i < nCnt; i++)
                {
                    DataRow dr = dt.NewRow();
                    for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                    {
                        var type = dt.Columns[intColumName].DataType;
                        dr[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, i, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                    }

                    dt.Rows.Add(dr);
                }

                if (handler != null)
                {
                    if (Convert.ToInt32(e.sPrevNext) != 2)
                    {
                        //_OptStatus.InitOptCallingStatus();
                    }
                    //AxKH_10015_OnReceived(e.sTrCode, dt, Convert.ToInt32(e.sPrevNext));
                    AxKH_10015_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                    return;
                }

                break;


            case "공매도추이요청 ":
                using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                {
                    foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10014Index)))
                    {
                        int j = 0;
                        j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column10014Index), i));
                        dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j));
                    }
                };
                handler = AxKH_10014_OnReceived;

                if (nCnt == 0)
                {
                    if (handler != null)
                    {
                        //_OptStatus.InitOptCallingStatus();
                        AxKH_10014_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                        return;
                    }
                }

                for (int i = 0; i < nCnt; i++)
                {
                    DataRow dr = dt.NewRow();
                    for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                    {
                        var type = dt.Columns[intColumName].DataType;
                        dr[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, i, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                    }

                    dt.Rows.Add(dr);
                }

                if (handler != null)
                {
                    if (Convert.ToInt32(e.sPrevNext) != 2)
                    {
                        //_OptStatus.InitOptCallingStatus();
                    }

                    AxKH_10014_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                    return;
                }

                break;

            case "주식일봉차트조회":
                using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                {
                    foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10081Index)))
                    {
                        int j = 0;
                        j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column10081Index), i));
                        dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j));
                    }
                };

                handler = AxKH_10081_OnReceived;

                if (nCnt == 0)
                {
                    if (handler != null)
                    {
                        //_OptStatus.InitOptCallingStatus();
                        AxKH_10081_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                        return;
                    }
                }

                for (int i = 0; i < nCnt; i++)
                {
                    DataRow dr = dt.NewRow();
                    for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                    {
                        var type = dt.Columns[intColumName].DataType;
                        dr[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, i, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                    }

                    dt.Rows.Add(dr);
                }

                if (handler != null)
                {
                    if (Convert.ToInt32(e.sPrevNext) != 2)
                    {
                        //_OptStatus.InitOptCallingStatus();
                    }
                    //AxKH_10081_OnReceived(e.sTrCode, dt, Convert.ToInt32(e.sPrevNext));
                    AxKH_10081_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                    return;
                }

                break;

            case "종목별투자자기관별차트요청":
                try
                {
                    using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                    {
                        foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column10060Index)))
                        {
                            int j = 0;
                            j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column10060Index), i));
                            // _dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)i));
                            dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j));
                        }
                    };

                    handler = AxKH_10060_OnReceived;

                    if (nCnt == 0)
                    {
                        if (handler != null)
                        {
                            //_OptStatus.InitOptCallingStatus();
                            AxKH_10060_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                            return;
                        }
                    }

                    for (int i = 0; i < nCnt; i++)
                    {
                        DataRow dr = dt.NewRow();
                        for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                        {
                            var type = dt.Columns[intColumName].DataType;
                            dr[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, i, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                        }

                        dt.Rows.Add(dr);
                    }

                    if (handler != null)
                    {
                        if (Convert.ToInt32(e.sPrevNext) != 2)
                        {
                            //_OptStatus.InitOptCallingStatus();
                        }

                        AxKH_10060_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                        return;
                    }
                    else
                    {
                        AxKH_10060_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                        return;
                    }
                }
                catch (Exception)
                {
                    AxKH_10060_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                    break;
                    throw;
                }



            case "대차거래추이요청(종목별)":
                using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                {
                    foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column20068Index)))
                    {
                        int j = 0;
                        j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column20068Index), i));
                        // _dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)i));
                        dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j));
                    }
                };
                handler = AxKH_20068_OnReceived;

                if (nCnt == 0)
                {
                    if (handler != null)
                    {
                        //_OptStatus.InitOptCallingStatus();
                        AxKH_20068_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                        return;
                    }
                }

                for (int i = 0; i < nCnt; i++)
                {
                    DataRow dr = dt.NewRow();
                    for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                    {
                        var type = dt.Columns[intColumName].DataType;
                        dr[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, i, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                    }

                    dt.Rows.Add(dr);
                }

                if (handler != null)
                {
                    if (Convert.ToInt32(e.sPrevNext) != 2)
                    {
                        //_OptStatus.InitOptCallingStatus();
                    }

                    AxKH_20068_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                    return;
                }

                break;

            case "테마그룹별요청":
                using (ClsColumnSets oBasicDataType = new ClsColumnSets())
                {
                    foreach (int i in Enum.GetValues(typeof(ClsColumnSets.Column90002Index)))
                    {
                        int j = 0;
                        j = (int)Enum.Parse(typeof(ClsColumnSets.ColumnNameIndex), Enum.GetName(typeof(ClsColumnSets.Column90002Index), i));
                        // _dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)i));
                        dt.Columns.Add(oBasicDataType.GetDataColumn((ClsColumnSets.ColumnNameIndex)j));
                    }
                };
                handler = AxKH_90002_OnReceived;

                if (nCnt == 0)
                {
                    if (handler != null)
                    {
                        //_OptStatus.InitOptCallingStatus();
                        AxKH_90002_OnReceived(e.sRQName.ToString().Trim(), null, 0);
                        return;
                    }
                }

                for (int i = 0; i < nCnt; i++)
                {
                    DataRow dr = dt.NewRow();
                    for (int intColumName = 0; intColumName < dt.Columns.Count; intColumName++)
                    {
                        var type = dt.Columns[intColumName].DataType;
                        dr[dt.Columns[intColumName].ColumnName.ToString()] = Convert.ChangeType(ClsAxKH.AxKH.GetCommData(e.sTrCode, e.sRQName, i, dt.Columns[intColumName].ColumnName.ToString()).ToString().Trim(), type);
                    }

                    dt.Rows.Add(dr);
                }

                if (handler != null)
                {
                    if (Convert.ToInt32(e.sPrevNext) != 2)
                    {
                        //_OptStatus.InitOptCallingStatus();
                    }

                    AxKH_90002_OnReceived(e.sRQName.ToString().Trim(), dt, Convert.ToInt32(e.sPrevNext));
                    return;
                }

                break;

            default:
                return;
            }
        }