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

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 Infos_AskInfoWrite : System.Web.UI.Page
  12. {
  13.     /// <summary>
  14.     /// 论坛模板
  15.     /// </summary>
  16.     Model.Asks MB = new Model.Asks();
  17.     /// <summary>
  18.     /// 论坛业务
  19.     /// </summary>
  20.     BLL.Asks BB = new BLL.Asks();
  21.     /// <summary>
  22.     /// 问题内容模板
  23.     /// </summary>
  24.     Model.AsksContent MAC = new Model.AsksContent();
  25.     /// <summary>
  26.     /// 问题内容业务
  27.     /// </summary>
  28.     BLL.AsksContent BAC = new BLL.AsksContent();
  29.     protected void Button1_Click(object sender, EventArgs e)
  30.     {
  31.         try
  32.         {
  33.             if (TextBoxTitle.Text == "")
  34.             {
  35.                 throw new Exception("问题不能为空!");
  36.             }
  37.             if (ListBox1.Items.Count <= 0)
  38.             {
  39.                 throw new Exception("问题选项不能为空!");
  40.             }
  41.             MB.DCNR = TextBoxTitle.Text;
  42.             MB.DCR = SessionInclude.SessionId;
  43.             MB.DCSJ = DateTime.Now;
  44.             BB.Add(MB);
  45.             DBUtility.SqlHelper DS = new DBUtility.SqlHelper();
  46.             object objone= DS.ExecuteScalar(System.Configuration.ConfigurationManager.ConnectionStrings["DB"].ConnectionString, CommandType.Text, "select ID from Asks order by ID desc ", null);
  47.             if (objone != null)
  48.             {
  49.                 int MBID = int.Parse(objone.ToString());
  50.                 foreach (ListItem LIm in ListBox1.Items)
  51.                 {
  52.                     Model.AsksContent ItmMAC = new Model.AsksContent();
  53.                     ItmMAC.AskID = MBID;
  54.                     ItmMAC.AskNR = LIm.Text;
  55.                     ItmMAC.AskCount = 0;
  56.                     BAC.Add(ItmMAC);
  57.                 }
  58.             }
  59.             else
  60.             {
  61.                 throw new Exception("没加载问题!");
  62.             }
  63.             
  64.             MessageBox.Show("调查发布成功", "AskNewsManager.aspx");
  65.         }
  66.         catch(Exception exp)
  67.         {
  68.             MessageBox.Show(exp.Message);
  69.         }
  70.         }
  71.     protected void Button2_Click(object sender, EventArgs e)
  72.     {
  73.         ListBox1.Items.Add(TextBoxItem.Text);
  74.     }
  75.     protected void Button3_Click(object sender, EventArgs e)
  76.     {
  77.         ListBox1.Items.Remove(ListBox1.SelectedItem);
  78.     }
  79.     protected void Page_Load(object sender, EventArgs e)
  80.     {
  81.         LoginLogic.MatchLoad("../", "Infos_AskInfoWrite");
  82.     }
  83. }