123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using EMIS.DataLogic.Repositories;
- using EMIS.Entities;
- using EMIS.ViewModel.ExamManage;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- namespace EMIS.DataLogic.ExamManage
- {
- public class LevelSettingSubjectDAL
- {
- public LevelSettingRepository levelSettingRepository { get; set; }
- public ExaminationProjectRepository examinationProjectRepository { get; set; }
- public ExaminationTypeRepository examinationTypeRepository { get; set; }
- public LevelSettingSubjectRepository levelSettingSubjectRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public ProjectScoreRepository projectScoreRepository { get; set; }
- public ExaminationProjectSubjectRepository examinationProjectSubjectRepository { get; set; }
- public IQueryable<LevelSettingView> GetLevelSettingView(Expression<Func<EX_ExaminationProject, bool>> erexp)
- {
- var query = from level in levelSettingRepository.Entities
- from epr in examinationProjectRepository.Entities.Where(erexp).Where(x => x.ExaminationProjectID == level.ExaminationProjectID)
- from etr in examinationTypeRepository.Entities.Where(x => x.ExaminationTypeID == epr.ExaminationTypeID)
- select new LevelSettingView
- {
- LevelSettingID = level.LevelSettingID,
- LevelName = level.LevelName,
- ExaminationProjectID = level.ExaminationProjectID,
- ExaminationProjectName = epr.Name,
- ExaminationTypeID = epr.ExaminationTypeID,
- ExaminationTypeName = etr.Name,
- IsPassed = level.IsPassed,
- IsPassedEdit = level.IsPassed.Value,
- IsPassLine = level.IsPassLine,
- IsPassLineEdit = level.IsPassLine.Value,
- RecordStatus = level.RecordStatus,
- };
- return query;
- }
- public IQueryable<LevelSettingSubjectView> GetLevelSettingSubjectViewByLevelID(Guid? levelSettingID)
- {
- var query = from level in levelSettingRepository.Entities.Where(x => x.LevelSettingID == levelSettingID)
- from lssr in levelSettingSubjectRepository.Entities.Where(x => x.LevelSettingID == level.LevelSettingID)
- from epr in examinationProjectRepository.Entities.Where(x => x.ExaminationProjectID == level.ExaminationProjectID)
- from etr in examinationTypeRepository.Entities.Where(x => x.ExaminationTypeID == epr.ExaminationTypeID)
- select new LevelSettingSubjectView
- {
- LevelSettingID = level.LevelSettingID,
- ExaminationSubjectID = lssr.ExaminationSubjectID,
- PassScore = lssr.PassScore
- };
- return query;
- }
- public LevelSettingView GetLevelSettingSubjectView(Guid? levelSettingID)
- {
- var query = from level in levelSettingRepository.Entities.Where(x => x.LevelSettingID == levelSettingID)
- from epr in examinationProjectRepository.Entities.Where(x => x.ExaminationProjectID == level.ExaminationProjectID)
- from etr in examinationTypeRepository.Entities.Where(x => x.ExaminationTypeID == epr.ExaminationTypeID)
- select new LevelSettingView
- {
- LevelSettingID = level.LevelSettingID,
- LevelName = level.LevelName,
- ExaminationProjectID = level.ExaminationProjectID,
- ExaminationProjectName = epr.Name,
- ExaminationTypeID = epr.ExaminationTypeID,
- ExaminationTypeName = etr.Name,
- IsPassed = level.IsPassed,
- IsPassedEdit = level.IsPassed.Value,
- IsPassLine = level.IsPassLine,
- IsPassLineEdit = level.IsPassLine.Value,
- RecordStatus = level.RecordStatus,
- };
- return query.FirstOrDefault();
- }
- public IQueryable<LevelSettingSubjectView> GetLevelSettingSubjectViewByProjectID(Guid? examinationProjectID)
- {
- var query = from dic in dictionaryItemRepository.Entities.Where(x => x.DictionaryCode == "EX_ExaminationSubject")
- select new LevelSettingSubjectView
- {
- ExaminationSubjectID = dic.Value,
- };
- if (examinationProjectID.HasValue)
- {
- query = from level in levelSettingRepository.Entities.Where(x => x.ExaminationProjectID == examinationProjectID)
- from lssr in levelSettingSubjectRepository.Entities.Where(x => x.LevelSettingID == level.LevelSettingID)
- select new LevelSettingSubjectView
- {
- LevelSettingID = level.LevelSettingID,
- ExaminationSubjectID = lssr.ExaminationSubjectID,
- PassScore = lssr.PassScore
- };
- }
- return query.Distinct();
- }
- }
- }
|