123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.MinorManage.MinorPlanManage;
- using EMIS.Entities;
- using System.Linq.Expressions;
- using EMIS.ViewModel.Students;
- namespace EMIS.DataLogic.MinorManage.MinorPlanManage
- {
-
- public class MinorSpecialtyDAL
- {
- public GrademinorRepository GrademinorRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public StudentMinorRegistRepository studentMinorRegistRepository { get; set; }
- public StudentRepository studentRepository { get; set; }
- public ClassmajorRepository classmajorRepository { get; set; }
- public GrademajorRepository grademajorRepository { get; set; }
- public FacultymajorRepository facultymajorRepository { get; set; }
- public CollegeRepository collegeRepository { get; set; }
- public IQueryable<MinorSpecialtyView> GetMinorSpecialtyViewQueryable(Expression<Func<CF_Grademinor, bool>> exp)
- {
- var query = from Grademinor in GrademinorRepository.GetList(exp)
- join User in UserRepository.Entities on Grademinor.CreateUserID equals User.UserID into user
- from u in user.DefaultIfEmpty()
- join College in CollegeRepository.Entities on Grademinor.CollegeID equals College.CollegeID
- join schoolYear in SchoolyearRepository.Entities on Grademinor.SchoolyearID equals schoolYear.SchoolyearID
- select new MinorSpecialtyView
- {
- GrademinorID=Grademinor.GrademinorID,
- GradeMinorApplicationID = Grademinor.GrademinorApplicationID,
- YearID = Grademinor.YearID,
- SchoolyearID = Grademinor.SchoolyearID,
- SchoolyearCode=schoolYear.Code,
- StandardID = Grademinor.StandardID,
- CollegeID = Grademinor.CollegeID,
- CollegeName = College.Name,
- CollegeNo = College.No,
- StudentLimit = Grademinor.StudentLimit,
- OpenStatus = Grademinor.RecordStatus,
- CreateUserID = Grademinor.CreateUserID,
- CreateTime = Grademinor.CreateTime,
- CreateUserName = u.Name,
- StudentCount = Grademinor.EM_StudentMinorRegist.GroupBy(x => x.UserID).Count(),
- };
- return query;
- }
- public IQueryable<StudentsView> GetStudentsQueryable(Expression<Func<EM_StudentMinorRegist, bool>> exp)
- {
- var query = from stumrr in studentMinorRegistRepository.GetList(exp)
- group stumrr by stumrr.UserID
- into gstu
- join user in UserRepository.Entities
- on gstu.Key equals user.UserID
- join stu in studentRepository.Entities
- on gstu.Key equals stu.UserID
- join cla in classmajorRepository.Entities
- on stu.ClassmajorID equals cla.ClassmajorID
- join gra in grademajorRepository.Entities
- on cla.GrademajorID equals gra.GrademajorID
- join fac in facultymajorRepository.Entities
- on gra.FacultymajorID equals fac.FacultymajorID
- join col in collegeRepository.Entities
- on fac.CollegeID equals col.CollegeID
- select new StudentsView
- {
- CollegeID = col.CollegeID,
- CollegeName = col.Name,
- CollegeCode = col.No,
- GradeMajorID = gra.GrademajorID,
- GradeMajorCode = gra.Code,
- GradeMajorName = gra.Name,
- ClassMajorID = cla.GrademajorID,
- ClassMajorName = cla.Name,
- ClassMajorCode = cla.No,
- LoginID = user.LoginID,
- UserName = user.Name,
- UserID = user.UserID,
- };
- return query;
- }
- }
- }
|