LevelSettingDAL.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using EMIS.DataLogic.Repositories;
  2. using EMIS.Entities;
  3. using EMIS.ViewModel.ScoreManage.LevelScoreManage;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Linq.Expressions;
  8. using System.Text;
  9. namespace EMIS.DataLogic.ScoreManage.LevelScoreManage
  10. {
  11. public class LevelSettingDAL
  12. {
  13. public LevelSettingRepository LevelSettingRepository { get; set; }
  14. public ExaminationSubjectRepository ExaminationSubjectRepository { get; set; }
  15. public UserRepository UserRepository { get; set; }
  16. /// <summary>
  17. /// 查询对应的成绩等级信息LevelSettingView
  18. /// </summary>
  19. /// <param name="expLevelSetting"></param>
  20. /// <returns></returns>
  21. public IQueryable<LevelSettingView> GetLevelSettingViewQueryable(Expression<Func<ER_LevelSetting, bool>> expLevelSetting)
  22. {
  23. var query = from lvst in LevelSettingRepository.GetList(expLevelSetting)
  24. join exsub in ExaminationSubjectRepository.Entities
  25. on lvst.ExaminationSubjectID equals exsub.ExaminationSubjectID
  26. join usc in UserRepository.Entities
  27. on lvst.CreateUserID equals usc.UserID into tempusc
  28. from uscu in tempusc.DefaultIfEmpty()
  29. join usm in UserRepository.Entities
  30. on lvst.ModifyUserID equals usm.UserID into tempusm
  31. from usmu in tempusm.DefaultIfEmpty()
  32. select new LevelSettingView
  33. {
  34. LevelSettingID = lvst.LevelSettingID,
  35. ExaminationSubjectID = lvst.ExaminationSubjectID,
  36. ExaminationSubjectName = exsub.Name,
  37. LevelNum = lvst.LevelNum ?? 0,
  38. LevelName = lvst.LevelName,
  39. MinScore = lvst.MinScore,
  40. MinScoreOperator = lvst.MinScoreOperator,
  41. MaxScore = lvst.MaxScore,
  42. MaxScoreOperator = lvst.MaxScoreOperator,
  43. TotalScoreRange = lvst.MinScore.ToString() + lvst.MinScoreOperator
  44. + "总成绩" + lvst.MaxScoreOperator + lvst.MaxScore.ToString(),
  45. Remark = lvst.Remark,
  46. RecordStatus = lvst.RecordStatus,
  47. CreateUserID = lvst.CreateUserID,
  48. CreateUserName = uscu.Name,
  49. CreateTime = lvst.CreateTime,
  50. ModifyUserID = lvst.ModifyUserID,
  51. ModifyUserName = usmu.Name,
  52. ModifyTime = lvst.ModifyTime
  53. };
  54. return query;
  55. }
  56. }
  57. }