📄 testduoxuanadd.aspx.cs
字号:
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 Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["adminId"] == null)
{
Response.Redirect("Default.aspx");
}
else
if (!Page.IsPostBack)
{
if (Session["courseId"] != null)
{
string courseId = Convert.ToString(Session["courseId"]);
lbl_courseName.Text = (new projClass()).getCourseNameAsCourseId(courseId);
}
else
{
Response.Write("<script>alert(\"没有获取到科目ID\");</script>");
Response.Redirect("showDuoXuan.aspx");
}
}
}
//取消事件
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("showDuoXuan.aspx");
}
//确定事件
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
if (tbx_content.Text.Trim() != "")
{
int count;
string courseId = Convert.ToString(Session["courseId"]);
//string courseId = "1";
string content = tbx_content.Text.Trim();
string ans1 = tbx_ans1.Text.Trim();
string ans2 = tbx_ans2.Text.Trim();
string ans3 = tbx_ans3.Text.Trim();
string ans4 = tbx_ans4.Text.Trim();
string rightAns = "";
int score;
int pub;
if (cbx_isPub.Checked)
pub = 1;
else pub = 0;
score = Convert.ToInt32(tbx_score.Text);
if (this.CheckBoxList1.Items[0].Selected)
rightAns = rightAns + "A";
if (this.CheckBoxList1.Items[1].Selected)
rightAns = rightAns + "B";
if (this.CheckBoxList1.Items[2].Selected)
rightAns = rightAns + "C";
if (this.CheckBoxList1.Items[3].Selected)
rightAns = rightAns + "D";
count = (new projClass()).insertTestDuoXuan(content, ans1, ans2, ans3, ans4, rightAns, pub, score, courseId);
tbx_content.Text = "";
tbx_ans1.Text = "";
tbx_ans2.Text = "";
tbx_ans3.Text = "";
tbx_ans4.Text = "";
if (count == 0)
this.Label1.Text = "添加失败!";
}
else
this.Label1.Text = "请输入完整题目!";
if (!cbx_continue.Checked)
{
Response.Write("<script>alert(\"添加成功!\");</script>");
Response.Redirect("showDuoXuan.aspx");
}
this.Label1.Text = "添加成功!";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -