12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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<OpenControlView> GetOpenControlView(Expression<Func<EX_ExaminationOpenControl, bool>> 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;
- }
- /// <summary>
- /// 根据开课控制学生类别
- /// </summary>
- /// <param name="openControlID"></param>
- /// <returns></returns>
- public List<string> 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();
- }
- }
- }
|