/// <summary> /// 绑定数据源 /// </summary> private void bind() { string id = Request.QueryString["id"].ToString(); AttendanceBLL attendBLL = new AttendanceBLL(); attend = attendBLL.get(id); CourseTableBLL ctBLL = new CourseTableBLL(); CourseTable ct = ctBLL.get(attend.CourTableID); ClassBLL classBLL = new ClassBLL(); TeacherBLL teacherBLL = new TeacherBLL(); CourseBLL courseBLL = new CourseBLL(); StudentBLL stuBLL = new StudentBLL(); #region 绑定页面数据 Label_class.Text = classBLL.get(ct.ClassID).Name; Label_course.Text = courseBLL.get(ct.CourId).Name; Label_teacher.Text = teacherBLL.get(ct.TeachID).Name; Label_student.Text = stuBLL.get(attend.StudID).Name; Label_oldStatus.Text = attend.Status; Label_week.Text = ct.Week; Label_weekDay.Text = ct.WeekDay; Label_courseTime.Text = ct.CourseTime; Label_place.Text = ct.Place; #endregion }
private DataTable transferListToDataTable(List<Attendance> attenList) { StudentBLL stuBLL = new StudentBLL(); DataTable dt = new DataTable(); //设置自增长列 DataColumn colNumber = new DataColumn("ID"); colNumber.AutoIncrement = true;//设置是否为自增列 colNumber.AutoIncrementSeed = 1;//设置自增初始值 colNumber.AutoIncrementStep = 1;//设置每次子增值 dt.Columns.Add(colNumber); dt.Columns.Add("stuId", Type.GetType("System.String")); dt.Columns.Add("name", Type.GetType("System.String")); dt.Columns.Add("gender", Type.GetType("System.String")); dt.Columns.Add("status", Type.GetType("System.String")); dt.Columns.Add("remark", Type.GetType("System.String")); foreach (Attendance att in attenList) { Student stud = stuBLL.get(att.StudID); DataRow dr = dt.NewRow(); dr[1] = stud.StuId; dr[2] = stud.Name; dr[3] = stud.Gender; dr[4] = att.Status; dr[5] = att.Remark; dt.Rows.Add(dr); } return dt; }
private void bind() { string id = Request.QueryString["id"].ToString(); StudentBLL stuBLL = new StudentBLL(); stu = stuBLL.get(id); Label_stuId.Text = stu.StuId; TextBox_name.Text = stu.Name; if (stu.Gender.Equals("女")) RadioButton_female.Checked = true; PageUtil.bindDropDownList(DropDownList_yearPart1, stu.Birth[0].ToString()); PageUtil.bindDropDownList(DropDownList_yearPart2, stu.Birth[1].ToString()); PageUtil.bindDropDownList(DropDownList_yearPart3, stu.Birth[2].ToString()); PageUtil.bindDropDownList(DropDownList_yearPart4, stu.Birth[3].ToString()); PageUtil.bindDropDownList(DropDownList_month, stu.Birth.Substring(4, 2)); TextBox_phone.Text = stu.Phone; TextBox_address.Text = stu.Address; PageUtil.bindDropDownList(DropDownList_class, stu.ClassID); }
protected void ImageButton_delete_Click(object sender, ImageClickEventArgs e) { ImageButton imageButton = sender as ImageButton; string id = imageButton.CommandArgument; ClassBLL classBLL = new ClassBLL(); StudentBLL stuBLL = new StudentBLL(); UserBLL userBLL = new UserBLL(); Student stu = stuBLL.get(id); User user = userBLL.get(stu.UserID); stuBLL.delete(stu); userBLL.delete(user); Class clazz = classBLL.get(stu.ClassID); clazz.StudCount = (Convert.ToInt32(clazz.StudCount) - 1).ToString(); classBLL.update(clazz); Response.Write("<script>alert('删除成功!');location.href='showStudents.aspx';</script>"); }