1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.Cultureplan;
- using EMIS.ViewModel.CultureplanManage.CourseMaterial;
- namespace EMIS.DataLogic.CultureplanManage.CourseMaterial
- {
- public class ClubCourseDAL
- {
- public ClubCourseRepository ClubCourseRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public ClassGroupingRepository ClassGroupingRepository { get; set; }
- /// <summary>
- /// 查询对应的俱乐部课程信息View
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<ClubCourseView> GetClubCourseViewQueryable(Expression<Func<ER_ClubCourse, bool>> exp)
- {
- var query = from club in ClubCourseRepository.GetList(exp)
- join cou in CoursematerialRepository.Entities
- on club.CoursematerialID equals cou.CoursematerialID
- join cg in ClassGroupingRepository.Entities
- on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
- from coucg in tempcg.DefaultIfEmpty()
- select new ClubCourseView
- {
- ClubCourseID = club.ClubCourseID,
- CoursematerialID = club.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- Abbreviation = cou.Abbreviation,
- CourseLevelID = cou.CourseLevelID,
- CourseScienceID = cou.CourseScienceID,
- ClassGroupingID = cou.ClassGroupingID,
- ClassName = coucg.ClassName,
- IsEnable = cou.IsEnable == true ? true : false,
- RecordStatus = club.RecordStatus,
- CreateUserID = club.CreateUserID,
- CreateTime = club.CreateTime,
- ModifyUserID = club.ModifyUserID,
- ModifyTime = club.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的课程信息View(课程信息表左连俱乐部课程表,排除对应的俱乐部课程信息)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<CoursematerialView> GetCourseNoClubViewQueryable(Expression<Func<EM_Coursematerial, bool>> exp)
- {
- var query = from cou in CoursematerialRepository.GetList(exp)
- join cg in ClassGroupingRepository.Entities
- on cou.ClassGroupingID equals cg.ClassGroupingID into tempcg
- from coucg in tempcg.DefaultIfEmpty()
- join club in ClubCourseRepository.Entities
- on cou.CoursematerialID equals club.CoursematerialID into tempclub
- from clubcou in tempclub.DefaultIfEmpty()
- where clubcou.CoursematerialID == null
- select new CoursematerialView
- {
- CoursematerialID = cou.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- Abbreviation = cou.Abbreviation,
- EnglishName = cou.EnglishName,
- StandardName = cou.StandardName,
- CourseEdition = cou.CourseEdition,
- CourseLevelID = cou.CourseLevelID,
- CourseScienceID = cou.CourseScienceID,
- ClassGroupingID = cou.ClassGroupingID,
- ClassName = coucg.ClassName,
- CourseSynopsis = cou.CourseSynopsis,
- CourseReserve = cou.CourseReserve,
- IsEnable = cou.IsEnable == true ? true : false,
- Remark = cou.Remark,
- RecordStatus = cou.RecordStatus,
- CreateUserID = cou.CreateUserID,
- CreateTime = cou.CreateTime,
- ModifyUserID = cou.ModifyUserID,
- ModifyTime = cou.ModifyTime
- };
- return query;
- }
- }
- }
|