//发布 protected void btnFB_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "发布成功!"; //新文档时 TPortalClass.JpArticle JpArticle = new TPortalClass.JpArticle(); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); JpArticle.cid = this.txtcid.Text; JpArticle.title = this.txttitle.Text; JpArticle.subhead = this.txttitle2.Text; JpArticle.ht_content = this.content1.Value; if (this.txtsummary.Text == "") { JpArticle.summary = JpCommon.OutPicGetStr(this.content1.Value, 150); } else { JpArticle.summary = this.txtsummary.Text; } JpArticle.author = this.Session["uname"].ToString(); JpArticle.status = "发布"; //JpArticle.ifindexdisplay = ""; string lsfilename = FileUpload1.FileName; string lspath = ""; string lsurl = ""; string str_path = ""; if (lsfilename != "") //attsize { //SaveCommon(ls_path, ls_attsize, lsguid); //将附件上传到服务器目录下 lspath = Server.MapPath("~/");//虚拟目录的位置 lsurl = "/upload/indexpic"; //存放的文件夹 Directory.CreateDirectory(lspath + "/" + lsurl); str_path = lspath + "/" + lsurl + "/" + lsfilename; FileUpload1.SaveAs(str_path); JpArticle.indexdisplaypicpath = lsurl + "/" + lsfilename; } else { this.txtpic.Value = JpCommon.GetImg(this.content1.Value); JpArticle.indexdisplaypicpath = this.txtpic.Value; } if (this.txtseotitle.Text == "") { JpArticle.seotitle = this.txttitle.Text; } else { JpArticle.seotitle = this.txtseotitle.Text; } if (this.txtseokeywords.Text == "") { JpArticle.seokeywords = this.txttitle.Text; } else { JpArticle.seokeywords = this.txtseokeywords.Text; } if (this.txtseodescription.Text == "") { JpArticle.seodescription = JpCommon.OutPicGetStr(this.content1.Value, 150); } else { JpArticle.seodescription = this.txtseodescription.Text; } JpArticle.asort = System.Int32.Parse(this.txtasort.Text); JpArticle.iftop = this.ddlsfzd.SelectedValue; JpArticle.topendtime = this.txttopendtime.Value; JpArticle.ifindexdisplay = this.ddlsfsyss.SelectedValue; JpArticle.ifcomment = "0"; JpArticle.source = this.txtsource.Value; JpArticle.role_userid = this.txtrole_userid.Text; JpArticle.role_username = this.txtrole_username.Text; JpArticle.input = this.Session["uid"].ToString(); JpArticle.GUID = this.txtguid.Text; if (ddllb.SelectedValue != "请选择") { JpArticle.map_cid = ddllb.SelectedValue; } else { JpArticle.map_cid = ""; } JpArticle.map_aid = 0; JpArticle.targettype = ""; JpArticle.hits = 0; JpArticle.goodnum = 0; if (radlist.SelectedValue == "否") { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ddlwz.SelectedValue; } else { JpArticle.sfzwd = radlist.SelectedValue; JpArticle.zwdid = ""; } if (this.txtendtime.Text != "") { JpArticle.endtime = this.txtendtime.Text; } else { JpArticle.endtime = System.DateTime.Now.AddYears(10).ToString(); } if (this.txtpubtime.Text != "") { JpArticle.pubtime = this.txtpubtime.Text; } else { JpArticle.pubtime = System.DateTime.Now.ToString(); } if (this.txtop.Value == "add") { //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "审核新增", "审核新增文章记录[guid:" + this.txtguid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpArticle.Insert(); } else { //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "审核修改", "审核修改组织记录[id:" + this.txtguid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpArticle.aid = System.Int32.Parse(this.txtaid.Text); JpArticle.Update(); } //静态发布 TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); string ls_html = JpSite.fax; if (ls_html == "开启") { DataTable dt = JpArticle.GetArticleByGUID(this.txtguid.Text); if (dt.Rows.Count > 0) { JpArticle.PubAll("," + dt.Rows[0]["aid"].ToString() + ",", this.txtpubtime.Text, this.txtendtime.Text); } } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }