ExaminationSubjectServices.cs 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using Bowin.Common.Linq;
  6. using Bowin.Common.Linq.Entity;
  7. using EMIS.Entities;
  8. using EMIS.ViewModel;
  9. using EMIS.DataLogic.ExaminationApply;
  10. using EMIS.ViewModel.ExaminationApply;
  11. using EMIS.ViewModel.Students;
  12. using EMIS.DataLogic.Common.Students;
  13. using Spire.Barcode;
  14. using System.Drawing;
  15. using EMIS.Utility;
  16. using System.Web;
  17. using System.IO;
  18. using System.Text;
  19. using Bowin.Common.Utility;
  20. using System.Web.Mvc;
  21. using EMIS.DataLogic.ExamManage;
  22. using System.Data;
  23. using EMIS.ViewModel.SystemView;
  24. using EMIS.CommonLogic.SystemServices;
  25. namespace EMIS.CommonLogic.ExaminationApply
  26. {
  27. public class ExaminationSubjectServices : BaseServices, IExaminationSubjectServices
  28. {
  29. public ExaminationSubjectDAL ExaminationSubjectDAL { get; set; }
  30. public StudentsDAL studentsDAL { get; set; }
  31. public ProjectFeeDAL ProjectFeeDAL { get; set; }
  32. public ExaminationBatchDAL ExaminationBatchDAL { get; set; }
  33. public Lazy<ISerialNumberServices> SerialNumberServices { get; set; }
  34. public IGridResultSet<StudentListView> GetStudentListViewGrid(ConfiguretView examinationSubjectView, Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID,
  35. Guid? examinationProjectID, int? campusID, Guid? collegeID, int? year, Guid? classmajorID, int? recordStatus, int? isConfirm, int pageIndex, int pageSize)
  36. {
  37. Expression<Func<EX_ExaminationRegistration, bool>> erexp = x => true;
  38. Expression<Func<EX_ExaminationProject, bool>> epexp = x => true;
  39. Expression<Func<EX_ExaminationBatchProject, bool>> ebpexp = x => true;
  40. Expression<Func<CF_Student, bool>> stuexp = x => true;
  41. if (schoolYearID.HasValue)
  42. {
  43. ebpexp = ebpexp.And(x => x.EX_ExaminationBatch.SchoolyearID == schoolYearID);
  44. }
  45. if (examinationBatchID.HasValue)
  46. {
  47. ebpexp = ebpexp.And(x => x.ExaminationBatchID == examinationBatchID);
  48. }
  49. if (examinationTypeID.HasValue)
  50. {
  51. epexp = epexp.And(x => x.ExaminationTypeID == examinationTypeID);
  52. }
  53. if (examinationProjectID.HasValue)
  54. {
  55. epexp = epexp.And(x => x.ExaminationProjectID == examinationProjectID);
  56. }
  57. if (campusID.HasValue)
  58. {
  59. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolAreaID == campusID);
  60. }
  61. if (collegeID.HasValue)
  62. {
  63. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
  64. }
  65. if (year.HasValue)
  66. {
  67. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolyearID == year);
  68. }
  69. if (classmajorID.HasValue)
  70. {
  71. stuexp = stuexp.And(x => x.ClassmajorID == classmajorID);
  72. }
  73. if (recordStatus.HasValue)
  74. {
  75. erexp = erexp.And(x => x.RecordStatus == recordStatus);
  76. }
  77. var q = ExaminationSubjectDAL.GetStudentListView(erexp, epexp, ebpexp, stuexp);
  78. if (isConfirm.HasValue)
  79. {
  80. q = q.Where(x => isConfirm == 1 ? (x.ExaminationRegistrationConfirmID != null) : (x.ExaminationRegistrationConfirmID == null));
  81. }
  82. if (!string.IsNullOrEmpty(examinationSubjectView.ConditionValue) && !string.IsNullOrEmpty(examinationSubjectView.Attribute))
  83. q = q.DynamicWhere(examinationSubjectView.Attribute, examinationSubjectView.Condition, examinationSubjectView.ConditionValue);
  84. return q.OrderBy(x => x.ExaminationTypeName).ThenBy(x => x.ExaminationProjectName).ThenBy(x => x.FeeTypeID).ThenBy(x => x.UserName).ToGridResultSet<StudentListView>(pageIndex, pageSize);
  85. }
  86. public IGridResultSet<StudentListView> GetMyexamListView(ConfiguretView examinationSubjectView,Guid UserID, int pageIndex, int pageSize)
  87. {
  88. Expression<Func<EX_ExaminationRegistration, bool>> erexp = x => true;
  89. Expression<Func<EX_ExaminationProject, bool>> epexp = x => true;
  90. Expression<Func<EX_ExaminationBatchProject, bool>> ebpexp = x => true;
  91. Expression<Func<CF_Student, bool>> stuexp = x => true;
  92. erexp = erexp.And(x => x.UserID == UserID);
  93. var q = ExaminationSubjectDAL.GetStudentListView(erexp, epexp, ebpexp, stuexp);
  94. if (!string.IsNullOrEmpty(examinationSubjectView.ConditionValue) && !string.IsNullOrEmpty(examinationSubjectView.Attribute))
  95. q = q.DynamicWhere(examinationSubjectView.Attribute, examinationSubjectView.Condition, examinationSubjectView.ConditionValue);
  96. return q.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.ExaminationProjectName).ThenBy(x => x.ExaminationTypeName).ThenBy(x => x.FeeTypeID).
  97. ThenBy(x => x.ClassmajorName).ThenByDescending(x => x.StudentNo).ToGridResultSet<StudentListView>(pageIndex, pageSize);
  98. }
  99. public List<StudentListView> GetStudentListViewForExport(ConfiguretView examinationSubjectView, Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID,
  100. Guid? examinationProjectID, int? campusID, Guid? collegeID, int? year, Guid? classmajorID, int? recordStatus, int? isConfirm, List<Guid?> idList)
  101. {
  102. Expression<Func<EX_ExaminationRegistration, bool>> erexp = x => true;
  103. Expression<Func<EX_ExaminationProject, bool>> epexp = x => true;
  104. Expression<Func<EX_ExaminationBatchProject, bool>> ebpexp = x => true;
  105. Expression<Func<CF_Student, bool>> stuexp = x => true;
  106. if (schoolYearID.HasValue)
  107. {
  108. ebpexp = ebpexp.And(x => x.EX_ExaminationBatch.SchoolyearID == schoolYearID);
  109. }
  110. if (examinationBatchID.HasValue)
  111. {
  112. ebpexp = ebpexp.And(x => x.ExaminationBatchID == examinationBatchID);
  113. }
  114. if (examinationTypeID.HasValue)
  115. {
  116. epexp = epexp.And(x => x.ExaminationTypeID == examinationTypeID);
  117. }
  118. if (examinationProjectID.HasValue)
  119. {
  120. epexp = epexp.And(x => x.ExaminationProjectID == examinationProjectID);
  121. }
  122. if (campusID.HasValue)
  123. {
  124. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolAreaID == campusID);
  125. }
  126. if (collegeID.HasValue)
  127. {
  128. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
  129. }
  130. if (year.HasValue)
  131. {
  132. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolyearID == year);
  133. }
  134. if (classmajorID.HasValue)
  135. {
  136. stuexp = stuexp.And(x => x.ClassmajorID == classmajorID);
  137. }
  138. if (recordStatus.HasValue)
  139. {
  140. erexp = erexp.And(x => x.RecordStatus == recordStatus);
  141. }
  142. if (idList.Count > 0)
  143. {
  144. erexp = erexp.And(x => idList.Contains(x.ExaminationRegistrationID));
  145. }
  146. var q = ExaminationSubjectDAL.GetStudentListView(erexp, epexp, ebpexp, stuexp);
  147. if (isConfirm.HasValue)
  148. {
  149. q = q.Where(x => isConfirm == 1 ? (x.ExaminationRegistrationConfirmID != null) : (x.ExaminationRegistrationConfirmID == null));
  150. }
  151. if (!string.IsNullOrEmpty(examinationSubjectView.ConditionValue) && !string.IsNullOrEmpty(examinationSubjectView.Attribute))
  152. q = q.DynamicWhere(examinationSubjectView.Attribute, examinationSubjectView.Condition, examinationSubjectView.ConditionValue);
  153. return q.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.ExaminationProjectName).ThenBy(x => x.ExaminationTypeName).ThenBy(x => x.FeeTypeID).
  154. ThenBy(x => x.ClassmajorName).ThenByDescending(x => x.StudentNo).ToList();
  155. }
  156. public StudentListView GetStudentListView(Guid? examinationRegistrationID)
  157. {
  158. try
  159. {
  160. var studentListView = ExaminationSubjectDAL.GetStudentListView(x => x.ExaminationRegistrationID == examinationRegistrationID, x => true, x => true, x => true)
  161. .SingleOrDefault();
  162. return studentListView;
  163. }
  164. catch (Exception ex)
  165. {
  166. throw new Exception(ex.Message);
  167. }
  168. }
  169. public void AddSave(StudentListView studentListView, List<StudentsView> studentsViewList)
  170. {
  171. try
  172. {
  173. var ExaminationProjectFeeType = ExaminationSubjectDAL.examinationProjectFeeTypeRepository.GetSingle(x => x.ExaminationProjectFeeID == studentListView.ExaminationProjectFeeID && x.FeeTypeID == studentListView.FeeTypeID);
  174. if (ExaminationProjectFeeType == null)
  175. {
  176. throw new Exception("找不到收费标准对应的收费项,请先设置。");
  177. }
  178. List<EX_ExaminationRegistration> RegistrationList = new List<EX_ExaminationRegistration>();
  179. var ExaminationBatchProject = ExaminationSubjectDAL.examinationBatchProjectRepository.GetList(x => x.ExaminationProjectID == studentListView.ExaminationProjectID && x.ExaminationBatchID == studentListView.ExaminationBatchID).FirstOrDefault();
  180. var userIDList = studentsViewList.Select(x => x.UserID).ToList();
  181. var dbstudentRegistration = ExaminationSubjectDAL.examinationRegistrationRepository.GetList(x => x.ExaminationProjectFeeTypeID == ExaminationProjectFeeType.ExaminationProjectFeeTypeID && x.ExaminationBatchProjectID == ExaminationBatchProject.ExaminationBatchProjectID && userIDList.Contains(x.UserID.Value) && x.RecordStatus != (int)EX_ExaminationRegistrationStatus.Refunded).FirstOrDefault();
  182. if (dbstudentRegistration != null)
  183. {
  184. throw new Exception("添加的学生中有已报名的学生。");
  185. }
  186. foreach (var student in studentsViewList)
  187. {
  188. EX_ExaminationRegistration examinationRegistration = new EX_ExaminationRegistration();
  189. examinationRegistration.ExaminationBatchProjectID = ExaminationBatchProject.ExaminationBatchProjectID;
  190. examinationRegistration.ExaminationProjectFeeTypeID = ExaminationProjectFeeType.ExaminationProjectFeeTypeID;
  191. examinationRegistration.ExaminationRegistrationConfirmID = studentListView.ExaminationRegistrationConfirmID;
  192. //examinationRegistration.SchoolyearID = studentListView.SchoolyearID;
  193. examinationRegistration.Fee = ExaminationProjectFeeType.Fee;
  194. examinationRegistration.Remark = studentListView.Remark;
  195. examinationRegistration.ExaminationRegistrationID = Guid.NewGuid();
  196. examinationRegistration.UserID = student.UserID;
  197. this.SetNewStatus(examinationRegistration);
  198. RegistrationList.Add(examinationRegistration);
  199. }
  200. UnitOfWork.BulkInsert(RegistrationList);
  201. }
  202. catch (Exception)
  203. {
  204. throw;
  205. }
  206. }
  207. public void EditSave(StudentListView studentListView)
  208. {
  209. var ExaminationProjectFeeType = ExaminationSubjectDAL.examinationProjectFeeTypeRepository.GetSingle(x => x.ExaminationProjectFeeID == studentListView.ExaminationProjectFeeID && x.FeeTypeID == studentListView.FeeTypeID);
  210. if (ExaminationProjectFeeType == null)
  211. {
  212. throw new Exception("找不到收费标准对应的收费项,请先设置。");
  213. }
  214. var dbstudentRegistration = ExaminationSubjectDAL.examinationRegistrationRepository.GetSingle(x => x.ExaminationRegistrationID == studentListView.ExaminationRegistrationID);
  215. if (dbstudentRegistration == null)
  216. {
  217. throw new Exception("该报名信息不存在。");
  218. }
  219. else {
  220. dbstudentRegistration.ExaminationProjectFeeTypeID = ExaminationProjectFeeType.ExaminationProjectFeeTypeID;
  221. dbstudentRegistration.Fee = ExaminationProjectFeeType.Fee;
  222. dbstudentRegistration.Remark = studentListView.Remark;
  223. }
  224. UnitOfWork.Commit();
  225. }
  226. public IGridResultSet<StudentListView> GetStudentViewList(ConfiguretView examinationSubjectView, Guid? examinationRegistrationID, int pageIndex, int pageSize)
  227. {
  228. Expression<Func<CF_Student, bool>> filter = x => true;
  229. var inSchoolStatusIDList = studentsDAL.InSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();
  230. filter = filter.And(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID));
  231. var query = ExaminationSubjectDAL.GetStudentListView(x => x.ExaminationRegistrationID == examinationRegistrationID, x => true, x => true, x => true);
  232. return query.OrderByDescending(x => x.StudentNo).ToGridResultSet<StudentListView>(pageIndex, pageSize);
  233. }
  234. public IGridResultSet<BaseStudentView> GetStudentListForSelect(ConfiguretView configuretView, Guid? examinationRegistrationID, Guid? examinationBatchID, Guid? examinationProjectID, int? campusID, Guid? collegeID, Guid? grademajorID, int? year, int? standardID, Guid? classmajorID, int pageIndex, int pageSize)
  235. {
  236. var examinationBatchProject = ExaminationSubjectDAL.examinationBatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == examinationBatchID && x.ExaminationProjectID == examinationProjectID).FirstOrDefault();
  237. List<Guid?> studentUserIDList = new List<Guid?>();
  238. if (examinationBatchProject != null)
  239. {
  240. var dbStudentList = ExaminationSubjectDAL.examinationRegistrationRepository.Entities.Where(x => x.ExaminationBatchProjectID == examinationBatchProject.ExaminationBatchProjectID && x.RecordStatus != (int)EX_ExaminationRegistrationStatus.Refunded).ToList();
  241. studentUserIDList = dbStudentList.Select(x => x.UserID).ToList();
  242. }
  243. Expression<Func<CF_Student, bool>> exp = x => true;
  244. if (campusID.HasValue)
  245. {
  246. exp = exp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolAreaID == campusID);
  247. }
  248. if (collegeID.HasValue)
  249. {
  250. exp = exp.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
  251. }
  252. if (grademajorID.HasValue)
  253. {
  254. exp = exp.And(x => x.CF_Classmajor.GrademajorID == grademajorID);
  255. }
  256. if(year.HasValue)
  257. {
  258. exp = exp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolyearID == year);
  259. }
  260. if (standardID.HasValue)
  261. {
  262. exp = exp.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
  263. }
  264. if (classmajorID.HasValue)
  265. {
  266. exp = exp.And(x => x.ClassmajorID == classmajorID);
  267. }
  268. //if (studentUserIDList.Count > 0)
  269. //{
  270. // exp = exp.And(x => !studentUserIDList.Contains(x.UserID));
  271. //}
  272. var query = studentsDAL.GetInSchoolStudentViewQueryable(exp);
  273. if (!string.IsNullOrEmpty(configuretView.ConditionValue) && !string.IsNullOrEmpty(configuretView.Attribute))
  274. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  275. var result = query.ToList();
  276. if (studentUserIDList.Count > 0)
  277. {
  278. result = query.ToList().Where(x => !studentUserIDList.Contains(x.UserID)).ToList();
  279. }
  280. return result.AsQueryable<BaseStudentView>().OrderBy(x => x.CollegeName).ThenByDescending(x => x.Years).ThenBy(x => x.ClassmajorName).ThenBy(x => x.UserName).ToGridResultSet<BaseStudentView>(pageIndex, pageSize);
  281. //return null;
  282. }
  283. public void Delete(List<Guid> examinationRegistrationIDLsit)
  284. {
  285. try
  286. {
  287. var dbExaminationRegistrationList = ExaminationSubjectDAL.GetStudentListView(x => examinationRegistrationIDLsit.Contains(x.ExaminationRegistrationID), x => true, x => true, x => true).ToList();
  288. if (dbExaminationRegistrationList.Any(x => x.RecordStatus > (int)EX_ExaminationRegistrationStatus.ForPay))
  289. {
  290. throw new Exception("不是“待缴费”状态的数据不能删除");
  291. }
  292. if (dbExaminationRegistrationList.Any(x => x.ExaminationRegistrationConfirmID != null))
  293. {
  294. throw new Exception("已确认的数据不能删除");
  295. }
  296. UnitOfWork.Delete<EX_ExaminationRegistration>(x => examinationRegistrationIDLsit.Contains(x.ExaminationRegistrationID));
  297. }
  298. catch (Exception ex)
  299. {
  300. throw ex;
  301. }
  302. }
  303. public void ChangeFee(List<Guid> examinationRegistrationIDLsit, decimal? Fee, string Remark)
  304. {
  305. try
  306. {
  307. var examinationRegistrationList = ExaminationSubjectDAL.examinationRegistrationRepository.GetList(x => examinationRegistrationIDLsit.Contains(x.ExaminationRegistrationID)).ToList();
  308. examinationRegistrationList.ForEach(x =>
  309. {
  310. if (x.RecordStatus != (int)EX_ExaminationRegistrationStatus.ForPay)
  311. {
  312. throw new Exception("只有待缴费的数据才能调整费用");
  313. }
  314. });
  315. examinationRegistrationList.ForEach(x => {
  316. x.Fee = Fee;
  317. x.Remark = Remark;
  318. });
  319. UnitOfWork.BatchUpdate(examinationRegistrationList);
  320. }
  321. catch (Exception)
  322. {
  323. throw;
  324. }
  325. }
  326. public Guid? Confirm(List<Guid> examinationRegistrationIDLsit, string filePathUrl)
  327. {
  328. try
  329. {
  330. var dbExaminationRegistrationList = ExaminationSubjectDAL.GetStudentListView(x => examinationRegistrationIDLsit.Contains(x.ExaminationRegistrationID), x => true, x => true, x => true).ToList();
  331. if (dbExaminationRegistrationList.Any(x => x.RecordStatus != (int)EX_ExaminationRegistrationStatus.ForPay))
  332. {
  333. throw new Exception("只能选择待缴费状态的数据进行打包");
  334. }
  335. if (dbExaminationRegistrationList.Any(x => x.ExaminationRegistrationConfirmID != null))
  336. {
  337. throw new Exception("选择的数据存在已确认数据,如需要重新打包请先取消打包");
  338. }
  339. //var confirmNo = DateTime.Now.ToString("yyyyMMdd");
  340. //var dbRegistrationList = ExaminationSubjectDAL.examinationRegistrationRepository.GetList(x => x.ExaminationRegistrationConfirmID != null).ToList();
  341. //var confirmIDList = dbRegistrationList.Select(x => x.ExaminationRegistrationConfirmID).ToList();
  342. //var dbConfirmList = ExaminationSubjectDAL.examinationRegistrationConfirmRepository.GetList(x => confirmIDList.Contains(x.ExaminationRegistrationConfirmID));
  343. //var todayNoList = dbConfirmList.Where(x => x.No.Contains(confirmNo)).Select(x => x.No).ToList();
  344. //var maxNo = 0;
  345. //if (todayNoList.Count > 0)
  346. //{
  347. // foreach (var noStr in todayNoList)
  348. // {
  349. // var no = int.Parse(noStr.Substring(noStr.Length - 4, 4));
  350. // if (no > maxNo)
  351. // {
  352. // maxNo = no;
  353. // }
  354. // }
  355. //}
  356. //maxNo = maxNo + 1;
  357. //confirmNo = confirmNo + maxNo.ToString("0000");
  358. var confirmNo = SerialNumberServices.Value.SetDialySN(Const.EX_REGISTCONFIRM_NO_PREFIX, 4)
  359. .Replace(Const.EX_REGISTCONFIRM_NO_PREFIX, DateTime.Today.ToString("yyyyMMdd"));
  360. //string filePath = Const.LOCAL_SETTING_UPLOAD_FILEPATH;
  361. //string physicalPath = HttpContext.Current.Server.MapPath(filePath);
  362. EX_ExaminationRegistrationConfirm confirm = new EX_ExaminationRegistrationConfirm();
  363. confirm.ExaminationRegistrationConfirmID = Guid.NewGuid();
  364. confirm.No = confirmNo;
  365. confirm.BarcodeUrl = GenerateBarCodeByConfirm(confirmNo, filePathUrl);
  366. SetNewStatus(confirm);
  367. var examinationRegistrationList = ExaminationSubjectDAL.examinationRegistrationRepository.GetList(x => examinationRegistrationIDLsit.Contains(x.ExaminationRegistrationID)).ToList();
  368. examinationRegistrationList.ForEach(x =>
  369. {
  370. x.ExaminationRegistrationConfirmID = confirm.ExaminationRegistrationConfirmID;
  371. });
  372. UnitOfWork.Add(confirm);
  373. UnitOfWork.Commit();
  374. UnitOfWork.BatchUpdate(examinationRegistrationList);
  375. return confirm.ExaminationRegistrationConfirmID;
  376. }
  377. catch (Exception)
  378. {
  379. throw;
  380. }
  381. }
  382. public void CancelConfirm(List<Guid> examinationRegistrationIDLsit)
  383. {
  384. try
  385. {
  386. var registrationList = ExaminationSubjectDAL.examinationRegistrationRepository.GetList(x => examinationRegistrationIDLsit.Contains(x.ExaminationRegistrationID)).ToList();
  387. if (registrationList.Where(x => x.RecordStatus == (int)EX_ExaminationRegistrationStatus.Paid || x.RecordStatus == (int)EX_ExaminationRegistrationStatus.Refunding).Count() > 0)
  388. {
  389. throw new Exception("选中的数据有已缴费状态的,无法取消确认");
  390. }
  391. var confirmIDList = registrationList.Select(x => x.ExaminationRegistrationConfirmID).ToList();
  392. var cancelRegistrationList = ExaminationSubjectDAL.examinationRegistrationRepository.GetList(x => confirmIDList.Contains(x.ExaminationRegistrationConfirmID)).ToList();
  393. cancelRegistrationList.ForEach(x => x.ExaminationRegistrationConfirmID = null);
  394. UnitOfWork.BatchUpdate(cancelRegistrationList);
  395. UnitOfWork.Delete<EX_ExaminationRegistrationConfirm>(x => confirmIDList.Contains(x.ExaminationRegistrationConfirmID));
  396. }
  397. catch (Exception)
  398. {
  399. throw;
  400. }
  401. }
  402. public IList<StudentsView> GetStudentViewListByIDList(IList<Guid?> registrationIDList)
  403. {
  404. return ExaminationSubjectDAL.GetStudentQueryableByRegistration(x => registrationIDList.Contains(x.ExaminationRegistrationID)).ToList();
  405. }
  406. public IList<StudentsView> GetStudentListByCondition(ConfiguretView configuretView,
  407. Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID,
  408. Guid? examinationProjectID, int? campusID, Guid? collegeID, int? year, Guid? classmajorID, int? recordStatus, int? isConfirm)
  409. {
  410. Expression<Func<EX_ExaminationRegistration, bool>> erexp = x => true;
  411. Expression<Func<EX_ExaminationProject, bool>> epexp = x => true;
  412. Expression<Func<EX_ExaminationBatchProject, bool>> ebpexp = x => true;
  413. Expression<Func<CF_Student, bool>> stuexp = x => true;
  414. if (schoolYearID.HasValue)
  415. {
  416. ebpexp = ebpexp.And(x => x.EX_ExaminationBatch.SchoolyearID == schoolYearID);
  417. }
  418. if (examinationBatchID.HasValue)
  419. {
  420. ebpexp = ebpexp.And(x => x.ExaminationBatchID == examinationBatchID);
  421. }
  422. if (examinationTypeID.HasValue)
  423. {
  424. epexp = epexp.And(x => x.ExaminationTypeID == examinationTypeID);
  425. }
  426. if (examinationProjectID.HasValue)
  427. {
  428. epexp = epexp.And(x => x.ExaminationProjectID == examinationProjectID);
  429. }
  430. if (campusID.HasValue)
  431. {
  432. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolAreaID == campusID);
  433. }
  434. if (collegeID.HasValue)
  435. {
  436. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
  437. }
  438. if (year.HasValue)
  439. {
  440. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolyearID == year);
  441. }
  442. if (classmajorID.HasValue)
  443. {
  444. stuexp = stuexp.And(x => x.ClassmajorID == classmajorID);
  445. }
  446. if (recordStatus.HasValue)
  447. {
  448. erexp = erexp.And(x => x.RecordStatus == recordStatus);
  449. }
  450. var q = ExaminationSubjectDAL.GetStudentListView(erexp, epexp, ebpexp, stuexp);
  451. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  452. q = q.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  453. var idList = q.Select(x => x.ExaminationRegistrationID).ToList();
  454. return ExaminationSubjectDAL.GetStudentQueryableByRegistration(x => idList.Contains(x.ExaminationRegistrationID)).ToList();
  455. }
  456. public string GenerateBarCodeByConfirm(string confirmNo, string filePathUrl) {
  457. BarcodeSettings bs = new BarcodeSettings()
  458. {
  459. Data = confirmNo,
  460. ShowCheckSumChar = false,
  461. TopTextColor = Color.Red,
  462. ShowTopText = false,
  463. ShowTextOnBottom = true
  464. };
  465. BarcodeSettings.ApplyKey("JY1YX-2SPIQ-9H8DV-H2IPO-3RPI2");
  466. //Generate the barcode based on the this.barCodeControl1
  467. BarCodeGenerator generator = new BarCodeGenerator(bs);
  468. Image barcode = generator.GenerateImage();
  469. string filePath = Const.LOCAL_SETTING_UPLOAD_FILEPATH.EndsWith("\\") ? Const.LOCAL_SETTING_UPLOAD_FILEPATH : Const.LOCAL_SETTING_UPLOAD_FILEPATH + "\\";
  470. filePath = filePath + Const.LOCAL_SETTING_BARCODEPATH + "\\";
  471. string physicalPath = HttpContext.Current.Server.MapPath(filePath);
  472. if (!Directory.Exists(physicalPath))
  473. {
  474. Directory.CreateDirectory(physicalPath);
  475. }
  476. string url = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority;
  477. string savePath = url + filePathUrl + "/" + Const.LOCAL_SETTING_BARCODEPATH + "/" + confirmNo + ".png";
  478. string tagetPhysicalPath = (physicalPath.EndsWith("\\") ? physicalPath : physicalPath + "\\") + confirmNo + ".png";
  479. //save the barcode as an image
  480. barcode.Save(@tagetPhysicalPath);
  481. return savePath;
  482. }
  483. public ExcelImportResult StudentImport(Dictionary<string, string> cellheader, out int OkCount, out List<StudentListView> errdataList, out int ErrCount, string sourcePhysicalPath,
  484. Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID, Guid? examinationProjectID, Guid? examinationProjectFeeID, int? feeTypeID)
  485. {
  486. //获取要报考的批次项目和项目收费标准对应收费项
  487. var examinationBatchProject = ExaminationSubjectDAL.examinationBatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == examinationBatchID && x.ExaminationProjectID == examinationProjectID).FirstOrDefault();
  488. //var examinationProjectFeeType = ExaminationSubjectDAL.examinationProjectFeeTypeRepository.Entities.Where(x => x.ExaminationProjectFeeID == examinationProjectFeeID && x.FeeTypeID == feeTypeID).FirstOrDefault();
  489. //获取要报考的批次项目和项目收费标准对应收费项对应的已报名名单
  490. var studentRegistrationList = ExaminationSubjectDAL.examinationRegistrationRepository.Entities.Where(x => x.ExaminationBatchProjectID == examinationBatchProject.ExaminationBatchProjectID).ToList();
  491. StringBuilder errorMsg = new StringBuilder(); // 错误信息
  492. var result = new ExcelImportResult();
  493. var excel = new NpoiExcelHelper();
  494. var errorTable = new DataTable();
  495. List<StudentListView> errList = new List<StudentListView>();
  496. cellheader.Remove("ErrorMessage");//去除异常列、导入操作不需要
  497. // 1.1解析文件,存放到一个List集合里
  498. List<StudentListView> enlist =
  499. NpoiExcelHelper.ExcelToEntityList<StudentListView>(cellheader, sourcePhysicalPath, out errorMsg, out errList);
  500. Expression<Func<CF_Student, bool>> filter = x => true;
  501. List<BaseStudentView> insertList = new List<BaseStudentView>();
  502. var inSchoolStatusIDList = studentsDAL.InSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();
  503. //filter = filter.And(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID));获取所有学生,不排除是否在校
  504. var studentList = studentsDAL.GetInSchoolStudentViewQueryable(filter).ToList();
  505. cellheader.Add("ErrorMessage", "错误信息");//还原字典项
  506. cellheader.ForEach(x => errorTable.Columns.Add(x.Value));
  507. if (enlist.Count() <= 0)
  508. {
  509. throw new Exception("请填写Excel模板信息数据。");
  510. }
  511. for (int i = 0; i < enlist.Count(); i++)
  512. {
  513. string errorMsgStr = "第" + (i + 2) + "行数据检测异常:";
  514. StudentListView en = enlist[i];
  515. bool isHaveNoInputValue = false;
  516. en.IsExcelVaildateOK = true;
  517. #region 检查是否有未填的值
  518. if (string.IsNullOrEmpty(en.IDNumber))
  519. {
  520. errorMsgStr += "证件号不能为空;";
  521. isHaveNoInputValue = true;
  522. }
  523. #endregion
  524. #region 检查数据是否存在
  525. if (!studentList.Any(x => x.IDNumber == en.IDNumber))
  526. {
  527. errorMsgStr += "学生不存在;";
  528. isHaveNoInputValue = true;
  529. }
  530. else {
  531. var student = studentList.FirstOrDefault(x => x.IDNumber == en.IDNumber);
  532. if (studentRegistrationList.Any(x => x.UserID == student.UserID))
  533. {
  534. errorMsgStr += "学生已报名该科目;";
  535. isHaveNoInputValue = true;
  536. }
  537. }
  538. #endregion
  539. if (isHaveNoInputValue)
  540. {
  541. en.IsExcelVaildateOK = false;
  542. en.ErrorMessage = errorMsgStr;
  543. errList.Add(en);
  544. }
  545. else
  546. {
  547. //enlist[i].IsExcelVaildateOK = true;
  548. var student = studentList.FirstOrDefault(x => x.IDNumber == en.IDNumber);
  549. if(student != null)
  550. {
  551. insertList.Add(student);
  552. }
  553. }
  554. }
  555. ErrCount = errList.Distinct().Count();
  556. errdataList = errList.Distinct().ToList();
  557. OkCount = enlist.Distinct().Count() - errList.Distinct().Count();
  558. result.SuccessCount = OkCount;
  559. result.ErrorCount = ErrCount;
  560. if (ErrCount > 0)
  561. {
  562. errList.ForEach(x => errorTable.Rows.Add(x));
  563. result.IsAllSuccess = false;
  564. var errorCellHeader = cellheader;
  565. result.Data = insertList;
  566. result.ErrorFilePath = this.WriteErrorFile(excel, cellheader.Values, errorTable);
  567. result.Message = string.Format("导入失败,详情请点击错误数据下载查看。");
  568. }
  569. else
  570. {
  571. result.IsAllSuccess = true;
  572. result.Data = insertList;
  573. }
  574. return result;
  575. }
  576. private string WriteErrorFile(NpoiExcelHelper excel, IEnumerable<string> errorCellheader, DataTable errorTable)
  577. {
  578. var errorExcelBuff = excel.ExportMemoryStream(errorTable, "", errorCellheader.ToArray());
  579. var logicalPath = Const.LOCAL_SETTING_UPLOAD_FILEPATH + "/" + Guid.NewGuid().ToString() + ".xls";
  580. var physicalPath = HttpContext.Current.Server.MapPath(logicalPath);
  581. var fs = File.Create(physicalPath);
  582. fs.Write(errorExcelBuff, 0, errorExcelBuff.Length);
  583. fs.Flush();
  584. fs.Close();
  585. return UrlHelper.GenerateContentUrl(logicalPath, HttpContext.Current.Request.RequestContext.HttpContext);
  586. }
  587. /// <summary>
  588. /// 获取项目下拉(根据批次,考试类型)
  589. /// </summary>
  590. /// <param name="configuretView"></param>
  591. /// <param name="examinationBatchID"></param>
  592. /// <param name="examinationTypeID"></param>
  593. /// <param name="pageIndex"></param>
  594. /// <param name="pageSize"></param>
  595. /// <returns></returns>
  596. public IGridResultSet<ExaminationProjectViewNotSubject> GetExaminationProjectViewGridForComboGrid(ConfiguretView configuretView, Guid? examinationBatchID, Guid? examinationTypeID, int pageIndex, int pageSize)
  597. {
  598. Expression<Func<EX_ExaminationProject, bool>> expCampus = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  599. if (examinationBatchID.HasValue)
  600. {
  601. expCampus = expCampus.And(x => x.EX_ExaminationBatchProject.Any(y => y.ExaminationBatchID == examinationBatchID));
  602. }
  603. if (examinationTypeID.HasValue)
  604. {
  605. expCampus = expCampus.And(x => x.ExaminationTypeID == examinationTypeID);
  606. }
  607. var query = ProjectFeeDAL.GetProectListViewGridForSelect(expCampus).Distinct();
  608. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  609. {
  610. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  611. }
  612. return query.OrderBy(x => x.ExaminationProjectID).ThenBy(x => x.ExaminationLevelID)
  613. .ToGridResultSet<ExaminationProjectViewNotSubject>(pageIndex, pageSize);
  614. }
  615. /// <summary>
  616. /// 获取项目收费标准下拉(根据项目)
  617. /// </summary>
  618. /// <param name="configuretView"></param>
  619. /// <param name="examinationProjectID"></param>
  620. /// <param name="pageIndex"></param>
  621. /// <param name="pageSize"></param>
  622. /// <returns></returns>
  623. public IGridResultSet<ExaminationProjectFeeView> GetProjectFeeTypeViewForComboGrid(ConfiguretView configuretView, Guid? examinationBatchID, Guid? examinationProjectID, int pageIndex, int pageSize)
  624. {
  625. Expression<Func<EX_ExaminationBatchProjectControl, bool>> expebpc = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  626. var ExaminationBatchProject = ExaminationSubjectDAL.examinationBatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == examinationBatchID && x.ExaminationProjectID == examinationProjectID).FirstOrDefault();
  627. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  628. if (ExaminationBatchProject != null)
  629. {
  630. expebpc = expebpc.And(x => x.ExaminationBatchProjectID == ExaminationBatchProject.ExaminationBatchProjectID);
  631. }
  632. if (curUser != null && curUser.IsStudent)
  633. {
  634. var student = studentsDAL.GetStudentQueryable(x => x.UserID == curUser.UserID, x => true, x => true).FirstOrDefault();
  635. expebpc = expebpc.And(x => x.SchoolyearID == student.Years && x.StandardID == student.StandardID);
  636. }
  637. var query = ProjectFeeDAL.GerProjectFeeByProjectAndYearStandard(expebpc);
  638. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  639. {
  640. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  641. }
  642. return query.Distinct().OrderBy(x => x.ExaminationProjectID).ToGridResultSet<ExaminationProjectFeeView>(pageIndex, pageSize);
  643. }
  644. public IGridResultSet<ExaminationProjectFeeView> GetProjectFeeTypeViewByBaseForComboGrid(ConfiguretView configuretView, Guid? examinationBatchID, Guid? examinationProjectID, int pageIndex, int pageSize)
  645. {
  646. Expression<Func<EX_ExaminationProjectFee, bool>> expFee = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  647. var ExaminationBatchProject = ExaminationSubjectDAL.examinationBatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == examinationBatchID && x.ExaminationProjectID == examinationProjectID).FirstOrDefault();
  648. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  649. if (examinationProjectID.HasValue)
  650. {
  651. expFee = expFee.And(x => x.ExaminationProjectID == examinationProjectID);
  652. }
  653. var query = ProjectFeeDAL.GetProjectFee(expFee);
  654. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  655. {
  656. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  657. }
  658. return query.OrderBy(x => x.ProjectName).ThenBy(x => x.Name).ToGridResultSet<ExaminationProjectFeeView>(pageIndex, pageSize);
  659. }
  660. /// <summary>
  661. /// 获取收费项下拉(根据项目收费标准)
  662. /// </summary>
  663. /// <param name="configuretView"></param>
  664. /// <param name="examinationProjectFeeID"></param>
  665. /// <param name="pageIndex"></param>
  666. /// <param name="pageSize"></param>
  667. /// <returns></returns>
  668. public IGridResultSet<DictionaryItemView> GetFeeTypeViewForComboGrid(ConfiguretView configuretView, Guid? examinationProjectFeeID, int pageIndex, int pageSize)
  669. {
  670. var examinationProjectFeeTypeList = ExaminationSubjectDAL.examinationProjectFeeTypeRepository.GetList(x => x.ExaminationProjectFeeID == examinationProjectFeeID && x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  671. List<int?> feeTypeID = examinationProjectFeeTypeList.Select(x => x.FeeTypeID).Distinct().ToList();
  672. var query = from a in ExaminationSubjectDAL.dictionaryItemRepository.GetList(x => x.DictionaryCode == "EX_ExaminationProjectFeeType" && feeTypeID.Contains(x.Value))
  673. from epftr in ExaminationSubjectDAL.examinationProjectFeeTypeRepository.Entities.Where(x => x.ExaminationProjectFeeID == examinationProjectFeeID && x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.FeeTypeID == a.Value).DefaultIfEmpty()
  674. select new DictionaryItemView
  675. {
  676. DictionaryItemID = a.DictionaryItemID,
  677. DictionaryCode = a.DictionaryCode,
  678. Code = a.Code,
  679. DictionaryName = a.Sys_Dictionary.Name,
  680. Value = a.Value,
  681. IsEditable = a.IsEditable.Value,
  682. IsVisible = a.RecordStatus > 0,
  683. Name = a.Name + "(" + epftr.Fee.ToString() + ")",
  684. OrderNo = a.OrderNo,
  685. RecordStatus = a.RecordStatus,
  686. };
  687. return query.Distinct().OrderBy(x => x.Value).ToGridResultSet<DictionaryItemView>(pageIndex, pageSize);
  688. }
  689. /// <summary>
  690. /// 获取批次下拉(根据学年学期)
  691. /// </summary>
  692. /// <param name="configuretView"></param>
  693. /// <param name="schoolyearID"></param>
  694. /// <param name="pageIndex"></param>
  695. /// <param name="pageSize"></param>
  696. /// <returns></returns>
  697. public IGridResultSet<ExaminationBatchView> GetExaminationBatchViewForComboGrid(ConfiguretView configuretView, Guid? schoolyearID, int pageIndex, int pageSize)
  698. {
  699. Expression<Func<EX_ExaminationBatch, bool>> expCampus = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
  700. if (schoolyearID.HasValue)
  701. {
  702. expCampus = expCampus.And(x => x.SchoolyearID == schoolyearID);
  703. }
  704. var query = ExaminationBatchDAL.GetBatchList(expCampus);
  705. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  706. {
  707. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  708. }
  709. return query.OrderBy(x => x.Name).ToGridResultSet<ExaminationBatchView>(pageIndex, pageSize);
  710. }
  711. public List<StudentListForExportView> GetStudentListForExportViewGrid(ConfiguretView examinationSubjectView, Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID,
  712. Guid? examinationProjectID, int? campusID, Guid? collegeID, int? year, Guid? classmajorID, int? recordStatus, int? isConfirm, List<Guid?> ids)
  713. {
  714. Expression<Func<EX_ExaminationRegistration, bool>> erexp = x => true;
  715. Expression<Func<EX_ExaminationProject, bool>> epexp = x => true;
  716. Expression<Func<EX_ExaminationBatchProject, bool>> ebpexp = x => true;
  717. Expression<Func<CF_Student, bool>> stuexp = x => true;
  718. if (schoolYearID.HasValue)
  719. {
  720. ebpexp = ebpexp.And(x => x.EX_ExaminationBatch.SchoolyearID == schoolYearID);
  721. }
  722. if (examinationBatchID.HasValue)
  723. {
  724. ebpexp = ebpexp.And(x => x.ExaminationBatchID == examinationBatchID);
  725. }
  726. if (examinationTypeID.HasValue)
  727. {
  728. epexp = epexp.And(x => x.ExaminationTypeID == examinationTypeID);
  729. }
  730. if (examinationProjectID.HasValue)
  731. {
  732. epexp = epexp.And(x => x.ExaminationProjectID == examinationProjectID);
  733. }
  734. if (campusID.HasValue)
  735. {
  736. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolAreaID == campusID);
  737. }
  738. if (collegeID.HasValue)
  739. {
  740. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
  741. }
  742. if (year.HasValue)
  743. {
  744. stuexp = stuexp.And(x => x.CF_Classmajor.CF_Grademajor.SchoolyearID == year);
  745. }
  746. if (classmajorID.HasValue)
  747. {
  748. stuexp = stuexp.And(x => x.ClassmajorID == classmajorID);
  749. }
  750. if (recordStatus.HasValue)
  751. {
  752. erexp = erexp.And(x => x.RecordStatus == recordStatus);
  753. }
  754. var q = ExaminationSubjectDAL.GetStudentListForExport(erexp, epexp, ebpexp, stuexp);
  755. if (isConfirm.HasValue)
  756. {
  757. q = q.Where(x => isConfirm == 1 ? (x.ExaminationRegistrationConfirmID != null) : (x.ExaminationRegistrationConfirmID == null));
  758. }
  759. if (!string.IsNullOrEmpty(examinationSubjectView.ConditionValue) && !string.IsNullOrEmpty(examinationSubjectView.Attribute))
  760. q = q.DynamicWhere(examinationSubjectView.Attribute, examinationSubjectView.Condition, examinationSubjectView.ConditionValue);
  761. return q.OrderByDescending(x => x.Year).ThenBy(x => x.CollegeID).ThenBy(x => x.StandardID).ThenBy(x => x.StudentNo).ToList();
  762. }
  763. public List<BaseStudentView> AddStudentsCheck(List<string> IDList, Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID, Guid? examinationProjectID, Guid? examinationProjectFeeID, int? feeTypeID)
  764. {
  765. try
  766. {
  767. //获取要报考的批次项目和项目收费标准对应收费项
  768. var examinationBatchProject = ExaminationSubjectDAL.examinationBatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == examinationBatchID && x.ExaminationProjectID == examinationProjectID).FirstOrDefault();
  769. //var examinationProjectFeeType = ExaminationSubjectDAL.examinationProjectFeeTypeRepository.Entities.Where(x => x.ExaminationProjectFeeID == examinationProjectFeeID && x.FeeTypeID == feeTypeID).FirstOrDefault();
  770. //获取要报考的批次项目和项目收费标准对应收费项对应的已报名名单
  771. var studentRegistrationList = ExaminationSubjectDAL.examinationRegistrationRepository.Entities.Where(x => x.ExaminationBatchProjectID == examinationBatchProject.ExaminationBatchProjectID && x.RecordStatus != (int)EX_ExaminationRegistrationStatus.Refunded).ToList();
  772. var userIDList = studentRegistrationList.Select(x => x.UserID).ToList();
  773. //获取学生
  774. Expression<Func<CF_Student, bool>> filter = x => true;
  775. filter = filter.And(x => IDList.Contains(x.IDNumber));
  776. var studentList = studentsDAL.GetInSchoolStudentViewQueryable(filter).ToList();
  777. studentList = studentList.Where(x => !userIDList.Contains(x.UserID)).ToList();
  778. return studentList;
  779. }
  780. catch (Exception)
  781. {
  782. throw;
  783. }
  784. }
  785. }
  786. }