Пример #1
0
        public JsonResult GetByKHvaLoaiTTByTeacher(long IDHK, long IDTT, string masv, string studentname, int pageNumber = 0, int pageSize = 10)
        {
            long id_gv   = long.Parse(Session["UserId"].ToString());
            var  thuctap = practiceService.GetByLoaiTTvaHocKy(IDTT, IDHK);
            var  total   = studentPracticeService.getListByPracticeTypeIdAndTeacherIdCount(thuctap.ID, id_gv, masv, studentname);
            var  listst  = studentPracticeService.getListByPracticeTypeIdAndTeacherIdSort(thuctap.ID, id_gv, masv, studentname, pageNumber, pageSize);
            var  list    = new List <StudentModel>();

            foreach (var i in listst)
            {
                var listField = fieldService.GetByStudentId(i.ID);
                var field     = "";
                for (var j = 0; j < listField.Count(); j++)
                {
                    if (j == listField.Count() - 1)
                    {
                        field += listField[j];
                    }
                    else
                    {
                        field += listField[j] + ",";
                    }
                }
                var faculty = facultyService.GetById(i.FacultyID).FacultyName;
                var student = new StudentModel
                {
                    Faculty   = faculty,
                    Masv      = i.MaSV,
                    FieldName = field,
                    FirstName = i.FirstName,
                    LastName  = i.LastName,
                    Birthday  = i.Birthday.Value.Day + "/" + i.Birthday.Value.Month + "/" + i.Birthday.Value.Year,
                    Sex       = i.Sex,
                    Email     = i.Email,
                    Phone     = i.Phone,
                    Address   = i.Address,
                    Note      = i.Note
                };
                list.Add(student);
            }
            // 5. Trả về các Link được phân trang theo kích thước và số trang.
            return(Json(new { TotalRecords = total, List = list }, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult GetListByTeacherIdAndFacultyId(long facultyId, string masv, string studentname, int pageNumber = 0, int pageSize = 10)
        {
            long teacherId = long.Parse(Session["UserId"].ToString());
            var  total     = studentService.getListByTeacherIdAndFacultyIdCount(teacherId, facultyId, masv, studentname);
            var  listtc    = studentService.getListByTeacherIdAndFacultyIdSort(teacherId, facultyId, masv, studentname, pageNumber, pageSize);
            var  list      = new List <StudentModel>();

            foreach (var i in listtc)
            {
                var listField = fieldService.GetByStudentId(i.ID);
                var field     = "";
                for (var j = 0; j < listField.Count(); j++)
                {
                    if (j == listField.Count() - 1)
                    {
                        field += listField[j];
                    }
                    else
                    {
                        field += listField[j] + ",";
                    }
                }
                var student = new StudentModel
                {
                    Masv      = i.MaSV,
                    FieldName = field,
                    FirstName = i.FirstName,
                    LastName  = i.LastName,
                    Birthday  = i.Birthday.Value.Day + "/" + i.Birthday.Value.Month + "/" + i.Birthday.Value.Year,
                    Sex       = i.Sex,
                    Email     = i.Email,
                    Phone     = i.Phone,
                    Address   = i.Address,
                    Note      = i.Note
                };
                list.Add(student);
            }
            // 5. Trả về các Link được phân trang theo kích thước và số trang.
            return(Json(new { TotalRecords = total, List = list }, JsonRequestBehavior.AllowGet));
        }