StudentExaminationCourseServices.cs 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Bowin.Common.Linq.Entity;
  6. using EMIS.ViewModel.ExaminationManage;
  7. using EMIS.ViewModel;
  8. using System.Linq.Expressions;
  9. using EMIS.Entities;
  10. using Bowin.Common.Linq;
  11. using EMIS.DataLogic.ExaminationManage;
  12. namespace EMIS.CommonLogic.ExaminationManage
  13. {
  14. public class StudentExaminationCourseServices : BaseServices,IStudentExaminationCourseServices
  15. {
  16. public StudentExaminationCourseDAL studentExaminationCourseDAL { get; set; }
  17. public IGridResultSet<StudentExaminationCourseView> GetStudentExaminationCourseViewList(ConfiguretView configuretView,
  18. Guid? schoolyearID, int? examsCategoryID, int? examinationModeID, int? examinationStyleID, Guid userID, int pageIndex, int pageSize)
  19. {
  20. Expression<Func<EX_ExaminationPlan, bool>> exp = (x => x.RecordStatus == (int)EX_ExaminationPlanStatus.Submitted);
  21. if (schoolyearID.HasValue)
  22. {
  23. exp = exp.And(x => x.SchoolyearID == schoolyearID);
  24. }
  25. if (examsCategoryID.HasValue)
  26. {
  27. exp = exp.And(x => x.ExamsCategoryID == examsCategoryID);
  28. }
  29. if (examinationModeID.HasValue)
  30. {
  31. exp = exp.And(x => x.ExaminationModeID == examinationModeID);
  32. }
  33. if (examinationStyleID.HasValue)
  34. {
  35. exp = exp.And(x => x.ExaminationStyleID == examinationStyleID);
  36. }
  37. var query = studentExaminationCourseDAL.GetExaminationPlanView(exp, userID);
  38. if (!string.IsNullOrEmpty(configuretView.ConditionValue) && !string.IsNullOrEmpty(configuretView.Attribute))
  39. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  40. var result = query.OrderBy(x => x.SchoolyearCode).ThenBy(x => x.ExaminationDate).ThenBy(x => x.StartTime).ToGridResultSet<StudentExaminationCourseView>(pageIndex, pageSize);
  41. return result;
  42. }
  43. public List<StudentExaminationCourseView> GetStudentExaminationCourseViewList(ConfiguretView configuretView,
  44. Guid? schoolyearID, int? examsCategoryID, int? examinationModeID, int? examinationStyleID, Guid userID, List<Guid?> selectIDlist)
  45. {
  46. Expression<Func<EX_ExaminationPlan, bool>> exp = (x => x.RecordStatus == (int)EX_ExaminationPlanStatus.Submitted);
  47. if (schoolyearID.HasValue)
  48. {
  49. exp = exp.And(x => x.SchoolyearID == schoolyearID);
  50. }
  51. if (examsCategoryID.HasValue)
  52. {
  53. exp = exp.And(x => x.ExamsCategoryID == examsCategoryID);
  54. }
  55. if (examinationModeID.HasValue)
  56. {
  57. exp = exp.And(x => x.ExaminationModeID == examinationModeID);
  58. }
  59. if (examinationStyleID.HasValue)
  60. {
  61. exp = exp.And(x => x.ExaminationStyleID == examinationStyleID);
  62. }
  63. if (selectIDlist.Count > 0)
  64. {
  65. exp = exp.And(x => selectIDlist.Contains(x.ExaminationPlanID));
  66. }
  67. var query = studentExaminationCourseDAL.GetExaminationPlanView(exp, userID);
  68. if (!string.IsNullOrEmpty(configuretView.ConditionValue) && !string.IsNullOrEmpty(configuretView.Attribute))
  69. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  70. var result = query.OrderBy(x => x.SchoolyearCode).ThenBy(x => x.ExaminationDate).ThenBy(x => x.StartTime).ToList();
  71. return result;
  72. }
  73. }
  74. }