BBSEdit.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:2k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class BBS_BBSEdit : System.Web.UI.Page
  12. {
  13.     /// <summary>
  14.     /// 论坛模板
  15.     /// </summary>
  16.     Model.BBS MB = new Model.BBS();
  17.     /// <summary>
  18.     /// 论坛业务
  19.     /// </summary>
  20.     BLL.BBS BB = new BLL.BBS();
  21.     protected void Page_Load(object sender, EventArgs e)
  22.     {
  23.         LoginLogic.MatchLoad("../", "BBS_BBSEdit");
  24.         if (!IsPostBack)
  25.         {
  26.             DropLoadSet();
  27.             if(Request.QueryString["id"]!=null)
  28.             {
  29.                 MB = BB.GetModel(int.Parse(Request.QueryString["id"].ToString()));
  30.                 DropDownListType.Text = EnumGet.GetBBSSmailTYPEName(int.Parse(MB.FL));
  31.                 Editor1.Text = MB.ZTNR;
  32.                 TextBoxTitle.Text = MB.ZT;
  33.             }
  34.           
  35.         }
  36.     }
  37.     public void DropLoadSet()
  38.     {
  39.         DropDownListType.DataTextField = "MC";
  40.         DropDownListType.DataValueField = "ID";
  41.         DropDownListType.DataSource = EnumGet.BBSSmailTYPEGetEnum();
  42.         DropDownListType.DataBind();
  43.         DropDownListType.SelectedIndex = DropDownListType.Items.Count - 1;
  44.     }
  45.     protected void Button1_Click(object sender, EventArgs e)
  46.     {
  47.         try
  48.         {
  49.             if (TextBoxTitle.Text == "")
  50.             {
  51.                 throw new Exception("标题不能为空!");
  52.             }
  53.             if (Editor1.Text == "")
  54.             {
  55.                 throw new Exception("内容不能为空!");
  56.             }
  57.             MB.ID = int.Parse(Request.QueryString["id"].ToString());
  58.             MB.DJ = 0;
  59.             MB.FL = DropDownListType.SelectedValue;
  60.             MB.HF = 0;
  61.             MB.ZHHF = DateTime.Now;
  62.             MB.ZT = TextBoxTitle.Text;
  63.             MB.ZTNR = Editor1.Text;
  64.             MB.ZTZZ = SessionInclude.SessionId;
  65.             BB.Update(MB);
  66.             MessageBox.Show("更新成功","MyBBS.aspx");
  67.         }
  68.         catch(Exception exp)
  69.         {
  70.             MessageBox.Show(exp.Message);
  71.         }
  72.         }
  73.    
  74.     }