CheckingControlDAL.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Linq.Expressions;
  6. using EMIS.Entities;
  7. using EMIS.DataLogic.Repositories;
  8. using EMIS.ViewModel;
  9. using EMIS.ViewModel.StudentManage.OnlineChecking;
  10. using EMIS.ViewModel.StudentManage.InfoCenter;
  11. namespace EMIS.DataLogic.StudentManage.OnlineChecking
  12. {
  13. public class CheckingControlDAL
  14. {
  15. public StudentEditControlRepository StudentEditControlRepository { get; set; }
  16. public StudentEditColumnDescriptionRepository StudentEditColumnDescriptionRepository { get; set; }
  17. public UserRepository UserRepository { get; set; }
  18. /// <summary>
  19. /// 查询对应的学生校对控制信息CheckingControlView
  20. /// </summary>
  21. /// <param name="expStudentEditControl"></param>
  22. /// <returns></returns>
  23. public IQueryable<CheckingControlView> GetStudentEditControlQueryable(Expression<Func<CF_StudentEditControl, bool>> exp)
  24. {
  25. var query = from stuec in StudentEditControlRepository.GetList(exp)
  26. join usc in UserRepository.Entities
  27. on stuec.CreateUserID equals usc.UserID into tempusc
  28. from uscu in tempusc.DefaultIfEmpty()
  29. join usm in UserRepository.Entities
  30. on stuec.ModifyUserID equals usm.UserID into tempusm
  31. from usmu in tempusm.DefaultIfEmpty()
  32. select new CheckingControlView
  33. {
  34. StudentEditControlID = stuec.StudentEditControlID,
  35. OrderNo = stuec.OrderNo,
  36. ColumnName = stuec.ColumnName,
  37. DisplayColumnName = stuec.DisplayColumnName,
  38. Description = stuec.Description,
  39. CheckingTypeID = stuec.CheckingTypeID,
  40. RecordStatus = stuec.RecordStatus,
  41. CreateUserID = stuec.CreateUserID,
  42. CreateUserName = uscu.Name,
  43. CreateTime = stuec.CreateTime,
  44. ModifyUserID = stuec.ModifyUserID,
  45. ModifyUserName = usmu.Name,
  46. ModifyTime = stuec.ModifyTime
  47. };
  48. return query;
  49. }
  50. /// <summary>
  51. /// 查询对应的学生校对控制信息
  52. /// </summary>
  53. /// <param name="exp"></param>
  54. /// <returns></returns>
  55. public IQueryable<EditFeildView> GetStudentEditFeildQueryable(Expression<Func<CF_StudentEditControl, bool>> exp)
  56. {
  57. var query = from stuec in StudentEditControlRepository.GetList(exp)
  58. select new EditFeildView
  59. {
  60. OrderNo = stuec.OrderNo ?? 0,
  61. ColumnFeild = stuec.ColumnName,
  62. ColumnName = stuec.DisplayColumnName,
  63. Description = stuec.Description,
  64. IsEdit = (stuec.CheckingTypeID != (int)CF_CheckingType.Close),
  65. CheckingTypeID = stuec.CheckingTypeID
  66. };
  67. return query;
  68. }
  69. }
  70. }