// 排序:座號/姓名 private int SortStudent(StudentTotalObj obj1, StudentTotalObj obj2) { string seatno1 = obj1.seat_no.PadLeft(3, '0'); seatno1 += obj1.student_name.PadLeft(10, '0'); string seatno2 = obj2.seat_no.PadLeft(3, '0'); seatno2 += obj2.student_name.PadLeft(10, '0'); return(seatno1.CompareTo(seatno2)); }
// 取得學生資料 By SQL private List <StudentTotalObj> GetStudentOBJ(List <string> _ClassIDList) { List <StudentTotalObj> list = new List <StudentTotalObj>(); //取得班級學生資料 string qu = "select student.id,class.id as class_id,student.seat_no,student.student_number,student.name,student.status,student.gender from student join class on class.id=student.ref_class_id where class.id in('" + string.Join("','", _ClassIDList) + "')"; DataTable dt = _queryHelper.Select(qu); foreach (DataRow row in dt.Rows) { StudentTotalObj obj = new StudentTotalObj(row); //學生不等於 刪除 與 畢業及離校 if (obj.status != "16" && obj.status != "256") { list.Add(obj); } } return(list); }
// 取得學生資料 By SQL private List<StudentTotalObj> GetStudentOBJ(List<string> _ClassIDList) { List<StudentTotalObj> list = new List<StudentTotalObj>(); //取得班級學生資料 string qu = "select student.id,class.id as class_id,student.seat_no,student.student_number,student.name,student.status,student.gender from student join class on class.id=student.ref_class_id where class.id in('" + string.Join("','", _ClassIDList) + "')"; DataTable dt = _queryHelper.Select(qu); foreach (DataRow row in dt.Rows) { StudentTotalObj obj = new StudentTotalObj(row); //學生不等於 刪除 與 畢業及離校 if (obj.status != "16" && obj.status != "256") { list.Add(obj); } } return list; }
// 排序:座號/姓名 private int SortStudent(StudentTotalObj obj1, StudentTotalObj obj2) { string seatno1 = obj1.seat_no.PadLeft(3, '0'); seatno1 += obj1.student_name.PadLeft(10, '0'); string seatno2 = obj2.seat_no.PadLeft(3, '0'); seatno2 += obj2.student_name.PadLeft(10, '0'); return seatno1.CompareTo(seatno2); }