123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel.MinorManage.MinorClass;
- using EMIS.ViewModel.MinorManage.MinorApply;
- using EMIS.ViewModel.Students;
- namespace EMIS.DataLogic.MinorManage.MinorClass
- {
- public class MinorClassDAL
- {
- public ClassminorRepository classminorRepository { get; set; }
- public GrademinorRepository grademinorRepository { get; set; }
- public SchoolyearRepository schoolyearRepository { get; set; }
- public CollegeRepository collegeRepository { get; set; }
- public StudentRepository studentRepository { get; set; }
- public ClassmajorRepository classmajorRepository { get; set; }
- public GrademajorRepository grademajorRepository { get; set; }
- public FacultymajorRepository facultymajorRepository { get; set; }
- public StudentMinorRegistRepository studentMinorRegistRepository { get; set; }
- public GrademinorApplicationRepository grademinorApplicationRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public ClassminorStudentRepository classminorStudentRepository { get; set; }
- public UserRepository userRepository { get; set; }
- public IQueryable<MinorClassView> GetMinorClassViewQueryable(Expression<Func<CF_Classminor, bool>> exp, Expression<Func<CF_Grademinor, bool>> expgm)
- {
- var query = from cr in classminorRepository.GetList(exp)
- join gr in grademinorRepository.GetList(expgm)
- on cr.GrademinorID equals gr.GrademinorID
- join sr in schoolyearRepository.Entities
- on gr.SchoolyearID equals sr.SchoolyearID
- join col in collegeRepository.Entities
- on gr.CollegeID equals col.CollegeID
- select new MinorClassView
- {
- ClassminorID = cr.ClassminorID,
- GrademinorID = cr.GrademinorID,
- SchoolyearID = gr.SchoolyearID,
- SchoolyearCode = sr.Code,
- GradeYearID = gr.YearID,
- StandardID = gr.StandardID,
- Name = cr.Name,
- StudentNum = cr.CF_ClassminorStudent.Count,
- CF_ClassminorStudent = cr.CF_ClassminorStudent,
- RecordStatus = cr.RecordStatus
- };
- return query;
- }
- public IQueryable<StudentsView> GetStudentsQueryable(Expression<Func<CF_ClassminorStudent, bool>> exp)
- {
- var query = from clastu in classminorStudentRepository.GetList(exp)
- join user in userRepository.Entities
- on clastu.UserID equals user.UserID
- join stu in studentRepository.Entities
- on clastu.UserID 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;
- }
- public IQueryable<CF_Grademinor> GetGrademinor()
- {
- var query = from gr in grademinorRepository.Entities
- select new CF_Grademinor
- {
- GrademinorID = gr.GrademinorID,
- SchoolyearID = gr.SchoolyearID,
- CollegeID = gr.CollegeID,
- YearID = gr.YearID,
- };
- return query;
- }
- }
- }
|