OpenObjectDAL.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.ViewModel;
  8. using EMIS.ViewModel.StudentManage.OnlineChecking;
  9. using EMIS.ViewModel.SystemView;
  10. using EMIS.DataLogic.Repositories;
  11. namespace EMIS.DataLogic.StudentManage.OnlineChecking
  12. {
  13. public class OpenObjectDAL
  14. {
  15. public StudentEditObjectsRepository StudentEditObjectsRepository { get; set; }
  16. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  17. public DictionaryRepository DictionaryRepository { get; set; }
  18. public UserRepository UserRepository { get; set; }
  19. /// <summary>
  20. /// 查询学生校对控制开放对象信息OpenObjectView
  21. /// </summary>
  22. /// <param name="exp"></param>
  23. /// <returns></returns>
  24. public IQueryable<OpenObjectView> GetStudentEditObjectQueryable(Expression<Func<CF_StudentEditObjects, bool>> exp)
  25. {
  26. var query = from stuobj in StudentEditObjectsRepository.GetList(exp)
  27. join usc in UserRepository.Entities
  28. on stuobj.CreateUserID equals usc.UserID into tempusc
  29. from uscu in tempusc.DefaultIfEmpty()
  30. join usm in UserRepository.Entities
  31. on stuobj.ModifyUserID equals usm.UserID into tempusm
  32. from usmu in tempusm.DefaultIfEmpty()
  33. select new OpenObjectView
  34. {
  35. StudentEditObjectsID = stuobj.StudentEditObjectsID,
  36. EducationID = stuobj.EducationID,
  37. SchoolyearNumID = stuobj.SchoolyearNumID,
  38. Starttime = stuobj.Starttime,
  39. Endtime = stuobj.Endtime,
  40. Remark = stuobj.Remark,
  41. RecordStatus = stuobj.RecordStatus,
  42. CreateUserID = stuobj.CreateUserID,
  43. CreateUserName = uscu.Name,
  44. CreateTime = stuobj.CreateTime,
  45. ModifyUserID = stuobj.ModifyUserID,
  46. ModifyUserName = usmu.Name,
  47. ModifyTime = stuobj.ModifyTime
  48. };
  49. return query;
  50. }
  51. /// <summary>
  52. /// 查询开放对象中未新增的开放学年信息DictionaryItemView
  53. /// </summary>
  54. /// <param name="expStudentEditObject"></param>
  55. /// <returns></returns>
  56. public IQueryable<DictionaryItemView> GetSchoolyearNumNoAddQueryable(Expression<Func<CF_StudentEditObjects, bool>> expStudentEditObject)
  57. {
  58. var query = from dicitsyn in DictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_SchoolyearNum.ToString())
  59. join stuobj in StudentEditObjectsRepository.GetList(expStudentEditObject)
  60. on dicitsyn.Value equals stuobj.SchoolyearNumID into tempobj
  61. from dicitobj in tempobj.DefaultIfEmpty()
  62. join dicsyn in DictionaryRepository.Entities
  63. on dicitsyn.DictionaryCode equals dicsyn.DictionaryCode
  64. where dicitobj.StudentEditObjectsID == null
  65. select new DictionaryItemView
  66. {
  67. DictionaryItemID = dicitsyn.DictionaryItemID,
  68. DictionaryCode = dicitsyn.DictionaryCode,
  69. DictionaryName = dicsyn.Name,
  70. OrderNo = dicitsyn.OrderNo,
  71. Code = dicitsyn.Code,
  72. Name = dicitsyn.Name,
  73. Value = dicitsyn.Value,
  74. IsEditable = dicitsyn.IsEditable == true ? true : false,
  75. IsVisible = dicitsyn.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
  76. RecordStatus = dicitsyn.RecordStatus
  77. };
  78. return query;
  79. }
  80. }
  81. }