StaffDAL.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.TeacherManagement;
  7. using EMIS.Entities;
  8. using System.Linq.Expressions;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.Common.TeacherManagement
  11. {
  12. public class StaffDAL
  13. {
  14. public StaffRepository staffRepository { get; set; }
  15. public StaffProfileRepository staffProfileRepository { get; set; }
  16. public DictionaryItemRepository dictionaryItemRepository { get; set; }
  17. public UserRepository UserRepository { get; set; }
  18. public IQueryable<CF_Campus> GetUserInChargeCampus(Expression<Func<CF_Staff, bool>> exp)
  19. {
  20. var query = from s in staffRepository.GetList(exp)
  21. from smc in s.CF_StaffManageCampus
  22. select smc.CF_Campus;
  23. return query;
  24. }
  25. public IQueryable<CF_College> GetUserInChargeCollege(Expression<Func<CF_Staff, bool>> exp)
  26. {
  27. var query = from s in staffRepository.GetList(exp)
  28. from smc in s.CF_StaffManageCollege
  29. select smc.CF_College;
  30. return query;
  31. }
  32. public IQueryable<CF_Department> GetUserInChargeDepartment(Expression<Func<CF_Staff, bool>> exp)
  33. {
  34. var query = from s in staffRepository.GetList(exp)
  35. from smd in s.CF_StaffManageDepartment
  36. select smd.CF_Department;
  37. return query;
  38. }
  39. /// <summary>
  40. /// 查询教师详细信息
  41. /// </summary>
  42. /// <param name="exp"></param>
  43. /// <returns></returns>
  44. public IQueryable<StaffView> GetStaffViewQueryable(Expression<Func<CF_Staff, bool>> exp)
  45. {
  46. var query = from a in staffRepository.GetList(exp)
  47. select new StaffView
  48. {
  49. UserID = a.UserID,
  50. Name = a.Sys_User.Name,
  51. DepartmentID = a.DepartmentID,
  52. DepartmentCode = a.CF_Department.No,
  53. DepartmentName = a.CF_Department.Name,
  54. CampusID = a.CF_College.CampusID,
  55. CampusCode = a.CF_College.CF_Campus.No,
  56. CampusName = a.CF_College.CF_Campus.Name,
  57. CollegeID = a.CF_College.CollegeID,
  58. CollegeNo = a.CF_College.No,
  59. CollegeName = a.CF_College.Name,
  60. StaffCode = a.Sys_User.LoginID,
  61. BirthDate = a.BirthDate,
  62. Sex = a.Sex,
  63. TeacherType = a.TeacherType,
  64. IncumbencyState = a.IncumbencyState,
  65. CertificatesType = a.CertificatesType,
  66. CertificatesNum = a.CertificatesNum,
  67. Situation = a.Situation,
  68. LiteracyLevels = a.LiteracyLevels,
  69. DegreeState = a.DegreeState,
  70. LearnPosition = a.LearnPosition,
  71. Title = a.Title,
  72. WorkDate = a.WorkDate,
  73. ComeSchoolDate = a.ComeSchoolDate,
  74. TeachingDate = a.TeachingDate,
  75. PhotoUrl = a.PhotoUrl,
  76. Profile = a.Profile,
  77. UsedName = a.CF_StaffProfile.UsedName,
  78. Nation = a.CF_StaffProfile.Nation,
  79. Place = a.CF_StaffProfile.Place,
  80. EducationCode = a.CF_StaffProfile.EducationCode,
  81. Telephone = a.CF_StaffProfile.Telephone,
  82. OfficeTelephone = a.CF_StaffProfile.OfficeTelephone,
  83. Mobile = a.CF_StaffProfile.Mobile,
  84. Email = a.CF_StaffProfile.Email,
  85. QQ = a.CF_StaffProfile.QQ,
  86. Nationality = a.CF_StaffProfile.Nationality,
  87. HealthState = a.CF_StaffProfile.HealthState,
  88. HousePhone = a.CF_StaffProfile.HousePhone,
  89. Address = a.CF_StaffProfile.Address,
  90. Postcode = a.CF_StaffProfile.Postcode,
  91. HomeAddress = a.CF_StaffProfile.HomeAddress,
  92. NowAddress = a.CF_StaffProfile.NowAddress,
  93. Residence = a.CF_StaffProfile.Residence,
  94. Speciality = a.CF_StaffProfile.Speciality,
  95. WeChatNum = a.CF_StaffProfile.WeChatNum,
  96. Religion = a.CF_StaffProfile.Religion,
  97. PaymentLevelID = a.PaymentLevelID,
  98. IsDualTeacher = (a.IsDualTeacher ?? false),
  99. CreateUserID = a.CreateUserID,
  100. CreateTime = a.CreateTime,
  101. Remarks = a.Remarks,
  102. Account=a.CF_StaffProfile.Account
  103. };
  104. return query;
  105. }
  106. }
  107. }