ChangeTotalServices.cs 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using Bowin.Common.Linq;
  7. using Bowin.Common.Linq.Entity;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel;
  10. using EMIS.ViewModel.StudentManage.StudentChange;
  11. using EMIS.DataLogic.StudentManage.StudentChange;
  12. using EMIS.CommonLogic.SystemServices;
  13. namespace EMIS.CommonLogic.StudentManage.StudentChange
  14. {
  15. public class ChangeTotalServices : BaseWorkflowServices<CF_DifferentDynamic>, IChangeTotalServices
  16. {
  17. public Lazy<StudentChangeDAL> StudentChangeDAL { get; set; }
  18. /// <summary>
  19. /// 查询对应的异动统计信息ChangeTotalView
  20. /// </summary>
  21. /// <param name="configuretView"></param>
  22. /// <param name="schoolyearID"></param>
  23. /// <param name="campusID"></param>
  24. /// <param name="collegeID"></param>
  25. /// <param name="pageIndex"></param>
  26. /// <param name="pageSize"></param>
  27. /// <returns></returns>
  28. public IGridResultSet<ChangeTotalView> GetChangeTotalViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID, int pageIndex, int pageSize)
  29. {
  30. var endApproveStatusID = this.GetCorrectEndStatus();
  31. Expression<Func<CF_DifferentDynamic, bool>> expStudentChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  32. expStudentChange = expStudentChange.And(x => x.ApprovalStatus == endApproveStatusID);
  33. if (schoolyearID.HasValue)
  34. {
  35. expStudentChange = expStudentChange.And(x => x.SchoolyearID == schoolyearID);
  36. }
  37. var query = StudentChangeDAL.Value.GetChangeTotalViewQueryable(expStudentChange);
  38. if (campusID.HasValue)
  39. {
  40. query = query.Where(x => x.CampusID == campusID);
  41. }
  42. if (collegeID.HasValue)
  43. {
  44. query = query.Where(x => x.CollegeID == collegeID);
  45. }
  46. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  47. {
  48. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  49. }
  50. var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CampusCode).ThenBy(x => x.CollegeNo).ToGridResultSet<ChangeTotalView>(pageIndex, pageSize);
  51. return result;
  52. }
  53. /// <summary>
  54. /// 查询对应的异动统计信息List
  55. /// </summary>
  56. /// <param name="configuretView"></param>
  57. /// <param name="schoolyearID"></param>
  58. /// <param name="campusID"></param>
  59. /// <param name="collegeID"></param>
  60. /// <returns></returns>
  61. public IList<ChangeTotalView> GetChangeTotalViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID)
  62. {
  63. var endApproveStatusID = this.GetCorrectEndStatus();
  64. Expression<Func<CF_DifferentDynamic, bool>> expStudentChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  65. expStudentChange = expStudentChange.And(x => x.ApprovalStatus == endApproveStatusID);
  66. if (schoolyearID.HasValue)
  67. {
  68. expStudentChange = expStudentChange.And(x => x.SchoolyearID == schoolyearID);
  69. }
  70. var query = StudentChangeDAL.Value.GetChangeTotalViewQueryable(expStudentChange);
  71. if (campusID.HasValue)
  72. {
  73. query = query.Where(x => x.CampusID == campusID);
  74. }
  75. if (collegeID.HasValue)
  76. {
  77. query = query.Where(x => x.CollegeID == collegeID);
  78. }
  79. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  80. {
  81. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  82. }
  83. var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CampusCode).ThenBy(x => x.CollegeNo).ToList();
  84. return result;
  85. }
  86. }
  87. }