TeacherEvaluationCountServices.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 TeacherEvaluationCountServices:BaseServices, ITeacherEvaluationCountServices
  15. {
  16. public TeacherEvaluationCountDAL TeacherEavluationCountDAL { get; set; }
  17. public IGridResultSet<TeacherEvaluationCountView> GetTeacherView(ViewModel.ConfiguretView configuretView, Guid? collegeID, Guid? schoolyearID, Guid? typeID, Guid? departmentID, int pageIndex, int pageSize)
  18. {
  19. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> filter = x => true;
  20. Expression<Func<EM_EvaluationSetting, bool>> espset = x => true;
  21. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  22. {
  23. filter = filter.And(x => x.SchoolyearID == schoolyearID);
  24. }
  25. if (typeID.HasValue && typeID != Guid.Empty)
  26. {
  27. espset = espset.And(x => x.EvaluationTypeID == typeID);
  28. }
  29. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  30. var query = TeacherEavluationCountDAL.GetTeacherView(filter, espset);
  31. query = query.OrderBy(x => x.TeacherNo);
  32. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  33. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  34. if (collegeID.HasValue)
  35. {
  36. query = query.Where(x => x.CollegeID == collegeID);
  37. }
  38. //if (typeID.HasValue)
  39. //{
  40. // query = query.Where(x => x.EvaluationTypeID == typeID);
  41. //}
  42. if (departmentID.HasValue)
  43. {
  44. query = query.Where(x => x.DepartmentID == departmentID);
  45. }
  46. return query.ToGridResultSet(pageIndex, pageSize);
  47. }
  48. public IList<TeacherEvaluationCountView> GetTeacherView(ViewModel.ConfiguretView configuretView, Guid? collegeID, Guid? schoolyearID, Guid? typeID, Guid? departmentID)
  49. {
  50. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> filter = x => true;
  51. Expression<Func<EM_EvaluationSetting, bool>> espset = x => true;
  52. if (schoolyearID.HasValue && schoolyearID != Guid.Empty)
  53. {
  54. filter = filter.And(x => x.SchoolyearID == schoolyearID);
  55. }
  56. if (typeID.HasValue && typeID != Guid.Empty)
  57. {
  58. espset = espset.And(x => x.EvaluationTypeID == typeID);
  59. }
  60. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  61. var query = TeacherEavluationCountDAL.GetTeacherView(filter, espset);
  62. //query = query.OrderBy(x => x.ClassmajorID).ThenBy(x => x.StudentNo);
  63. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  64. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  65. if (collegeID.HasValue)
  66. {
  67. query = query.Where(x => x.CollegeID == collegeID);
  68. }
  69. //if (typeID.HasValue)
  70. //{
  71. // query = query.Where(x => x.EvaluationTypeID == typeID);
  72. //}
  73. if (departmentID.HasValue)
  74. {
  75. query = query.Where(x => x.DepartmentID == departmentID);
  76. }
  77. return query.ToList();
  78. }
  79. }
  80. }