123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.EvaluationManage;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.Common.EvaluationManage
- {
- public class EvaluationOpenControlDAL
- {
- public EvaluationGradeControlRepository EvaluationGradeControlRepository { get; set; }
- public SchoolyearRepository schoolyearRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public ClassmajorRepository classmajorRepository { get; set; }
- public EvaluationTypeRepository EvaluationTypeRepository { get; set; }
- /// <summary>
- /// 读取评价控制信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<EvaluationOpenControlView> GetEvaluationControlQueryable(Expression<Func<EM_EvaluationGradeControl, bool>> exp)
- {
- var query = from egc in EvaluationGradeControlRepository.GetList(exp)
- join sy in schoolyearRepository.Entities on egc.SchoolyearID equals sy.SchoolyearID into schoolyear
- from year in schoolyear.DefaultIfEmpty()
- join grad in GrademajorRepository.Entities on egc.GrademajorID equals grad.GrademajorID into grademajor
- from g in grademajor.DefaultIfEmpty()
- select new EvaluationOpenControlView
- {
- EvaluationGradeControlID=egc.EvaluationGradeControlID,
- SchoolyearID = year.SchoolyearID,
- SchoolyearCode = year.Code,
- GrademajorID=g.GrademajorID,
- GrademajorCode=g.Code,
- GrademajorName=g.Name,
- CollegeID=g.CF_Facultymajor.CF_College.CollegeID,
- CollegeName=g.CF_Facultymajor.CF_College.Name,
- StartTime=egc.StartTime,
- EndTime=egc.EndTime,
- EvaluationCount=egc.Number
- };
- return query;
- }
- /// <summary>
- /// 读取未控制的评价控制信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<GrademajorView> GrademajorViewGridQueryable(Expression<Func<CF_Grademajor, bool>> exp, Expression<Func<EM_EvaluationGradeControl, bool>> exps)
- {
- var query = from a in GrademajorRepository.GetList(exp)
- join c in dictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name) on a.CF_Facultymajor.StandardID equals c.Value
- join sc in
- (from sc in classmajorRepository.Entities
- group sc by sc.GrademajorID into g
- select new
- {
- GrademajorID = g.Key,
- StudentCount = g.Sum(x => x.CF_Student.Count())
- }) on a.GrademajorID equals sc.GrademajorID into dsc
- from esc in dsc.DefaultIfEmpty()
- join egc in EvaluationGradeControlRepository.GetList(exps) on a.GrademajorID equals egc.GrademajorID into e
- from eg in e.DefaultIfEmpty()
- where eg.EvaluationGradeControlID == null
- select new GrademajorView
- {
- GrademajorID = a.GrademajorID,
- Code = a.Code,
- Name = a.Name,
- Abbreviation = a.Abbreviation,
- GradeID = a.GradeID,
- Professional = a.Professional,
- SemesterID = a.SemesterID,
- FacultymajorID = a.CF_Facultymajor.FacultymajorID,
- FacultymajorCode = a.CF_Facultymajor.Code,
- FacultymajorName = a.CF_Facultymajor.Name,
- EducationID = a.CF_Facultymajor.EducationID,
- LearningformID = a.CF_Facultymajor.LearningformID,
- LearnSystem = a.CF_Facultymajor.LearnSystem,
- StandardID = a.CF_Facultymajor.StandardID,
- CollegeID = a.CF_Facultymajor.CollegeID,
- CollegeName = a.CF_Facultymajor.CF_College.Name,
- CollegeCode = a.CF_Facultymajor.CF_College.No,
- CampusID = a.CF_Facultymajor.CF_College.CampusID,
- GraduateSchoolyearID = a.GraduateSchoolyearID,
- GraduateValue = a.CF_Schoolyear.Value,
- GraduateSchoolyearCode = a.CF_Schoolyear.Code,
- StudentCount = esc.StudentCount == null ? 0 : esc.StudentCount,
- CreateUserID = a.CreateUserID,
- CreateTime = a.CreateTime,
- Remark = a.Remark
- };
- return query;
- }
- }
- }
|