12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMISOnline.Entities;
- using System.Linq.Expressions;
- using EMISOnline.DataLogic.Repositories;
- using EMISOnline.ViewModel.Educational;
- using EMISOnline.ViewModel;
- namespace EMISOnline.DataLogic.Educational
- {
- public class CourseDAL
- {
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
- public ExecutablePlanTeachingSettingRepository ExecutablePlanTeachingSettingRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public IQueryable<CoursematerView> GetCourseList()
- {
- var query = from com in CoursematerialRepository.Entities
- //join exp in ExecutablePlanRepository.Entities on com.CoursematerialID equals exp.CoursematerialID into expResult
- //from expr in expResult.DefaultIfEmpty()
- //join expSet in ExecutablePlanTeachingSettingRepository.Entities on expr.ExecutablePlanID equals expSet.ExecutablePlanID into expSetResult
- //from expSetr in expSetResult.DefaultIfEmpty()
- //join dic in DictionaryItemRepository.Entities.Where(d => d.DictionaryCode == (typeof(CF_CourseQuality).Name)) on expr.CourseQualityID equals dic.Value into dicItem
- //from di in dicItem.DefaultIfEmpty()
- select new CoursematerView
- {
- CoursematerialID = com.CoursematerialID,
- CourseCode=com.CourseCode,
- CourseName = com.CourseName,
- //CourseQualityID = expr.CourseQualityID,
- //CourseQualityName = di.Name,
- //Credit = expSetr.Credit,
- //Hours = expSetr.TheoryCourse ?? 0 + expSetr.Practicehours ?? 0 + expSetr.Trialhours ?? 0,
- CreateTime = com.CreateTime
- };
- return query;
- }
- /// <summary>
- /// 获取课程信息
- /// </summary>
- /// <returns></returns>
- public IQueryable<CoursematerView> GetCoursematerialViewQueryable()
- {
- var query = from a in CoursematerialRepository.Entities
- select new CoursematerView
- {
- CoursematerialID = a.CoursematerialID,
- ClassGroupingID = a.ClassGroupingID,
- CourseCode = a.CourseCode,
- CourseName = a.CourseName,
- Abbreviation = a.Abbreviation,
- EnglishName = a.EnglishName,
- StandardName = a.StandardName,
- CourseEdition = a.CourseEdition,
- CourseSynopsis = a.CourseSynopsis,
- CourseReserve = a.CourseReserve,
- IsEnable = a.IsEnable ?? true,
- IsEnableName = a.IsEnable == true ? "是" : "否",
- CourseLevelID = a.CourseLevelID,
- CourseScienceID = a.CourseScienceID,
- CreateUserID = a.CreateUserID,
- CreateTime = a.CreateTime,
- Remarks = a.Remarks
- };
- return query;
- }
- }
- }
|