public string GetAll(int?curriculumID, int?classID, int?classRoomID, int?teacherID, DateTime?startTime, DateTime?endTime, int offset, int pageSize) { int total = 0; ArrangeClassManager manager = new ArrangeClassManager(); List <ArrangeClassViewEntity> list = manager.GetArrangeClassViewList(curriculumID, classID, classRoomID, teacherID, startTime, endTime); total = list.Count; List <ArrangeClassViewEntity> listView = list.Skip(offset).Take(pageSize).ToList(); //给分页实体赋值 PageModels <ArrangeClassViewEntity> model = new PageModels <ArrangeClassViewEntity>(); model.total = total; if (total % pageSize == 0) { model.page = total / pageSize; } else { model.page = (total / pageSize) + 1; } model.rows = listView; //将查询结果返回 return(new JavaScriptSerializer().Serialize(model)); }
public void GetArrangeClasses() { //用于序列化实体类的对象 JavaScriptSerializer jss = new JavaScriptSerializer(); //请求中携带的条件 string order = HttpContext.Request.Params["order"]; int offset = Convert.ToInt32(HttpContext.Request.Params["offset"]); int pageSize = Convert.ToInt32(HttpContext.Request.Params["limit"]); string student = HttpContext.Request.Params["student"]; string curriculumID = HttpContext.Request.Params["curriculumID"]; string classID = HttpContext.Request.Params["classID"]; string classRoomID = HttpContext.Request.Params["classRoomID"]; string teacherID = HttpContext.Request.Params["teacherID"]; string startTime = HttpContext.Request.Params["startTime"]; DateTime?endTime = null; if (!string.IsNullOrWhiteSpace(startTime)) { endTime = DateTime.Parse(startTime).AddDays(1); } List <int> classList = null; if (!string.IsNullOrWhiteSpace(student)) { classList = new ClassStudentMapManager().GetClassStudentMapViewList(Ext.ToIntOrNull(classID), null, student).Select(r => r.ClassID).ToList(); } int total = 0; ArrangeClassManager manager = new ArrangeClassManager(); List <ArrangeClassViewEntity> list = manager.GetArrangeClassViewList(Ext.ToIntOrNull(curriculumID), Ext.ToIntOrNull(classID), Ext.ToIntOrNull(classRoomID), Ext.ToIntOrNull(teacherID), Ext.ToDateOrNull(startTime), Ext.ToDateOrNull(endTime)); list = list.OrderByDescending(r => r.StartTime).OrderBy(r => r.ClassCode).ToList(); total = list.Count; List <ArrangeClassViewEntity> listView = list.Skip(offset).Take(pageSize).ToList(); if (!string.IsNullOrWhiteSpace(student)) { listView = list.Where(r => classList.Contains(r.ClassID)).Skip(offset).Take(pageSize).ToList(); } //给分页实体赋值 PageModels <ArrangeClassViewEntity> model = new PageModels <ArrangeClassViewEntity>(); model.total = total; if (total % pageSize == 0) { model.page = total / pageSize; } else { model.page = (total / pageSize) + 1; } model.rows = listView; //将查询结果返回 HttpContext.Response.Write(jss.Serialize(model)); }
public string GetArrangeClassViewList(int?curriculumID, int?classID, int?classRoomID, int?teacherID, DateTime?startTime, DateTime?endTime) { ArrangeClassManager manager = new ArrangeClassManager(); return(new JavaScriptSerializer().Serialize(manager.GetArrangeClassViewList(curriculumID, classID, classRoomID, teacherID, startTime, endTime))); }