EvaluationAdviseServices.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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.EvaluationEnter;
  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. using Bowin.Common.JSON;
  16. using EMIS.Utility;
  17. using EMIS.DataLogic.SystemDAL;
  18. using EMIS.ViewModel.EvaluationManage;
  19. namespace EMIS.CommonLogic.EvaluationManage
  20. {
  21. public class EvaluationAdviseServices : BaseServices, IEvaluationAdviseServices
  22. {
  23. public EvaluationAdviseDAL EvaluationAdviseDAL { get; set; }
  24. public EvaluationRecordDAL EvaluationRecordDAL { get; set; }
  25. public EvaluationEnterDAL EvaluationEnterDAL { get; set; }
  26. public IGridResultSet<EvaluationAdviseView> GetEvaluationAdviseViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? departmentID, Guid? evaluationTableID, Guid? typeID, Guid? staffID, int pageIndex, int pageSize)//, Guid? collegeID, Guid? departmentID
  27. {
  28. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  29. //var query = EvaluationEnterDAL.GetEvaluationEnterQuery();
  30. var query = EvaluationAdviseDAL.GetEvaluationAdviseQuery();
  31. if (curUser.CollegeID != null)//考虑到管理员院系ID为null
  32. {
  33. query = GetQueryByDataRangeByCollege(query);//以院系 区分
  34. }
  35. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  36. {
  37. query = query.Where(w => w.SchoolyearID == schoolyearID);
  38. }
  39. if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty)
  40. {
  41. query = query.Where(w => w.EvaluationTableID == evaluationTableID);
  42. }
  43. if (typeID.HasValue && typeID != Guid.Empty)
  44. {
  45. query = query.Where(w => w.EvaluationTypeID == typeID);
  46. }
  47. if (collegeID.HasValue && collegeID != Guid.Empty)
  48. {
  49. query = query.Where(w => w.CollegeID == collegeID);
  50. }
  51. if (departmentID.HasValue && departmentID != Guid.Empty)
  52. {
  53. query = query.Where(w => w.DepartmentID == departmentID);
  54. }
  55. if (staffID.HasValue && staffID != Guid.Empty)
  56. {
  57. query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID));
  58. }
  59. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  60. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  61. query = query.OrderByDescending(w => w.SchoolyearCode);
  62. return query.ToGridResultSet<EvaluationAdviseView>(pageIndex, pageSize);
  63. //return query.ToGridResultSet<EvaluationAdviseView>(pageIndex, pageSize);
  64. }
  65. public IList<EvaluationAdviseView> GetEvaluationAdviseViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? departmentID, Guid? evaluationTableID, Guid? typeID, Guid? staffID)//, Guid? collegeID, Guid? departmentID
  66. {
  67. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  68. //var query = EvaluationEnterDAL.GetEvaluationEnterQuery();
  69. var query = EvaluationAdviseDAL.GetEvaluationAdviseQuery();
  70. if (curUser.CollegeID != null)//考虑到管理员院系ID为null
  71. {
  72. query = GetQueryByDataRangeByCollege(query);//以院系 区分
  73. }
  74. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  75. {
  76. query = query.Where(w => w.SchoolyearID == schoolyearID);
  77. }
  78. if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty)
  79. {
  80. query = query.Where(w => w.EvaluationTableID == evaluationTableID);
  81. }
  82. if (typeID.HasValue && typeID != Guid.Empty)
  83. {
  84. query = query.Where(w => w.EvaluationTypeID == typeID);
  85. }
  86. if (collegeID.HasValue && collegeID != Guid.Empty)
  87. {
  88. query = query.Where(w => w.CollegeID == collegeID);
  89. }
  90. if (departmentID.HasValue && departmentID != Guid.Empty)
  91. {
  92. query = query.Where(w => w.DepartmentID == departmentID);
  93. }
  94. if (staffID.HasValue && staffID != Guid.Empty)
  95. {
  96. query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID));
  97. }
  98. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  99. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  100. query = query.OrderByDescending(w => w.CourseCode);
  101. return query.ToList();
  102. }
  103. public IGridResultSet<EvaluationAdviseView> GetMyEvaluationViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? coursematerialID, Guid? evaluationTableID, Guid? typeID, Guid? staffID, int pageIndex, int pageSize)//, Guid? collegeID, Guid? departmentID
  104. {
  105. int paramterTypeID = (int)CF_ParameterType.EvaluationSensitiveWord;
  106. var paraquery = from a in EvaluationAdviseDAL.parameterRepository.GetList(x => x.ParameterTypeID == paramterTypeID)
  107. select new
  108. {
  109. Value = a.Value,
  110. };
  111. //List<String> valueList = new List<string>();
  112. List<String> sArray = new List<string>();
  113. //var values = paraquery.FirstOrDefault().Value;
  114. if (paraquery != null)
  115. {
  116. var values = paraquery.FirstOrDefault().Value;
  117. sArray = values.Split('|').ToList();
  118. //for (int i = 0; i < values.Split('|').Length; i++)
  119. //{
  120. // string id = values.Split('|')[i];
  121. // if (!string.IsNullOrEmpty(id))
  122. // {
  123. // valueList.Add(id);
  124. // }
  125. //}
  126. }
  127. else {
  128. sArray = null;
  129. }
  130. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  131. //var query = EvaluationEnterDAL.GetEvaluationEnterQuery();
  132. Expression<Func<EM_EducationMissionClass, bool>> emcexp = x => true;
  133. Expression<Func<EM_EducationMission, bool>> emexp = x => true;
  134. Expression<Func<EM_EvaluationEnter, bool>> eeexp = x => true;
  135. Expression<Func<EM_EvaluationTable, bool>> etexp = x => true;
  136. //var query = EvaluationEnterDAL.GetEvaluationEnterQuery();
  137. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  138. {
  139. emexp = emexp.And(x => x.SchoolyearID == schoolyearID);
  140. }
  141. if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty)
  142. {
  143. eeexp = eeexp.And(x => x.EvaluationTableID == evaluationTableID);
  144. }
  145. if (typeID.HasValue && typeID != Guid.Empty)
  146. {
  147. etexp = etexp.And(x => x.EvaluationTypeID == typeID);
  148. }
  149. if (coursematerialID.HasValue && coursematerialID != Guid.Empty)
  150. {
  151. emcexp = emcexp.And(x => x.CoursematerialID == coursematerialID);
  152. }
  153. var query = EvaluationAdviseDAL.GetMyEvaluationQuery(emcexp, emexp, eeexp, etexp);
  154. if (staffID.HasValue && staffID != Guid.Empty)
  155. {
  156. query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID));
  157. }
  158. //不知道是否需要数据范围
  159. //if (curUser.CollegeID != null)//考虑到管理员院系ID为null
  160. //{
  161. // query = GetQueryByDataRangeByCollege(query);//以院系 区分
  162. //}
  163. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  164. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  165. query = query.OrderByDescending(w => w.SchoolyearCode);
  166. //query.ToList().ForEach(x => x.Remark = (sArray != null ? (sArray.Any(y => x.Remark.Contains(y.ToString())) ? "" : x.Remark) : x.Remark));
  167. var result = query.ToGridResultSet<EvaluationAdviseView>(pageIndex, pageSize);
  168. result.rows.ForEach(x => x.Remark = (sArray != null ? (sArray.Any(y => x.Remark.Contains(y.ToString())) ? "" : x.Remark) : x.Remark));
  169. return result;
  170. //return query.ToGridResultSet<EvaluationAdviseView>(pageIndex, pageSize);
  171. }
  172. public IList<EvaluationAdviseView> GetMyEvaluationViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? coursematerialID, Guid? evaluationTableID, Guid? typeID, Guid? staffID)//, Guid? collegeID, Guid? departmentID
  173. {
  174. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  175. Expression<Func<EM_EducationMissionClass, bool>> emcexp = x => true;
  176. Expression<Func<EM_EducationMission, bool>> emexp = x => true;
  177. Expression<Func<EM_EvaluationEnter, bool>> eeexp = x => true;
  178. Expression<Func<EM_EvaluationTable, bool>> etexp = x => true;
  179. //var query = EvaluationEnterDAL.GetEvaluationEnterQuery();
  180. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  181. {
  182. emexp = emexp.And(x => x.SchoolyearID == schoolyearID);
  183. }
  184. if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty)
  185. {
  186. eeexp = eeexp.And(x => x.EvaluationTableID == evaluationTableID);
  187. }
  188. if (typeID.HasValue && typeID != Guid.Empty)
  189. {
  190. etexp = etexp.And(x => x.EvaluationTypeID == typeID);
  191. }
  192. if (coursematerialID.HasValue && coursematerialID != Guid.Empty)
  193. {
  194. emcexp = emcexp.And(x => x.CoursematerialID == coursematerialID);
  195. }
  196. var query = EvaluationAdviseDAL.GetMyEvaluationQuery(emcexp, emexp, eeexp, etexp);
  197. if (staffID.HasValue && staffID != Guid.Empty)
  198. {
  199. query = query.Where(w => w.Sys_User.Any(x => x.UserID == staffID));
  200. }
  201. //不知道是不是需要数据范围
  202. //if (curUser.CollegeID != null)//考虑到管理员院系ID为null
  203. //{
  204. // query = GetQueryByDataRangeByCollege(query);//以院系 区分
  205. //}
  206. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  207. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  208. query = query.OrderByDescending(x => x.SchoolyearCode);
  209. return query.ToList();
  210. }
  211. public void Delete(List<Guid> ids)
  212. {
  213. }
  214. }
  215. }