123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EnrollManage.SpecialtyManage;
- using EMIS.DataLogic.Repositories;
- namespace EMIS.DataLogic.EnrollManage.SpecialtyManage
- {
- public class SpecialtyApplyDAL
- {
- public SpecialtyApplyRepository specialtyApplyRepository { get; set; }
- public SpecialtyRepository specialtyRepository { get; set; }
- public CollegeRepository collegeRepository { get; set; }
- public CampusRepository campusRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public RecruitSpecialtyRepository recruitSpecialtyRepository { get; set; }
- public UserRepository userRepository { get; set; }
- /// <summary>
- /// 查询专业申请信息SpecialtyApplyView
- /// </summary>
- /// <param name="exp">条件查询</param>
- /// <returns></returns>
- public IQueryable<SpecialtyApplyView> GetSpecialtyApplyViewQueryable(Expression<Func<CF_SpecialtyApply, bool>> exp)
- {
- var query = from spay in specialtyApplyRepository.GetList(exp)
- join sp in specialtyRepository.Entities
- on spay.SpecialtyID equals sp.SpecialtyID
- join col in collegeRepository.Entities
- on spay.CollegeID equals col.CollegeID
- join cam in campusRepository.Entities
- on col.CampusID equals cam.CampusID
- join stan in dictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
- on sp.StandardID equals stan.Value into tempstan
- from dtstan in tempstan.DefaultIfEmpty()
- join crus in userRepository.Entities
- on spay.CreateUserID equals crus.UserID into tempcrus
- from spaycrus in tempcrus.DefaultIfEmpty()
- select new SpecialtyApplyView
- {
- SpecialtyApplyID = spay.SpecialtyApplyID,
- SpecialtyID = spay.SpecialtyID,
- StandardID = sp.StandardID,
- StandardCode = dtstan.Code,
- StandardName = dtstan.Name,
- CollegeID = spay.CollegeID,
- CollegeCode = col.No,
- CollegeName = col.Name,
- CampusID = col.CampusID,
- CampusCode = cam.No,
- CampusName = cam.Name,
- GradeID = spay.GradeID,
- SemesterID = spay.SemesterID,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- ScienceclassID = sp.ScienceclassID,
- StandardTitle = sp.StandardTitle,
- StandardLevel = sp.StandardLevel,
- PropertyID = sp.PropertyID,
- ApprovalStatus = spay.ApprovalStatus,
- Remark = spay.Remark,
- RecordStatus = spay.RecordStatus,
- CreateUserID = spay.CreateUserID,
- CreateUserCode = spaycrus.LoginID,
- CreateUserName = spaycrus.Name,
- CreateTime = spay.CreateTime,
- ModifyUserID = spay.ModifyUserID,
- ModifyTime = spay.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询未进行申请的专业信息SpecialtyView
- /// </summary>
- /// <param name="expSpecialty"></param>
- /// <param name="expSpecialtyApply"></param>
- /// <param name="expRecruitSpecialty"></param>
- /// <returns></returns>
- public IQueryable<SpecialtyView> GetSpecialtyViewNoApplyQueryable(Expression<Func<CF_Specialty, bool>> expSpecialty,
- Expression<Func<CF_SpecialtyApply, bool>> expSpecialtyApply, Expression<Func<CF_RecruitSpecialty, bool>> expRecruitSpecialty)
- {
- var query = from sp in specialtyRepository.GetList(expSpecialty)
- join stan in dictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
- on sp.StandardID equals stan.Value into tempstan
- from dtstan in tempstan.DefaultIfEmpty()
- join spay in specialtyApplyRepository.GetList(expSpecialtyApply)
- on sp.SpecialtyID equals spay.SpecialtyID into tempspay
- from spapply in tempspay.DefaultIfEmpty()
- join rs in recruitSpecialtyRepository.GetList(expRecruitSpecialty)
- on sp.SpecialtyID equals rs.SpecialtyID into temprs
- from rsp in temprs.DefaultIfEmpty()
- where spapply.SpecialtyApplyID == null && rsp.RecruitSpecialtyID == null
- select new SpecialtyView
- {
- SpecialtyID = sp.SpecialtyID,
- StandardID = sp.StandardID,
- StandardCode = dtstan.Code,
- StandardName = dtstan.Name,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- ScienceclassID = sp.ScienceclassID,
- PropertyID = sp.PropertyID,
- StandardTitle = sp.StandardTitle,
- StandardLevel = sp.StandardLevel,
- RecordStatus = sp.RecordStatus,
- Remark = sp.Remark,
- CreateUserID = sp.CreateUserID,
- CreateTime = sp.CreateTime,
- ModifyUserID = sp.ModifyUserID,
- ModifyTime = sp.ModifyTime,
- };
- return query;
- }
- }
- }
|