AskInfoWrite.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:3k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class Infos_AskInfoWrite : System.Web.UI.Page
- {
- /// <summary>
- /// 论坛模板
- /// </summary>
- Model.Asks MB = new Model.Asks();
- /// <summary>
- /// 论坛业务
- /// </summary>
- BLL.Asks BB = new BLL.Asks();
- /// <summary>
- /// 问题内容模板
- /// </summary>
- Model.AsksContent MAC = new Model.AsksContent();
- /// <summary>
- /// 问题内容业务
- /// </summary>
- BLL.AsksContent BAC = new BLL.AsksContent();
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (TextBoxTitle.Text == "")
- {
- throw new Exception("问题不能为空!");
- }
- if (ListBox1.Items.Count <= 0)
- {
- throw new Exception("问题选项不能为空!");
- }
- MB.DCNR = TextBoxTitle.Text;
- MB.DCR = SessionInclude.SessionId;
- MB.DCSJ = DateTime.Now;
- BB.Add(MB);
- DBUtility.SqlHelper DS = new DBUtility.SqlHelper();
- object objone= DS.ExecuteScalar(System.Configuration.ConfigurationManager.ConnectionStrings["DB"].ConnectionString, CommandType.Text, "select ID from Asks order by ID desc ", null);
- if (objone != null)
- {
- int MBID = int.Parse(objone.ToString());
- foreach (ListItem LIm in ListBox1.Items)
- {
- Model.AsksContent ItmMAC = new Model.AsksContent();
- ItmMAC.AskID = MBID;
- ItmMAC.AskNR = LIm.Text;
- ItmMAC.AskCount = 0;
- BAC.Add(ItmMAC);
- }
- }
- else
- {
- throw new Exception("没加载问题!");
- }
-
- MessageBox.Show("调查发布成功", "AskNewsManager.aspx");
- }
- catch(Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- protected void Button2_Click(object sender, EventArgs e)
- {
- ListBox1.Items.Add(TextBoxItem.Text);
- }
- protected void Button3_Click(object sender, EventArgs e)
- {
- ListBox1.Items.Remove(ListBox1.SelectedItem);
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "Infos_AskInfoWrite");
- }
- }