TypeSettingDAL.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.SelectCourse;
  6. using EMIS.DataLogic.Repositories;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel;
  10. namespace EMIS.DataLogic.SelectCourse
  11. {
  12. public class TypeSettingDAL
  13. {
  14. public SelectCourseTypeSettingRepository SelectCourseTypeSettingRepository { get; set; }
  15. public SchoolyearRepository SchoolyearRepository { get; set; }
  16. public DictionaryItemRepository DictionaryItemRepository { get; set; }
  17. public IQueryable<SelectCourseTypeSettingView> GetTypeSettingView(Expression<Func<EM_SelectCourseTypeSetting, bool>> typeSettingExp,
  18. Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> schoolYearExp)
  19. {
  20. var q = (from scts in SelectCourseTypeSettingRepository.GetList(typeSettingExp)
  21. join sy in SchoolyearRepository.GetList(schoolYearExp) on scts.SchoolyearID equals sy.SchoolyearID
  22. join disct in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EM_SelectCourseType).Name) on scts.SelectCourseTypeID equals disct.Value into ddisct
  23. from edisct in ddisct.DefaultIfEmpty()
  24. join dirs in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(SYS_STATUS).Name) on scts.RecordStatus equals dirs.Value into ddirs
  25. from edirs in ddirs.DefaultIfEmpty()
  26. select new SelectCourseTypeSettingView
  27. {
  28. SelectCourseTypeSettingID = scts.SelectCourseTypeSettingID,
  29. SchoolyearID = scts.SchoolyearID,
  30. SchoolyearCode = sy.Code,
  31. SelectCourseTypeID = scts.SelectCourseTypeID,
  32. SelectCourseTypeDesc = edisct.Name,
  33. StartTime = scts.StartTime,
  34. EndTime = scts.EndTime,
  35. MaxSelectCount = scts.MaxSelectCount,
  36. MinSelectCount = scts.MinSelectCount,
  37. MaxCredit = scts.MaxCredit,
  38. MinCredit = scts.MinCredit,
  39. Remark = scts.Remark,
  40. RecordStatus = scts.RecordStatus,
  41. RecordStatusDesc = edirs.Name,
  42. CreateUserID = scts.CreateUserID,
  43. CreateTime = scts.CreateTime,
  44. ModifyUserID = scts.ModifyUserID,
  45. ModifyTime = scts.ModifyTime
  46. });
  47. return q;
  48. }
  49. }
  50. }