using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.DataLogic.Repositories;
using System.Linq.Expressions;
using EMIS.ViewModel.GraduationManage.GraduationRequirement;
using EMIS.Entities;
namespace EMIS.DataLogic.GraduationManage.GraduationRequirement
{
public class GrademajorRequirementDAL
{
public GraduationRequirementRepository GraduationRequirementRepository { get; set; }
public GrademajorRepository GrademajorRepository { get; set; }
public FacultymajorRepository FacultymajorRepository { get; set; }
public CollegeRepository CollegeRepository { get; set; }
public SchoolyearRepository SchoolyearRepository { get; set; }
///
/// 查询对应的毕业专业学分信息View
///
///
///
public IQueryable GetGradGrademajorRequirementQueryable(Expression> exp)
{
var query = from gsr in GraduationRequirementRepository.GetList(exp)
join gr in GrademajorRepository.Entities
on gsr.GrademajorID equals gr.GrademajorID
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join sye in SchoolyearRepository.Entities
on
new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
equals
new { SchoolyearID = sye.Years, SchoolcodeID = sye.SchoolcodeID }
into tempsyenter
from syenter in tempsyenter.DefaultIfEmpty()
select new GrademajorRequirementView
{
GraduationRequirementID = gsr.GraduationRequirementID,
GrademajorID = gsr.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
FacultymajorID = gr.FacultymajorID,
FacultymajorNo = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
SchoolyearID = gr.GradeID,
SchoolcodeID = gr.SemesterID,
EnteringSchoolYearID = syenter.SchoolyearID,
EnteringSchoolYearCode = syenter.Code,
GraduatingSemesterID = gr.CF_Schoolyear.SchoolyearID,
GraduatingSemesterCode = gr.CF_Schoolyear.Code,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
OptionalCourseCredit = gsr.OptionalCourseCredit,
RequiredCredit = gsr.RequiredCredit,
TotalCredit = gsr.TotalCredit,
RecordStatus = gsr.RecordStatus,
CreateUserID = gsr.CreateUserID,
CreateTime = gsr.CreateTime,
ModifyUserID = gsr.ModifyUserID,
ModifyTime = gsr.ModifyTime
};
return query;
}
}
}