StudentEvaluationCountServices.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Bowin.Common.Linq;
  6. using Bowin.Common.Linq.Entity;
  7. using EMIS.ViewModel.EvaluationManage;
  8. using EMIS.ViewModel;
  9. using EMIS.DataLogic.Common.EvaluationManage;
  10. using System.Linq.Expressions;
  11. using EMIS.Entities;
  12. namespace EMIS.CommonLogic.EvaluationManage
  13. {
  14. public class StudentEvaluationCountServices : BaseServices, IStudentEvaluationCountServices
  15. {
  16. public StudentEvaluationCountDAL StudentEvaluationCountDAL { get; set; }
  17. public IGridResultSet<StudentEvaluationCountView> GetStudentView(ConfiguretView configuretView, int? schoolyearNumID,
  18. Guid? collegeID, Guid? schoolyearID, int? standardID, Guid? classID, int pageIndex, int pageSize)
  19. {
  20. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> filter = x => true;
  21. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  22. {
  23. filter = filter.And(x => x.SchoolyearID == schoolyearID);
  24. }
  25. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  26. var query = StudentEvaluationCountDAL.GetStudentView(filter);
  27. query = query.OrderBy(x => x.ClassmajorID).ThenBy(x => x.StudentNo);
  28. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  29. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  30. if (schoolyearNumID.HasValue)
  31. {
  32. query = query.Where(x => x.SchoolyearNumID == schoolyearNumID);
  33. }
  34. if (collegeID.HasValue)
  35. {
  36. query = query.Where(x => x.CollegeID == collegeID);
  37. }
  38. if (standardID.HasValue&&standardID>0)
  39. {
  40. query = query.Where(x => x.StandardID == standardID);
  41. }
  42. if (classID.HasValue)
  43. {
  44. query = query.Where(x => x.ClassmajorID == classID);
  45. }
  46. return query.ToGridResultSet(pageIndex, pageSize);
  47. }
  48. public IList<StudentEvaluationCountView> GetStudentView(ConfiguretView configuretView, int? schoolyearNumID,
  49. Guid? collegeID, Guid? schoolyearID, int? standardID, Guid? classID)
  50. {
  51. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> filter = x => true;
  52. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  53. {
  54. filter = filter.And(x => x.SchoolyearID == schoolyearID);
  55. }
  56. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  57. var query = StudentEvaluationCountDAL.GetStudentView(filter);
  58. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  59. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  60. if (schoolyearNumID.HasValue)
  61. {
  62. query = query.Where(x => x.SchoolyearNumID == schoolyearNumID);
  63. }
  64. if (collegeID.HasValue)
  65. {
  66. query = query.Where(x => x.CollegeID == collegeID);
  67. }
  68. //if (schoolyearID.HasValue)
  69. //{
  70. // query = query.Where(x => x.SchoolyearID == schoolyearID);
  71. //}
  72. if (standardID.HasValue)
  73. {
  74. query = query.Where(x => x.StandardID == standardID);
  75. }
  76. if (classID.HasValue)
  77. {
  78. query = query.Where(x => x.ClassmajorID == classID);
  79. }
  80. query = query.OrderByDescending(o => o.SchoolyearID);
  81. return query.ToList();
  82. }
  83. }
  84. }