WebSite3/dean/studentInsert.aspx.cs
(完整代码) 2KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CheckOnWork.BusinessLogicLayer;
using CheckOnWork.Model;
public partial class dean_studentInsert : System.Web.UI.Page
{
CheckOnWork.BusinessLogicLayer.ProfessionalBLL bll = new ProfessionalBLL();
CheckOnWork.BusinessLogicLayer.StudentBLL studentBll = new StudentBLL();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// 验证当前用户的身份
if (Session["State"].ToString() != "dean")
{
Response.Write("<script type='text/javascript'>alert('您还没有登录!无法访问');self.parent.location.href('../default.aspx') </script>");
}
IList<CheckOnWork.Model.professional> listProfessional = bll.GetProfessionByDepartmentId(Convert.ToInt32(Session["departmentId"]));
//Response.Write(listDepartment[0].departmentName);
ddlBianHao.DataSource = listProfessional;
ddlBianHao.DataTextField = "professionalName";
ddlBianHao.DataBind();
}
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
int professionalID=bll.GetProfessionIdByName(ddlBianHao.Text);
Student student = new Student(txtStudentID.Text,txtStudentName.Text,labelPwd.Text,professionalID,ddlSex.Text,Convert.ToDateTime(txtBirth.Text.ToString()),txtPhone.Text);
int sign = studentBll.Insert(student);
if (sign == 1)
{
Response.Write("<script type='text/javascript'>alert('添加成功')</script>");
//添加成功则清空行
txtStudentID.Text = "";
txtBirth.Text = "";
txtPhone.Text = "";
txtStudentName.Text = "";
}
else Response.Write("<script type='text/javascript'>alert('添加失败')</script>");
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。