EvaluationControlDAL.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.ViewModel;
  7. using EMIS.DataLogic.Repositories;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel.EvaluationManage;
  10. namespace EMIS.DataLogic.Common.EvaluationManage
  11. {
  12. public class EvaluationControlDAL
  13. {
  14. public EvaluationControlRepository evaluationControlRepository { get; set; }
  15. public EvaluationSettingRepository EvaluationSettingRepository { get; set; }
  16. public EvaluationEnterRepository EvaluationEnterRepository { get; set; }
  17. public StudentRepository StudentRepository { get; set; }
  18. public SchoolyearRepository schoolyearRepository { get; set; }
  19. /// <summary>
  20. /// 读取评价控制信息
  21. /// </summary>
  22. /// <param name="exp"></param>
  23. /// <returns></returns>
  24. public IQueryable<EvaluationControlView> GetEvaluationControlQueryable(Expression<Func<EM_EvaluationControl, bool>> exp)
  25. {
  26. var query = from a in evaluationControlRepository.GetList(exp)
  27. join b in schoolyearRepository.Entities on a.SchoolyearID equals b.SchoolyearID
  28. select new EvaluationControlView
  29. {
  30. ControlID = a.EvaluationControlID,
  31. SchoolyearID = a.SchoolyearID,
  32. SchoolyearCode = b.Code,
  33. IsResult = a.IsCourseScoreLock.Value,
  34. Result = (a.IsCourseScoreLock.HasValue && a.IsCourseScoreLock == true) ? "是" : "否",
  35. IsCourse = a.IsSelectCourseLock.Value,
  36. Course = (a.IsSelectCourseLock.HasValue && a.IsSelectCourseLock == true) ? "是" : "否",
  37. AllowNotEvaluationCount = a.NoNumber == null ? 0 : a.NoNumber,
  38. CreateUserID = a.CreateUserID,
  39. CreateTime = a.CreateTime
  40. };
  41. return query;
  42. }
  43. ///获取学生没评的课程教师信息
  44. public IQueryable<EM_EvaluationSetting> GetStudentNotEvaluationList(Expression<Func<CF_Student, bool>> studentExp, Expression<Func<EM_EvaluationSetting, bool>> evaluationSettingExp)
  45. {
  46. var query = (from es in EvaluationSettingRepository.GetList(evaluationSettingExp)
  47. from ess in es.CF_Student
  48. join s in StudentRepository.GetList(studentExp) on ess.UserID equals s.UserID
  49. join ee in EvaluationEnterRepository.Entities
  50. on new { es.EducationMissionClassID, StudentUserID = (Guid?)ess.UserID }
  51. equals new { ee.EducationMissionClassID, ee.StudentUserID }
  52. into dee
  53. from eee in dee.DefaultIfEmpty()
  54. where eee.EducationMissionClassID == null && es.OpenStatus == (int)CF_YesOrNoStatus.Yes
  55. select es
  56. );
  57. return query;
  58. }
  59. }
  60. }