ExaminationTypeDAL.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.ExaminationApply;
  6. using EMIS.DataLogic.Repositories;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. namespace EMIS.DataLogic.ExaminationApply
  10. {
  11. public class ExaminationTypeDAL
  12. {
  13. public ExaminationTypeRepository ExaminationTypeRepository { get; set; }
  14. public ExaminationBatchProjectRepository ExaminationBatchProjectRepository { get; set; }
  15. public IQueryable<ExaminationTypeView> GetExaminationTypeView(Expression<Func<EX_ExaminationType, bool>> examinationTypeExpression)
  16. {
  17. var q = (from et in ExaminationTypeRepository.GetList(examinationTypeExpression)
  18. orderby et.Name
  19. select new ExaminationTypeView
  20. {
  21. ExaminationTypeID = et.ExaminationTypeID,
  22. Name = et.Name,
  23. IsTimesLimit = et.IsTimesLimit ?? false,
  24. RecordStatus = et.RecordStatus,
  25. CreateUserID = et.CreateUserID,
  26. CreateTime = et.CreateTime,
  27. ModifyUserID = et.ModifyUserID,
  28. ModifyTime = et.ModifyTime
  29. });
  30. return q;
  31. }
  32. public IQueryable<ExaminationTypeView> GetExaminationTypeViewBySchoolyearID(Expression<Func<EX_ExaminationBatchProject, bool>> ebpexp)
  33. {
  34. var query = from ebpr in ExaminationBatchProjectRepository.Entities.Where(ebpexp)
  35. from et in ExaminationTypeRepository.Entities.Where(x => x.ExaminationTypeID == ebpr.EX_ExaminationProject.ExaminationTypeID)
  36. select new ExaminationTypeView
  37. {
  38. ExaminationTypeID = et.ExaminationTypeID,
  39. Name = et.Name,
  40. IsTimesLimit = et.IsTimesLimit ?? false,
  41. RecordStatus = et.RecordStatus,
  42. CreateUserID = et.CreateUserID,
  43. CreateTime = et.CreateTime,
  44. ModifyUserID = et.ModifyUserID,
  45. ModifyTime = et.ModifyTime
  46. };
  47. return query;
  48. }
  49. }
  50. }