EvaluationTeacherScoreServices.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Common.EvaluationManage;
  6. using Bowin.Common.Linq;
  7. using Bowin.Common.Linq.Entity;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel;
  10. using System.Linq.Expressions;
  11. using EMIS.ViewModel.EvaluationManage;
  12. namespace EMIS.CommonLogic.EvaluationManage
  13. {
  14. public class EvaluationTeacherScoreServices: BaseServices, IEvaluationTeacherScoreServices
  15. {
  16. public EvaluationTeacherScoreDAL EvaluationTeacherScoreDAL { get; set; }
  17. public EvaluationTypeDAL EvaluationTypeDAL { get; set; }
  18. public IGridResultSet<EvaluationTeacherScoreView> GetEvaluationTeacherScoreViewGrid(ConfiguretView configuretView, Guid? schoolYearID, Guid? evaluationIntTypeID, Guid? evaluationTableTypeID, Guid? collegeID, Guid? DepartmentID, int pageIndex, int pageSize)
  19. {
  20. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  21. Expression<Func<EM_MissionClassTeacher, bool>> expmct = x => true;
  22. Expression<Func<EM_EvaluationTable, bool>> expTable = x => true;
  23. if (evaluationIntTypeID.HasValue && evaluationIntTypeID != Guid.Empty)
  24. {
  25. expTable = expTable.And(x => x.EvaluationIntTypeID == evaluationIntTypeID);
  26. }
  27. if (evaluationTableTypeID.HasValue && evaluationTableTypeID != Guid.Empty)
  28. {
  29. expTable = expTable.And(x => x.EvaluationTypeID == evaluationTableTypeID);
  30. //expTable = expTable.And(x => x.TypeID == evaluationTableTypeID);
  31. }
  32. if (schoolYearID.HasValue && schoolYearID != Guid.Empty)
  33. {
  34. expmct = expmct.And(x => x.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID == schoolYearID);
  35. }
  36. var query = EvaluationTeacherScoreDAL.GetEvaluationTeacherScoreQuery(expmct, expTable, schoolYearID);
  37. if (collegeID.HasValue)
  38. {
  39. query = query.Where(x => x.CollegeID == collegeID);
  40. }
  41. if (DepartmentID.HasValue)
  42. {
  43. query = query.Where(x => x.DepartmentID == DepartmentID);
  44. }
  45. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  46. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  47. query = this.GetQueryByDataRange(query, (x => x.UserID));
  48. //query2 = query2.OrderByDescending(x => x.TeacherNo);
  49. return query.OrderBy(x => x.CollegeRanking).ThenBy(x => x.DepartmentRanking).ToGridResultSet<EvaluationTeacherScoreView>(pageIndex, pageSize);
  50. }
  51. public IList<EvaluationTeacherScoreView> GetEvaluationTeacherScoreViewList(ConfiguretView configuretView, Guid? schoolYearID, Guid? evaluationIntTypeID, Guid? evaluationTableTypeID, Guid? collegeID, Guid? DepartmentID)
  52. {
  53. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  54. Expression<Func<EM_MissionClassTeacher, bool>> expmct = x => true;
  55. Expression<Func<EM_EvaluationTable, bool>> expTable = x => true;
  56. if (evaluationIntTypeID.HasValue && evaluationIntTypeID != Guid.Empty)
  57. {
  58. expTable = expTable.And(x => x.EvaluationIntTypeID == evaluationIntTypeID);
  59. }
  60. if (evaluationTableTypeID.HasValue && evaluationTableTypeID != Guid.Empty)
  61. {
  62. expTable = expTable.And(x => x.EvaluationTypeID == evaluationTableTypeID);
  63. }
  64. if (schoolYearID.HasValue && schoolYearID != Guid.Empty)
  65. {
  66. expmct = expmct.And(x => x.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID == schoolYearID);
  67. }
  68. var query = EvaluationTeacherScoreDAL.GetEvaluationTeacherScoreQuery(expmct, expTable, schoolYearID);
  69. if (collegeID.HasValue)
  70. {
  71. query = query.Where(x => x.CollegeID == collegeID);
  72. }
  73. if (DepartmentID.HasValue)
  74. {
  75. query = query.Where(x => x.DepartmentID == DepartmentID);
  76. }
  77. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  78. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  79. //query2 = query2.OrderByDescending(x => x.TeacherNo);
  80. return query.OrderBy(x => x.CollegeRanking).ThenBy(x => x.DepartmentRanking).ToList();
  81. }
  82. public Guid? GetEvaluaitonTableTypeID()
  83. {
  84. Expression<Func<EM_EvaluationType, bool>> expTable = x => true;
  85. expTable = expTable.And(x => x.Name.Equals("学生评"));
  86. var query = EvaluationTypeDAL.GetEvaluationTypeQueryable(expTable);
  87. return query.First().TypeID;
  88. }
  89. }
  90. }