EvaluationRecordServices.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Common.EvaluationManage;
  6. using Bowin.Common.Linq.Entity;
  7. using EMIS.ViewModel.EvaluationManage;
  8. using EMIS.ViewModel;
  9. using System.Linq.Expressions;
  10. using EMIS.Entities;
  11. using Bowin.Common.Linq;
  12. using Bowin.Common.Utility;
  13. using Bowin.Common.Mapping;
  14. using EMIS.CommonLogic.SystemServices;
  15. namespace EMIS.CommonLogic.EvaluationManage
  16. {
  17. public class EvaluationRecordServices : BaseServices, IEvaluationRecordServices
  18. {
  19. public EvaluationRecordDAL EvaluationRecordDAL { get; set; }
  20. public IGridResultSet<EvaluationRecordView> GetEvaluationRecordViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? standardID, Guid? classmajorID, int? schoolyearCodeID, Guid? schoolyearID, Guid? evaluationTableID, Guid? typeID, int? learningformID, int? education, string LearnSystem, Guid? staffID, int pageIndex, int pageSize)
  21. {
  22. Expression<Func<EM_EvaluationSetting, bool>> filter = x => true;
  23. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  24. var query = EvaluationRecordDAL.GetEvaluationRecordQuery();
  25. if (curUser.CollegeID != null)//考虑到管理员院系ID为null
  26. {
  27. query = GetQueryByDataRangeByCollege(query);//以院系 区分
  28. }
  29. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  30. {
  31. query = query.Where(w => w.SchoolyearID == schoolyearID);
  32. }
  33. if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty)
  34. {
  35. query = query.Where(w => w.EvaluationTableID == evaluationTableID);
  36. }
  37. if (typeID.HasValue && typeID != Guid.Empty)
  38. {
  39. query = query.Where(w => w.EvaluationTableTypeID == typeID);
  40. }
  41. if (staffID.HasValue && staffID != Guid.Empty)
  42. {
  43. query = query.Where(w => w.Sys_User.Any(x => x.UserID == (Guid)staffID));
  44. }
  45. if (campusID.HasValue)
  46. {
  47. query = query.Where(x => x.CampusID == campusID);
  48. }
  49. if (standardID.HasValue)
  50. {
  51. query = query.Where(x => x.StandardID == standardID);
  52. }
  53. if (collegeID.HasValue)
  54. {
  55. query = query.Where(x => x.CollegeID == collegeID);
  56. }
  57. if (classmajorID.HasValue)
  58. {
  59. query = query.Where(x => x.EducationMissionClassID == classmajorID);
  60. }
  61. if (schoolyearCodeID.HasValue && schoolyearCodeID > 0)
  62. {
  63. query = query.Where(x => x.Grade == schoolyearCodeID);
  64. }
  65. if (learningformID.HasValue)
  66. query = query.Where(x => x.LearningformID == learningformID);
  67. if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
  68. {
  69. var LearnSystems = Convert.ToDecimal(LearnSystem);
  70. query = query.Where(x => x.LearnSystem == LearnSystems);
  71. }
  72. if (education.HasValue)
  73. {
  74. query = query.Where(x => x.EducationID == education.Value);
  75. }
  76. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  77. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  78. query = query.OrderByDescending(o => o.SchoolyearCode);
  79. return query.ToGridResultSet<EvaluationRecordView>(pageIndex, pageSize);
  80. }
  81. public IList<EvaluationRecordView> GetEvaluationRecordViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? evaluationTableID, Guid? typeID, int? learningformID, int? education, string LearnSystem)
  82. {
  83. Expression<Func<EM_EvaluationSetting, bool>> filter = x => true;
  84. var query = EvaluationRecordDAL.GetEvaluationRecordQuery();
  85. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  86. {
  87. query = query.Where(w => w.SchoolyearID == schoolyearID);
  88. }
  89. if (collegeID.HasValue)
  90. {
  91. query = query.Where(x => x.CollegeID == collegeID);
  92. }
  93. if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty)
  94. {
  95. query = query.Where(w => w.EvaluationTableID == evaluationTableID);
  96. }
  97. if (typeID.HasValue && typeID != Guid.Empty)
  98. {
  99. query = query.Where(w => w.EvaluationTableTypeID == typeID);
  100. }
  101. if (learningformID.HasValue)
  102. query = query.Where(x => x.LearningformID == learningformID);
  103. if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
  104. {
  105. var LearnSystems = Convert.ToDecimal(LearnSystem);
  106. query = query.Where(x => x.LearnSystem == LearnSystems);
  107. }
  108. if (education.HasValue)
  109. {
  110. query = query.Where(x => x.EducationID == education.Value);
  111. }
  112. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  113. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  114. query = query.OrderByDescending(o => o.SchoolyearCode);
  115. return query.ToList();
  116. }
  117. public void Delete(List<Guid> ids)
  118. {
  119. try
  120. {
  121. //var evaluationEnterList = EvaluationRecordDAL.EvaluationEnterRepository.GetList(x => ids.Contains(x.EvaluationEnterID));
  122. //evaluationEnterList.ForEach(x => { x.Remark = ""; }); //清除之前操作记录
  123. //UnitOfWork.Commit();//提交操作!
  124. UnitOfWork.Delete<EM_EvaluationEnter_EM_EvaluationProject>(w => ids.Contains(w.EvaluationEnterID));
  125. UnitOfWork.Delete<EM_EvaluationEnter>(w => ids.Contains(w.EvaluationEnterID));
  126. }
  127. catch (Exception ex)
  128. {
  129. throw;
  130. }
  131. }
  132. //根据评价表名、选中参评类型
  133. public List<EvaluationTypeView> GetEvaluationTypeByTableIDList(Guid? evaluationTableID)
  134. {
  135. var evaluationEnterList = EvaluationRecordDAL.GetEvaluationTypeQueryable(x => true);
  136. if (evaluationTableID != null)
  137. {
  138. evaluationEnterList = EvaluationRecordDAL.GetEvaluationTypeQueryable(x => x.EvaluationTableID == evaluationTableID);
  139. }
  140. return evaluationEnterList.Distinct().ToList();
  141. }
  142. }
  143. }