CourseScoreDAL.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Bowin.Common.Linq;
  6. using EMISOnline.Entities;
  7. using EMISOnline.DataLogic.Repositories;
  8. using EMISOnline.ViewModel.SystemView;
  9. using System.Linq.Expressions;
  10. using EMISOnline.ViewModel.Student;
  11. namespace EMISOnline.DataLogic.Student
  12. {
  13. public class CourseScoreDAL
  14. {
  15. public TeacherScoreRepository teacherScoreRepository { get; set; }
  16. public StudentEducationMissionClassRepository studentEducationMissionClassRepository { get; set; }
  17. public IQueryable<ER_TeacherScore> getTeacherScore(Expression<Func<ER_TeacherScore, bool>> tsExpression)
  18. {
  19. var sql = teacherScoreRepository.GetList(tsExpression);
  20. return sql;
  21. }
  22. public IQueryable<studentEducationMissionClassAddView> getStudentEducationAdd(Guid UserID,string CoursematerialName, string YearsCode)
  23. {
  24. var sql = from v in studentEducationMissionClassRepository.GetList(w => w.UserID == UserID)
  25. join sy in studentEducationMissionClassRepository.UnitOfWork.CF_Schoolyear on v.SchoolyearID equals sy.SchoolyearID
  26. join stu in studentEducationMissionClassRepository.UnitOfWork.CF_Student on v.UserID equals stu.UserID
  27. join u in studentEducationMissionClassRepository.UnitOfWork.Sys_User on v.UserID equals u.UserID
  28. select new studentEducationMissionClassAddView { CoursematerialID=v.CoursematerialID,
  29. CourseName=v.CourseName,
  30. CoverUrl=v.CoverUrl,
  31. EducationMissionClassID=v.EducationMissionClassID,
  32. EducationMissionClassName=v.EducationMissionClassName,
  33. UserID=v.UserID,
  34. SchoolyearID=v.SchoolyearID,
  35. yearCode=sy.Code,
  36. years=sy.Years,
  37. StudentCardNo=u.LoginID,
  38. StudentName=u.Name
  39. };
  40. if (!string.IsNullOrEmpty(CoursematerialName))
  41. {
  42. sql = sql.Where(w => w.CourseName.Contains(CoursematerialName));
  43. }
  44. if (!string.IsNullOrEmpty(YearsCode))
  45. {
  46. sql = sql.Where(w => w.yearCode.Contains(YearsCode));
  47. }
  48. return sql;
  49. }
  50. }
  51. }