SatisfyRateServices.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.Entity;
  4. using System.Linq;
  5. using System.Linq.Expressions;
  6. using System.Text;
  7. using Bowin.Common.Linq;
  8. using Bowin.Common.Linq.Entity;
  9. using EMIS.ViewModel.EvaluationManage;
  10. using EMIS.ViewModel;
  11. using EMIS.DataLogic.Common.EvaluationManage;
  12. using EMIS.Entities;
  13. namespace EMIS.CommonLogic.EvaluationManage
  14. {
  15. public class SatisfyRateServices : BaseServices, ISatisfyRateServices
  16. {
  17. public SatisfyRateDAL SatisfyRateDAL { get; set; }
  18. public IGridResultSet<SatisfyRateView> GetSatisfyRateViewList(ConfiguretView configuretView, Guid? evaluationTypeID, Guid? collegeID, int? teacherTypeID, int pageIndex, int pageSize)
  19. {
  20. Expression<Func<CF_Staff, bool>> filter = x => true;
  21. Expression<Func<EM_EvaluationType, bool>> typeFilter = x => true;
  22. if (collegeID.HasValue)
  23. {
  24. filter = filter.And(x => x.CollegeID == collegeID);
  25. }
  26. if (evaluationTypeID.HasValue)
  27. {
  28. typeFilter = typeFilter.And(x => x.EvaluationTypeID == evaluationTypeID);
  29. }
  30. if (teacherTypeID.HasValue)
  31. {
  32. filter = filter.And(x => x.TeacherTypeID == teacherTypeID);
  33. }
  34. var query = SatisfyRateDAL.GetUserSatisfyRateView(filter, typeFilter);
  35. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  36. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  37. return this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.SatisfyRate).ThenBy(x => x.LoginID)
  38. .ToGridResultSet(pageIndex, pageSize);
  39. }
  40. public List<SatisfyRateView> GetSatisfyRateViewList(ConfiguretView configuretView, Guid? evaluationTypeID, Guid? collegeID, int? teacherTypeID)
  41. {
  42. Expression<Func<CF_Staff, bool>> filter = x => true;
  43. Expression<Func<EM_EvaluationType, bool>> typeFilter = x => true;
  44. if (collegeID.HasValue)
  45. {
  46. filter = filter.And(x => x.CollegeID == collegeID);
  47. }
  48. if (evaluationTypeID.HasValue)
  49. {
  50. typeFilter = typeFilter.And(x => x.EvaluationTypeID == evaluationTypeID);
  51. }
  52. if (teacherTypeID.HasValue)
  53. {
  54. filter = filter.And(x => x.TeacherTypeID == teacherTypeID);
  55. }
  56. var query = SatisfyRateDAL.GetUserSatisfyRateView(filter, typeFilter);
  57. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  58. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
  59. return this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.SatisfyRate).ThenBy(x => x.LoginID).ToList();
  60. }
  61. }
  62. }