123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- 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.NewStudentManage;
- using EMIS.DataLogic.Repositories;
- namespace EMIS.DataLogic.EnrollManage.NewStudentManage
- {
- public class NewStudentDAL
- {
- public NewStudentRepository NewStudentRepository { get; set; }
- public SpecialtyRepository SpecialtyRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public RecruitSpecialtyRepository RecruitSpecialtyRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public RecruitstudentsRepository RecruitstudentsRepository { get; set; }
- public FacultymajorRepository FacultymajorRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public ParameterRepository ParameterRepository { get; set; }
- public RoleRepository RoleRepository { get; set; }
- public CustomStandardSettingRepository CustomStandardSettingRepository { get; set; }
- public GraduateSchoolyearRepository GraduateSchoolyearRepository { get; set; }
- /// <summary>
- /// 查询对应的新生名单信息View
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetNewStudentViewQueryable(Expression<Func<CF_NewStudent, bool>> exp)
- {
- var query = from nstu in NewStudentRepository.GetList(exp)
- join sp in SpecialtyRepository.Entities
- on nstu.SpecialtyID equals sp.SpecialtyID
- join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
- on sp.StandardID equals dicst.Value into tempst
- from standard in tempst.DefaultIfEmpty()
- select new NewStudentView
- {
- NewStudentID = nstu.NewStudentID,
- ExamineeNum = nstu.ExamineeNum,
- AdmissionTicketNo = nstu.AdmissionTicketNo,
- Name = nstu.Name,
- SexID = nstu.SexID,
- NationID = nstu.NationID,
- PoliticsID = nstu.PoliticsID,
- BirthDate = nstu.BirthDate,
- CertificatesType = nstu.CertificatesType,
- IDNumber = nstu.IDNumber,
- GradeID = nstu.GradeID,
- SemesterID = nstu.SemesterID,
- SpecialtyID = nstu.SpecialtyID,
- StandardID = sp.StandardID,
- StandardCode = standard.Code,
- StandardName = standard.Name,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- EntranceDate = nstu.EntranceDate,
- Score = nstu.Score,
- Telephone = nstu.Telephone,
- ZIPCode = nstu.ZIPCode,
- EntranceWayID = nstu.EntranceWayID,
- FeaturesID = nstu.FeaturesID,
- TerritorialID = nstu.TerritorialID,
- Address = nstu.Address,
- Dormitory = nstu.Dormitory,
- RecruitPictureUrl = nstu.RecruitPictureUrl,
- PhotoHasValue = (nstu.RecruitPictureUrl == null || nstu.RecruitPictureUrl == "") ? false : true,
- IsDoubt = nstu.IsDoubt ?? false,
- AssignStatus = nstu.AssignStatus,
- Remark = nstu.Remark,
- RecordStatus = nstu.RecordStatus,
- CreateUserID = nstu.CreateUserID,
- CreateTime = nstu.CreateTime,
- ModifyUserID = nstu.ModifyUserID,
- ModifyTime = nstu.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的新生分配信息View
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetNewStudentCollegeViewQueryable(Expression<Func<CF_NewStudent, bool>> exp)
- {
- var query = from nstu in NewStudentRepository.GetList(exp)
- join sp in SpecialtyRepository.Entities
- on nstu.SpecialtyID equals sp.SpecialtyID
- join col in CollegeRepository.Entities
- on nstu.CollegeID equals col.CollegeID
- join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
- on sp.StandardID equals dicst.Value into tempst
- from standard in tempst.DefaultIfEmpty()
- select new NewStudentView
- {
- NewStudentID = nstu.NewStudentID,
- ExamineeNum = nstu.ExamineeNum,
- AdmissionTicketNo = nstu.AdmissionTicketNo,
- Name = nstu.Name,
- SexID = nstu.SexID,
- NationID = nstu.NationID,
- PoliticsID = nstu.PoliticsID,
- BirthDate = nstu.BirthDate,
- CertificatesType = nstu.CertificatesType,
- IDNumber = nstu.IDNumber,
- GradeID = nstu.GradeID,
- SemesterID = nstu.SemesterID,
- SpecialtyID = nstu.SpecialtyID,
- StandardID = sp.StandardID,
- StandardCode = standard.Code,
- StandardName = standard.Name,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- EntranceDate = nstu.EntranceDate,
- Score = nstu.Score,
- Telephone = nstu.Telephone,
- ZIPCode = nstu.ZIPCode,
- EntranceWayID = nstu.EntranceWayID,
- FeaturesID = nstu.FeaturesID,
- TerritorialID = nstu.TerritorialID,
- Address = nstu.Address,
- Dormitory = nstu.Dormitory,
- EnrollmentNo = nstu.EnrollmentNo,
- RecruitPictureUrl = nstu.RecruitPictureUrl,
- PhotoHasValue = (nstu.RecruitPictureUrl == null || nstu.RecruitPictureUrl == "") ? false : true,
- IsDoubt = nstu.IsDoubt ?? false,
- AssignStatus = nstu.AssignStatus,
- OrderNo = nstu.OrderNo,
- CollegeID = nstu.CollegeID,
- CollegeNo = col.No,
- CollegeName = col.Name,
- CampusID = col.CampusID,
- CampusCode = col.CF_Campus.No,
- CampusName = col.CF_Campus.Name,
- Remark = nstu.Remark,
- RecordStatus = nstu.RecordStatus,
- CreateUserID = nstu.CreateUserID,
- CreateTime = nstu.CreateTime,
- ModifyUserID = nstu.ModifyUserID,
- ModifyTime = nstu.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的录取名单信息View
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetNewStudentEnterViewQueryable(Expression<Func<CF_NewStudent, bool>> exp)
- {
- var query = from nstu in NewStudentRepository.GetList(exp)
- join sp in SpecialtyRepository.Entities
- on nstu.SpecialtyID equals sp.SpecialtyID
- join col in CollegeRepository.Entities
- on nstu.CollegeID equals col.CollegeID
- join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
- on sp.StandardID equals dicst.Value into tempst
- from standard in tempst.DefaultIfEmpty()
- join cl in ClassmajorRepository.Entities
- on nstu.ClassmajorID equals cl.ClassmajorID into tempcl
- from nstucl in tempcl.DefaultIfEmpty()
- select new NewStudentView
- {
- NewStudentID = nstu.NewStudentID,
- ExamineeNum = nstu.ExamineeNum,
- AdmissionTicketNo = nstu.AdmissionTicketNo,
- Name = nstu.Name,
- SexID = nstu.SexID,
- NationID = nstu.NationID,
- PoliticsID = nstu.PoliticsID,
- BirthDate = nstu.BirthDate,
- CertificatesType = nstu.CertificatesType,
- IDNumber = nstu.IDNumber,
- GradeID = nstu.GradeID,
- SemesterID = nstu.SemesterID,
- SpecialtyID = nstu.SpecialtyID,
- StandardID = sp.StandardID,
- StandardCode = standard.Code,
- StandardName = standard.Name,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- EntranceDate = nstu.EntranceDate,
- Score = nstu.Score,
- Telephone = nstu.Telephone,
- ZIPCode = nstu.ZIPCode,
- EntranceWayID = nstu.EntranceWayID,
- FeaturesID = nstu.FeaturesID,
- TerritorialID = nstu.TerritorialID,
- Address = nstu.Address,
- Dormitory = nstu.Dormitory,
- EnrollmentNo = nstu.EnrollmentNo,
- RecruitPictureUrl = nstu.RecruitPictureUrl,
- PhotoHasValue = (nstu.RecruitPictureUrl == null || nstu.RecruitPictureUrl == "") ? false : true,
- IsDoubt = nstu.IsDoubt ?? false,
- AssignStatus = nstu.AssignStatus,
- OrderNo = nstu.OrderNo,
- CollegeID = nstu.CollegeID,
- CollegeNo = col.No,
- CollegeName = col.Name,
- CampusID = col.CampusID,
- CampusCode = col.CF_Campus.No,
- CampusName = col.CF_Campus.Name,
- ClassmajorID = nstu.ClassmajorID,
- ClassmajorNo = nstucl.No,
- ClassmajorName = nstucl.Name,
- GrademajorID = nstucl.GrademajorID,
- GrademajorCode = nstucl.CF_Grademajor.Code,
- GrademajorName = nstucl.CF_Grademajor.Name,
- FacultymajorID = nstucl.CF_Grademajor.FacultymajorID,
- FacultymajorCode = nstucl.CF_Grademajor.CF_Facultymajor.Code,
- FacultymajorName = nstucl.CF_Grademajor.CF_Facultymajor.Name,
- StudentNo = nstu.StudentNo,
- Remark = nstu.Remark,
- RecordStatus = nstu.RecordStatus,
- CreateUserID = nstu.CreateUserID,
- CreateTime = nstu.CreateTime,
- ModifyUserID = nstu.ModifyUserID,
- ModifyTime = nstu.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询最大录取通知书编号(年级、院系所分组)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetEnrollmentNo(Expression<Func<CF_NewStudent, bool>> exp)
- {
- var query = from st in NewStudentRepository.GetList(exp)
- join col in CollegeRepository.Entities
- on st.CollegeID equals col.CollegeID
- group st by new { st.GradeID, st.CollegeID, col.No } into g
- select new NewStudentView
- {
- GradeID = g.Key.GradeID.Value,
- CollegeID = g.Key.CollegeID,
- CollegeNo = g.Key.No,
- EnrollmentNo = g.Max(x => x.EnrollmentNo)
- };
- return query;
- }
- /// <summary>
- /// 根据新生信息查询对应的新生院系专业信息(业务主键:专业ID(Value)、培养层次、学习形式、学制、院系所ID)
- /// </summary>
- /// <param name="expNewStudent"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetFacultymajorByNewStudent(Expression<Func<CF_NewStudent, bool>> expNewStudent)
- {
- var query = from st in NewStudentRepository.GetList(expNewStudent)
- join sp in SpecialtyRepository.Entities
- on st.SpecialtyID equals sp.SpecialtyID
- join fa in FacultymajorRepository.Entities
- on new { sp.StandardID, sp.EducationID, sp.LearningformID, sp.LearnSystem, st.CollegeID }
- equals new { fa.StandardID, fa.EducationID, fa.LearningformID, fa.LearnSystem, fa.CollegeID }
- select new NewStudentView
- {
- NewStudentID = st.NewStudentID,
- GradeID = st.GradeID,
- SemesterID = st.SemesterID,
- SpecialtyID = st.SpecialtyID,
- StandardID = sp.StandardID,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- CollegeID = st.CollegeID,
- FacultymajorID = fa.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name
- };
- return query;
- }
- /// <summary>
- /// 根据新生信息、院系专业信息查询新生对应的年级专业信息(业务主键:院系专业ID、年级)
- /// </summary>
- /// <param name="expNewStudent"></param>
- /// <param name="expFacultymajor"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetGrademajorByNewStudent(Expression<Func<CF_NewStudent, bool>> expNewStudent, Expression<Func<CF_Facultymajor, bool>> expFacultymajor)
- {
- var query = from st in NewStudentRepository.GetList(expNewStudent)
- join sp in SpecialtyRepository.Entities
- on st.SpecialtyID equals sp.SpecialtyID
- join fa in FacultymajorRepository.GetList(expFacultymajor)
- on new { sp.StandardID, sp.EducationID, sp.LearningformID, sp.LearnSystem, st.CollegeID }
- equals new { fa.StandardID, fa.EducationID, fa.LearningformID, fa.LearnSystem, fa.CollegeID }
- join gr in GrademajorRepository.Entities
- on new { FacultymajorID = fa.FacultymajorID, GradeID = st.GradeID }
- equals new { FacultymajorID = gr.FacultymajorID.Value, GradeID = gr.GradeID }
- select new NewStudentView
- {
- NewStudentID = st.NewStudentID,
- GradeID = st.GradeID,
- SemesterID = st.SemesterID,
- SpecialtyID = st.SpecialtyID,
- StandardID = sp.StandardID,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- CollegeID = st.CollegeID,
- FacultymajorID = fa.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- GrademajorID = gr.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name
- };
- return query;
- }
- /// <summary>
- /// 根据新生信息、院系专业信息、年级专业信息查询新生对应的班级信息(业务主键:年级专业ID)
- /// </summary>
- /// <param name="expNewStudent"></param>
- /// <param name="expFacultymajor"></param>
- /// <param name="expGrademajor"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetClassmajorByNewStudent(Expression<Func<CF_NewStudent, bool>> expNewStudent, Expression<Func<CF_Facultymajor, bool>> expFacultymajor,
- Expression<Func<CF_Grademajor, bool>> expGrademajor)
- {
- var query = from st in NewStudentRepository.GetList(expNewStudent)
- join sp in SpecialtyRepository.Entities
- on st.SpecialtyID equals sp.SpecialtyID
- join fa in FacultymajorRepository.GetList(expFacultymajor)
- on new { sp.StandardID, sp.EducationID, sp.LearningformID, sp.LearnSystem, st.CollegeID }
- equals new { fa.StandardID, fa.EducationID, fa.LearningformID, fa.LearnSystem, fa.CollegeID }
- join gr in GrademajorRepository.GetList(expGrademajor)
- on new { FacultymajorID = fa.FacultymajorID, GradeID = st.GradeID }
- equals new { FacultymajorID = gr.FacultymajorID.Value, GradeID = gr.GradeID }
- join cl in ClassmajorRepository.Entities
- on gr.GrademajorID equals cl.GrademajorID
- select new NewStudentView
- {
- NewStudentID = st.NewStudentID,
- GradeID = st.GradeID,
- SemesterID = st.SemesterID,
- SpecialtyID = st.SpecialtyID,
- StandardID = sp.StandardID,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- CollegeID = st.CollegeID,
- FacultymajorID = fa.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- GrademajorID = gr.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- ClassmajorID = cl.ClassmajorID,
- ClassmajorNo = cl.No,
- ClassmajorName = cl.Name
- };
- return query;
- }
- /// <summary>
- /// 查询对应的专业班级信息(手动生成可使用此方法)
- /// </summary>
- /// <param name="expNewStudent"></param>
- /// <param name="expFa"></param>
- /// <param name="expGr"></param>
- /// <param name="expCl"></param>
- /// <returns></returns>
- public virtual IQueryable<NewStudentView> GetNewStudentCollegeClass(Expression<Func<CF_NewStudent, bool>> expNewStudent, Expression<Func<CF_Facultymajor, bool>> expFacultymajor,
- Expression<Func<CF_Grademajor, bool>> expGrademajor, Expression<Func<CF_Classmajor, bool>> expClassmajor)
- {
- var query = from st in NewStudentRepository.GetList(expNewStudent)
- join sp in SpecialtyRepository.Entities
- on st.SpecialtyID equals sp.SpecialtyID
- join fa in FacultymajorRepository.GetList(expFacultymajor)
- on
- new { sp.StandardID, sp.EducationID, sp.LearningformID, sp.LearnSystem, st.CollegeID }
- equals
- new { fa.StandardID, fa.EducationID, fa.LearningformID, fa.LearnSystem, fa.CollegeID }
- join gr in GrademajorRepository.GetList(expGrademajor)
- on
- new { FacultymajorID = fa.FacultymajorID, GradeID = st.GradeID }
- equals
- new { FacultymajorID = gr.FacultymajorID.Value, GradeID = gr.GradeID }
- join cl in ClassmajorRepository.GetList(expClassmajor)
- on gr.GrademajorID equals cl.GrademajorID
- select new NewStudentView
- {
- NewStudentID = st.NewStudentID,
- GradeID = st.GradeID,
- SemesterID = st.SemesterID,
- SpecialtyID = st.SpecialtyID,
- StandardID = sp.StandardID,
- EducationID = sp.EducationID,
- LearningformID = sp.LearningformID,
- LearnSystem = sp.LearnSystem,
- CollegeID = st.CollegeID,
- FacultymajorID = fa.FacultymajorID,
- FacultymajorCode = fa.Code,
- FacultymajorName = fa.Name,
- GrademajorID = gr.GrademajorID,
- GrademajorCode = gr.Code,
- GrademajorName = gr.Name,
- ClassmajorID = cl.ClassmajorID,
- ClassmajorNo = cl.No,
- ClassmajorName = cl.Name
- };
- return query;
- }
- /// <summary>
- /// 查询新生信息、学生信息中最大学号(以班级信息ID分组,注:学号在两个表中都可能存在-Concat)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetMaxStudentNoClass(Expression<Func<CF_Classmajor, bool>> exp)
- {
- //新生信息表
- var queryNewStudent = from nst in NewStudentRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
- join cl in ClassmajorRepository.GetList(exp)
- on nst.ClassmajorID equals cl.ClassmajorID
- select new NewStudentView
- {
- ClassmajorID = cl.ClassmajorID,
- ClassmajorNo = cl.No,
- StudentNo = nst.StudentNo
- };
- //学生信息表
- var queryStudent = from st in StudentRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
- join cl in ClassmajorRepository.GetList(exp)
- on st.ClassmajorID equals cl.ClassmajorID
- join u in UserRepository.Entities
- on st.UserID equals u.UserID
- select new NewStudentView
- {
- ClassmajorID = cl.ClassmajorID,
- ClassmajorNo = cl.No,
- StudentNo = u.LoginID
- };
- //合并后分组
- var query = from stu in queryNewStudent.Concat(queryStudent)
- group stu by new { stu.ClassmajorID, stu.ClassmajorNo } into g
- select new NewStudentView
- {
- ClassmajorID = g.Key.ClassmajorID,
- ClassmajorNo = g.Key.ClassmajorNo,
- StudentNo = g.Max(x => x.StudentNo)
- };
- return query;
- }
- /// <summary>
- /// 查询对应的学生信息(验证:考生号、准考证号)
- /// </summary>
- /// <param name="expStudent"></param>
- /// <returns></returns>
- public IQueryable<NewStudentView> GetStudentViewQueryable(Expression<Func<CF_Recruitstudents, bool>> expRecruitstudents)
- {
- var query = from stu in StudentRepository.Entities
- join rs in RecruitstudentsRepository.GetList(expRecruitstudents)
- on stu.UserID equals rs.UserID
- join us in UserRepository.Entities
- on stu.UserID equals us.UserID
- select new NewStudentView
- {
- StudentNo = us.LoginID,
- ExamineeNum = rs.ExamineeNum,
- AdmissionTicketNo = rs.AdmissionTicketNo,
- IDNumber = stu.IDNumber,
- ClassmajorID = stu.ClassmajorID
- };
- return query;
- }
- }
- }
|