* unimarc
a. 팩스전송 완료. b. 마크목록 폼 작성중 1. 엑셀반출 기능 추가중 사용 작업중 2. 마크편집 폼 수정 중 (마크 반출 test프로젝트 진행완료, 본 프로젝트에 적용중. / 저장기능활성화 작업완료) 2-1. 기존의 칸채우기에서 예상되지 못한 버그가 발생하여 칸채우기 숨김. 2-2. 008태크 재배치 => TextBox에 적용완료. 변경사항 메모장으로 넘기는 작업 진행해야함. 2-3. 현재 TODO : 저장기능 TODOLIST 1. 팩스로 전송될 엑셀파일 밑작업마무리 (입력될 파라미터만 적용하면 실사용가능) 2. 알라딘API로 ISBN조회 프로젝트 새로 작업할 것 => 대부분의 작업 완료. 내일 네이버 API연동중 자잘한 버그 수정작업 필요.
This commit is contained in:
@@ -13,7 +13,7 @@ using System.Xml;
|
||||
|
||||
namespace ISBN_Check_test
|
||||
{
|
||||
class Aladin_API
|
||||
class API
|
||||
{
|
||||
/// <summary>
|
||||
/// https://blog.aladin.co.kr/openapi 참고
|
||||
@@ -22,14 +22,14 @@ namespace ISBN_Check_test
|
||||
/// <param name="QueryType"></param>
|
||||
/// <param name="Param"></param>
|
||||
/// <returns></returns>
|
||||
public string Find(string Query, string QueryType, string[] Param)
|
||||
public string Aladin(string Query, string QueryType, string[] Param)
|
||||
{
|
||||
string result = string.Empty;
|
||||
// 쿼리 생성
|
||||
string key = "ttbgloriabook1512001";
|
||||
string site = "http://www.aladin.co.kr/ttb/api/ItemSearch.aspx";
|
||||
string query = string.Format("{0}?query={1}&TTBKey={2}&output=xml&querytype={3}&MaxResults={4}",
|
||||
site, Query, key, "Title", 30.ToString());
|
||||
site, Query, key, QueryType, 30.ToString());
|
||||
|
||||
// 쿼리를 입력인자로 WebRequest 개채 생성
|
||||
WebRequest request = WebRequest.Create(query);
|
||||
@@ -100,6 +100,91 @@ namespace ISBN_Check_test
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public string Naver(string[] Query, string[] Param)
|
||||
{
|
||||
string result = string.Empty;
|
||||
string json = string.Empty;
|
||||
// url 생성
|
||||
string url = "https://openapi.naver.com/v1/search/book_adv?";
|
||||
|
||||
if(Query[0] != null || Query[0] != "")
|
||||
url += "d_titl=" + Query[0] + "&";
|
||||
|
||||
if(Query[1] != null || Query[1] != "")
|
||||
url += "d_auth=" + Query[1] + "&";
|
||||
|
||||
if(Query[2] != null || Query[2] != "")
|
||||
url += "d_publ=" + Query[2] + "&";
|
||||
|
||||
//
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
|
||||
request.Headers.Add("X-Naver-Client-Id", "wYr0JczCBoDopq1NKTyQ"); // 클라이언트 아이디
|
||||
request.Headers.Add("X-Naver-Client-Secret", "QHzeXadtO7"); // 클라이언트 시크릿
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
string status = response.StatusCode.ToString();
|
||||
if (status == "OK")
|
||||
{
|
||||
Stream stream = response.GetResponseStream();
|
||||
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
|
||||
json = reader.ReadToEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(status, "Error");
|
||||
return "Error";
|
||||
}
|
||||
/*
|
||||
// xml형식을 json형식으로 변환
|
||||
XmlDocument doc = new XmlDocument();
|
||||
//doc.LoadXml(xml);
|
||||
doc.Load(xml);
|
||||
var json = JsonConvert.SerializeXmlNode(doc);
|
||||
*/
|
||||
// json형식 분석을 위해 JavaScriptSerializer 개체 생성
|
||||
JavaScriptSerializer js = new JavaScriptSerializer();
|
||||
|
||||
// 런타임에 개체를 확인하여 사용할수 있는 dynamic을 이용해 역직렬화
|
||||
dynamic dob = js.Deserialize<dynamic>(json);
|
||||
|
||||
// "object"내에 있는것을 얻어오기 위해 다시 dynamic변수에 참조
|
||||
dynamic docs = "";
|
||||
try
|
||||
{
|
||||
// docs = dob["object"]["item"];
|
||||
docs = dob["items"];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
int length = 0;
|
||||
int ID_length = Param.Length;
|
||||
|
||||
// 검색 결과가 1개 이하일 경우, 오류가 발생하여 try/catch문 사용.
|
||||
try
|
||||
{
|
||||
// docs는 요소 컬렉션으로 object로 변환.
|
||||
object[] buf = docs;
|
||||
length = buf.Length;
|
||||
}
|
||||
catch
|
||||
{
|
||||
object buf = docs;
|
||||
length = 1;
|
||||
}
|
||||
for (int a = 0; a < length; a++)
|
||||
{
|
||||
List<string> tmp_data = new List<string>();
|
||||
for (int b = 0; b < ID_length; b++)
|
||||
{
|
||||
tmp_data.Add(docs[a][Param[b]]);
|
||||
result += tmp_data[b] + "|";
|
||||
}
|
||||
result += "\n\t";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
class Skill_Grid
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user