StudentEncourageDAL.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using EMIS.DataLogic.Repositories;
  7. using EMIS.Entities;
  8. using EMIS.ViewModel.StudentManage.StudentProfile;
  9. namespace EMIS.DataLogic.StudentManage.StudentProfile
  10. {
  11. public class StudentEncourageDAL
  12. {
  13. public StudentEncourageRepository StudentEncourageRepository { get; set; }
  14. public SchoolyearRepository SchoolyearRepository { get; set; }
  15. public StudentRepository StudentRepository { get; set; }
  16. public ClassmajorRepository ClassmajorRepository { get; set; }
  17. public GrademajorRepository GrademajorRepository { get; set; }
  18. public FacultymajorRepository FacultymajorRepository { get; set; }
  19. public CollegeRepository CollegeRepository { get; set; }
  20. public CampusRepository CampusRepository { get; set; }
  21. public UserRepository UserRepository { get; set; }
  22. /// <summary>
  23. /// 查询对应的学生奖励信息StudentEncourageView
  24. /// </summary>
  25. /// <param name="expStudentEncourage"></param>
  26. /// <returns></returns>
  27. public IQueryable<StudentEncourageView> GetStudentEncourageViewQueryable(Expression<Func<EM_StudentEncourage, bool>> expStudentEncourage)
  28. {
  29. var query = from stuenc in StudentEncourageRepository.GetList(expStudentEncourage)
  30. join sy in SchoolyearRepository.Entities
  31. on stuenc.SchoolyearID equals sy.SchoolyearID
  32. join stu in StudentRepository.Entities
  33. on stuenc.UserID equals stu.UserID
  34. join cl in ClassmajorRepository.Entities
  35. on stu.ClassmajorID equals cl.ClassmajorID
  36. join gr in GrademajorRepository.Entities
  37. on cl.GrademajorID equals gr.GrademajorID
  38. join fa in FacultymajorRepository.Entities
  39. on gr.FacultymajorID equals fa.FacultymajorID
  40. join col in CollegeRepository.Entities
  41. on fa.CollegeID equals col.CollegeID
  42. join cam in CampusRepository.Entities
  43. on col.CampusID equals cam.CampusID
  44. join us in UserRepository.Entities
  45. on stu.UserID equals us.UserID
  46. select new StudentEncourageView
  47. {
  48. StudentEncourageID = stuenc.StudentEncourageID,
  49. SchoolyearID = stuenc.SchoolyearID,
  50. SchoolyearValue = sy.Value,
  51. SchoolyearCode = sy.Code,
  52. UserID = stuenc.UserID,
  53. StudentNo = us.LoginID,
  54. Name = us.Name,
  55. SexID = stu.SexID,
  56. BirthDate = stu.BirthDate,
  57. NationID = stu.NationID,
  58. PoliticsID = stu.PoliticsID,
  59. InSchoolStatusID = stu.InSchoolStatusID,
  60. StudentStatus = stu.StudentStatus,
  61. GradeID = gr.GradeID,
  62. StandardID = fa.StandardID,
  63. EducationID = fa.EducationID,
  64. LearningformID = fa.LearningformID,
  65. LearnSystem = fa.LearnSystem,
  66. ClassNum = cl.ClassNum,
  67. ClassmajorID = stu.ClassmajorID,
  68. ClassmajorNo = cl.No,
  69. ClassmajorName = cl.Name,
  70. GrademajorID = cl.GrademajorID,
  71. GrademajorCode = gr.Code,
  72. GrademajorName = gr.Name,
  73. FacultymajorID = gr.FacultymajorID,
  74. FacultymajorCode = fa.Code,
  75. FacultymajorName = fa.Name,
  76. CollegeID = fa.CollegeID,
  77. CollegeNo = col.No,
  78. CollegeName = col.Name,
  79. CampusID = col.CampusID,
  80. CampusCode = cam.No,
  81. CampusName = cam.Name,
  82. EncourageNameID = stuenc.EncourageNameID,
  83. EncourageTypeID = stuenc.EncourageTypeID,
  84. EncourageLevelID = stuenc.EncourageLevelID,
  85. DocNo = stuenc.DocNo,
  86. Unit = stuenc.Unit,
  87. EncourageDate = stuenc.EncourageDate,
  88. Amount = stuenc.Amount,
  89. Reason = stuenc.Reason,
  90. ApprovalStatus = stuenc.ApprovalStatus,
  91. RecordStatus = stuenc.RecordStatus,
  92. CreateUserID = stuenc.CreateUserID,
  93. CreateTime = stuenc.CreateTime,
  94. ModifyUserID = stuenc.ModifyUserID,
  95. ModifyTime = stuenc.ModifyTime
  96. };
  97. return query;
  98. }
  99. /// <summary>
  100. /// 查询对应的学生奖励信息StudentEncourageView
  101. /// </summary>
  102. /// <param name="expStudentEncourage"></param>
  103. /// <param name="expStudent"></param>
  104. /// <returns></returns>
  105. public IQueryable<StudentEncourageView> GetStudentEncourageViewQueryable(Expression<Func<EM_StudentEncourage, bool>> expStudentEncourage, Expression<Func<CF_Student, bool>> expStudent)
  106. {
  107. var query = from stuenc in StudentEncourageRepository.GetList(expStudentEncourage)
  108. join sy in SchoolyearRepository.Entities
  109. on stuenc.SchoolyearID equals sy.SchoolyearID
  110. join stu in StudentRepository.GetList(expStudent)
  111. on stuenc.UserID equals stu.UserID
  112. join cl in ClassmajorRepository.Entities
  113. on stu.ClassmajorID equals cl.ClassmajorID
  114. join gr in GrademajorRepository.Entities
  115. on cl.GrademajorID equals gr.GrademajorID
  116. join fa in FacultymajorRepository.Entities
  117. on gr.FacultymajorID equals fa.FacultymajorID
  118. join col in CollegeRepository.Entities
  119. on fa.CollegeID equals col.CollegeID
  120. join cam in CampusRepository.Entities
  121. on col.CampusID equals cam.CampusID
  122. join us in UserRepository.Entities
  123. on stu.UserID equals us.UserID
  124. select new StudentEncourageView
  125. {
  126. StudentEncourageID = stuenc.StudentEncourageID,
  127. SchoolyearID = stuenc.SchoolyearID,
  128. SchoolyearValue = sy.Value,
  129. SchoolyearCode = sy.Code,
  130. UserID = stuenc.UserID,
  131. StudentNo = us.LoginID,
  132. Name = us.Name,
  133. SexID = stu.SexID,
  134. BirthDate = stu.BirthDate,
  135. NationID = stu.NationID,
  136. PoliticsID = stu.PoliticsID,
  137. InSchoolStatusID = stu.InSchoolStatusID,
  138. StudentStatus = stu.StudentStatus,
  139. GradeID = gr.GradeID,
  140. StandardID = fa.StandardID,
  141. EducationID = fa.EducationID,
  142. LearningformID = fa.LearningformID,
  143. LearnSystem = fa.LearnSystem,
  144. ClassNum = cl.ClassNum,
  145. ClassmajorID = stu.ClassmajorID,
  146. ClassmajorNo = cl.No,
  147. ClassmajorName = cl.Name,
  148. GrademajorID = cl.GrademajorID,
  149. GrademajorCode = gr.Code,
  150. GrademajorName = gr.Name,
  151. FacultymajorID = gr.FacultymajorID,
  152. FacultymajorCode = fa.Code,
  153. FacultymajorName = fa.Name,
  154. CollegeID = fa.CollegeID,
  155. CollegeNo = col.No,
  156. CollegeName = col.Name,
  157. CampusID = col.CampusID,
  158. CampusCode = cam.No,
  159. CampusName = cam.Name,
  160. EncourageNameID = stuenc.EncourageNameID,
  161. EncourageTypeID = stuenc.EncourageTypeID,
  162. EncourageLevelID = stuenc.EncourageLevelID,
  163. DocNo = stuenc.DocNo,
  164. Unit = stuenc.Unit,
  165. EncourageDate = stuenc.EncourageDate,
  166. Amount = stuenc.Amount,
  167. Reason = stuenc.Reason,
  168. ApprovalStatus = stuenc.ApprovalStatus,
  169. RecordStatus = stuenc.RecordStatus,
  170. CreateUserID = stuenc.CreateUserID,
  171. CreateTime = stuenc.CreateTime,
  172. ModifyUserID = stuenc.ModifyUserID,
  173. ModifyTime = stuenc.ModifyTime
  174. };
  175. return query;
  176. }
  177. }
  178. }