public void ProcessRequest(HttpContext context) { string comic_id = context.Request["comic_id"]; //漫画id string chap_id = context.Request["chap_id"]; //章节 using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { ChapInforMation chapIn = new ChapInforMation(); using (DataTable _dt = cn.ExecQuery(@"select * from T0005 where C00029=? and C00030=?" , new OleDbParameter[] { new OleDbParameter("@C00029", chap_id), new OleDbParameter("@C00030", comic_id) })) { if (_dt.Rows.Count > 0) { DataRow dr = _dt.Rows[0]; chapIn.chapter_name = Coding.ToUnicode(dr["C00031"].ToString()); chapIn.chapter_order = dr["C00032"].ToString(); chapIn.comic_id = dr["C00030"].ToString(); } } string h_id = chap_id; //上一张 using (DataTable _dt = cn.ExecQuery(@"select top 1 C00029 from T0005 where C00030=" + comic_id + " and C00029 < " + chap_id + " order by C00029 desc")) { if (_dt.Rows.Count > 0) { h_id = _dt.Rows[0]["C00029"].ToString(); chapIn.id = h_id; //根据话id 查找 using (DataTable _dts = cn.ExecQuery(@"Select * from T0006 WHERE C00035=? order by C00034 asc" , new OleDbParameter[] { new OleDbParameter("@C00035", h_id) })) { string[] pages = new string[_dts.Rows.Count]; for (int i = 0; i < _dts.Rows.Count; i++) { pages[i] = _dts.Rows[i]["C00036"].ToString(); } chapIn.page = pages; } } } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(chapIn)); } }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { comicsearchhots chots = new comicsearchhots(); chots.result = 1; chots.msg = "OK"; try { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { using (DataTable _dt = cn.ExecQuery(@"SELECT top 20 * FROM T0003 ORDER BY C00010 DESC")) { comicsearchhotData[] comDataList = new comicsearchhotData[_dt.Rows.Count]; for (int i = 0; i < _dt.Rows.Count; i++) { comicsearchhotData cData = new comicsearchhotData(); cData.id = _dt.Rows[i]["C00010"].ToString(); cData.name = Coding.ToUnicode(_dt.Rows[i]["C00011"].ToString()); comDataList[i] = cData; } chots.data = comDataList; } } } catch { } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(chots)); }
public void ProcessRequest(HttpContext context) { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { Ctop cp = new Ctop(); using (DataTable _dt = cn.ExecQuery("select top 10 * from T0004 ORDER BY C00016 DESC")) { Topdata[] TD = new Topdata[_dt.Rows.Count]; for (int i = 0; i < _dt.Rows.Count; i++) { Topdata tdrow = new Topdata(); tdrow.authors = Coding.ToUnicode(_dt.Rows[i]["C00025"].ToString()); tdrow.cover = _dt.Rows[i]["C00024"].ToString(); tdrow.id = _dt.Rows[i]["C00016"].ToString(); tdrow.last_update_chapter_name = Coding.ToUnicode(_dt.Rows[i]["C00022"].ToString()); tdrow.sum_chapters = "100"; tdrow.sum_source = "101"; tdrow.title = Coding.ToUnicode(_dt.Rows[i]["C00017"].ToString()); tdrow.types = Coding.ToUnicode(_dt.Rows[i]["C00019"].ToString()); TD[i] = tdrow; } cp.month = TD; cp.total = TD; cp.week = TD; } context.Response.Write(JsonSerialize.jSerialize(cp)); } }
/// <summary> /// ACCESS高效分页 /// </summary> /// <param name="pageIndex">当前页码</param> /// <param name="pageSize">分页容量</param> /// <param name="strKey">主键</param> /// <param name="showString">显示的字段</param> /// <param name="queryString">查询字符串,支持联合查询</param> /// <param name="whereString">查询条件,若有条件限制则必须以where 开头</param> /// <param name="orderString">排序规则</param> /// <param name="pageCount">传出参数:总页数统计</param> /// <param name="recordCount">传出参数:总记录统计</param> /// <returns>装载记录的DataTable</returns> public static DataTable ExecutePager(int pageIndex, int pageSize, string strKey, string showString, string queryString, string whereString, string orderString, out int pageCount, out int recordCount) { if (pageIndex < 1) { pageIndex = 1; } if (pageSize < 1) { pageSize = 10; } if (string.IsNullOrEmpty(showString)) { showString = "*"; } if (string.IsNullOrEmpty(orderString)) { orderString = strKey + " asc "; } using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { string myVw = string.Format(" ( {0} ) tempVw ", queryString); string sql111 = string.Format(" select count(*) as recordCount from {0} {1}", myVw, whereString); recordCount = Convert.ToInt32(cn.ExecScalar(sql111)); if ((recordCount % pageSize) > 0) { pageCount = recordCount / pageSize + 1; } else { pageCount = recordCount / pageSize; } string sql; if (pageIndex == 1)//第一页 { sql = string.Format("select top {0} {1} from {2} {3} order by {4} ", pageSize, showString, myVw, whereString, orderString); } else if (pageIndex > pageCount)//超出总页数 { sql = string.Format("select top {0} {1} from {2} {3} order by {4} ", pageSize, showString, myVw, "where 1=2", orderString); } else { int pageLowerBound = pageSize * pageIndex; int pageUpperBound = pageLowerBound - pageSize; string recordIDs = recordID(string.Format("select top {0} {1} from {2} {3} order by {4} ", pageLowerBound, strKey, myVw, whereString, orderString), pageUpperBound); sql = string.Format("select {0} from {1} where {2} in ({3}) order by {4} ", showString, myVw, strKey, recordIDs, orderString); } using (DataTable dt = cn.ExecQuery(sql)) { return(dt); } } }
public void ProcessRequest(HttpContext context) { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { //获取大分类的信息 using (DataTable _dtBig = cn.ExecQuery(@"select * from T0000 order by C00001 asc")) { TreeListing[] tl = new TreeListing[_dtBig.Rows.Count]; for (int i = 0; i < _dtBig.Rows.Count; i++) { TreeListing tlb = new TreeListing(); tlb.id = _dtBig.Rows[i]["C00001"].ToString(); tlb.title = _dtBig.Rows[i]["C00003"].ToString(); tlb.icon = _dtBig.Rows[i]["C00002"].ToString(); using (DataTable _dtSmall = cn.ExecQuery(@"select * from T0001 where C00101=? order by C00004", new OleDbParameter[] { new OleDbParameter("@a", _dtBig.Rows[i]["C00001"].ToString()) })) { TreeListing[] tls = new TreeListing[_dtSmall.Rows.Count]; for (int j = 0; j < _dtSmall.Rows.Count; j++) { TreeListing tlsRow = new TreeListing(); tlsRow.id = _dtSmall.Rows[j]["C00004"].ToString(); tlsRow.icon = _dtSmall.Rows[j]["C00005"].ToString(); tlsRow.title = _dtSmall.Rows[j]["C00006"].ToString(); tls[j] = tlsRow; } tlb.subnodes = tls; } tl[i] = tlb; } //信息填充后 json 序列化返回 context.Response.Write(JsonSerialize.jSerialize(tl)); } } }
public static CPageDataCache CreatePageDataCache(string sKey, string SqlString, int Spacing) { CPageDataCache cpdc = new CPageDataCache(); cpdc.UpdateSpacing = Spacing; cpdc.SqlString = SqlString; //执行查询 string Connstr = System.Configuration.ConfigurationManager.AppSettings["DBConnStr"]; using (CDBAccess cn = new CDBAccess(Connstr)) { cpdc.dt = cn.ExecQuery(cpdc.SqlString); } cpdc.dt.TableName = "TBN_" + DateTime.Now.ToString("HH:mm:ss fffff"); cpdc.UpdateTime = DateTime.Now; return(cpdc); }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { CallBackJson json = new CallBackJson(); Classify classify = new Classify(); classify.Status = "Error"; classify.Msg = "服务器异常"; try { string id = context.Request.Form["id"]; if (string.IsNullOrEmpty(id)) { throw new Exception("信息不完整"); } using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { using (DataTable _dt = cn.ExecQuery("select * from T0001 WHERE C00004=?", new OleDbParameter[] { new OleDbParameter("@id", id) })) { if (_dt.Rows.Count > 0) { classify.Status = "Success"; classify.classifyName = _dt.Rows[0]["C00006"].ToString(); classify.Msg = "获取信息成功"; } else { throw new Exception("未找到分类信息"); } } } } catch (Exception ex) { classify.Msg = ex.Message; } context.Response.Write(json.Serializer(classify)); }
void UpdateDt() { try { lock (isUpdatting) { if (isUpdatting == "1") { return; } isUpdatting = "1"; } //在此执行查询 string Connstr = System.Configuration.ConfigurationManager.AppSettings["DBConnStr"]; DataTable dt2 = null; using (CDBAccess cn = new CDBAccess(Connstr)) { dt2 = cn.ExecQuery(SqlString); } dt2.TableName = "TBN_" + DateTime.Now.ToString("HH:mm:ss fffff"); DataTable dtTemp = this.dt; lock (this.dt) { this.UpdateTime = DateTime.Now; this.dt = dt2; } dtTemp.Dispose(); lock (isUpdatting) { isUpdatting = "0"; } } catch (Exception ex) { } }
/// <summary> /// 分页使用 /// </summary> /// <param name="query"></param> /// <param name="passCount"></param> /// <returns></returns> private static string recordID(string query, int passCount) { string result = string.Empty; using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { using (DataTable _dt = cn.ExecQuery(query)) { foreach (DataRow dr in _dt.Rows) { if (passCount < 1) { result += ",'" + dr[0] + "'"; } passCount--; } } return(result.Substring(1)); } }
void BindData() { using (CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { dt01 = cn.ExecQuery("select * from T0000"); dttype = cn.ExecQuery("select * from T0001"); string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { //当前漫画对应的多个分类 using (DataTable dt3 = cn.ExecQuery("select * from T0003 where C00010 = " + id + "")) { thisdttypes = cn.ExecQuery("select * from T0002 where C00009 = " + id + ""); if (dt3.Rows.Count > 0) { TextBox1.Text = dt3.Rows[0]["C00011"].ToString(); } using (DataTable dt = cn.ExecQuery("select * from T0004 where C00016 = " + id + "")) { if (dt.Rows.Count > 0) { TextBox2.Text = dt.Rows[0]["C00018"].ToString(); TextBox4.Text = dt.Rows[0]["C00024"].ToString(); TextBox5.Text = dt.Rows[0]["C00025"].ToString(); TextBox6.Text = dt.Rows[0]["C00026"].ToString(); } } } } else { //当前漫画对应的多个分类 thisdttypes = cn.ExecQuery("select * from T0002 where C00009 = -1 "); } } }
protected void Button1_Click(object sender, EventArgs e) { string id = Request.QueryString["id"]; string name = TextBox1.Text; string jianjie = TextBox2.Text; string leixing = Request.Form["checkname"]; string tpdizhi = TextBox4.Text; string zuozhe = TextBox5.Text; string jieshao = TextBox6.Text; using (CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { string Tleixing = ""; string[] T = null; if (!string.IsNullOrEmpty(leixing)) { T = leixing.Split(','); string Tsql = ""; if (T.Length > 0) { foreach (string s in T) { Tsql += " C00004 = '" + s + "' or"; } Tsql = Tsql.Substring(0, Tsql.LastIndexOf("or")); using (DataTable dt = cn.ExecQuery("select * from T0001 where " + Tsql)) { foreach (DataRow dr in dt.Rows) { Tleixing += dr[2] + "/"; } if (dt.Rows.Count > 0) { Tleixing = Tleixing.Substring(0, Tleixing.LastIndexOf("/")); } } } } if (string.IsNullOrEmpty(id)) { Dictionary <string, string> dc = new Dictionary <string, string>(); int iid = int.Parse(cn.ExecQuery("select top 1 C00010 from T0003 order by C00010 desc").Rows[0][0].ToString()) + 1; dc.Add("id", iid.ToString()); dc.Add("name", name); dc.Add("jianjie", jianjie); dc.Add("tpdizhi", tpdizhi); dc.Add("zuozhe", zuozhe); dc.Add("jieshao", jieshao); dc.Add("tm", exPagers.getSecondEnd(DateTime.Now).ToString()); //添加 string sql = "insert into T0004(C00016,C00017,C00018,C00024,C00025,C00026,C00028,C00023) values (@id,@name,@jianjie,@tpdizhi,@zuozhe,@jieshao,1,@tm)"; cn.ExecSQL("insert into T0003 (C00010,C00011,C00013,C00012,C00014) values (@p1,@p2,@p3,@p4,@p5)", new OleDbParameter[] { new OleDbParameter("@p1", iid), new OleDbParameter("@p2", name), new OleDbParameter("@p3", tpdizhi), new OleDbParameter("@p4", exPagers.getSecondEnd(DateTime.Now)), new OleDbParameter("@p5", exPagers.getSecondEnd(DateTime.Now)) }); cn.ExecQuery(sql, cn.sqlparameter_append(dc)); // string Tid = cn.ExecQuery("select C00016 from T0004 where C00017 = @name", new OleDbParameter[] { new OleDbParameter("@name", name) }).Rows[0][0].ToString(); string insertsql = "insert into T0002(C00008,C00009) values (@p2,@p3)"; if (T != null) { foreach (string s in T) { cn.ExecSQL(insertsql, new OleDbParameter[] { new OleDbParameter("@p2", s), new OleDbParameter("@p3", iid) }); } } Response.Write("<script>alert('添加成功');window.location.href='addcomic.aspx'</script>"); } else { //修改 Dictionary <string, string> dc = new Dictionary <string, string>(); dc.Add("name", name); dc.Add("jianjie", jianjie); dc.Add("tpdizhi", tpdizhi); dc.Add("zuozhe", zuozhe); dc.Add("jieshao", jieshao); dc.Add("id", id); cn.ExecQuery("update T0003 set C00011 = @name,C00013=@tpdizhi where C00010=@id", new OleDbParameter[] { new OleDbParameter("@name", name), new OleDbParameter("@tpdizhi", tpdizhi), new OleDbParameter("@id", id) }); cn.ExecSQL("update T0004 set C00017 = @name,C00018 = @jianjie,C00024 = @tpdizhi,C00025 = @zuozhe,C00026 = @jieshao where C00016 = @id", cn.sqlparameter_append(dc)); //循环插入分类 string insertsql = "insert into T0002(C00008,C00009) values (@p2,@p3)"; cn.ExecSQL("delete from T0002 where C00009 = @id", new OleDbParameter[] { new OleDbParameter("@p", id) }); if (T != null) { foreach (string s in T) { cn.ExecSQL(insertsql, new OleDbParameter[] { new OleDbParameter("@p2", s), new OleDbParameter("@p3", id) }); } } Response.Write("<script>alert('修改成功');window.location.href='addcomic.aspx?id=" + id + "'</script>"); } } }
/// <summary> /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网 /// </summary> /// public void ProcessRequest(HttpContext context) { string classify_type = context.Request["classify_type"]; //字母 string classify_id = context.Request["classify_id"]; //小分类id string page = context.Request["page"]; //页码 int pages = 0; int.TryParse(page, out pages); pages = pages + 1; LetterComic lc = new LetterComic(); lc.result = 1; lc.msg = "OK"; try { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { int check_classify_type = 0; int.TryParse(classify_type, out check_classify_type); string sql_Big = string.Empty; OleDbParameter[] ole_big = new OleDbParameter[] { }; if (classify_type != "update") { if (check_classify_type > 0) { //说明是INT型的分类 sql_Big = "select * from T0000,T0001 where C00001=C00101 and C00001=" + classify_type + " and C00004='" + classify_id + "'"; } else { //字母型 sql_Big = "select * from T0000,T0001 where C00001=C00101 and C00002 like '%" + classify_type + "%' and C00004='" + classify_id + "'"; } } else { sql_Big = "select * from T0000,T0001 where C00001=C00101 and C00004='" + classify_id + "'"; } //先验证字母 跟小分类id using (DataTable _dt = cn.ExecQuery(sql_Big)) { if (_dt.Rows.Count > 0) { string sql = string.Empty; OleDbParameter[] ole = new OleDbParameter[] { }; if (pages == 1) { //第一页 sql = "select top " + 30 + " * from T0003,T0002 where C00009=C00010 and C00008='" + classify_id + "' order by C00010 desc"; } else { //N页 sql = "select top " + 30 + " * from T0003,T0002 where C00009=C00010 and C00008='" + classify_id + "' and C00010 not in " + @"(select top " + ((pages - 1) * 1) + " C00010 from T0003,T0002 where C00009=C00010 and C00008='" + classify_id + "' order by C00010 desc)" + "order by C00010 desc"; } //进行分页寻找返回列表 using (DataTable _dtList = cn.ExecQuery(sql)) { ComicList[] cmlist = new ComicList[_dtList.Rows.Count]; for (int i = 0; i < _dtList.Rows.Count; i++) { ComicList clist = new ComicList(); clist.id = _dtList.Rows[i]["C00010"].ToString(); clist.cover = _dtList.Rows[i]["C00013"].ToString(); clist.hot_hits = _dtList.Rows[i]["C00015"].ToString(); clist.last_update_chapter_name = Coding.ToUnicode(_dtList.Rows[i]["C00012"].ToString()); clist.last_updatetime = _dtList.Rows[i]["C00014"].ToString(); clist.title = Coding.ToUnicode(_dtList.Rows[i]["C00011"].ToString()); cmlist[i] = clist; } lc.data = cmlist; } } } } } catch { } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(lc)); }
public void ProcessRequest(HttpContext context) { using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { CIndexData cdata = new CIndexData(); //首页大图信息图片 using (DataTable _dtInfo = cn.ExecQuery(@"SELECT top 1 * FROM T0004 ORDER BY rnd(C00016) DESC")) { headlinesInfo hinfo = new headlinesInfo(); hinfo.id = _dtInfo.Rows[0]["C00016"].ToString(); hinfo.subtitle = Coding.ToUnicode(_dtInfo.Rows[0]["C00018"].ToString()); hinfo.title = Coding.ToUnicode(_dtInfo.Rows[0]["C00017"].ToString()); hinfo.cover = _dtInfo.Rows[0]["C00024"].ToString(); cdata.headlines = hinfo; } //首页信息 using (DataTable _dtepList = cn.ExecQuery(@"SELECT top 15 * FROM T0004 ORDER BY rnd(C00016) DESC")) { episodeList[] _dtepStr = new episodeList[_dtepList.Rows.Count]; for (int i = 0; i < _dtepList.Rows.Count; i++) { episodeList episRow = new episodeList(); episRow.id = _dtepList.Rows[i]["C00016"].ToString(); episRow.title = Coding.ToUnicode(_dtepList.Rows[i]["C00017"].ToString()); episRow.last_update_chapter_name = Coding.ToUnicode(_dtepList.Rows[i]["C00022"].ToString()); episRow.cover = _dtepList.Rows[i]["C00024"].ToString(); _dtepStr[i] = episRow; } cdata.episode = _dtepStr; } //连载 CIndexData cdata1 = new CIndexData(); using (DataTable _dtInfo = cn.ExecQuery(@"SELECT top 1 * FROM T0004 ORDER BY rnd(C00016) DESC")) { headlinesInfo hinfo = new headlinesInfo(); hinfo.id = _dtInfo.Rows[0]["C00016"].ToString(); hinfo.subtitle = Coding.ToUnicode(_dtInfo.Rows[0]["C00018"].ToString()); hinfo.title = Coding.ToUnicode(_dtInfo.Rows[0]["C00017"].ToString()); hinfo.cover = _dtInfo.Rows[0]["C00024"].ToString(); cdata1.headlines = hinfo; } //连载 using (DataTable _dtepList = cn.ExecQuery(@"SELECT top 15 * FROM T0004 ORDER BY rnd(C00016) DESC")) { episodeList[] _dtepStr = new episodeList[_dtepList.Rows.Count]; for (int i = 0; i < _dtepList.Rows.Count; i++) { episodeList episRow = new episodeList(); episRow.id = _dtepList.Rows[i]["C00016"].ToString(); episRow.title = Coding.ToUnicode(_dtepList.Rows[i]["C00017"].ToString()); episRow.last_update_chapter_name = Coding.ToUnicode(_dtepList.Rows[i]["C00022"].ToString()); episRow.cover = _dtepList.Rows[i]["C00024"].ToString(); _dtepStr[i] = episRow; } cdata1.episode = _dtepStr; } //最新 CIndexData cdata2 = new CIndexData(); using (DataTable _dtInfo = cn.ExecQuery(@"SELECT top 1 * FROM T0004 ORDER BY rnd(C00016) DESC")) { headlinesInfo hinfo = new headlinesInfo(); hinfo.id = _dtInfo.Rows[0]["C00016"].ToString(); hinfo.subtitle = Coding.ToUnicode(_dtInfo.Rows[0]["C00018"].ToString()); hinfo.title = Coding.ToUnicode(_dtInfo.Rows[0]["C00017"].ToString()); hinfo.cover = _dtInfo.Rows[0]["C00024"].ToString(); cdata2.headlines = hinfo; } using (DataTable _dtepList = cn.ExecQuery(@"SELECT top 15 * FROM T0004 ORDER BY rnd(C00016) DESC")) { episodeList[] _dtepStr = new episodeList[_dtepList.Rows.Count]; for (int i = 0; i < _dtepList.Rows.Count; i++) { episodeList episRow = new episodeList(); episRow.id = _dtepList.Rows[i]["C00016"].ToString(); episRow.title = Coding.ToUnicode(_dtepList.Rows[i]["C00017"].ToString()); episRow.last_update_chapter_name = Coding.ToUnicode(_dtepList.Rows[i]["C00022"].ToString()); episRow.cover = _dtepList.Rows[i]["C00024"].ToString(); _dtepStr[i] = episRow; } cdata2.episode = _dtepStr; } //完结 CIndexData cdata3 = new CIndexData(); using (DataTable _dtInfo = cn.ExecQuery(@"SELECT top 1 * FROM T0004 ORDER BY rnd(C00016) DESC")) { headlinesInfo hinfo = new headlinesInfo(); hinfo.id = _dtInfo.Rows[0]["C00016"].ToString(); hinfo.subtitle = Coding.ToUnicode(_dtInfo.Rows[0]["C00018"].ToString()); hinfo.title = Coding.ToUnicode(_dtInfo.Rows[0]["C00017"].ToString()); hinfo.cover = _dtInfo.Rows[0]["C00024"].ToString(); cdata3.headlines = hinfo; } using (DataTable _dtepList = cn.ExecQuery(@"SELECT top 15 * FROM T0004 ORDER BY rnd(C00016) DESC")) { episodeList[] _dtepStr = new episodeList[_dtepList.Rows.Count]; for (int i = 0; i < _dtepList.Rows.Count; i++) { episodeList episRow = new episodeList(); episRow.id = _dtepList.Rows[i]["C00016"].ToString(); episRow.title = Coding.ToUnicode(_dtepList.Rows[i]["C00017"].ToString()); episRow.last_update_chapter_name = Coding.ToUnicode(_dtepList.Rows[i]["C00022"].ToString()); episRow.cover = _dtepList.Rows[i]["C00024"].ToString(); _dtepStr[i] = episRow; } cdata3.episode = _dtepStr; } //原创 CIndexData cdata4 = new CIndexData(); using (DataTable _dtInfo = cn.ExecQuery(@"SELECT top 1 * FROM T0004 ORDER BY rnd(C00016) DESC")) { headlinesInfo hinfo = new headlinesInfo(); hinfo.id = _dtInfo.Rows[0]["C00016"].ToString(); hinfo.subtitle = Coding.ToUnicode(_dtInfo.Rows[0]["C00018"].ToString()); hinfo.title = Coding.ToUnicode(_dtInfo.Rows[0]["C00017"].ToString()); hinfo.cover = _dtInfo.Rows[0]["C00024"].ToString(); cdata4.headlines = hinfo; } using (DataTable _dtepList = cn.ExecQuery(@"SELECT top 15 * FROM T0004 ORDER BY rnd(C00016) DESC")) { episodeList[] _dtepStr = new episodeList[_dtepList.Rows.Count]; for (int i = 0; i < _dtepList.Rows.Count; i++) { episodeList episRow = new episodeList(); episRow.id = _dtepList.Rows[i]["C00016"].ToString(); episRow.title = Coding.ToUnicode(_dtepList.Rows[i]["C00017"].ToString()); episRow.last_update_chapter_name = Coding.ToUnicode(_dtepList.Rows[i]["C00022"].ToString()); episRow.cover = _dtepList.Rows[i]["C00024"].ToString(); _dtepStr[i] = episRow; } cdata4.episode = _dtepStr; } CIndex cdex = new CIndex(); cdex.index = cdata; cdex.lianzai = cdata1; cdex.new_key_huan = cdata2; cdex.wanjie = cdata3; cdex.yuanchuang = cdata4; string json_callback = JsonSerialize.jSerialize(cdex); context.Response.Write(json_callback.Replace(@"new_key_huan", "new")); } }
public void ProcessRequest(HttpContext context) { //获取漫画基本信息 string comic_id = context.Request.QueryString["comic_id"]; //漫画id //数据库的连接字符串 using ( CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"])) { //返回基本信息类 ComicInforMation cimn = new ComicInforMation(); cimn.result = 1; cimn.msg = "OK"; try { Comicdata cdata = new Comicdata(); //数据集data InforMation imn = new InforMation(); //基本信息实体类 //根据参数查询出基本信息 using (DataTable _dtInforMation = cn.ExecQuery("SELECT * FROM T0004 WHERE C00016=?", new OleDbParameter[] { new OleDbParameter("@C00016", comic_id) })) { if (_dtInforMation.Rows.Count > 0) { DataRow _drInforMation = _dtInforMation.Rows[0]; imn.id = _drInforMation["C00016"].ToString(); imn.last_update_chapter_name = Coding.ToUnicode(_drInforMation["C00022"].ToString()); imn.last_updatetime = _drInforMation["C00023"].ToString(); imn.status = Coding.ToUnicode(_drInforMation["C00021"].ToString()); imn.subtitle = Coding.ToUnicode(_drInforMation["C00018"].ToString()); imn.title = Coding.ToUnicode(_drInforMation["C00017"].ToString()); imn.types = Coding.ToUnicode(_drInforMation["C00019"].ToString()); imn.zone = Coding.ToUnicode(_drInforMation["C00020"].ToString()); imn.authors = Coding.ToUnicode(_drInforMation["C00025"].ToString()); imn.cover = _drInforMation["C00024"].ToString(); imn.description = Coding.ToUnicode(_drInforMation["C00026"].ToString()); imn.direction = _drInforMation["C00028"].ToString(); imn.first_letter = _drInforMation["C00027"].ToString(); } else { throw new Exception(); } } cdata.info = imn; //赋值基本信息 //赋值话信息 using (DataTable _dtword = cn.ExecQuery("select * from T0005 where C00030=? order by C00029 desc", new OleDbParameter[] { new OleDbParameter("@id", comic_id) })) { wordList[] wlists = new wordList[_dtword.Rows.Count]; for (int i = 0; i < _dtword.Rows.Count; i++) { wordList wlistRow = new wordList(); wlistRow.id = _dtword.Rows[i]["C00029"].ToString(); wlistRow.filesize = _dtword.Rows[i]["C00033"].ToString(); wlistRow.comic_id = _dtword.Rows[i]["C00030"].ToString(); wlistRow.chapter_order = _dtword.Rows[i]["C00032"].ToString(); wlistRow.chapter_name = Coding.ToUnicode(_dtword.Rows[i]["C00031"].ToString()); wlists[i] = wlistRow; } cdata.list = wlists; } aloneList[] alist = new aloneList[0]; cdata.alone = alist; //赋值similarList关联信息 using (DataTable _dtsimilar = cn.ExecQuery("SELECT top 10 * FROM T0004 ORDER BY rnd(C00016) DESC")) { similarList[] similar = new similarList[_dtsimilar.Rows.Count]; for (int i = 0; i < _dtsimilar.Rows.Count; i++) { similarList similarRow = new similarList(); similarRow.id = _dtsimilar.Rows[i]["C00016"].ToString(); similarRow.cover = _dtsimilar.Rows[i]["C00024"].ToString(); similarRow.last_update_chapter_name = Coding.ToUnicode(_dtsimilar.Rows[i]["C00022"].ToString()); similarRow.title = Coding.ToUnicode(_dtsimilar.Rows[i]["C00017"].ToString()); similar[i] = similarRow; } cdata.similar = similar; } cimn.data = cdata; } catch { } context.Response.ContentType = "text/plain"; context.Response.Write(JsonSerialize.jSerialize(cimn)); } }