/// <summary> /// 根据专业查询所有的学生的成绩 /// </summary> /// <param name="proname"></param> /// <param name="b"></param> /// <returns></returns> public IQueryable <Grade> GetAllGradeByPro(string proname, bool b) { GradeDal gradal = new GradeDal(); IQueryable <Grade> iq = null; if (b) { iq = based.GetEntities(u => u.Student.Profession.Pro_Name == proname); } else { iq = based.GetEntities(u => u.Student.Profession.Pro_Name == proname); } return(iq); }
public IQueryable <Grade> GetAllGradeByProAndPassed(string proname, bool b) { GradeDal gradal = new GradeDal(); IQueryable <Grade> iq = null; if (b) { iq = gradal.GetEntities(u => u.Student.Profession.Pro_Name == proname && u.Score >= 60).OrderBy <Grade, int>(s => s.Score); } else { iq = gradal.GetEntities(u => u.Student.Profession.Pro_Name == proname && u.Score >= 60).OrderByDescending <Grade, int>(s => s.Score); } return(iq); }
public ActionResult GetStuSou() { string key = Request["key"]; GradeDal studal = new GradeDal(); IQueryable <Grade> iq = studal.GetEntities(u => u.Student.Stu_Name.Contains(key) || u.Theme.Theme_Name.Contains(key) || u.Teacher.Tea_Name.Contains(key)); IList <string> strl = new List <string>(); foreach (var item in iq) { string s = item.Student.Stu_Name + "-" + item.Theme.Theme_Name + "-" + item.Teacher.Tea_Name + "-" + item.Score; strl.Add(s); } string str = js.Serialize(strl); Response.Write(str); Response.End(); return(View()); }
public ActionResult GetStuGradeByPro(int pageIndex = 1, int pageSize = 3) { BaseDal <Grade> based = new BaseDal <Grade>(); GradeService gradeser = new GradeService(); ChoseThemeDal c = new ChoseThemeDal(); GradeDal g = new GradeDal(); StudentDal studal = new StudentDal(); int total; if (Request["action"] == "gettotal") { string pro = Request["pro"]; IQueryable <Grade> iq = gradeser.GetAllGradeByPro(pro, true); IQueryable <Student> stuiq = studal.GetEntities(u => u.Profession.Pro_Name == pro); total = iq.Count(); int prototal = stuiq.Count(); int[] arr = { pageIndex, pageSize, total, prototal }; string str = js.Serialize(arr); Response.Write(str); } if (Request["action"] == "getgrade") { string pro = Request["pro"]; IQueryable <Grade> iq = gradeser.GetAllGradeByPro(pro, true); total = iq.Count(); int pgindex = Convert.ToInt32(Request["pgindex"]); iq = based.GetPageEntities <int?>(pageSize, pgindex, out total, u => u.Student.Profession.Pro_Name == pro, u => u.Score, true); IList <string> strl = new List <string>(); foreach (var item in iq) { string s = item.Student.Stu_Name + "-" + item.Theme.Theme_Name + "-" + item.Teacher.Tea_Name + "-" + item.Score; strl.Add(s); } string str = js.Serialize(strl); Response.Write(str); } Response.End(); return(View()); }