//디비에서 디테일 채워주는 private void mfnGetDetailFromDB(string p_Name, int p_HowLoing) { string strQuery = ""; strQuery += "SELECT * FROM List WHERE Name = '" + p_Name + "' ORDER BY Date LIMIT " + (p_HowLoing + 60).ToString(); DataTable dt = Network.GetDBTable(strQuery, mDbSource); Variables.DetailInfo[] vdTemp = new Variables.DetailInfo[p_HowLoing + 60]; for (int i = 0; i < dt.Rows.Count; i++) { vdTemp[i].date = dt.Rows[i]["Date"].ToString(); vdTemp[i].price = Convert.ToInt32(dt.Rows[i]["price"]); vdTemp[i].volumn = Convert.ToInt32(dt.Rows[i]["volumn"]); vdTemp[i].highPrice = Convert.ToInt32(dt.Rows[i]["highPrice"]); vdTemp[i].lowPrice = Convert.ToInt32(dt.Rows[i]["lowPrice"]); vdTemp[i].startPrice = Convert.ToInt32(dt.Rows[i]["startPrice"]); } mDetailInfo = vdTemp; }
// GetDetailInfo public static Variables.DetailInfo[] GetDetailInfo(string p_StockCode, int p_Date) { Variables.DetailInfo[] detailInfo = new Variables.DetailInfo[p_Date]; /* Parsing EX * xxxx:functionmouseOver(obj){:obj.style.backgroundColor="#f6f4e5";:}: * functionmouseOut(obj){:obj.style.backgroundColor="#ffffff";:}:일별시세: * 날짜:종가:전일비:시가:고가:저가:거래량: * 2019.01.23:30,650:650:30,650:30,650:29,800:23,812: * 2019.01.22:30,000:650:30,200:30,500:29,450:47,576: * 2019.01.21:30,650:200:30,500:30,750:30,250:18,348: * 2019.01.18:30,450:100:30,850:30,900:29,850:23,615: * 2019.01.17:30,350:350:30,550:30,850:29,500:35,802: * 2019.01.16:30,700:850:29,500:30,800:29,400:52,867: * 2019.01.15:29,850:100:29,800:30,150:29,550:27,256: * 2019.01.14:29,750:1,200:28,850:30,450:28,850:71,833: * 2019.01.11:28,550:450:29,100:29,100:28,200:29,718: * 2019.01.10:29,000:0:29,000:30,000:28,700:62,221: * 페이지네비게이션:1:2:3:4:5:6:7:8:9:10:다음:맨뒤: * */ string strURL = ""; string tempStr = ""; string[] SplitStr = new string[] { }; int x = 0; for (int i = 0; i < (p_Date / 10); i++) { strURL = "http://finance.naver.com/item/sise_day.nhn?code=" + p_StockCode + "&page=" + Convert.ToString(i + 1); tempStr = GetHtmlString(strURL); SplitStr = tempStr.Split(':'); if (tempStr == "False") { detailInfo[0].date = "0000.00.00"; detailInfo[0].price = -1; detailInfo[0].volumn = -1; detailInfo[0].highPrice = -1; detailInfo[0].lowPrice = -1; detailInfo[0].startPrice = -1; return(detailInfo); } if (x < p_Date) { for (int j = 15; j < 85; j += 7) { // 혹여나 60일치가 모두 파싱이 안된 경우 if (!SplitStr[j].Contains(".")) { detailInfo[x].date = "0000.00.00"; detailInfo[x].price = -1; detailInfo[x].volumn = -1; detailInfo[x].highPrice = -1; detailInfo[x].lowPrice = -1; detailInfo[x].startPrice = -1; return(detailInfo); } try { detailInfo[x].date = SplitStr[j]; detailInfo[x].price = Convert.ToInt32(SplitStr[j + 1].Replace(",", "")); detailInfo[x].volumn = Convert.ToInt32(SplitStr[j + 6].Replace(",", "")); detailInfo[x].highPrice = Convert.ToInt32(SplitStr[j + 4].Replace(",", "")); detailInfo[x].lowPrice = Convert.ToInt32(SplitStr[j + 5].Replace(",", "")); detailInfo[x].startPrice = Convert.ToInt32(SplitStr[j + 3].Replace(",", "")); } catch { detailInfo[x].date = "0000.00.00"; detailInfo[x].price = -1; detailInfo[x].volumn = -1; detailInfo[x].highPrice = -1; detailInfo[x].lowPrice = -1; detailInfo[x].startPrice = -1; return(detailInfo); } x++; } } } return(detailInfo); }