📄 subject.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;
using ExaminationSystem.BLL.Service;
using ExaminationSystem.BLL.Domain;
public partial class Teacher_Subject : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
private void BindData()
{
GridView1.DataSource = new SubjectService().GetAll();
GridView1.DataBind();
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
long subjectId = long.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
try
{
new SubjectService().DeleteById(subjectId);
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
BindData();
}
protected void Button1_Click(object sender, EventArgs e)
{
string subjectName = TextBox1.Text;
Subject subject = new Subject(subjectName);
new SubjectService().Save(subject);
BindData();
}
protected void Button2_Click(object sender, EventArgs e)
{
new QuestionContentService().ClearUselessQuestionContent();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -