EvaluationAdviseDAL.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.ViewModel.EvaluationManage;
  9. using EMIS.DataLogic.SystemDAL;
  10. using EMIS.ViewModel;
  11. using Bowin.Common.Linq;
  12. using EMIS.Utility;
  13. using EMIS.DataLogic.Common.Students;
  14. namespace EMIS.DataLogic.Common.EvaluationManage
  15. {
  16. public class EvaluationAdviseDAL
  17. {
  18. public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
  19. public ParameterRepository parameterRepository { get; set; }
  20. public MissionClassTeacherRepository missionClassTeacherRepository { get; set; }
  21. public CoursematerialRepository coursematerialRepository { get; set; }
  22. public EvaluationEnterRepository evaluationEnterRepository { get; set; }
  23. public EvaluationTypeRepository evaluationTypeRepository { get; set; }
  24. public EvaluationTableRepository evaluationTableRepository { get; set; }
  25. public EducationMissionRepository educationMissionRepository { get; set; }
  26. public SchoolyearRepository schoolyearRepository { get; set; }
  27. public IQueryable<EvaluationAdviseView> GetEvaluationAdviseQuery()
  28. {
  29. var query = from a in EducationMissionClassRepository.Entities
  30. from b in a.EM_EvaluationSetting
  31. from c in a.EM_EvaluationEnter
  32. select new EvaluationAdviseView
  33. {
  34. Sys_User = a.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User),
  35. CoursematerialID = a.EM_Coursematerial.CoursematerialID,
  36. CourseName = a.EM_Coursematerial.CourseName,
  37. CourseCode = a.EM_Coursematerial.CourseCode,
  38. EducationMissionClassName = a.Name,
  39. EvaluationTypeID = c.EM_EvaluationTable.EM_EvaluationType.EvaluationTypeID,
  40. EvaluationTypeName = c.EM_EvaluationTable.EM_EvaluationType.Name,
  41. SchoolyearCode = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.Code,
  42. SchoolyearID = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID,
  43. EvaluationTableID = c.EvaluationTableID,
  44. EvaluationTableName = c.EM_EvaluationTable.Name,
  45. CollegeID = c.EM_EducationMissionClass.EM_EducationMission.CF_College.CollegeID,
  46. DepartmentID = c.EM_EducationMissionClass.EM_EducationMission.CF_Department.DepartmentID,
  47. Remark = c.Remark
  48. };
  49. return query;
  50. }
  51. public IQueryable<EvaluationAdviseView> GetMyEvaluationQuery(Expression<Func<EM_EducationMissionClass, bool>> emcexp, Expression<Func<EM_EducationMission, bool>> emexp,
  52. Expression<Func<EM_EvaluationEnter, bool>> eeexp, Expression<Func<EM_EvaluationTable, bool>> etexp)
  53. {
  54. //int paramterTypeID = (int)CF_ParameterType.SensitiveWords;
  55. //var paraquery = from a in parameterRepository.GetList(x => x.ParameterTypeID == paramterTypeID)
  56. // select new
  57. // {
  58. // Value = a.Value,
  59. // };
  60. ////List<String> valueList = new List<string>();
  61. //List<String> sArray = new List<string>();
  62. ////var values = paraquery.FirstOrDefault().Value;
  63. //if (paraquery != null)
  64. //{
  65. // var values = paraquery.FirstOrDefault().Value;
  66. // sArray = values.Split('|').ToList();
  67. //}
  68. //else
  69. //{
  70. // sArray = null;
  71. //}
  72. var query = from emcr in EducationMissionClassRepository.GetList(emcexp)
  73. join emr in educationMissionRepository.GetList(emexp)
  74. on emcr.EducationMissionID equals emr.EducationMissionID
  75. join sr in schoolyearRepository.Entities
  76. on emr.SchoolyearID equals sr.SchoolyearID
  77. join cmr in coursematerialRepository.Entities
  78. on emcr.CoursematerialID equals cmr.CoursematerialID
  79. join eer in evaluationEnterRepository.GetList(eeexp)
  80. on emcr.EducationMissionClassID equals eer.EducationMissionClassID
  81. join table in evaluationTableRepository.GetList(etexp)
  82. on eer.EvaluationTableID equals table.EvaluationTableID
  83. join etr in evaluationTypeRepository.Entities
  84. on table.EvaluationTypeID equals etr.EvaluationTypeID
  85. select new EvaluationAdviseView
  86. {
  87. Sys_User = emcr.EM_MissionClassTeacher.Select(x => x.CF_Staff.Sys_User),
  88. CoursematerialID = cmr.CoursematerialID,
  89. CourseName = cmr.CourseName,
  90. CourseCode = cmr.CourseCode,
  91. EducationMissionClassName = emcr.Name,
  92. EvaluationTypeID = etr.EvaluationTypeID,
  93. EvaluationTypeName = etr.Name,
  94. SchoolyearCode = sr.Code,
  95. SchoolyearID = sr.SchoolyearID,
  96. EvaluationTableID = table.EvaluationTableID,
  97. EvaluationTableName = table.Name,
  98. Remark = eer.Remark,
  99. };
  100. //var query = from a in EducationMissionClassRepository.Entities
  101. // from b in a.EM_EvaluationSetting
  102. // from c in a.EM_EvaluationEnter
  103. // select new EvaluationAdviseView
  104. // {
  105. // Sys_User = a.EM_MissionClassTeacher.Select(s => s.CF_Staff.Sys_User),
  106. // CoursematerialID = a.EM_Coursematerial.CoursematerialID,
  107. // CourseName = a.EM_Coursematerial.CourseName,
  108. // CourseCode = a.EM_Coursematerial.CourseCode,
  109. // EducationMissionClassName = a.Name,
  110. // EvaluationTypeID = c.EM_EvaluationTable.EM_EvaluationType.TypeID,
  111. // EvaluationTypeName = c.EM_EvaluationTable.EM_EvaluationType.Name,
  112. // SchoolyearCode = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.Code,
  113. // SchoolyearID = c.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID,
  114. // EvaluationTableID = c.EvaluationTableID,
  115. // EvaluationTableName = c.EM_EvaluationTable.Name,
  116. // CollegeID = c.EM_EducationMissionClass.EM_EducationMission.CF_College.CollegeID,
  117. // DepartmentID = c.EM_EducationMissionClass.EM_EducationMission.CF_Department.DepartmentID,
  118. // Remark = valueList.Any(y => c.Remark.Contains(y.ToString())) ? "" : c.Remark,
  119. // };
  120. return query;
  121. }
  122. }
  123. }