BBSWrite.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_BBSWrite : 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_BBSWrite");
  24.         if (!IsPostBack)
  25.         {
  26.             DropLoadSet();
  27.         }
  28.     }
  29.     public void DropLoadSet()
  30.     {
  31.         DropDownListType.DataTextField = "MC";
  32.         DropDownListType.DataValueField = "ID";
  33.         DropDownListType.DataSource = EnumGet.BBSSmailTYPEGetEnum();
  34.         DropDownListType.DataBind();
  35.         DropDownListType.SelectedIndex = DropDownListType.Items.Count - 1;
  36.     }
  37.     protected void Button1_Click(object sender, EventArgs e)
  38.     {
  39.         try
  40.         {
  41.             if (TextBoxTitle.Text == "")
  42.             {
  43.                 throw new Exception("标题不能为空!");
  44.             }
  45.             if (Editor1.Text == "")
  46.             {
  47.                 throw new Exception("内容不能为空!");
  48.             }
  49.             MB.DJ = 0;
  50.             MB.FL = DropDownListType.SelectedValue;
  51.             MB.HF = 0;
  52.             MB.ZHHF = DateTime.Now;
  53.             MB.ZT = TextBoxTitle.Text;
  54.             MB.ZTNR = Editor1.Text;
  55.             MB.ZTZZ = SessionInclude.SessionId;
  56.             BB.Add(MB);
  57.             MessageBox.Show("发表成功","BBSNews.aspx");
  58.         }
  59.         catch(Exception exp)
  60.         {
  61.             MessageBox.Show(exp.Message);
  62.         }
  63.         }
  64.    
  65.     }