HyperLesson/Admin/Lesson-A.aspx.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HyperLesson
{
public partial class Lesson_A : System.Web.UI.Page
{
//绑定GridView
private void Bind()
{
GridView1.DataSource = LessonManager.getCategoryList();
GridView1.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
this.Button1.Attributes.Add("onclick", "return confirm('确认删除选中的项目吗??')");
}
}
//删除
protected void GridView1__RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//获取课程名字
string LesName = GridView1.Rows[e.RowIndex].Cells[2].Text;
if (LessonManager.Delete(int.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text)))
{
//第一重验证-删除没有学生选的课
Response.Write("<script>alert('删除《"+ LesName + "》成功!')</script>");
//第二重验证-同步删除学生已经选择了的课程
if (LessonManager.DeleteStu(int.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text)))
{
Response.Write("<script>alert('同步删除成功!');location.href='Lesson-A.aspx';</script>");
}
}
else
Response.Write("<script>alert('删除失败!');location.href='Lesson-A.aspx';</script>");
Bind();
}
//更新
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
Lesson ls = new Lesson();
//id为只读
ls.id = int.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text);
ls.LessonName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
//课程编码为只读
ls.LessonCode = int.Parse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text);
ls.Teacher = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[4].Controls[0])).Text;
ls.LessonTime = DateTime.Parse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text);
ls.LessonPart = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].Controls[0])).Text;
ls.LessonNeed = int.Parse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[7].Controls[0])).Text);
ls.LessonScore = int.Parse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[8].Controls[0])).Text);
后面还有 147 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。