//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; TPortalClass.JpColumns JpColumns = new TPortalClass.JpColumns(); //先判断静态发布路径是否已经存在 if (this.txtpubhtmlpath.Text.Trim() != "") { if (JpColumns.IsExist_pubhtmlpath(this.txtcid.Text, this.txtpubhtmlpath.Text.Trim()) == true) { ls_tip = "静态发布路径已存在不能重复,请重新填写!"; Response.Write("<script>alert('" + ls_tip + "');</script>"); return; } } JpColumns.cid = this.txtcid.Text; JpColumns.cname = this.txtcname.Text; JpColumns.tmp_col = this.ddltmp_col.SelectedValue; JpColumns.tmp_art = this.ddltmp_art.SelectedValue; JpColumns.seotitle = this.txtseotitle.Text; JpColumns.seokeywords = this.txtseokeywords.Text; JpColumns.seodescription = this.txtseodescription.Text; JpColumns.pubhtmlpath = this.txtpubhtmlpath.Text; JpColumns.csort = System.Int32.Parse(this.txtcsort.Text); JpColumns.rss = System.Int32.Parse(this.txtrss.Text); //JpColumns.newpic = this.txtnewpic.Text; string lsfilename = FileUpload1.FileName; string lspath = "", lsurl = "", str_path = ""; if (lsfilename != "") //attsize { lsfilename = System.Guid.NewGuid() + "_" + lsfilename; //将附件上传到服务器目录下 lspath = Server.MapPath("~/"); //虚拟目录的位置 lsurl = "/upload/columnpic"; //原图存放的文件夹 Directory.CreateDirectory(lspath + "/" + lsurl); str_path = lspath + "/" + lsurl + "/" + lsfilename; FileUpload1.SaveAs(str_path); JpColumns.newpic = lsurl + "/" + lsfilename; } else { JpColumns.newpic = this.txtpicurl.Value; } JpColumns.newday = System.Int32.Parse(this.txtnewday.Text); if (cblsx.Items[0].Selected == true) { JpColumns.online = "1"; } else { JpColumns.online = "0"; } if (cblsx.Items[1].Selected == true) { JpColumns.hotpublish = "1"; } else { JpColumns.hotpublish = "0"; } if (cblsx.Items[2].Selected == true) { JpColumns.shtml = "1"; } else { JpColumns.shtml = "0"; } if (cblsx.Items[3].Selected == true) { JpColumns.pubtime = "1"; } else { JpColumns.pubtime = "0"; } if (this.txtop.Value == "add") { //写系统日志 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.txtcid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpColumns.Insert(); } else { //写系统日志 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.txtcid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpColumns.Update(); } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }