-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddQuestionApplication.aspx.cs
59 lines (56 loc) · 2.07 KB
/
AddQuestionApplication.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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 Teacher_Application : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["questionID"] = "98760001";
Session["teacher"] = "黄素叶";
Session["teacherID"] = "黄叶";
Session["courseName"] = "C语言程序设计";
Session["chapterName"] = "第一章";
Session["imgFile"] = "";
}
lblTeacher.Text = Session["teacher"].ToString();
lblCourseName.Text = Session["courseName"].ToString();
txtChapter.Text = Session["chapterName"].ToString();
txtID.Text = Session["questionID"].ToString();
}
protected void btnCancel_Click(object sender, EventArgs e)
{
txtContent.Text = "";
txtAnswer.Text = "";
txtContent.Focus();
}
protected void btnConfirm_Click(object sender, EventArgs e)
{
string isShare = "";
if (cbShare.Checked == true)
isShare = "1";
else
isShare = "0";
string str = "insert into tb_application(questionID,questionText,answer,courseID,teacherID,chapter,share) values('" + Session["questionID"].ToString() + "','" + txtContent.Text.Trim() + "','" + txtAnswer.Text.Trim() + "','" + Session["courseName"].ToString() + "','" + Session["teacherID"].ToString() + "','" + Session["chapterName"].ToString() + "','" + isShare + "')";
if (cbID.Checked)
{
Session["questionID"] = Int64.Parse(Session["questionID"].ToString()) + 1;
txtID.Text = Session["questionID"].ToString();
}
else
{
txtID.Text = "";
}
//调用公共类的方法,向数据库插入记录
BaseClass.OperateData(str);
btnCancel_Click(sender, e);
}
}