private void GetOpt10015Caller(string stockCode) { if (_opt10015 != null) { _opt10015.Dispose(); _opt10015 = null; } _opt10015 = new ClsOpt10015(); TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); if (tcs == null || tcs.Task.IsCompleted) { return; } SetFormId(); _opt10015.SetInit(_FormId); _opt10015.JustRequest(stockCode, _stdDate, "", 0); OPS10060.Text = ClsAxKH._limitCount.ToString(); lblTime.Text = ClsAxKH._limitTime.ToString(); tcs.SetResult(true); }
private void GetOpt10015Caller(string stockCode, string MaxDate, string MinDate) { if (_opt10015 != null) { _opt10015.Dispose(); _opt10015 = null; } _opt10015 = new ClsOpt10015(); TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); if (tcs == null || tcs.Task.IsCompleted) { return; } _opt10015.SetInit(_FormId); _opt10015.JustRequest(stockCode, _stdDate, "", 0); tcs.SetResult(true); }
private void Opt10015_OnReceived(string sRQName, DataTable dt, int sPreNext) { TaskCompletionSource <bool> tcs = null; tcs = new TaskCompletionSource <bool>(); string[] sRQNameArray = sRQName.Split(','); string stockCode = ""; string stdDate = ""; string maxDate = ""; string minDate = ""; string chainMaxDate = ""; stockCode = ClsAxKH.RetStockCodeBysRqName(ClsAxKH.OptType.Opt10015, sRQName); stdDate = ClsAxKH.RetStdDateBysRqName(ClsAxKH.OptType.Opt10015, sRQName); try { if (dt != null) { maxDate = dt.Compute("max([일자])", string.Empty).ToString().Trim(); minDate = dt.Compute("min([일자])", string.Empty).ToString().Trim(); ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); var rows = _dtOptCalMagam.AsEnumerable().Where(Row => Row.Field <string>("STOCK_CODE") == stockCode); foreach (DataRow dr2th in rows) { if (dr2th["CHAIN_COMP_GB"].ToString().Trim() == "Y") { chainMaxDate = dr2th["CHAIN_MAX_DATE"].ToString().Trim(); } } } if (tcs == null || tcs.Task.IsCompleted) { return; } if (dt != null) { ArrayParam arrParam = new ArrayParam(); Sql oSql = new Sql(SDataAccess.ClsServerInfo.VADISSEVER, "KIWOOMDB"); foreach (DataRow dr in dt.Rows) { WriteTextSafe(stockCode + "(" + dr["일자"] + ")"); arrParam.Clear(); arrParam.Add("@ACTION_GB", "A"); arrParam.Add("@STOCK_CODE", stockCode); arrParam.Add("@STOCK_DATE", dr["일자"].ToString()); arrParam.Add("@LAST_PRICE", dr["종가"]); arrParam.Add("@OAGO_DAEBI_SYMBOL", dr["전일대비기호"]); arrParam.Add("@OAGO_DAEBI", dr["전일대비"]); arrParam.Add("@UPDOWN_RATE", dr["등락율"]); arrParam.Add("@TRADE_QTY", dr["거래량"]); arrParam.Add("@TRADE_DAEGUM", dr["거래대금"]); arrParam.Add("@BETRADE_QTY", dr["장전거래량"]); arrParam.Add("@BETRADE_BIJUNG", dr["장전거래비중"]); arrParam.Add("@INTRADE_QTY", dr["장중거래량"]); arrParam.Add("@INTRADE_BIJUNG", dr["장중거래비중"]); arrParam.Add("@AFTRADE_QTY", dr["장후거래량"]); arrParam.Add("@AFTRADE_BIJUNG", dr["장후거래비중"]); arrParam.Add("@SUM3", dr["합계3"]); arrParam.Add("@GITRADE_QTY", dr["기간중거래량"]); arrParam.Add("@BETRADE_DAEGUM", dr["장전거래대금"]); arrParam.Add("@BETRADE_DBIJUNG", dr["장전거래대금비중"]); arrParam.Add("@INTRADE_DAEGUM", dr["장중거래대금"]); arrParam.Add("@INTRADE_DBIJUNG", dr["장중거래대금비중"]); arrParam.Add("@AFTRADE_DAEGUM", dr["장후거래대금"]); arrParam.Add("@AFTRADE_DBIJUNG", dr["장후거래대금비중"]); arrParam.Add("@DEUNG_DATE", ""); arrParam.Add("@DEUNG_TIME", ""); arrParam.Add("@R_ERRORCD", -1, SqlDbType.Int, ParameterDirection.InputOutput); oSql.ExecuteNonQuery("p_Opt10015Add", CommandType.StoredProcedure, arrParam); if (chainMaxDate != "") { if (chainMaxDate == dr["일자"].ToString().Trim()) { ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); _opt10015.Dispose(); tcs.SetResult(true); WaitTime(); OnGetStockCode(); return; } } } } // 최근 거래일 100일을 가져오는걸로 한다면 if (chk100.Checked == true) { ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); _opt10015.Dispose(); tcs.SetResult(true); OnGetStockCode(); return; } else { if (sPreNext == 2) { tcs.SetResult(true); ClsDbLogger.OptCallMagamStoredData(actionGb: "A", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "S", chainCompGb: "", chainMaxDate: "", chainMinDate: ""); WaitTime(); _opt10015.SetInit(_FormId); _opt10015.JustRequest(StockCode: sRQNameArray[1].ToString().Trim(), StartDate: sRQNameArray[2].ToString().Trim(), StockName: "", nPrevNext: 2); OPS10060.Text = ClsAxKH._limitCount.ToString(); lblTime.Text = ClsAxKH._limitTime.ToString(); return; } else { if (dt != null) { ClsDbLogger.OptCallMagamStoredData(actionGb: "CE", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "C", chainCompGb: "", chainMaxDate: "", chainMinDate: minDate); } else { ClsDbLogger.OptCallMagamStoredData(actionGb: "EE", optCaller: "OPT10015", stockCode: stockCode, stdDate: stdDate, maxDate: maxDate, minDate: minDate, jobIngGb: "F", chainCompGb: "", chainMaxDate: "", chainMinDate: minDate); } _opt10015.Dispose(); tcs.SetResult(true); OnGetStockCode(); return; } } } catch (Exception ex) { _opt10015.Dispose(); tcs.SetResult(true); OnGetStockCode(); MessageBox.Show(ex.Message.ToString()); throw; } }