123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.SelectCourse;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.SelectCourse
- {
- public class OpenControlSettingDAL
- {
- public SelectCourseOpenControlSettingRepository SelectCourseOpenControlSettingRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public FreeSelectionCourseGradeYearSettingRepository FreeSelectionCourseGradeYearSettingRepository { get; set; }
- public IQueryable<SelectCourseOpenControlSettingView> GetOpenControlSettingView(
- Expression<Func<EM_SelectCourseOpenControlSetting, bool>> openControlSettingExp,
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> schoolYearExp,
- Expression<Func<CF_Grademajor, bool>> gradeMajorExp)
- {
- var q = (from scocs in SelectCourseOpenControlSettingRepository.GetList(openControlSettingExp)
- join sy in SchoolyearRepository.GetList(schoolYearExp) on scocs.SchoolyearID equals sy.SchoolyearID
- join gm in GrademajorRepository.GetList(gradeMajorExp) on scocs.GrademajorID equals gm.GrademajorID
- join dis in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name) on gm.CF_Facultymajor.StandardID equals dis.Value into ddis
- from edis in ddis.DefaultIfEmpty()
- join disy in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.CF_Year).Name) on gm.GradeID equals disy.Value into ddisy
- from edisy in ddisy.DefaultIfEmpty()
- select new SelectCourseOpenControlSettingView
- {
- SelectCourseOpenControlSettingID = scocs.SelectCourseOpenControlSettingID,
- SchoolyearID = scocs.SchoolyearID,
- SchoolyearCode = sy.Code,
- GrademajorID = scocs.GrademajorID,
- GrademajorName = gm.Name,
- GrademajorCode=gm.Code,
- YearID = gm.GradeID,
- YearName = edisy.Name,
- StandardID = gm.CF_Facultymajor.StandardID,
- StandardDesc = edis.Name,
- LearnSystem = gm.CF_Facultymajor.LearnSystem,
- EducationID = gm.CF_Facultymajor.EducationID,
- LearningformID = gm.CF_Facultymajor.LearningformID,
- CollegeID = gm.CF_Facultymajor.CollegeID,
- CollegeName = gm.CF_Facultymajor.CF_College.Name,
- StartTime = scocs.StartTime,
- EndTime = scocs.EndTime,
- MaxSelectCount = scocs.MaxSelectCount,
- MinSelectCount = scocs.MinSelectCount,
- MaxCredit = scocs.MaxCredit,
- MinCredit = scocs.MinCredit,
- Remark = scocs.Remark,
- RecordStatus = scocs.RecordStatus,
- CreateUserID = scocs.CreateUserID,
- CreateTime = scocs.CreateTime,
- ModifyUserID = scocs.ModifyUserID,
- ModifyTime = scocs.ModifyTime
- });
- return q;
- }
- public IQueryable<FreeSelectionCouseControlView> GetFreeSelectionCouseControlView(
- Expression<Func<EM_FreeSelectionCourseGradeYearSetting, bool>> openControlSettingExp)
- {
- var q = (from fr in FreeSelectionCourseGradeYearSettingRepository.GetList(openControlSettingExp)
- join sy in SchoolyearRepository.Entities on fr.SchoolyearID equals sy.SchoolyearID
- select new FreeSelectionCouseControlView
- {
- FreeSelectionCourseGradeYearSettingID = fr.FreeSelectionCourseGradeYearSettingID,
- SchoolyearID = fr.SchoolyearID,
- SchoolyearCode = sy.Code,
- GradeYear = fr.GradeYear,
- StartTime = fr.StartTime,
- EndTime = fr.EndTime,
- MaxSelectCount = fr.MaxSelectCount??0,
- MinSelectCount = fr.MinSelectCount??0,
- MaxCredit = fr.MaxCredit??0,
- MinCredit = fr.MinCredit??0,
- Remark = fr.Remark,
- });
- return q;
- }
- }
- }
|