Ejemplo n.º 1
0
        public void GetClassStudentMaps()
        {
            //用于序列化实体类的对象
            JavaScriptSerializer jss = new JavaScriptSerializer();

            //请求中携带的条件
            string order     = HttpContext.Request.Params["order"];
            string searchKey = HttpContext.Request.Params["search"];
            int    offset    = Convert.ToInt32(HttpContext.Request.Params["offset"]);
            int    pageSize  = Convert.ToInt32(HttpContext.Request.Params["limit"]);

            string classID = HttpContext.Request.Params["classID"];

            int total = 0;
            ClassStudentMapManager           manager = new ClassStudentMapManager();
            List <ClassStudentMapViewEntity> list    = manager.GetSearch(Ext.ToIntOrNull(classID), searchKey, order, offset, pageSize, out total);

            //给分页实体赋值
            PageModels <ClassStudentMapViewEntity> model = new PageModels <ClassStudentMapViewEntity>();

            model.total = total;
            if (total % pageSize == 0)
            {
                model.page = total / pageSize;
            }
            else
            {
                model.page = (total / pageSize) + 1;
            }

            model.rows = list;

            //将查询结果返回
            HttpContext.Response.Write(jss.Serialize(model));
        }
Ejemplo n.º 2
0
        public string PutClassStudentMap(ClassStudentMapEntity entity)
        {
            try
            {
                if (entity == null)
                {
                    return("error");
                }

                ClassStudentMapManager manager = new ClassStudentMapManager();

                entity.CreateTime = DateTime.Now;
                entity.CreateTime = DateTime.Now;

                manager.Update(entity);

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
Ejemplo n.º 3
0
        public string DeleteClassStudentMap(int id)
        {
            try
            {
                ClassStudentMapManager manager = new ClassStudentMapManager();

                ClassStudentMapEntity entity = manager.GetClassStudentMapByID(id);
                if (entity != null)
                {
                    entity.Valid      = "F";
                    entity.CreateTime = DateTime.Now;
                    entity.CreateTime = DateTime.Now;

                    manager.Update(entity);
                }

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        public string GetClassStudentMapViewList(int?classID, int?studentID)
        {
            ClassStudentMapManager manager = new ClassStudentMapManager();

            return(new JavaScriptSerializer().Serialize(manager.GetClassStudentMapViewList(classID, studentID)));
        }
Ejemplo n.º 6
0
        public string GetClassStudentMapByStudentID(int studentID)
        {
            ClassStudentMapManager manager = new ClassStudentMapManager();

            return(new JavaScriptSerializer().Serialize(manager.GetClassStudentMapByStudentID(studentID)));
        }