SOCServices_heyw.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using Bowin.Common.Linq;
  7. using Bowin.Common.Linq.Entity;
  8. using EMIS.ViewModel.Cultureplan;
  9. using EMIS.ViewModel;
  10. using EMIS.Entities;
  11. using EMIS.ViewModel.DQPSystem;
  12. namespace EMIS.CommonLogic.DQPSystem
  13. {
  14. public partial class SOCServices
  15. {
  16. public IGridResultSet<CoursematerialView> GetTeacherCoursematerialViewList(ConfiguretView conditionView,
  17. Guid schoolyearID, Guid userID, int? pageIndex, int? pageSize)
  18. {
  19. Expression<Func<DQP_SOC, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.SchoolyearID == schoolyearID);
  20. Expression<Func<CF_Staff, bool>> staffExp = (x => x.UserID == userID);
  21. var query = this.SOCDAL.GetStaffRelateCoursematerialViewQueryable(exp, staffExp);
  22. if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
  23. query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
  24. query = query.OrderBy(x => x.CourseCode);
  25. return query.ToGridResultSet(pageIndex, pageSize);
  26. }
  27. public IGridResultSet<CoursematerialView> GetStudentCoursematerialViewList(ConfiguretView conditionView,
  28. Guid? schoolyearID, Guid userID, int? pageIndex, int? pageSize)
  29. {
  30. Expression<Func<DQP_SOC, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  31. Expression<Func<CF_Student, bool>> studentExp = (x => x.UserID == userID);
  32. if (schoolyearID.HasValue)
  33. {
  34. exp = exp.And(x => x.SchoolyearID == schoolyearID);
  35. }
  36. var query = this.SOCDAL.GetStudentRelateCoursematerialViewQueryable(exp, studentExp);
  37. if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
  38. query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
  39. query = query.OrderBy(x => x.CourseCode);
  40. return query.ToGridResultSet(pageIndex, pageSize);
  41. }
  42. public IGridResultSet<SOCStudentView> GetSOCStudentViewGrid(ConfiguretView conditionView, Guid? schoolyearID, Guid? coursematerialID, Guid userID, int? status, int? pageIndex, int? pageSize)
  43. {
  44. Expression<Func<DQP_SOC, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  45. Expression<Func<CF_Student, bool>> studentExp = (x => x.UserID == userID);
  46. if (schoolyearID.HasValue)
  47. {
  48. exp = exp.And(x => x.SchoolyearID == schoolyearID);
  49. }
  50. if (coursematerialID.HasValue)
  51. {
  52. exp = exp.And(x => x.CoursematerialID == coursematerialID);
  53. }
  54. if (status.HasValue)
  55. {
  56. exp = exp.And(x => x.RecordStatus == status);
  57. }
  58. var query = this.SOCDAL.GetSOCStudentViewQueryable(exp, studentExp);
  59. if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
  60. query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
  61. query = query.OrderByDescending(x => x.SchoolyearCode)
  62. .ThenBy(x => x.CourseCode)
  63. .ThenBy(x => x.Name);
  64. return query.ToGridResultSet(pageIndex, pageSize);
  65. }
  66. }
  67. }