ProjectFeeDAL.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using EMIS.ViewModel.ExamManage;
  9. namespace EMIS.DataLogic.ExamManage
  10. {
  11. public class ProjectFeeDAL
  12. {
  13. public ExaminationProjectFeeTypeRepository ProjectFeeTypeRepository { get; set; }
  14. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  15. public ExaminationProjectFeeRepository ProjectFeeRepository { get; set; }
  16. public ExaminationProjectRepository ProjectRepository { get; set; }
  17. public ExaminationTypeRepository TypeRepository { get; set; }
  18. public ExaminationProjectSubjectRepository ProjectSubjectRepository { get; set; }
  19. public ExaminationBatchProjectRepository BatchProjectRepository { get; set; }
  20. public ExaminationBatchProjectControlRepository ExaminationBatchProjectControlRepository { get; set; }
  21. public ExaminationProjectFeeRepository ExaminationProjectFeeRepository { get; set; }
  22. public IQueryable<EMIS.ViewModel.ProjectFeeTypeView> GetProjectFeeTypeGrid(Expression<Func<EX_ExaminationProjectFeeType, bool>> expCampus)
  23. {
  24. var query = from a in ProjectFeeTypeRepository.GetList(expCampus)
  25. join c in DictionaryItemRepository.Entities
  26. on new { a.FeeTypeID, DictionaryCode = "EX_ExaminationProjectFeeType" } equals new { FeeTypeID = c.Value, c.DictionaryCode }
  27. select new EMIS.ViewModel.ProjectFeeTypeView
  28. {
  29. ExaminationProjectFeeTypeID = a.ExaminationProjectFeeTypeID,
  30. ExaminationProjectFeeID = a.ExaminationProjectFeeID,
  31. Fee = a.Fee,
  32. FeeTypeID = a.FeeTypeID,
  33. FeeTypeName = c.Name,
  34. IsRequiredForNew = a.IsRequiredForNew,
  35. IsResit = a.IsResit,
  36. IsMaterial = a.IsMaterial,
  37. IsTrainingFee = a.IsTrainingFee,
  38. IsResitText = a.IsResit == true ? "是" : "否",
  39. IsMaterialText = a.IsMaterial == true ? "是" : "否",
  40. IsTrainingFeeText = a.IsTrainingFee == true ? "是" : "否"
  41. };
  42. return query;
  43. }
  44. public IQueryable<EMIS.ViewModel.ExaminationProjectView> GetProectListViewGrid(Expression<Func<EX_ExaminationProject, bool>> expFeetype)
  45. {
  46. var query = from a in ProjectRepository.Entities.Where(expFeetype)
  47. join c in DictionaryItemRepository.Entities
  48. on new { a.ExaminationLevelID, DictionaryCode = "EX_ExaminationLevel" } equals new { ExaminationLevelID = c.Value, c.DictionaryCode }
  49. join d in DictionaryItemRepository.Entities
  50. on new { a.IssuedByID, DictionaryCode = "EX_Issuer" } equals new { IssuedByID = d.Value, d.DictionaryCode }
  51. select new EMIS.ViewModel.ExaminationProjectView
  52. {
  53. ExaminationLevelID = a.ExaminationLevelID,
  54. ExaminationProjectID = a.ExaminationProjectID,
  55. ExaminationType = a.EX_ExaminationType.Name,
  56. ExaminationTypeID = a.ExaminationTypeID,
  57. Name = a.Name,
  58. IssuedByID = a.IssuedByID,
  59. ExaminationLevelText = c.Name,
  60. IssuedByIDText = d.Name,
  61. EX_ExaminationProjectSubject = a.EX_ExaminationProjectSubject,
  62. PreposeProjectID = a.PreposeProjectID,
  63. Remark = a.Remark
  64. };
  65. return query;
  66. }
  67. public IQueryable<EMIS.ViewModel.ExaminationProjectViewNotSubject> GetProectListViewGridForSelect(Expression<Func<EX_ExaminationProject, bool>> expFeetype)
  68. {
  69. var query = from a in ProjectRepository.Entities.Where(expFeetype)
  70. join c in DictionaryItemRepository.Entities
  71. on new { a.ExaminationLevelID, DictionaryCode = "EX_ExaminationLevel" } equals new { ExaminationLevelID = c.Value, c.DictionaryCode }
  72. join d in DictionaryItemRepository.Entities
  73. on new { a.IssuedByID, DictionaryCode = "EX_Issuer" } equals new { IssuedByID = d.Value, d.DictionaryCode }
  74. select new EMIS.ViewModel.ExaminationProjectViewNotSubject
  75. {
  76. ExaminationLevelID = a.ExaminationLevelID,
  77. ExaminationProjectID = a.ExaminationProjectID,
  78. ExaminationType = a.EX_ExaminationType.Name,
  79. ExaminationTypeID = a.ExaminationTypeID,
  80. Name = a.Name,
  81. IssuedByID = a.IssuedByID,
  82. ExaminationLevelText = c.Name,
  83. IssuedByIDText = d.Name,
  84. PreposeProjectID = a.PreposeProjectID,
  85. Remark = a.Remark
  86. };
  87. return query;
  88. }
  89. public IQueryable<EMIS.ViewModel.ProjectFeeTypeView> GetProjectFeeType(Expression<Func<EX_ExaminationProjectFeeType, bool>> expFeetype)
  90. {
  91. var query = from a in ProjectFeeTypeRepository.Entities.Where(expFeetype)
  92. join c in DictionaryItemRepository.Entities
  93. on new { a.FeeTypeID, DictionaryCode = "EX_ExaminationProjectFeeType" } equals new { FeeTypeID = c.Value, c.DictionaryCode }
  94. select new EMIS.ViewModel.ProjectFeeTypeView
  95. {
  96. ExaminationProjectFeeTypeID = a.ExaminationProjectFeeTypeID,
  97. ExaminationProjectFeeID = a.ExaminationProjectFeeID,
  98. Fee = a.Fee,
  99. FeeTypeID = a.FeeTypeID,
  100. FeeTypeName = c.Name,
  101. IsRequiredForNew = a.IsRequiredForNew,
  102. IsResitText = a.IsResit == true ? "是" : "否",
  103. IsMaterialText = a.IsMaterial == true ? "是" : "否",
  104. IsTrainingFeeText = a.IsTrainingFee == true ? "是" : "否",
  105. IsResit = a.IsResit,
  106. IsMaterial = a.IsMaterial,
  107. IsTrainingFee = a.IsTrainingFee,
  108. };
  109. return query;
  110. }
  111. public IQueryable<EMIS.ViewModel.ExaminationProjectFeeView> GetProjectFee(Expression<Func<EX_ExaminationProjectFee, bool>> expFee)
  112. {
  113. var query = from a in ProjectFeeRepository.Entities.Where(expFee)
  114. join p in ProjectRepository.Entities on a.ExaminationProjectID equals p.ExaminationProjectID
  115. select new EMIS.ViewModel.ExaminationProjectFeeView
  116. {
  117. ExaminationProjectFeeID = a.ExaminationProjectFeeID,
  118. ExaminationType = p.EX_ExaminationType.Name,
  119. ExaminationProjectID = a.ExaminationProjectID,
  120. Name = a.Name,
  121. ProjectName = p.Name,
  122. ExaminationTypeID = p.ExaminationTypeID,
  123. RecordStatus = a.RecordStatus.Value
  124. };
  125. return query;
  126. }
  127. public IQueryable<EMIS.ViewModel.ExaminationProjectFeeView> GerProjectFeeByProjectAndYearStandard(Expression<Func<EX_ExaminationBatchProjectControl, bool>> expebpc)
  128. {
  129. var query = from ebpcr in ExaminationBatchProjectControlRepository.Entities.Where(expebpc)
  130. from epfr in ExaminationProjectFeeRepository.Entities.Where(x => ebpcr.ExaminationProjectFeeID == x.ExaminationProjectFeeID)
  131. select new EMIS.ViewModel.ExaminationProjectFeeView
  132. {
  133. ExaminationProjectFeeID = ebpcr.ExaminationProjectFeeID.Value,
  134. ExaminationProjectID = epfr.ExaminationProjectID,
  135. Name = epfr.Name,
  136. ProjectName = epfr.EX_ExaminationProject.Name,
  137. };
  138. return query;
  139. }
  140. public IQueryable<EX_ExaminationType> GetExaminationType(Expression<Func<EX_ExaminationType, bool>> expFee)
  141. {
  142. var query = from a in TypeRepository.Entities.Where(expFee)
  143. select a;
  144. return query;
  145. }
  146. public IQueryable<EMIS.ViewModel.ExaminationProjectSubjectView> GetProjectSubjectList(Expression<Func<EX_ExaminationProjectSubject, bool>> expFee)
  147. {
  148. var query = from a in ProjectSubjectRepository.Entities.Where(expFee)
  149. join c in DictionaryItemRepository.Entities
  150. on new { a.ExaminationSubjectID, DictionaryCode = "EX_ExaminationSubject" } equals new { ExaminationSubjectID = c.Value, c.DictionaryCode }
  151. select new EMIS.ViewModel.ExaminationProjectSubjectView
  152. {
  153. ExaminationProjectSubjectID = a.ExaminationProjectSubjectID,
  154. ExaminationSubject = c.Name,
  155. ExaminationSubjectID = a.ExaminationSubjectID,
  156. ExaminationProjectID = a.ExaminationProjectID,
  157. SubjectCode = c.Code
  158. };
  159. return query;
  160. }
  161. public IQueryable<ExamSubjectView> GetExamSubjectByProjectID(Expression<Func<EX_ExaminationProjectSubject, bool>> expeps)
  162. {
  163. var query = from psr in ProjectSubjectRepository.Entities.Where(expeps)
  164. from dic in DictionaryItemRepository.Entities.Where(x => x.DictionaryCode == "EX_ExaminationSubject" && x.Value == psr.ExaminationSubjectID)
  165. select new ExamSubjectView
  166. {
  167. ExaminationSubjectID = psr.ExaminationSubjectID,
  168. ExaminationSubjectName = dic.Name,
  169. ResitCount = psr.ResitCount,
  170. };
  171. return query;
  172. }
  173. public IQueryable<ExamSubjectView> GetExamSubject()
  174. {
  175. var query = from dic in DictionaryItemRepository.Entities.Where(x => x.DictionaryCode == "EX_ExaminationSubject")
  176. select new ExamSubjectView
  177. {
  178. ExaminationSubjectID = dic.Value,
  179. ExaminationSubjectName = dic.Name,
  180. //ResitCount = psr.ResitCount,
  181. };
  182. return query;
  183. }
  184. }
  185. }