123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.DataLogic.Common.Cultureplan;
- using EMIS.ViewModel.SelectCourse;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.SelectCourse
- {
- public class FreeSelectionCourseDAL
- {
- public FreeSelectionCouseRepository FreeSelectionCouseRepository { get; set; }
- public FreeSelectionCouseTeachingSettingRepository FreeSelectionCouseTeachingSettingRepository { get; set; }
- public Lazy<CoursematerialDAL> CoursematerialDAL { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public IQueryable<FreeSelectionCourseView> GetFreeSelectionCourseViewQueryable(Expression<Func<EM_FreeSelectionCouse, bool>> exp)
- {
- var query = from fsc in FreeSelectionCouseRepository.GetList(exp)
- join fscts in FreeSelectionCouseTeachingSettingRepository.Entities on fsc.FreeSelectionCouseID equals fscts.FreeSelectionCouseID
- join cm in CoursematerialDAL.Value.GetCoursematerialViewQueryable(x => true)
- on fsc.CoursematerialID equals cm.CoursematerialID
- join dicc in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseCategory).Name)
- on fsc.CourseCategoryID equals dicc.Value into ddicc
- from edicc in ddicc.DefaultIfEmpty()
- join dict in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseType).Name)
- on fsc.CourseTypeID equals dict.Value into ddict
- from edict in ddict.DefaultIfEmpty()
- join dicq in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseQuality).Name)
- on fsc.CourseQualityID equals dicq.Value into ddicq
- from edicq in ddicq.DefaultIfEmpty()
- join dics in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_CourseStructure).Name)
- on fsc.CourseStructureID equals dics.Value into ddics
- from edics in ddics.DefaultIfEmpty()
- join disyn in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_SchoolyearNum).Name)
- on fsc.SchoolyearNumID equals disyn.Value into ddisyn
- from edisyn in ddisyn.DefaultIfEmpty()
- join disc in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Semester).Name)
- on fsc.SchoolcodeID equals disc.Value into ddisc
- from edisc in ddisc.DefaultIfEmpty()
- //join dist in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Startterm).Name)
- // on fsc.StarttermID equals dist.Value into ddist
- //from edist in ddist.DefaultIfEmpty()
- join diem in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_ExaminationMode).Name)
- on fsc.ExaminationModeID equals diem.Value into ddiem
- from ediem in ddiem.DefaultIfEmpty()
- join ditl in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Teachinglanguage).Name)
- on fsc.TeachinglanguageID equals ditl.Value into dditl
- from editl in dditl.DefaultIfEmpty()
- select new FreeSelectionCourseView
- {
- FreeSelectionCouseID = fsc.FreeSelectionCouseID,
- //No = fsc.No,
- CollegeID = fsc.CF_Department.CollegeID,
- DepartmentID = fsc.DepartmentID,
- DepartmentName = fsc.CF_Department.Name,
- CourseStructureID = fsc.CourseStructureID,
- CourseStructureName = edics.Name,
- CourseCategoryID = fsc.CourseCategoryID,
- CourseCategoryName = edicc.Name,
- CourseTypeID = fsc.CourseTypeID,
- CourseTypeName = edict.Name,
- CourseQualityID = fsc.CourseQualityID,
- CourseQualityName = edicq.Name,
- ExaminationModeID = fsc.ExaminationModeID,
- ExaminationModeName = ediem.Name,
- TeachinglanguageID = fsc.TeachinglanguageID,
- TeachinglanguageName = editl.Name,
- SchoolyearNumID = fsc.SchoolyearNumID,
- SchoolyearNumName = edisyn.Name,
- SchoolcodeID = fsc.SchoolcodeID,
- SchoolcodeName = edisc.Name,
- PracticeTypeID=fsc.PracticeTypeID,
- //StarttermID = fsc.StarttermID,
- //StarttermName = edist.Name,
- IsEnable = (bool)fsc.IsEnable,
- Credit = fscts.Credit??0,
- TheoryCourse = fscts.TheoryCourse,
- Practicehours = fscts.Practicehours,
- Trialhours = fscts.Trialhours,
- Totalhours=((fscts.TheoryCourse ?? 0) + (fscts.Practicehours ?? 0) + (fscts.Trialhours ?? 0)),
- WeeklyHours = fscts.WeeklyHours,
- WeeklyNum = fscts.WeeklyNum,
- TheoryWeeklyNum = fscts.TheoryWeeklyNum,
- PracticeWeeklyNum = fscts.PracticeWeeklyNum,
- TrialWeeklyNum = fscts.TrialWeeklyNum,
- StartWeeklyNum = fscts.StartWeeklyNum,
- EndWeeklyNum = fscts.EndWeeklyNum,
- CoursematerialID = cm.CoursematerialID,
- CourseCode = cm.CourseCode,
- CourseName = cm.CourseName,
- CreateTime = fsc.CreateTime,
- CreateUserID = fsc.CreateUserID,
- ResultTypeID=fsc.ResultTypeID,
- Remark = fsc.Remark
- };
- return query;
- }
- public IQueryable<FreeSelectionCourseView> GetTeachingModeTypeViewQueryable(Expression<Func<EM_FreeSelectionCouse, bool>> exp)
- {
- var query = from fsc in FreeSelectionCouseRepository.GetList(exp)
- from fsctm in fsc.EM_FreeSelectionCouseTeachingMode
- join ditm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
- on fsctm.TeachingModeID equals ditm.Value
- into dditm
- from editm in dditm.DefaultIfEmpty()
- select new FreeSelectionCourseView
- {
- FreeSelectionCouseID = fsc.FreeSelectionCouseID,
- DepartmentID = fsc.DepartmentID,
- DepartmentName = fsc.CF_Department.Name,
- SchoolyearNumID = fsc.SchoolyearNumID,
- SchoolcodeID = fsc.SchoolcodeID,
- IsEnable = (bool)fsc.IsEnable,
- CoursematerialID = fsc.CoursematerialID,
- TeachingModeName=editm.Name
- };
- return query;
- }
- public IQueryable<Sys_DictionaryItem> GetTeachingModeType(Expression<Func<EM_FreeSelectionCouse, bool>> exp)
- {
- var query = from fsc in FreeSelectionCouseRepository.GetList(exp)
- from fsctm in fsc.EM_FreeSelectionCouseTeachingMode
- join ditm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
- on fsctm.TeachingModeID equals ditm.Value
- into dditm
- from editm in dditm.DefaultIfEmpty()
- select editm;
- return query;
- }
- }
- }
|