using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.ExaminationApply; using System.Linq.Expressions; using EMIS.Entities; using EMIS.ViewModel; namespace EMIS.DataLogic.ExaminationApply { public class OpenControlDAL { public ExaminationOpenControlRepository ExaminationOpenControlRepository { get; set; } public ExaminationSubjectRepository ExaminationSubjectRepository { get; set; } public DictionaryItemRepository dictionaryItemRepository { get; set; } public IQueryable GetOpenControlView(Expression> openControlExpression) { var q = (from oc in ExaminationOpenControlRepository.GetList(openControlExpression) select new OpenControlView { ExaminationSubjectEditID = oc.ExaminationSubjectID, ExaminationOpenControlID = oc.ExaminationOpenControlID, ExaminationTypeID = oc.EX_ExaminationSubject.ExaminationTypeID, ExaminationTypeName = oc.EX_ExaminationSubject.EX_ExaminationType.Name, ExaminationSubjectID = oc.ExaminationSubjectID, ExaminationSubjectName = oc.EX_ExaminationSubject.Name, SchoolyearNumID = oc.SchoolyearNumID, StudentType = oc.StudentType, StartDate = oc.StartDate, EndDate = oc.EndDate, PeopleNumLimit = oc.PeopleNumLimit, RecordStatus = oc.RecordStatus, CreateUserID = oc.CreateUserID, CreateTime = oc.CreateTime, ModifyUserID = oc.ModifyUserID, ModifyTime = oc.ModifyTime }).OrderBy(x => x.ExaminationTypeName).ThenBy(x => x.ExaminationSubjectName).ThenBy(x => x.StudentType).ThenByDescending(x => x.SchoolyearNumID); return q; } /// /// 根据开课控制学生类别 /// /// /// public List GetStudentTypeQueryble(Guid? openControlID) { var query = from a in ExaminationOpenControlRepository.Entities.Where(x => x.ExaminationOpenControlID == openControlID) join b in dictionaryItemRepository.Entities on new { a.StudentType, DictionaryCode = DictionaryItem.CF_STUDENTTYPE.ToString() } equals new { StudentType = b.Value, b.DictionaryCode } select b.Value.Value.ToString(); return query.ToList(); } } }