public void bind() { courTableID = Request.QueryString["courTableID"]; User user = Session["User"] as User; StudentBLL studBLL = new StudentBLL(); CourseTableBLL ctBLL = new CourseTableBLL(); CourseTable ct = ctBLL.get(courTableID); ClassBLL classBll = new ClassBLL(); Class cla = classBll.get(ct.ClassID); className.Text = cla.Name; dt = studBLL.getByClassId(ct.ClassID).Tables[0]; if (Session["attenList"] != null) { attenList = Session["attenList"] as List<Attendance>; } else { attenList = new List<Attendance>(); foreach (DataRow dr in dt.Rows) { Attendance attend = new Attendance(); attend.Status = "正常"; attend.Remark = ""; attend.Recorder = "班长"; attend.RecorderID = studBLL.getByUserId(user.Id).Id; attend.StudID = dr["ID"].ToString(); attend.CourTableID = courTableID; attenList.Add(attend); } } AspNetPager1.RecordCount = dt.Rows.Count; int from = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int to = from + AspNetPager1.PageSize - 1 > AspNetPager1.RecordCount ? AspNetPager1.RecordCount : from + AspNetPager1.PageSize - 1; GridView1.DataSource = PageUtil.resort(PageUtil.getPaged(dt, from, to)); GridView1.DataBind(); initStatusAndRemark(); }
private void bind() { User user = (User)Session["user"]; StudentBLL studBll = new StudentBLL(); Student stud = studBll.getByUserId(user.Id); CommonBLL commonBll = new CommonBLL(); // 根据班级ID得到课程信息 string filter = "1=1"; filter += weekId.SelectedIndex == 0 ? "" : " and week='" + weekId.SelectedValue + "'"; DataTable dt = PageUtil.getProcessedDataTable(commonBll.getWorkAttendanceByClassID(stud.ClassID), filter); AspNetPager1.RecordCount = dt.Rows.Count; int from = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int to = from + AspNetPager1.PageSize - 1 > AspNetPager1.RecordCount ? AspNetPager1.RecordCount : from + AspNetPager1.PageSize - 1; GridView1.DataSource = PageUtil.getPaged(dt, from, to); GridView1.DataBind(); }
public void bind() { User user = (User)Session["user"]; ClassBLL classBLL = new ClassBLL(); StudentBLL studBll = new StudentBLL(); Student stud = studBll.getByUserId(user.Id); Class clazz = classBLL.get(stud.ClassID); className.Text = clazz.Name; CommonBLL commBLL = new CommonBLL(); DataTable dt = commBLL.getClassStudentAttendStatistics(clazz.Id, stud.Id, false); AspNetPager1.RecordCount = dt.Rows.Count; int from = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int to = from + AspNetPager1.PageSize - 1 > AspNetPager1.RecordCount ? AspNetPager1.RecordCount : from + AspNetPager1.PageSize - 1; GridView1.DataSource = PageUtil.getPaged(dt, from, to); GridView1.DataBind(); }