📄 testifadd.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 Default3 : 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("showIf.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 = this.RadioButtonList1.Items[0].Text;
string ans2 = this.RadioButtonList1.Items[1].Text;
string rightAns = "";
int score;
int pub;
if (cbx_isPub.Checked)
pub = 1;
else pub = 0;
score = Convert.ToInt32(tbx_score.Text);
if (this.RadioButtonList1.Items[0].Selected)
rightAns = "对";
else
rightAns = "错";
count = (new projClass()).insertTestIf(content, rightAns, pub, score, courseId);
tbx_content.Text = "";
if (count == 0)
this.Label1.Text = "添加失败!";
}
else
this.Label1.Text = "请输入完整题目!";
if (!cbx_continue.Checked)
{
Response.Write("<script>alert(\"添加成功!\");</script>");
Response.Redirect("showIf.aspx");
}
this.Label1.Text = "添加成功!";
}
//取消事件
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("showIf.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -