//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); string ls_tip = "删除成功!"; for (int i = 0; i < rptList.Items.Count; i++) { //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { JpComment.id = int.Parse(id); JpComment.Delete(); } } string pageUrl = JpCommon.CombUrlTxt("list_comment_ysh.aspx", "page={0}&rnd={1}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + ""); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "删除", "批量删除已审核评论记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
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(); }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 } if (this.Request.QueryString["id"] != null) { this.txtid.Text = this.Request.QueryString["id"].ToString(); //部门ID } TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); //旧文档 if (this.txtop.Value == "modify") { DataTable dt = JpComment.Getdoc(int.Parse(this.txtid.Text)); if (dt.Rows.Count > 0) { this.lbhy_id.Text = dt.Rows[0]["articleid"].ToString(); this.lbhy_ip.Text = dt.Rows[0]["commentip"].ToString(); this.lbhy_content.Text = dt.Rows[0]["commentcontent"].ToString(); this.lbhy_user.Text = dt.Rows[0]["usname"].ToString(); this.lbhy_time.Text = dt.Rows[0]["commenttime"].ToString(); this.txthy_ifshow.SelectedValue = dt.Rows[0]["ifshow"].ToString(); } } }
public void RptBind() { string strWhere = ""; string strUid = ""; try { strUid = this.Session["hyuid"].ToString(); } catch { } if (strUid != "") { strWhere = " and hy_uid='" + strUid + "' "; } else { return; } JpFavorite jpFavorite = new JpFavorite(); DataTable dt = jpFavorite.GetData(strWhere); StringBuilder stringBuilder = new StringBuilder(); int commentCount = 0; JpComment jpComment = new JpComment(); for (int i = 0; i < dt.Rows.Count; i++) { DataTable dtComment = jpComment.Getdocsbyaid_ysh(pis_cid, dt.Rows[i]["hy_aid"].ToString()); commentCount = dtComment.Rows.Count; stringBuilder.Append("<li><a onclick=\"locationDetail('art_detail.aspx?aid=" + dt.Rows[i]["hy_aid"].ToString() + "&cid=" + dt.Rows[i]["hy_cid"].ToString() + "','" + locationType + "','1')\">" + dt.Rows[i]["hy_bt"].ToString() + "</a>"); stringBuilder.Append("<span>" + dt.Rows[i]["hy_addtime"].ToString() + "</span>"); stringBuilder.Append("</li>"); } this.lb_show.Text = 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 strId = ""; if (this.Request.QueryString["id"] != null) { strId = this.Request.QueryString["id"].ToString(); } if (strId.Contains("_")) { strId = strId.Substring(0, strId.LastIndexOf("_")); } JpComment jpComment = new JpComment(); jpComment.UpdatePraiseCount(strId); Response.Write(jpComment.getPraiseCount(strId)); }
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); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); JpComment.id = System.Int32.Parse(this.txtid.Text); JpComment.ifshow = this.txthy_ifshow.SelectedValue; //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "修改", "修改评论记录[id:" + this.txtid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpComment.Update_sh(); Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
private void DataPlay() { TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); TPortalClass.JpUserVip JpUserVip = new TPortalClass.JpUserVip(); string strOrder = " order by commenttime desc "; DataTable dt = JpComment.GetdocsbyaidAll(aid, cid, 1, 3, strOrder); 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); } rptListNew.DataSource = tempTable; rptListNew.DataBind(); //获得最热的数据 dt.Clear(); strOrder = " order by praiseCount desc "; dt = JpComment.GetdocsbyaidAll(aid, cid, 1, 3, strOrder); tempTable.Clear(); tempTable = dt.Clone(); DataColumn col3 = new DataColumn("rytx", typeof(String)); DataColumn col4 = new DataColumn("showTime", typeof(String)); tempTable.Columns.Add(col3); tempTable.Columns.Add(col4); 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); } rptList.DataSource = tempTable; rptList.DataBind(); }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; this.txtKeywords.Text = this.keywords; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); DataTable dt = JpComment.Getdocs_ysh(); this.totalCount = dt.Rows.Count; DataTable tempTable = dt.Clone(); for (int i = (this.page - 1) * this.pageSize; i < this.page * this.pageSize; i++) { if (i > dt.Rows.Count - 1) break; DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } rptList.DataSource = tempTable; rptList.DataBind(); //翻页 //string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", // this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__"); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string pageUrl = JpCommon.CombUrlTxt("list_comment_ysh.aspx", "page={0}&rnd={1}&keywords={2}", "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + ""); PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <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; }
//首页顶部4张最新图片资讯 private void GetNewsPics() { StringBuilder stringBuilder = new StringBuilder(); //首页大图显示 TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); string ls_where = " and iftop='1' "; string ls_order = " order by pubtime desc"; DataTable dt = JpArticle.SearchdocsByKey(ls_where, ls_order, 1, 4); if (dt.Rows.Count == 4) { DateTime ls_now = DateTime.Now; DateTime ls_date = DateTime.Parse(dt.Rows[0]["pubtime"].ToString()); DateTime ls_date1 = DateTime.Parse(dt.Rows[1]["pubtime"].ToString()); DateTime ls_date2 = DateTime.Parse(dt.Rows[2]["pubtime"].ToString()); DateTime ls_date3 = DateTime.Parse(dt.Rows[3]["pubtime"].ToString()); string ls_rnd = System.Guid.NewGuid().ToString(); string ls_aid = dt.Rows[0]["aid"].ToString(); string ls_aid1 = dt.Rows[1]["aid"].ToString(); string ls_aid2 = dt.Rows[2]["aid"].ToString(); string ls_aid3 = dt.Rows[3]["aid"].ToString(); string ls_cid = dt.Rows[0]["cid"].ToString(); string ls_cid1 = dt.Rows[1]["cid"].ToString(); string ls_cid2 = dt.Rows[2]["cid"].ToString(); string ls_cid3 = dt.Rows[3]["cid"].ToString(); string ls_pic = dt.Rows[0]["indexdisplaypicpath"].ToString(); string ls_pic1 = dt.Rows[1]["indexdisplaypicpath"].ToString(); string ls_pic2 = dt.Rows[2]["indexdisplaypicpath"].ToString(); string ls_pic3 = dt.Rows[3]["indexdisplaypicpath"].ToString(); string ls_title = dt.Rows[0]["title"].ToString(); string ls_title1 = dt.Rows[1]["title"].ToString(); string ls_title2 = dt.Rows[2]["title"].ToString(); string ls_title3 = dt.Rows[3]["title"].ToString(); string ls_url = "art_detail.aspx?aid=" + ls_aid + "&cid=" + ls_cid + "&rnd=" + ls_rnd; string ls_url1 = "art_detail.aspx?aid=" + ls_aid1 + "&cid=" + ls_cid1 + "&rnd=" + ls_rnd; string ls_url2 = "art_detail.aspx?aid=" + ls_aid2 + "&cid=" + ls_cid2 + "&rnd=" + ls_rnd; string ls_url3 = "art_detail.aspx?aid=" + ls_aid3 + "&cid=" + ls_cid3 + "&rnd=" + ls_rnd; int commentCount = 0; JpComment jpComment = new JpComment(); commentCount = jpComment.GetdocsbyaidAllCount(ls_aid, ls_cid); //第一张大图 stringBuilder.Append("<a onclick=\"locationDetail('" + ls_url + "','" + locationType + "','1')\" href=\"javascript:void(0);\" ><div class=\"swipe\"><div class=\"xd\"><img src=\"" + ls_pic + "\" onError=\"this.src='images/nophoto.jpg';\" />"); stringBuilder.Append("<div class=\"jd\"><h1>" + ls_title + "</h1><time>" + JpCommon.DateDiff(ls_now, ls_date) + "</time>"); stringBuilder.Append("<span><i class=\"ico-pl\"></i>" + commentCount + "</span></div></div></a>"); commentCount = jpComment.GetdocsbyaidAllCount(ls_aid1, ls_cid1); //第二张图 stringBuilder.Append("<a onclick=\"locationDetail('" + ls_url1 + "','" + locationType + "','1')\" href=\"javascript:void(0);\" ><div class=\"tp1\"><img src=\"" + ls_pic1 + "\" onError=\"this.src='images/nophoto.jpg';\" />"); stringBuilder.Append("<div class=\"jd\"><h2>" + ls_title1 + "</h2><time>" + JpCommon.DateDiff(ls_now, ls_date1) + "</time>"); stringBuilder.Append("<span><i class=\"ico-pl\"></i>" + commentCount + "</span></div></div></a>"); commentCount = jpComment.GetdocsbyaidAllCount(ls_aid2, ls_cid2); //第三张图 stringBuilder.Append("<div class=\"tp\"><ul><li><a onclick=\"locationDetail('" + ls_url2 + "','" + locationType + "','1')\" href=\"javascript:void(0);\" ><img src=\"" + ls_pic2 + "\" onError=\"this.src='images/nophoto.jpg';\" />"); stringBuilder.Append("<div class=\"jd\"><h2>" + ls_title2 + "</h2><time>" + JpCommon.DateDiff(ls_now, ls_date2) + "</time>"); stringBuilder.Append("<span><i class=\"ico-pl\"></i>" + commentCount + "</span></div></a></li></ul>"); commentCount = jpComment.GetdocsbyaidAllCount(ls_aid3, ls_cid3); //第四张图 stringBuilder.Append("<ul><li><a onclick=\"locationDetail('" + ls_url3 + "','" + locationType + "','1')\" href=\"javascript:void(0);\" ><img src=\"" + ls_pic3 + "\" class=\"m05\" onError=\"this.src='images/nophoto.jpg';\" />"); stringBuilder.Append("<div class=\"jd\"><h2>" + ls_title3 + "</h2><time>" + JpCommon.DateDiff(ls_now, ls_date3) + "</time>"); stringBuilder.Append("<span><i class=\"ico-pl\"></i>" + commentCount + "</span></div></a></li></ul></div></div>"); } this.lb_head.Text = stringBuilder.ToString(); stringBuilder.Remove(0, stringBuilder.Length); //清空字节流 dt.Clear(); }