public string RptBind() { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); StringBuilder stringBuilder = new StringBuilder(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_where = " and cid like '" + pis_cid + "%' and sfzwd='否' "; string ls_order = " order by pubtime desc"; DataTable dt = JpArticle.SearchdocsByKey(ls_where, ls_order, 1, 6); int commentCount = 0; JpComment jpComment = new JpComment(); for (int i = 0; i < dt.Rows.Count; i++) { commentCount = jpComment.GetdocsbyaidAllCount(dt.Rows[i]["aid"].ToString(), pis_cid); stringBuilder.Append("<li><a onclick=\"locationDetail('art_detail.aspx?aid=" + dt.Rows[i]["aid"].ToString() + "&cid=" + pis_cid + "','" + locationType + "','1')\">"); stringBuilder.Append("<img class=\"scrollLoading\" src=\"" + dt.Rows[i]["indexdisplaypicpath"].ToString() + "\"><h1>"); stringBuilder.Append("" + dt.Rows[i]["title"].ToString() + "</h1>"); stringBuilder.Append("<p class=\"fleft\">" + JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["crtime"].ToString())) + "</p><p class=\"fleft\"><span><i class=\"ico-dj\"></i>" + dt.Rows[i]["praiseCount"].ToString() + "</span></p><p class=\"fleft\"><span><i class=\"ico-pl\"></i>" + commentCount + "</span>"); if (dt.Rows[i]["map_cid"].ToString() != "") { stringBuilder.Append("<p class=\"fright\"><i class=\"ico-zt\">" + dt.Rows[i]["map_cid"].ToString() + "</i></p>"); } stringBuilder.Append("</a></li>"); } return stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { string ls_cid = "", ls_page = "1", la_pagesize = "10"; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); if (this.Request.QueryString["cid"] != null) { ls_cid = JpCommon.queryString2StrID(this.Request.QueryString["cid"].ToString(), 9); } if (this.Request.QueryString["page"] != null) { ls_page = JpCommon.Filter(this.Request.QueryString["page"].ToString()); } if (this.Request.QueryString["pagesize"] != null) { la_pagesize = JpCommon.Filter(this.Request.QueryString["pagesize"].ToString()); } //根据传入的文章栏目ID、页码、页数返回列表信息 TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_where = "", ls_order = ""; ls_where = " and cid like '" + ls_cid + "%' and sfzwd='否' "; ls_order = " order by pubtime desc"; DataTable dt = JpArticle.SearchdocsByKey(ls_where, ls_order, int.Parse(ls_page), int.Parse(la_pagesize)); //复制一个DataTalbe DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); //在现有的DatatTable增加一列 DataColumn col2 = new DataColumn("commentCount", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col2); int commentCount = 0; JpComment jpComment = new JpComment(); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } DataTable dtComment = jpComment.Getdocsbyaid_ysh(ls_cid, dt.Rows[i]["aid"].ToString()); commentCount = dtComment.Rows.Count; //获得间隔的时间 dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["crtime"].ToString())); dr["commentCount"] = commentCount; tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
protected void Page_Load(object sender, EventArgs e) { string strType = "", ls_page = "1", la_pagesize = "10"; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); //获取参数 if (this.Request.QueryString["type"] != null) { strType = this.Request.QueryString["type"].ToString(); } if (this.Request.QueryString["page"] != null) { ls_page = this.Request.QueryString["page"].ToString(); } if (this.Request.QueryString["pagesize"] != null) { la_pagesize = this.Request.QueryString["pagesize"].ToString(); } string ls_where = "", ls_order = ""; //构造sql if (strType == "1") { ls_where = " and (hy_ifsh ='1' or hy_ifsh='2') "; } else if (strType == "2") { ls_where = " and hy_ifsh ='0' "; } ls_order = " order by hy_addtime desc"; JpHelp jpHelp = new JpHelp(); //获取数据 DataTable dt = jpHelp.SearchdocsByKey(ls_where, ls_order, int.Parse(ls_page), int.Parse(la_pagesize)); //复制一个DataTalbe DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } //获得间隔的时间 dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())); tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
protected void Page_Load(object sender, EventArgs e) { string ls_page = "1", ls_pagesize = "10"; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); //获取参数 if (this.Request.QueryString["page"] != null) { ls_page = this.Request.QueryString["page"].ToString(); } if (this.Request.QueryString["pagesize"] != null) { ls_pagesize = this.Request.QueryString["pagesize"].ToString(); } string ls_where = " and hy_ifsh ='2' "; string ls_orderby = " order by hy_addtime desc "; JpPhotography jpPhotography = new JpPhotography(); //获取数据 string test = ""; DataTable dt = jpPhotography.SearchdocsByKey(ls_where,ls_orderby, int.Parse(ls_page), int.Parse(ls_pagesize)); Response.Write(test); //复制一个DataTalbe DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); //在现有的DatatTable增加一列 DataColumn co2 = new DataColumn("showImg", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(co2); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } //获得间隔的时间 dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())); HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { dr["showImg"] = dt_img.Rows[0]["hy_filepath"].ToString(); } tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
protected void Page_Load(object sender, EventArgs e) { string ls_aid="",ls_cid="",strType = "", ls_page = "1", la_pagesize = "10"; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); //获取参数 if (this.Request.QueryString["type"] != null) { strType = this.Request.QueryString["type"].ToString(); } if (this.Request.QueryString["page"] != null) { ls_page = this.Request.QueryString["page"].ToString(); } if (this.Request.QueryString["cid"] != null) { ls_cid = this.Request.QueryString["cid"].ToString(); } if (this.Request.QueryString["pagesize"] != null) { la_pagesize = this.Request.QueryString["pagesize"].ToString(); } JpArticle JpArticle = new JpArticle(); string ls_where = " and cid = '" + ls_cid + "' "; string ls_order = " order by pubtime desc"; DataTable dt = JpArticle.SearchdocsByKey(ls_where,ls_order, int.Parse(ls_page), int.Parse(la_pagesize)); DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } //获得间隔的时间 dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["crtime"].ToString())); tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
protected void Page_Load(object sender, EventArgs e) { //获取参数 string ls_aid = "", ls_cid = "", ls_page = "1", ls_pagesize = "10"; JpCommon JpCommon = new JpCommon(); if (this.Request.QueryString["cid"] != null) ls_cid = JpCommon.queryString2StrID(this.Request.QueryString["cid"].ToString(), 9); if (this.Request.QueryString["aid"] != null) ls_aid = JpCommon.queryString2StrID(this.Request.QueryString["aid"].ToString(), 9); if (this.Request.QueryString["page"] != null) ls_page = JpCommon.queryString2StrID(this.Request.QueryString["page"].ToString(), 9); if (this.Request.QueryString["pagesize"] != null) ls_pagesize = JpCommon.queryString2StrID(this.Request.QueryString["pagesize"].ToString(), 9); TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); TPortalClass.JpUserVip JpUserVip = new TPortalClass.JpUserVip(); DataTable dt = JpComment.Getdocsbyaid_ysh_fy(ls_aid, ls_cid, Convert.ToInt32(ls_page), Convert.ToInt32(ls_pagesize)); DataTable tempTable = dt.Clone(); DataColumn col1 = new DataColumn("rytx", typeof(String)); DataColumn col2 = new DataColumn("showTime", typeof(String)); tempTable.Columns.Add(col1); tempTable.Columns.Add(col2); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); string ls_user = dt.Rows[i]["usid"].ToString(); DataTable dtrytx = JpUserVip.GetJpUserPic(ls_user); if (dtrytx.Rows.Count > 0) { dr["rytx"] = dtrytx.Rows[0]["hy_pic"].ToString(); } else { dr["rytx"] = "images/1211p1.png"; } dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["commenttime"].ToString())); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
public String RptBind() { StringBuilder stringBuilder = new StringBuilder(); JpCommon JpCommon = new JpCommon(); if (this.Request.QueryString["aid"] != null) { this.pis_aid = JpCommon.queryString2StrID(this.Request.QueryString["aid"].ToString(), 9); } JpArticle JpArticle = new JpArticle(); DataTable dt = JpArticle.GetArticleByaid(int.Parse(pis_aid)); if (dt.Rows.Count > 0) { pis_cid = dt.Rows[0]["cid"].ToString(); this.lbljptx.Text = "<h1>\"" + dt.Rows[0]["title"].ToString() + "\"</h1><span><img src=\"" + dt.Rows[0]["indexdisplaypicpath"].ToString() + "\"></span>"; } string ls_where = " and cid = '" + pis_cid + "' and zwdid=" + pis_aid + " and sfzwd='否' "; string ls_order = " order by pubtime desc"; DataTable dt2 = JpArticle.SearchdocsByKey(ls_where, ls_order, 1, 5); string strTitle = ""; if (dt2.Rows.Count > 0) { for (int i = 0; i < dt2.Rows.Count; i++) { strTitle = dt2.Rows[i]["title"].ToString(); if (strTitle.Length > 18) { strTitle = strTitle.Substring(0, 18) + "..."; } stringBuilder.Append("<a onclick=\"locationDetail('art_detail.aspx?aid=" + dt2.Rows[i]["aid"].ToString() + "','" + locationType + "','0')\"><li>"); if (dt2.Rows[i]["indexdisplaypicpath"].ToString() != "") { stringBuilder.Append("<img src=\"" + dt2.Rows[i]["indexdisplaypicpath"].ToString() + "\">"); } else { stringBuilder.Append("<img src=\"/images/noImg.jpg\">"); } stringBuilder.Append("<h1>"); stringBuilder.Append("" + strTitle + "</h1><p class=\"fleft\">" + JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt2.Rows[i]["crtime"].ToString())) + "</p></li></a>"); } } return stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { //获取参数 string ls_aid = "", ls_cid = "", ls_page = "1", ls_pagesize = "10"; JpCommon JpCommon = new JpCommon(); if (this.Request.QueryString["cid"] != null) ls_cid = JpCommon.queryString2StrID(this.Request.QueryString["cid"].ToString(), 9); if (this.Request.QueryString["aid"] != null) ls_aid = JpCommon.queryString2StrID(this.Request.QueryString["aid"].ToString(), 9); if (this.Request.QueryString["page"] != null) ls_page = JpCommon.queryString2StrID(this.Request.QueryString["page"].ToString(), 9); if (this.Request.QueryString["pagesize"] != null) ls_pagesize = JpCommon.queryString2StrID(this.Request.QueryString["pagesize"].ToString(), 9); StringBuilder stringBuilder = new StringBuilder(); JpArticle JpArticle = new JpArticle(); string ls_where = " and cid = '" + ls_cid + "' "; string ls_order = " order by pubtime desc"; DataTable dt = JpArticle.SearchdocsByKey(ls_where, ls_order, Convert.ToInt32(ls_page), Convert.ToInt32(ls_pagesize)); JpColumns jpColumns = new JpColumns(); string strColumnName = ""; stringBuilder.Append("["); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { DataTable dt_columns = jpColumns.GetColumnBycid(dt.Rows[i]["cid"].ToString()); if (dt_columns.Rows.Count > 0) { strColumnName = dt_columns.Rows[0]["cname"].ToString(); } string ls_zwdid = dt.Rows[i]["aid"].ToString(); stringBuilder.Append("{\"aid\":\"" + dt.Rows[i]["aid"].ToString() + "\",\"cid\":\"" + dt.Rows[i]["cid"].ToString() + "\",\"cname\":\"" + strColumnName + "\",\"indexdisplaypicpath\":\"" + dt.Rows[i]["indexdisplaypicpath"].ToString() + "\",\"title\":\"" + dt.Rows[i]["title"].ToString() + "\",\"showTime\":\"" + JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["crtime"].ToString())) + "\",\"child\":["); string ls_where2 = " and cid = '" + ls_cid + "' and zwdid='" + ls_zwdid + "' and sfzwd='否' "; string ls_order2 = " order by pubtime desc"; DataTable dt_zwd = JpArticle.SearchdocsByKey(ls_where2, ls_order2, Convert.ToInt32(ls_page), Convert.ToInt32(ls_pagesize)); if (dt_zwd.Rows.Count > 0) { for (int j = 0; j < dt_zwd.Rows.Count; j++) { stringBuilder.Append("{\"aid\":\"" + dt_zwd.Rows[j]["aid"].ToString() + "\",\"cid\":\"" + dt.Rows[i]["cid"].ToString() + "\",\"cname\":\"" + strColumnName + "\",\"indexdisplaypicpath\":\"" + dt_zwd.Rows[j]["indexdisplaypicpath"].ToString() + "\",\"map_cid\":\"" + dt_zwd.Rows[j]["map_cid"].ToString() + "\",\"title\":\"" + dt_zwd.Rows[j]["title"].ToString() + "\",\"showTime\":\"" + JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt_zwd.Rows[j]["crtime"].ToString())) + "\""); if (j == dt_zwd.Rows.Count - 1) { stringBuilder.Append("}"); } else { stringBuilder.Append("},"); } } } stringBuilder.Append("]"); if (dt.Rows.Count - 1 == i) { stringBuilder.Append("}"); } else { stringBuilder.Append("},"); } } } stringBuilder.Append("]"); //数据抛出 Response.Write(stringBuilder.ToString()); }
protected void Page_Load(object sender, EventArgs e) { string strCid = ""; int ls_page = 1, ls_pagesize = 10; string strType = ""; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); //获取参数 if (this.Request.QueryString["cid"] != null) { strCid = this.Request.QueryString["cid"].ToString(); } if (this.Request.QueryString["page"] != null) { ls_page = Convert.ToInt32(this.Request.QueryString["page"].ToString()); } if (this.Request.QueryString["pagesize"] != null) { ls_pagesize = Convert.ToInt32(this.Request.QueryString["pagesize"].ToString()); } if (this.Request.QueryString["type"] != null) { strType = this.Request.QueryString["type"].ToString(); } JpGoods jpGoods = new JpGoods(); string strWhere = " and hy_cid like '" + strCid + "%' and hy_ifsh='2' "; if (strType == "0") { strWhere = " and hy_cid like '" + strCid + "%' and hy_ifsh='2' "; } else if (strType == "1") { strWhere = " and (hy_cid = '006001001' or hy_cid='006002001' or hy_cid='006003001' or hy_cid='006004001') and hy_ifsh='2' "; } else if (strType == "2") { strWhere = " and (hy_cid = '006001002' or hy_cid='006002002' or hy_cid='006003002' or hy_cid='006004002') and hy_ifsh='2' "; } else if (strType == "3") { strWhere = " and (hy_cid = '006001003' or hy_cid='006002003' or hy_cid='006003003' or hy_cid='006004003') and hy_ifsh='2' "; } string orderby = " order by hy_addtime desc "; //获取数据 DataTable dt = jpGoods.SearchdocsByKey(strWhere, orderby, ls_page, ls_pagesize); //复制一个DataTalbe DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showImg", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); DataColumn col2 = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col2); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } //获得间隔的时间 HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { dr["showImg"] = dt_img.Rows[0]["hy_filepath"].ToString(); } dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())); tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
/// <summary> /// 根据传入的条件显示新闻列表 /// </summary> /// <param name="pis_cid">栏目ID</param> /// <param name="pis_sfzwd">是否主文档</param> /// <param name="pis_iftop">是否置顶</param> /// <param name="num">显示数量</param> /// <returns></returns> public string NewsLists(string pis_cid, string pis_sfzwd, string pis_iftop, int page, int pagesize) { StringBuilder stringBuilder = new StringBuilder(); string ls_return = "", ls_form = "art_detail.aspx"; int k = 0; TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string ls_where = " and cid like '" + pis_cid + "%' "; //专栏 if (pis_cid == "003") { ls_where = " and cid like '" + pis_cid + "%' and cid <> '003004' "; } if (pis_sfzwd != "") { ls_where += " and sfzwd='" + pis_sfzwd + "' "; } if (pis_sfzwd == "是") { ls_form = "column_list_more.aspx"; } if (pis_iftop != "") { ls_where += " and iftop='" + pis_iftop + "' "; } string ls_order = " order by pubtime desc"; DataTable dt = JpArticle.SearchdocsByKey(ls_where, ls_order, page, pagesize); string onclickType = ""; JpColumns jpColumns = new JpColumns(); DataTable dtColumns = jpColumns.GetColumnBycid(pis_cid); string strColumnName = ""; if (dtColumns.Rows.Count > 0) { strColumnName = dtColumns.Rows[0]["cname"].ToString(); } if (dt.Rows.Count > 0) { if (dt.Rows.Count > pagesize) { k = pagesize; } else { k = dt.Rows.Count; } JpComment jpComment = new JpComment(); for (int i = 0; i < k; i++) { string ls_aid = dt.Rows[i]["aid"].ToString(); string ls_cid = dt.Rows[i]["cid"].ToString(); string ls_title = dt.Rows[i]["title"].ToString(); string ls_pic = dt.Rows[i]["indexdisplaypicpath"].ToString(); string ls_goodnum = dt.Rows[i]["goodnum"].ToString(); string ls_url = ls_form + "?aid=" + ls_aid + "&cid=" + ls_cid + "&rnd=" + System.Guid.NewGuid().ToString(); int commentCount = 0; commentCount = jpComment.GetdocsbyaidAllCount(ls_aid, ls_cid); DateTime ls_date = DateTime.Parse(dt.Rows[i]["pubtime"].ToString()); DateTime ls_now = DateTime.Now; string ls_time = JpCommon.DateDiff(ls_now, ls_date); string strArtType = "0"; if (ls_form == "art_detail.aspx") { strArtType = "1"; } if (pis_sfzwd == "是") { onclickType = "locationList('" + ls_url + "','" + locationType + "','" + strColumnName + "')"; } else { onclickType = "locationDetail('" + ls_url + "','" + locationType + "','" + strArtType + "')"; } stringBuilder.Append("<li><a onclick=\"" + onclickType + "\" href=\"javascript:void(0)\"><img src=\"images/loading.gif\" data-original=\"" + ls_pic + "\" onError=\"this.src='images/nophoto.jpg';\"><h2>" + ls_title + "</h2>"); stringBuilder.Append("<p class=\"fleft\"><span>" + ls_time + "</span></p><p class=\"fright\"><i class=\"ico-pl2\"></i><span>" + commentCount + "</span></p></a></li>"); } } ls_return = stringBuilder.ToString(); stringBuilder.Remove(0, stringBuilder.Length); return ls_return; }