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) { if (this.Request.QueryString["id"] != null) { try { id = Convert.ToInt32(this.Request.QueryString["id"].ToString()); } catch { id = 1; } } this.lb_type.Text = "往期回顾"; JpArticle jpArticle = new JpArticle(); DataTable dt = jpArticle.GetArticleByaid(id); HyFileatt HyFileatt = new HyFileatt(); if (dt.Rows.Count > 0) { this.lb_time.Text = Convert.ToDateTime(dt.Rows[0]["crtime"].ToString()).ToString("yyyy年MM月dd日"); this.lb_title.Text = dt.Rows[0]["title"].ToString(); this.lb_article.Text = dt.Rows[0]["ht_content"].ToString(); } }
/// <summary> /// �� /// </summary> /// <returns></returns> public bool Update() { bool ret = true; DAO db = new DAO(); try { JpArticle jpArticle = new JpArticle(); DataTable dt = new DataTable(); try { dt = jpArticle.GetArticleByaid(Convert.ToInt32(hy_aid)); } catch { } if (dt.Rows.Count > 0) { hy_bt = dt.Rows[0]["title"].ToString(); } String sql = " update hy_favorite "; sql += " set hy_uid = @hy_uid"; sql += " ,hy_aid = @hy_aid"; sql += " ,hy_addtime = @hy_addtime"; sql += " ,hy_bt = @hy_bt"; sql += " ,hy_cid = @hy_cid"; sql += " ,hy_sort = @hy_sort"; sql += " where id=@id "; SqlParameter[] sqlparam = { db.MakeInParam("@id",SqlDbType.Int,id), db.MakeInParam("@hy_uid",SqlDbType.VarChar,hy_uid), db.MakeInParam("@hy_aid",SqlDbType.VarChar,hy_aid), db.MakeInParam("@hy_addtime",SqlDbType.VarChar,hy_addtime), db.MakeInParam("@hy_bt",SqlDbType.VarChar,hy_bt), db.MakeInParam("@hy_cid",SqlDbType.VarChar,hy_cid), db.MakeInParam("@hy_sort",SqlDbType.Int,hy_sort), }; db.Execute(sql, sqlparam); } catch { ret = false; } finally { db.Close(); db.Dispose(); } return ret; }
/// <summary> /// ���� /// </summary> /// <returns></returns> public bool Insert() { bool ret = true; DAO db = new DAO(); try { String sql = " insert into hy_favorite(hy_uid,hy_aid,hy_addtime,hy_bt,hy_cid,hy_sort) values "; sql += "(@hy_uid,@hy_aid,@hy_addtime,@hy_bt,@hy_cid,@hy_sort) "; JpArticle jpArticle = new JpArticle(); DataTable dt = new DataTable(); try { dt = jpArticle.GetArticleByaid(Convert.ToInt32(hy_aid)); } catch { } if (dt.Rows.Count > 0) { hy_bt = dt.Rows[0]["title"].ToString(); } SqlParameter[] sqlparam = { db.MakeInParam("@hy_uid",SqlDbType.VarChar,hy_uid), db.MakeInParam("@hy_aid",SqlDbType.VarChar,hy_aid), db.MakeInParam("@hy_addtime",SqlDbType.VarChar,hy_addtime), db.MakeInParam("@hy_bt",SqlDbType.VarChar,hy_bt), db.MakeInParam("@hy_cid",SqlDbType.VarChar,hy_cid), db.MakeInParam("@hy_sort",SqlDbType.Int,hy_sort), }; dt.Clear(); dt = GetData(" and hy_uid='" + hy_uid + "' and hy_aid='" + hy_aid + "' and hy_cid='" + hy_cid + "' "); if (dt.Rows.Count > 0) { try { id = Convert.ToInt32(dt.Rows[0]["id"].ToString()); Update(); } catch { } } else { db.Execute(sql, sqlparam); } } catch { ret = false; } finally { db.Close(); db.Dispose(); } return ret; }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 } if (this.Request.QueryString["aid"] != null) { this.txtaid.Text = this.Request.QueryString["aid"].ToString(); //文章ID } if (this.Request.QueryString["cid"] != null) { this.txtcid.Text = this.Request.QueryString["cid"].ToString(); //栏目ID if (this.txtcid.Text.Contains(",")) this.txtcid.Text = this.txtcid.Text.Substring(0, this.txtcid.Text.IndexOf(",")); } TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); //新文档 if (this.txtop.Value == "add") { this.txtendtime.Text = System.DateTime.Now.AddYears(10).ToString(); this.txtpubtime.Text = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.txtguid.Text = System.Guid.NewGuid().ToString(); //直接返回字符串类型 this.txttopendtime.Value = System.DateTime.Now.AddDays(5).ToString("yyyy-MM-dd"); //this.ddlcolname.SelectedValue = this.cid; //根据栏目ID得到栏目名称start TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dtcols = JpColumns.GetColumnBycid(this.cid); this.txtcolname.Text = dtcols.Rows[0]["cname"].ToString(); //根据栏目ID得到栏目名称end this.txtauthor.Text = this.Session["uname"].ToString(); DataTable dtsort = JpArticle.Getmaxsort(); if (dtsort.Rows.Count > 0) { this.txtasort.Text = (System.Int32.Parse(dtsort.Rows[0]["asort"].ToString()) + 2).ToString(); } else { this.txtasort.Text = "1"; } } //旧文档 if (this.txtop.Value == "modify") { DataTable dt = JpArticle.GetArticleByaid(System.Int32.Parse(this.txtaid.Text)); if (dt.Rows.Count > 0) { this.txtendtime.Text = dt.Rows[0]["endtime"].ToString(); this.txtpubtime.Text = dt.Rows[0]["pubtime"].ToString(); //根据栏目ID得到栏目名称start TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); DataTable dtcols = JpColumns.GetColumnBycid(dt.Rows[0]["cid"].ToString()); this.txtcolname.Text = dtcols.Rows[0]["cname"].ToString(); //根据栏目ID得到栏目名称end this.txttitle.Text = dt.Rows[0]["title"].ToString(); this.txttitle2.Text = dt.Rows[0]["subhead"].ToString(); this.content1.Value = dt.Rows[0]["ht_content"].ToString(); this.txtauthor.Text = dt.Rows[0]["author"].ToString(); this.txtsummary.Text = dt.Rows[0]["summary"].ToString(); this.txtsummary.Text = dt.Rows[0]["summary"].ToString(); this.txtseotitle.Text = dt.Rows[0]["seotitle"].ToString(); this.txtseokeywords.Text = dt.Rows[0]["seokeywords"].ToString(); this.txtseodescription.Text = dt.Rows[0]["seodescription"].ToString(); this.txtasort.Text = dt.Rows[0]["asort"].ToString(); ; this.txttopendtime.Value = DateTime.Parse(dt.Rows[0]["topendtime"].ToString()).ToString("yyyy-MM-dd"); this.txtsource.Value = dt.Rows[0]["source"].ToString(); this.txtguid.Text = dt.Rows[0]["GUID"].ToString(); this.txtrole_userid.Text = dt.Rows[0]["role_userid"].ToString(); ; this.txtrole_username.Text = dt.Rows[0]["role_username"].ToString(); this.txtpic.Value = dt.Rows[0]["indexdisplaypicpath"].ToString(); if (dt.Rows[0]["map_cid"].ToString() != "") { ddllb.SelectedValue = dt.Rows[0]["map_cid"].ToString(); } if (dt.Rows[0]["indexdisplaypicpath"].ToString() != "") { this.lblpic.Text = "<img src='" + dt.Rows[0]["indexdisplaypicpath"].ToString() + "' onError=\"this.src='/images/nophoto.jpg';\" width=60px height=55px />"; } else { this.lblpic.Text = ""; } this.ddlsfzd.SelectedValue = dt.Rows[0]["iftop"].ToString(); if (dt.Rows[0]["iftop"].ToString() == "1") { ls_xs1 = "inline"; } this.ddlsfsyss.SelectedValue = dt.Rows[0]["ifindexdisplay"].ToString(); if (dt.Rows[0]["ifindexdisplay"].ToString() == "1") { ls_xs2 = "inline"; } if (dt.Rows[0]["sfzwd"].ToString() == "否") { radlist.SelectedValue = "否"; ls_xs3 = ""; ddlwz.SelectedValue = dt.Rows[0]["zwdid"].ToString(); } } } }
private void ChkRole() { //判断权限 TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); DataTable dtart; if (this.txtop.Value != "add") { dtart = JpArticle.GetArticleByaid(System.Int32.Parse(this.txtaid.Text)); } else { dtart = JpArticle.GetArticleByaid(-1); } //是发布者 if (this.txtop.Value != "add") { //旧文档 if (dtart.Rows[0]["status"].ToString() == "审核") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 } else { btnSave.Visible = false; //保存按钮 btnFB.Visible = false; //发布按钮 } } else { //新文档 btnSave.Visible = true; btnFB.Visible = false; } }
private void ChkRole() { //判断权限 TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); DataTable dtart; if (this.txtop.Value != "add") { dtart = JpArticle.GetArticleByaid(System.Int32.Parse(this.txtaid.Text)); } else { dtart = JpArticle.GetArticleByaid(-1); } if (this.txtop.Value != "add") { this.txtstatus.Text = dtart.Rows[0]["status"].ToString(); //旧文档 if (dtart.Rows[0]["status"].ToString() == "编辑") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 btnFBJX.Visible = true;//发布并继续按钮 btnCG.Visible = false; //撤稿按钮 btnBJ.Visible = false; //编辑按钮 } if (dtart.Rows[0]["status"].ToString() == "发布") { btnSave.Visible = false; //保存按钮 btnFB.Visible = false; //发布按钮 btnFBJX.Visible = false;//发布并继续按钮 btnCG.Visible = true; //撤稿按钮 btnBJ.Visible = true; //编辑按钮 this.Label1.Visible = true; this.Label2.Visible = true; this.Label3.Visible = true; this.Label4.Visible = true; this.Label5.Visible = true; this.Label6.Visible = true; this.Label7.Visible = true; this.Label8.Visible = true; this.Label9.Visible = true; this.Label10.Visible = true; this.Label11.Visible = true; this.txtpubtime.Visible = false; this.ddlcolname.Visible = false; this.txtasort.Visible = false; this.txtauthor.Visible = false; this.txtsource.Visible = false; this.btn_lgdw.Visible = false; this.txttitle.Visible = false; this.txttitle2.Visible = false; this.txtsummary.Visible = false; this.content1.Visible = false; this.txthits.Visible = false; this.txtgoodnum.Visible = false; } if (dtart.Rows[0]["status"].ToString() == "撤稿") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 btnFBJX.Visible = true; //发布并继续按钮 btnCG.Visible = false; //撤稿按钮 btnBJ.Visible = false; //编辑按钮 } if (dtart.Rows[0]["status"].ToString() == "审核") { btnSave.Visible = true; //保存按钮 btnFB.Visible = true; //发布按钮 btnFBJX.Visible = true; //发布并继续按钮 btnCG.Visible = false; //撤稿按钮 btnBJ.Visible = false; //编辑按钮 } } else { btnSave.Visible = true; btnFB.Visible = true; btnCG.Visible = false; btnBJ.Visible = false; //编辑按钮 } }
public string GetPraiseCount(string pis_yzm, string pis_table, string pis_id) { string pos_json = ""; string configYzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); bool flag = false; if (configYzm == pis_yzm && pis_table != "" && pis_id != "") { if (pis_table == "0") { JpArticle JpArticle = new JpArticle(); DataTable dt = JpArticle.GetArticleByaid(Convert.ToInt32(pis_id)); if (dt.Rows.Count > 0) { pos_json = "{\"code\":\"0\",\"praiseCount\":\"" + dt.Rows[0]["praiseCount"].ToString() + "\"}"; } else { pos_json = "{\"code\":\"0\",\"praiseCount\":\"0\"}"; } } else if (pis_table == "1") { JpPhotography JpPhotography = new JpPhotography(); DataTable dt = JpPhotography.Getdocbyid(Convert.ToInt32(pis_id)); if (dt.Rows.Count > 0) { pos_json = "{\"code\":\"0\",\"praiseCount\":\"" + dt.Rows[0]["praiseCount"].ToString() + "\"}"; } else { pos_json = "{\"code\":\"0\",\"praiseCount\":\"0\"}"; } } else { //系统错误 pos_json = "{\"code\":\"1\"}"; } } else { //非法调用 pos_json = "{\"code\":\"2\"}"; } return pos_json; }