public async Task <IActionResult> query0() { bs.dbQuery("test", "hika0", "select * from hika00 where title in(@title:hika00.title@,@title:hika00.title@)"); var r = bs.dbResult <List <object[]> >(); await bs.dbAsync(false, "test", async(db) => { r = await db.selectAsync <List <object[]> >("hika0", "title", "hika"); return(true); }); return(Json(new { r = r })); }
public async Task <IActionResult> list() { List <Dictionary <string, string> > list = null; String errMsg = null; await bs.dbAsync(false, "remote", async (db) => { var rs = await db.selectAsync <List <Dictionary <string, string> > >("contents/tree/list"); if (rs.valiError) { errMsg = "유효성 검사 오류"; return(false); } if (rs.noRecord) { errMsg = "트리 리스트가 존재하지 않습니다."; return(false); } list = rs.result; return(true); }); //contree_rowid,parent_rowid,title,ord,regdate if (errMsg != null) { bs.apiFail(errMsg); } string key = ""; int i, j; Dictionary <string, string> t0; var data = new Dictionary <string, Dictionary <string, Dictionary <string, string> > >(); for (i = 0, j = list.Count; i < j; i++) { t0 = list[i]; string pr = t0["parent_rowid"]; if (i == 0) { key = pr; } if (!data.ContainsKey(pr)) { data.Add(pr, new Dictionary <string, Dictionary <string, string> >()); } data[pr].Add(t0["contree_rowid"], t0); } /* * var conTreeList = new List<ConTree>(); * conTreeList.Add(new ConTree() { * r = 1, * title = "aaa", * tree = new List<ConTree>() * }); */ return(bs.apiOk(new { success = 1, data = data, key = key })); }
public async Task <IActionResult> list() { var before = (Dictionary <string, object>)bs.before(this); if (null == before) { if (null == bs.s("valiError")) { return(bs.apiFail("알 수 없는 에러 발생")); } else { return(bs.apiFail((Dictionary <string, bs.ValiResult>)bs.s("valiError"))); } } List <Dictionary <String, String> > catList = null; List <Dictionary <String, String> > contentsList = null; string errorMsg = null; await bs.dbAsync(false, "remote", async (db) => { var rs = await db.selectAsync <List <Dictionary <String, String> > >("contents/cat_list"); if (rs.noRecord || rs.valiError) { errorMsg = "컨텐츠 종류 정보를 가져오지 못했습니다."; return(false); } catList = rs.result; rs = await db.selectAsync <List <Dictionary <String, String> > >("contents/list", before); if (rs.noRecord || rs.valiError) { errorMsg = "컨텐츠 정보를 가져오지 못했습니다."; return(false); } contentsList = rs.result; return(true); }); if (errorMsg != null) { return(bs.apiFail(errorMsg)); } return(bs.apiOk(new { cat = catList, list = contentsList })); }
public async Task <IActionResult> add() { var before = (Dictionary <string, object>)bs.before(this); if (null == before) { //return bs.beforeErr(); if (null == bs.s("valiError")) { return(bs.apiFail("알 수 없는 에러 발생")); } else { return(bs.apiFail((Dictionary <string, bs.ValiResult>)bs.s("valiError"))); } } Dictionary <String, String> teacher = null; int teacher_rowid = 0; String errMsg = null; await bs.dbAsync(true, "remote", async (db) => { var rs0 = await db.selectAsync <Dictionary <String, String> >("teacher/view_from_cmps_rowid", before); if (rs0.valiError) { errMsg = "유효성 검사 오류"; return(false); } if (!rs0.noRecord) { errMsg = "이미 존재하는 교수입니다."; return(false); } var rs1 = await db.execAsync("teacher/add", before); if (rs1.result != 1) { errMsg = "교수를 추가하지 못했습니다."; return(false); } teacher_rowid = rs1.insertId; var rs2 = await db.selectAsync <Dictionary <String, String> >("teacher/view_from_rowid", "teacher_rowid", teacher_rowid + ""); if (rs2.noRecord) { errMsg = "교수 정보를 가져오지 못했습니다."; return(false); } teacher = rs2.result; return(true); }); if (errMsg != null) { return(bs.apiFail(errMsg)); } return(bs.apiOk(new { success = 1, professor = new { r = teacher["teacher_rowid"], cmps_r = teacher["cmps_rowid"], username = teacher["username"], regdate = teacher["regdate"] } })); }