EvaluationTableDAL.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using System.Text;
  6. using EMIS.Entities;
  7. using EMIS.ViewModel.EvaluationManage.EvaluationTable;
  8. using EMIS.DataLogic.Repositories;
  9. namespace EMIS.DataLogic.EvaluationManage.EvaluationTable
  10. {
  11. public class EvaluationTableDAL
  12. {
  13. public EvaluationTableRepository EvaluationTableRepository { get; set; }
  14. public EvaluationParticipateTypeRepository EvaluationParticipateTypeRepository { get; set; }
  15. public EvaluationIntTypeRepository EvaluationIntTypeRepository { get; set; }
  16. public EvaluationTargetRepository EvaluationTargetRepository { get; set; }
  17. public EvaluationProjectRepository EvaluationProjectRepository { get; set; }
  18. public UserRepository UserRepository { get; set; }
  19. /// <summary>
  20. /// 查询对应的评价表信息EvaluationTableView
  21. /// </summary>
  22. /// <param name="expEvaluationTable"></param>
  23. /// <returns></returns>
  24. public IQueryable<EvaluationTableView> GetEvaluationTableViewQueryable(Expression<Func<EM_EvaluationTable, bool>> expEvaluationTable)
  25. {
  26. var query = from evtb in EvaluationTableRepository.GetList(expEvaluationTable)
  27. join evpt in EvaluationParticipateTypeRepository.Entities
  28. on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
  29. join evit in EvaluationIntTypeRepository.Entities
  30. on evtb.EvaluationIntTypeID equals evit.EvaluationIntTypeID
  31. join tg in
  32. (
  33. from tg in EvaluationTargetRepository.Entities
  34. group tg by tg.EvaluationTableID into gtg
  35. select new
  36. {
  37. EvaluationTableID = gtg.Key,
  38. TargetCount = gtg.Count()
  39. }
  40. )
  41. on evtb.EvaluationTableID equals tg.EvaluationTableID into temptg
  42. from evtg in temptg.DefaultIfEmpty()
  43. join pj in
  44. (
  45. from pj in EvaluationProjectRepository.Entities
  46. group pj by pj.EM_EvaluationTarget.EM_EvaluationTable.EvaluationTableID into gpj
  47. select new
  48. {
  49. EvaluationTableID = gpj.Key,
  50. ProjectCount = gpj.Count()
  51. }
  52. )
  53. on evtb.EvaluationTableID equals pj.EvaluationTableID into temppj
  54. from evpj in temppj.DefaultIfEmpty()
  55. join usc in UserRepository.Entities
  56. on evtb.CreateUserID equals usc.UserID into tempusc
  57. from uscu in tempusc.DefaultIfEmpty()
  58. join usm in UserRepository.Entities
  59. on evtb.ModifyUserID equals usm.UserID into tempusm
  60. from usmu in tempusm.DefaultIfEmpty()
  61. select new EvaluationTableView
  62. {
  63. EvaluationTableID = evtb.EvaluationTableID,
  64. Code = evtb.Code,
  65. Name = evtb.Name,
  66. EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
  67. ParticipateTypeID = evpt.ParticipateTypeID,
  68. IsStudent = evpt.IsStudent.Value,
  69. EvaluationTypeID = evtb.EvaluationIntTypeID,
  70. EvaluationTypeCode = evit.Code,
  71. EvaluationTypeName = evit.Name,
  72. TeachingModeIDList = evit.EM_EvaluationTeachingMode.OrderBy(x => x.TeachingModeID).Select(x => x.TeachingModeID).ToList(),
  73. Weight = evtb.Weight,
  74. TargetCount = evtg.TargetCount == null ? 0 : evtg.TargetCount,
  75. ProjectCount = evpj.ProjectCount == null ? 0 : evpj.ProjectCount,
  76. IsEnabled = evtb.IsEnabled.Value,
  77. Remark = evtb.Remark,
  78. RecordStatus = evtb.RecordStatus,
  79. CreateUserID = evtb.CreateUserID,
  80. CreateUserName = uscu.Name,
  81. CreateTime = evtb.CreateTime,
  82. ModifyUserID = evtb.ModifyUserID,
  83. ModifyUserName = usmu.Name,
  84. ModifyTime = evtb.ModifyTime
  85. };
  86. return query;
  87. }
  88. /// <summary>
  89. /// 查询对应的评价指标信息EvaluationTargetView(统计对应的评价项目个数)
  90. /// </summary>
  91. /// <param name="expEvaluationTable"></param>
  92. /// <returns></returns>
  93. public IQueryable<EvaluationTargetView> GetEvaluationTargetViewQueryable(Expression<Func<EM_EvaluationTable, bool>> expEvaluationTable)
  94. {
  95. //var query = from col in CollegeRepository.GetList(expCollege)
  96. // join dep in DepartmentRepository.Entities
  97. // on col.CollegeID equals dep.CollegeID
  98. // join c in UserRepository.Entities
  99. // on dep.CF_DepartmentProfile.DirectorID equals c.UserID into gu
  100. // from guic in gu.DefaultIfEmpty()
  101. // join d in UserRepository.Entities
  102. // on dep.CF_DepartmentProfile.DeputyDirectorID equals d.UserID into gude
  103. // from gudeic in gude.DefaultIfEmpty()
  104. // join sta in
  105. // (
  106. // from sta in StaffRepository.Entities
  107. // group sta by sta.DepartmentID into stagr
  108. // select new
  109. // {
  110. // DepartmentID = stagr.Key,
  111. // StaffCount = stagr.Count()
  112. // }
  113. // )
  114. // on dep.DepartmentID equals sta.DepartmentID into tempsta
  115. // from stadep in tempsta.DefaultIfEmpty()
  116. // select new DepartmentView
  117. // {
  118. // DepartmentID = dep.DepartmentID,
  119. // No = dep.No,
  120. // Name = dep.Name,
  121. // SimpleName = dep.SimpleName,
  122. // EnglishName = dep.EnglishName,
  123. // CampusID = col.CampusID,
  124. // CampusNo = col.CF_Campus.No,
  125. // CampusName = col.CF_Campus.Name,
  126. // CollegeID = dep.CollegeID,
  127. // CollegeCode = col.No,
  128. // CollegeName = col.Name,
  129. // HierarchyID = dep.HierarchyID,
  130. // DirectorID = dep.CF_DepartmentProfile.DirectorID,
  131. // DirectorName = guic.Name,
  132. // DeputyDirectorID = dep.CF_DepartmentProfile.DeputyDirectorID,
  133. // DeputyDirectorName = gudeic.Name,
  134. // FoundDate = dep.CF_DepartmentProfile.FoundDate,
  135. // StaffCount = stadep.StaffCount == null ? 0 : stadep.StaffCount,
  136. // Remark = dep.Remark,
  137. // RecordStatus = dep.RecordStatus,
  138. // CreateUserID = dep.CreateUserID,
  139. // CreateTime = dep.CreateTime,
  140. // ModifyUserID = dep.ModifyUserID,
  141. // ModifyTime = dep.ModifyTime
  142. // };
  143. return null; ;
  144. }
  145. /// <summary>
  146. /// 查询对应的评价项目信息EvaluationProjectView
  147. /// </summary>
  148. /// <param name="expCollege"></param>
  149. /// <returns></returns>
  150. public IQueryable<EvaluationProjectView> GetEvaluationProjectViewQueryable(Expression<Func<EM_EvaluationTable, bool>> expEvaluationTable)
  151. {
  152. //var query = from col in CollegeRepository.GetList(expCollege)
  153. // join sf in StaffRepository.Entities
  154. // on col.CollegeID equals sf.CollegeID
  155. // join pr in StaffProfileRepository.Entities
  156. // on sf.UserID equals pr.UserID into temppr
  157. // from sfpr in temppr.DefaultIfEmpty()
  158. // join dep in DepartmentRepository.Entities
  159. // on sf.DepartmentID equals dep.DepartmentID into tempdep
  160. // from sfdep in tempdep.DefaultIfEmpty()
  161. // join us in UserRepository.Entities
  162. // on sf.UserID equals us.UserID
  163. // select new StaffView
  164. // {
  165. // UserID = sf.UserID,
  166. // StaffCode = us.LoginID,
  167. // Name = us.Name,
  168. // UsedName = sfpr.UsedName,
  169. // CampusID = col.CampusID,
  170. // CampusCode = col.CF_Campus.No,
  171. // CampusName = col.CF_Campus.Name,
  172. // CollegeID = sf.CollegeID,
  173. // CollegeNo = col.No,
  174. // CollegeName = col.Name,
  175. // DepartmentID = sf.DepartmentID,
  176. // DepartmentCode = sfdep.No,
  177. // DepartmentName = sfdep.Name,
  178. // Nationality = sfpr.Nationality,
  179. // Place = sfpr.Place,
  180. // SexID = sf.SexID,
  181. // BirthDate = sf.BirthDate,
  182. // NationID = sf.NationID,
  183. // PoliticsID = sf.PoliticsID,
  184. // CertificatesType = sf.CertificatesType,
  185. // CertificatesNum = sf.CertificatesNum,
  186. // TeacherTypeID = sf.TeacherTypeID,
  187. // IncumbencyState = sf.IncumbencyState,
  188. // SituationID = sf.SituationID,
  189. // TitleID = sf.TitleID,
  190. // LiteracyLevelID = sf.LiteracyLevelID,
  191. // LearnPositionID = sf.LearnPositionID,
  192. // IsDualTeacher = sf.IsDualTeacher ?? false,
  193. // PaymentLevelID = sf.PaymentLevelID,
  194. // WorkDate = sf.WorkDate,
  195. // ComeSchoolDate = sf.ComeSchoolDate,
  196. // Email = sfpr.Email,
  197. // ZIPCode = sfpr.ZIPCode,
  198. // WeChatNum = sfpr.WeChatNum,
  199. // QQ = sfpr.QQ,
  200. // Telephone = sfpr.Telephone,
  201. // OfficeTelephone = sfpr.OfficeTelephone,
  202. // HousePhone = sfpr.HousePhone,
  203. // Mobile = sfpr.Mobile,
  204. // Speciality = sfpr.Speciality,
  205. // HealthStateID = sfpr.HealthStateID,
  206. // ReligionID = sfpr.ReligionID,
  207. // Account = sfpr.Account,
  208. // Residence = sfpr.Residence,
  209. // HomeAddress = sfpr.HomeAddress,
  210. // Address = sfpr.Address,
  211. // NowAddress = sfpr.NowAddress,
  212. // PhotoUrl = sf.PhotoUrl,
  213. // PhotoHasValue = (sf.PhotoUrl == null || sf.PhotoUrl == "") ? false : true,
  214. // Profile = sf.Profile,
  215. // Remark = sf.Remark,
  216. // RecordStatus = sf.RecordStatus,
  217. // CreateUserID = sf.CreateUserID,
  218. // CreateTime = sf.CreateTime,
  219. // ModifyUserID = sf.ModifyUserID,
  220. // ModifyTime = sf.ModifyTime
  221. // };
  222. return null;
  223. }
  224. }
  225. }