using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.ViewModel;
using EMIS.ViewModel.CultureplanManage;
using EMIS.ViewModel.CultureplanManage.PlanManagement;
using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
using EMIS.ViewModel.Students;
using EMIS.DataLogic.Repositories;
using EMIS.DataLogic.UniversityManage.SpecialtyClassManage;
namespace EMIS.DataLogic.CultureplanManage.PlanManagement
{
public class SpecialtyPlanDAL
{
public SpecialtyPlanRepository SpecialtyPlanRepository { get; set; }
public SpecialtyPlanTeachingSettingRepository SpecialtyPlanTeachingSettingRepository { get; set; }
public SpecialtyPlanTeachingModeTypeRepository SpecialtyPlanTeachingModeTypeRepository { get; set; }
public SpecialtyPlanTeachingPlaceRepository SpecialtyPlanTeachingPlaceRepository { get; set; }
public SchoolyearRepository SchoolyearRepository { get; set; }
public CoursematerialRepository CoursematerialRepository { get; set; }
public DepartmentRepository DepartmentRepository { get; set; }
public GrademajorRepository GrademajorRepository { get; set; }
public ClassmajorRepository ClassmajorRepository { get; set; }
public StudentRepository StudentRepository { get; set; }
public UserRepository UserRepository { get; set; }
public FacultymajorRepository FacultymajorRepository { get; set; }
public CollegeRepository CollegeRepository { get; set; }
public CampusRepository CampusRepository { get; set; }
public SpecialtyRepository SpecialtyRepository { get; set; }
public SpecialtyCourseRepository SpecialtyCourseRepository { get; set; }
public SpecialtyCourseTeachingSettingRepository SpecialtyCourseTeachingSettingRepository { get; set; }
public ExecutablePlanRepository ExecutablePlanRepository { get; set; }
public DictionaryItemRepository DictionaryItemRepository { get; set; }
///
/// 查询专业计划信息SpecialtyPlanView
/// 注:普教版本(年级专业)
///
///
///
public IQueryable GetSpecialtyPlanViewQueryable(Expression> exp)
{
var query = from sp in SpecialtyPlanRepository.GetList(exp)
join spst in SpecialtyPlanTeachingSettingRepository.Entities
on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
from spspst in tempspst.DefaultIfEmpty()
join sy in SchoolyearRepository.Entities
on sp.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on sp.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on sp.DepartmentID equals dep.DepartmentID into tempdep
from spdep in tempdep.DefaultIfEmpty()
join gr in GrademajorRepository.Entities
on sp.GrademajorID equals gr.GrademajorID
join stsy in SchoolyearRepository.Entities
on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
equals new { SchoolyearID = stsy.Years, SchoolcodeID = stsy.SchoolcodeID } into tempstsy
from startsy in tempstsy.DefaultIfEmpty()
join grsy in SchoolyearRepository.Entities
on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
from gradsy in tempgrsy.DefaultIfEmpty()
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join spe in SpecialtyRepository.Entities
on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on fa.StandardID equals dicst.Value into tempst
from fast in tempst.DefaultIfEmpty()
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
select new SpecialtyPlanView
{
SpecialtyPlanID = sp.SpecialtyPlanID,
PlanApplicationID = sp.PlanApplicationID,
SchoolyearID = sp.SchoolyearID,
SchoolyearCode = sy.Code,
YearID = sy.Years,
Value = sy.Value,
SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
SchoolcodeID = sy.SchoolcodeID,
StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
GrademajorID = sp.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
GradeID = gr.GradeID,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeCode = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
StartSchoolyearID = startsy.SchoolyearID,
StartSchoolyearCode = startsy.Code,
StartValue = startsy.Value,
StartSchoolcodeID = gr.SemesterID,
GraduatingSemesterID = gr.GraduateSchoolyearID,
GraduatingSemesterCode = gradsy.Code,
GraduatingSemesterValue = gradsy.Value,
SpecialtyID = spe.SpecialtyID,
StandardID = fa.StandardID,
StandardName = fast.Name,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
CoursematerialID = sp.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = sp.CourseStructureID,
CourseCategoryID = sp.CourseCategoryID,
CourseTypeID = sp.CourseTypeID,
CourseQualityID = sp.CourseQualityID,
Credit = spspst.Credit ?? 0,
TheoryCourse = spspst.TheoryCourse ?? 0,
Practicehours = spspst.Practicehours ?? 0,
Trialhours = spspst.Trialhours ?? 0,
Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
WeeklyHours = spspst.WeeklyHours ?? 0,
WeeklyNum = spspst.WeeklyNum ?? 0,
StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
DepartmentID = sp.DepartmentID,
DepartmentCode = spdep.No,
DepartmentName = spdep.Name,
CourseCollegeID = spdep.CollegeID,
CourseCollegeCode = spdep.CF_College.No,
CourseCollegeName = spdep.CF_College.Name,
IsSpecialtycore = sp.IsSpecialtycore ?? false,
IsCooperation = sp.IsCooperation ?? false,
IsRequired = sp.IsRequired ?? false,
IsElective = sp.IsElective ?? false,
IsNetworkCourse = sp.IsNetworkCourse ?? false,
IsMainCourse = sp.IsMainCourse ?? false,
IsNeedMaterial = sp.IsNeedMaterial ?? false,
CourseFineID = sp.CourseFineID,
PracticeTypeID = sp.PracticeTypeID,
TeachinglanguageID = sp.TeachinglanguageID,
ExaminationModeID = sp.ExaminationModeID,
ResultTypeID = sp.ResultTypeID,
HandleModeID = sp.HandleModeID,
TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
Remark = sp.Remark,
RecordStatus = sp.RecordStatus,
CreateUserID = sp.CreateUserID,
CreateTime = sp.CreateTime,
ModifyUserID = sp.ModifyUserID,
ModifyTime = sp.ModifyTime
};
return query;
}
///
/// 查询专业计划信息SpecialtyPlanView(统计对应的计划范围、学生人数)
/// 注:普教版本(年级专业)
///
///
///
///
public IQueryable GetSpecialtyPlanViewQueryable(Expression> expSpecialtyPlan,
Expression> expStudent)
{
var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join spst in SpecialtyPlanTeachingSettingRepository.Entities
on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
from spspst in tempspst.DefaultIfEmpty()
join sy in SchoolyearRepository.Entities
on sp.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on sp.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on sp.DepartmentID equals dep.DepartmentID into tempdep
from spdep in tempdep.DefaultIfEmpty()
join gr in GrademajorRepository.Entities
on sp.GrademajorID equals gr.GrademajorID
join stsy in SchoolyearRepository.Entities
on new { SchoolyearID = gr.GradeID.Value, SchoolcodeID = gr.SemesterID.Value }
equals new { SchoolyearID = stsy.Years, SchoolcodeID = stsy.SchoolcodeID } into tempstsy
from startsy in tempstsy.DefaultIfEmpty()
join grsy in SchoolyearRepository.Entities
on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
from gradsy in tempgrsy.DefaultIfEmpty()
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join spe in SpecialtyRepository.Entities
on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on fa.StandardID equals dicst.Value into tempst
from fast in tempst.DefaultIfEmpty()
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join pr in
(
from cl in ClassmajorRepository.Entities
group cl by cl.GrademajorID into gpr
select new
{
GrademajorID = gpr.Key,
PlanRange = gpr.Count()
}
)
on gr.GrademajorID equals pr.GrademajorID into temppr
from grpr in temppr.DefaultIfEmpty()
join stu in
(
from stu in StudentRepository.GetList(expStudent)
group stu by stu.CF_Classmajor.CF_Grademajor.GrademajorID into gstu
select new
{
GrademajorID = gstu.Key,
StudentCount = gstu.Count()
}
)
on gr.GrademajorID equals stu.GrademajorID into tempstu
from grstu in tempstu.DefaultIfEmpty()
select new SpecialtyPlanView
{
SpecialtyPlanID = sp.SpecialtyPlanID,
PlanApplicationID = sp.PlanApplicationID,
SchoolyearID = sp.SchoolyearID,
SchoolyearCode = sy.Code,
YearID = sy.Years,
Value = sy.Value,
SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
SchoolcodeID = sy.SchoolcodeID,
StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
GrademajorID = sp.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
GradeID = gr.GradeID,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeCode = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
StartSchoolyearID = startsy.SchoolyearID,
StartSchoolyearCode = startsy.Code,
StartValue = startsy.Value,
StartSchoolcodeID = gr.SemesterID,
GraduatingSemesterID = gr.GraduateSchoolyearID,
GraduatingSemesterCode = gradsy.Code,
GraduatingSemesterValue = gradsy.Value,
SpecialtyID = spe.SpecialtyID,
StandardID = fa.StandardID,
StandardName = fast.Name,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
CoursematerialID = sp.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = sp.CourseStructureID,
CourseCategoryID = sp.CourseCategoryID,
CourseTypeID = sp.CourseTypeID,
CourseQualityID = sp.CourseQualityID,
Credit = spspst.Credit ?? 0,
TheoryCourse = spspst.TheoryCourse ?? 0,
Practicehours = spspst.Practicehours ?? 0,
Trialhours = spspst.Trialhours ?? 0,
Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
WeeklyHours = spspst.WeeklyHours ?? 0,
WeeklyNum = spspst.WeeklyNum ?? 0,
StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
DepartmentID = sp.DepartmentID,
DepartmentCode = spdep.No,
DepartmentName = spdep.Name,
CourseCollegeID = spdep.CollegeID,
CourseCollegeCode = spdep.CF_College.No,
CourseCollegeName = spdep.CF_College.Name,
IsSpecialtycore = sp.IsSpecialtycore ?? false,
IsCooperation = sp.IsCooperation ?? false,
IsRequired = sp.IsRequired ?? false,
IsElective = sp.IsElective ?? false,
IsNetworkCourse = sp.IsNetworkCourse ?? false,
IsMainCourse = sp.IsMainCourse ?? false,
IsNeedMaterial = sp.IsNeedMaterial ?? false,
CourseFineID = sp.CourseFineID,
PracticeTypeID = sp.PracticeTypeID,
TeachinglanguageID = sp.TeachinglanguageID,
ExaminationModeID = sp.ExaminationModeID,
ResultTypeID = sp.ResultTypeID,
HandleModeID = sp.HandleModeID,
TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
PlanRange = grpr.PlanRange == null ? 0 : grpr.PlanRange,
StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
Remark = sp.Remark,
RecordStatus = sp.RecordStatus,
CreateUserID = sp.CreateUserID,
CreateTime = sp.CreateTime,
ModifyUserID = sp.ModifyUserID,
ModifyTime = sp.ModifyTime
};
return query;
}
///
/// 查询对应的计划范围信息(根据专业计划信息,统计各班级信息对应的学生人数)
/// 注:普教版本(年级专业)
///
///
///
///
public IQueryable GetPlanRangeViewQueryable(Expression> expSpecialtyPlan,
Expression> expStudent)
{
var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join gr in GrademajorRepository.Entities
on sp.GrademajorID equals gr.GrademajorID
join cl in ClassmajorRepository.Entities
on gr.GrademajorID equals cl.GrademajorID
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join sc in
(
from stu in StudentRepository.GetList(expStudent)
group stu by stu.CF_Classmajor.ClassmajorID into gstu
select new
{
ClassmajorID = gstu.Key,
StudentCount = gstu.Count()
})
on cl.ClassmajorID equals sc.ClassmajorID into tempsc
from clsc in tempsc.DefaultIfEmpty()
join us in UserRepository.Entities
on cl.UserID equals us.UserID into tempus
from clus in tempus.DefaultIfEmpty()
join au in UserRepository.Entities
on cl.AssistantUserID equals au.UserID into tempau
from clau in tempau.DefaultIfEmpty()
select new ClassmajorView
{
ClassmajorID = cl.ClassmajorID,
No = cl.No,
Name = cl.Name,
Abbreviation = cl.Abbreviation,
EnglishName = cl.EnglishName,
ClassNum = cl.ClassNum,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
GrademajorID = gr.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
CampusID = col.CampusID,
CampusNo = col.CF_Campus.No,
CampusName = col.CF_Campus.Name,
CollegeID = fa.CollegeID,
CollegeCode = col.No,
CollegeName = col.Name,
GradeID = gr.GradeID,
SemesterID = gr.SemesterID,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
GraduateSchoolyearID = gr.GraduateSchoolyearID,
GraduateValue = gr.CF_Schoolyear.Value,
GraduateSchoolyearCode = gr.CF_Schoolyear.Code,
UserID = cl.UserID,
UserName = clus.Name,
AssistantUserID = cl.AssistantUserID,
AssistantUserName = clau.Name,
Fixedclassroom = cl.Fixedclassroom,
StudentCount = clsc.StudentCount == null ? 0 : clsc.StudentCount,
Remark = cl.Remark,
RecordStatus = cl.RecordStatus,
CreateUserID = cl.CreateUserID,
CreateTime = cl.CreateTime,
ModifyUserID = cl.ModifyUserID,
ModifyTime = cl.ModifyTime
};
return query;
}
///
/// 查询专业计划对应的学生信息BaseStudentView
/// 注:普教版本(年级专业)
///
///
///
///
public IQueryable GetBaseStudentViewQueryable(Expression> expSpecialtyPlan,
Expression> expStudent)
{
var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join gr in GrademajorRepository.Entities
on sp.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 cl in ClassmajorRepository.Entities
on gr.GrademajorID equals cl.GrademajorID
join stu in StudentRepository.GetList(expStudent)
on cl.ClassmajorID equals stu.ClassmajorID
join us in UserRepository.Entities
on stu.UserID equals us.UserID
select new BaseStudentView
{
UserID = stu.UserID,
LoginID = us.LoginID,
UserName = us.Name,
SexID = stu.SexID,
IDNumber = stu.IDNumber,
StudentStatus = stu.StudentStatus,
InSchoolStatusID = stu.InSchoolStatusID,
ClassmajorID = stu.ClassmajorID,
ClassmajorCode = cl.No,
ClassmajorName = cl.Name,
ClassNum = cl.ClassNum == null ? 1 : cl.ClassNum,
SchoolyearID = gr.GradeID,
GrademajorID = cl.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name
};
return query;
}
///
/// 查询对应的未新增专业课程信息
/// 注:普教版本(年级专业)
///
///
///
///
///
public IQueryable GetSpecialtyCourseViewNoAddQueryable(Expression> expSpecialtyCourse,
Expression> expGrademajor, Expression> expSpecialtyPlan)
{
var query = from sc in SpecialtyCourseRepository.GetList(expSpecialtyCourse)
join spe in SpecialtyRepository.Entities
on sc.SpecialtyID equals spe.SpecialtyID
join fa in FacultymajorRepository.Entities
on new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
equals new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
join gr in GrademajorRepository.GetList(expGrademajor)
on fa.FacultymajorID equals gr.FacultymajorID
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on spe.StandardID equals dicst.Value into tempst
from spest in tempst.DefaultIfEmpty()
join cou in CoursematerialRepository.Entities
on sc.CoursematerialID equals cou.CoursematerialID
join scts in SpecialtyCourseTeachingSettingRepository.Entities
on sc.SpecialtyCourseID equals scts.SpecialtyCourseID into tempscts
from scscts in tempscts.DefaultIfEmpty()
join dep in DepartmentRepository.Entities
on sc.DepartmentID equals dep.DepartmentID into tempdep
from scdep in tempdep.DefaultIfEmpty()
join col in CollegeRepository.Entities
on scdep.CollegeID equals col.CollegeID into tempcol
from sccol in tempcol.DefaultIfEmpty()
join sp in
(
from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join sy in SchoolyearRepository.Entities
on sp.SchoolyearID equals sy.SchoolyearID
join gr in GrademajorRepository.Entities
on sp.GrademajorID equals gr.GrademajorID
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join spe in SpecialtyRepository.Entities
on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
join spst in SpecialtyPlanTeachingSettingRepository.Entities
on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
from spspst in tempspst.DefaultIfEmpty()
join dep in DepartmentRepository.Entities
on sp.DepartmentID equals dep.DepartmentID into tempdep
from spdep in tempdep.DefaultIfEmpty()
select new
{
SpecialtyPlanID = sp.SpecialtyPlanID,
SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
SchoolcodeID = sy.SchoolcodeID,
StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
GrademajorID = sp.GrademajorID,
GradeID = gr.GradeID,
SpecialtyID = spe.SpecialtyID,
StartSchoolcodeID = gr.SemesterID,
CoursematerialID = sp.CoursematerialID,
CourseTypeID = sp.CourseTypeID,
Credit = spspst.Credit,
DepartmentID = spdep.DepartmentID
}
)
on new { GrademajorID = gr.GrademajorID, StarttermID = sc.StarttermID, CoursematerialID = sc.CoursematerialID }
equals new { GrademajorID = sp.GrademajorID.Value, StarttermID = sp.StarttermID, CoursematerialID = sp.CoursematerialID } into tempsp
from scsp in tempsp.DefaultIfEmpty()
where scsp.SpecialtyPlanID == null
select new SpecialtyCourseView
{
SpecialtyCourseID = sc.SpecialtyCourseID,
SpecialtyID = sc.SpecialtyID,
StandardID = spe.StandardID,
StandardName = spest.Name,
EducationID = spe.EducationID,
LearningformID = spe.LearningformID,
LearnSystem = spe.LearnSystem,
StarttermID = sc.StarttermID,
CoursematerialID = sc.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = sc.CourseStructureID,
CourseCategoryID = sc.CourseCategoryID,
CourseTypeID = sc.CourseTypeID,
CourseQualityID = sc.CourseQualityID,
Credit = scscts.Credit ?? 0,
TheoryCourse = scscts.TheoryCourse ?? 0,
Practicehours = scscts.Practicehours ?? 0,
Trialhours = scscts.Trialhours ?? 0,
Totalhours = (scscts.TheoryCourse ?? 0) + (scscts.Practicehours ?? 0),
TheoryWeeklyNum = scscts.TheoryWeeklyNum ?? 0,
PracticeWeeklyNum = scscts.PracticeWeeklyNum ?? 0,
TrialWeeklyNum = scscts.TrialWeeklyNum ?? 0,
SchoolweeksNum = (scscts.TheoryWeeklyNum ?? 0) + (scscts.PracticeWeeklyNum ?? 0),
WeeklyHours = scscts.WeeklyHours ?? 0,
WeeklyNum = scscts.WeeklyNum ?? 0,
StartWeeklyNum = scscts.StartWeeklyNum ?? 0,
EndWeeklyNum = scscts.EndWeeklyNum ?? 0,
StartEndWeeklyNum = (scscts.StartWeeklyNum ?? 0) + "-" + (scscts.EndWeeklyNum ?? 0),
DepartmentID = sc.DepartmentID,
DepartmentCode = scdep.No,
DepartmentName = scdep.Name,
CollegeID = scdep.CollegeID,
CollegeCode = sccol.No,
CollegeName = sccol.Name,
IsSpecialtycore = sc.IsSpecialtycore ?? false,
IsCooperation = sc.IsCooperation ?? false,
IsRequired = sc.IsRequired ?? false,
IsElective = sc.IsElective ?? false,
IsNetworkCourse = sc.IsNetworkCourse ?? false,
IsMainCourse = sc.IsMainCourse ?? false,
IsNeedMaterial = sc.IsNeedMaterial ?? false,
CourseFineID = sc.CourseFineID,
PracticeTypeID = sc.PracticeTypeID,
TeachinglanguageID = sc.TeachinglanguageID,
ExaminationModeID = sc.ExaminationModeID,
ResultTypeID = sc.ResultTypeID,
HandleModeID = sc.HandleModeID,
TeachingModeIDList = sc.EM_TeachingModeType.Select(x => x.TeachingModeID).ToList(),
TeachingPlaceIDList = sc.EM_TeachingPlace.Select(x => x.TeachingPlace).ToList(),
IsEnable = sc.IsEnable ?? false,
Remark = sc.Remark,
RecordStatus = sc.RecordStatus,
CreateUserID = sc.CreateUserID,
CreateTime = sc.CreateTime,
ModifyUserID = sc.ModifyUserID,
ModifyTime = sc.ModifyTime
};
return query;
}
///
/// 查询专业计划信息SpecialtyPlanView
/// 注:成教版本(入学学年学期、专业信息)
///
///
///
public IQueryable GetAdultSpecialtyPlanViewQueryable(Expression> exp)
{
var query = from sp in SpecialtyPlanRepository.GetList(exp)
join spst in SpecialtyPlanTeachingSettingRepository.Entities
on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
from spspst in tempspst.DefaultIfEmpty()
join sy in SchoolyearRepository.Entities
on sp.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on sp.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on sp.DepartmentID equals dep.DepartmentID into tempdep
from spdep in tempdep.DefaultIfEmpty()
join startsy in SchoolyearRepository.Entities
on sp.StartSchoolyearID equals startsy.SchoolyearID
join spe in SpecialtyRepository.Entities
on sp.SpecialtyID equals spe.SpecialtyID
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on spe.StandardID equals dicst.Value into tempst
from spest in tempst.DefaultIfEmpty()
select new SpecialtyPlanView
{
SpecialtyPlanID = sp.SpecialtyPlanID,
PlanApplicationID = sp.PlanApplicationID,
SchoolyearID = sp.SchoolyearID,
SchoolyearCode = sy.Code,
YearID = sy.Years,
Value = sy.Value,
SchoolyearNumID = (sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1)) / 2 + 1,
SchoolcodeID = sy.SchoolcodeID,
StarttermID = sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1) + 1,
GrademajorID = sp.GrademajorID,
GradeID = startsy.Years,
StartSchoolyearID = startsy.SchoolyearID,
StartSchoolyearCode = startsy.Code,
StartValue = startsy.Value,
StartSchoolcodeID = startsy.SchoolcodeID,
GraduatingSemesterValue = (int)(((startsy.Years * 2) - 1 + (startsy.SchoolcodeID - 1)) + Math.Ceiling(spe.LearnSystem.Value * 2 - 1)),
SpecialtyID = sp.SpecialtyID,
StandardID = spe.StandardID,
StandardName = spest.Name,
EducationID = spe.EducationID,
LearningformID = spe.LearningformID,
LearnSystem = spe.LearnSystem,
CoursematerialID = sp.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = sp.CourseStructureID,
CourseCategoryID = sp.CourseCategoryID,
CourseTypeID = sp.CourseTypeID,
CourseQualityID = sp.CourseQualityID,
Credit = spspst.Credit ?? 0,
TheoryCourse = spspst.TheoryCourse ?? 0,
Practicehours = spspst.Practicehours ?? 0,
Trialhours = spspst.Trialhours ?? 0,
Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
WeeklyHours = spspst.WeeklyHours ?? 0,
WeeklyNum = spspst.WeeklyNum ?? 0,
StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
DepartmentID = sp.DepartmentID,
DepartmentCode = spdep.No,
DepartmentName = spdep.Name,
CourseCollegeID = spdep.CollegeID,
CourseCollegeCode = spdep.CF_College.No,
CourseCollegeName = spdep.CF_College.Name,
IsSpecialtycore = sp.IsSpecialtycore ?? false,
IsCooperation = sp.IsCooperation ?? false,
IsRequired = sp.IsRequired ?? false,
IsElective = sp.IsElective ?? false,
IsNetworkCourse = sp.IsNetworkCourse ?? false,
IsMainCourse = sp.IsMainCourse ?? false,
IsNeedMaterial = sp.IsNeedMaterial ?? false,
CourseFineID = sp.CourseFineID,
PracticeTypeID = sp.PracticeTypeID,
TeachinglanguageID = sp.TeachinglanguageID,
ExaminationModeID = sp.ExaminationModeID,
ResultTypeID = sp.ResultTypeID,
HandleModeID = sp.HandleModeID,
TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
Remark = sp.Remark,
RecordStatus = sp.RecordStatus,
CreateUserID = sp.CreateUserID,
CreateTime = sp.CreateTime,
ModifyUserID = sp.ModifyUserID,
ModifyTime = sp.ModifyTime
};
return query;
}
///
/// 查询专业计划信息SpecialtyPlanView(统计对应的计划范围、学生人数)
/// 注:成教版本(入学学年学期、专业信息)
///
///
///
///
public IQueryable GetAdultSpecialtyPlanViewQueryable(Expression> expSpecialtyPlan,
Expression> expStudent)
{
var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join spst in SpecialtyPlanTeachingSettingRepository.Entities
on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
from spspst in tempspst.DefaultIfEmpty()
join sy in SchoolyearRepository.Entities
on sp.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on sp.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on sp.DepartmentID equals dep.DepartmentID into tempdep
from spdep in tempdep.DefaultIfEmpty()
join startsy in SchoolyearRepository.Entities
on sp.StartSchoolyearID equals startsy.SchoolyearID
join spe in SpecialtyRepository.Entities
on sp.SpecialtyID equals spe.SpecialtyID
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on spe.StandardID equals dicst.Value into tempst
from spest in tempst.DefaultIfEmpty()
join pr in
(
from gr in GrademajorRepository.Entities
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join spe in SpecialtyRepository.Entities
on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
group new { gr, spe } by new { gr.GradeID, gr.SemesterID, spe.SpecialtyID } into gpr
select new
{
GradeID = gpr.Key.GradeID,
StartSchoolcodeID = gpr.Key.SemesterID,
SpecialtyID = gpr.Key.SpecialtyID,
PlanRange = gpr.Count()
}
)
on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, SpecialtyID = spe.SpecialtyID }
equals new { GradeID = pr.GradeID.Value, StartSchoolcodeID = pr.StartSchoolcodeID.Value, SpecialtyID = pr.SpecialtyID } into temppr
from sppr in temppr.DefaultIfEmpty()
join sc in
(
from stu in StudentRepository.GetList(expStudent)
join cl in ClassmajorRepository.Entities
on stu.ClassmajorID equals cl.ClassmajorID
join gr in GrademajorRepository.Entities
on cl.GrademajorID equals gr.GrademajorID
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join spe in SpecialtyRepository.Entities
on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
group new { gr, spe } by new { gr.GradeID, gr.SemesterID, spe.SpecialtyID } into gstu
select new
{
GradeID = gstu.Key.GradeID,
StartSchoolcodeID = gstu.Key.SemesterID,
SpecialtyID = gstu.Key.SpecialtyID,
StudentCount = gstu.Count()
}
)
on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, SpecialtyID = spe.SpecialtyID }
equals new { GradeID = sc.GradeID.Value, StartSchoolcodeID = sc.StartSchoolcodeID.Value, SpecialtyID = sc.SpecialtyID } into tempstu
from spstu in tempstu.DefaultIfEmpty()
select new SpecialtyPlanView
{
SpecialtyPlanID = sp.SpecialtyPlanID,
PlanApplicationID = sp.PlanApplicationID,
SchoolyearID = sp.SchoolyearID,
SchoolyearCode = sy.Code,
YearID = sy.Years,
Value = sy.Value,
SchoolyearNumID = (sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1)) / 2 + 1,
SchoolcodeID = sy.SchoolcodeID,
StarttermID = sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1) + 1,
GrademajorID = sp.GrademajorID,
GradeID = startsy.Years,
StartSchoolyearID = startsy.SchoolyearID,
StartSchoolyearCode = startsy.Code,
StartValue = startsy.Value,
StartSchoolcodeID = startsy.SchoolcodeID,
GraduatingSemesterValue = (int)(((startsy.Years * 2) - 1 + (startsy.SchoolcodeID - 1)) + Math.Ceiling(spe.LearnSystem.Value * 2 - 1)),
SpecialtyID = sp.SpecialtyID,
StandardID = spe.StandardID,
StandardName = spest.Name,
EducationID = spe.EducationID,
LearningformID = spe.LearningformID,
LearnSystem = spe.LearnSystem,
CoursematerialID = sp.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = sp.CourseStructureID,
CourseCategoryID = sp.CourseCategoryID,
CourseTypeID = sp.CourseTypeID,
CourseQualityID = sp.CourseQualityID,
Credit = spspst.Credit ?? 0,
TheoryCourse = spspst.TheoryCourse ?? 0,
Practicehours = spspst.Practicehours ?? 0,
Trialhours = spspst.Trialhours ?? 0,
Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
WeeklyHours = spspst.WeeklyHours ?? 0,
WeeklyNum = spspst.WeeklyNum ?? 0,
StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
DepartmentID = sp.DepartmentID,
DepartmentCode = spdep.No,
DepartmentName = spdep.Name,
CourseCollegeID = spdep.CollegeID,
CourseCollegeCode = spdep.CF_College.No,
CourseCollegeName = spdep.CF_College.Name,
IsSpecialtycore = sp.IsSpecialtycore ?? false,
IsCooperation = sp.IsCooperation ?? false,
IsRequired = sp.IsRequired ?? false,
IsElective = sp.IsElective ?? false,
IsNetworkCourse = sp.IsNetworkCourse ?? false,
IsMainCourse = sp.IsMainCourse ?? false,
IsNeedMaterial = sp.IsNeedMaterial ?? false,
CourseFineID = sp.CourseFineID,
PracticeTypeID = sp.PracticeTypeID,
TeachinglanguageID = sp.TeachinglanguageID,
ExaminationModeID = sp.ExaminationModeID,
ResultTypeID = sp.ResultTypeID,
HandleModeID = sp.HandleModeID,
TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
PlanRange = sppr.PlanRange == null ? 0 : sppr.PlanRange,
StudentCount = spstu.StudentCount == null ? 0 : spstu.StudentCount,
PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
Remark = sp.Remark,
RecordStatus = sp.RecordStatus,
CreateUserID = sp.CreateUserID,
CreateTime = sp.CreateTime,
ModifyUserID = sp.ModifyUserID,
ModifyTime = sp.ModifyTime
};
return query;
}
///
/// 查询专业计划信息SpecialtyPlanView(需匹配年级专业信息、专业信息)
/// 注:查询出学年学期、年级专业、课程信息等信息
/// 注:成教版本(入学学年学期、专业信息)
///
///
///
///
///
public IQueryable GetAdultSpecialtyPlanViewQueryable(Expression> expSchoolyear,
Expression> expSpecialty, Expression> expSpecialtyPlan)
{
var query = from gr in GrademajorRepository.Entities
join startsy in SchoolyearRepository.GetList(expSchoolyear)
on new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value }
equals new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID }
join grsy in SchoolyearRepository.Entities
on gr.GraduateSchoolyearID equals grsy.SchoolyearID into tempgrsy
from gradsy in tempgrsy.DefaultIfEmpty()
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join spe in SpecialtyRepository.GetList(expSpecialty)
on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on fa.StandardID equals dicst.Value into tempst
from fast in tempst.DefaultIfEmpty()
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
on new { StartSchoolyearID = startsy.SchoolyearID, SpecialtyID = spe.SpecialtyID }
equals new { StartSchoolyearID = sp.StartSchoolyearID.Value, SpecialtyID = sp.SpecialtyID.Value }
join spst in SpecialtyPlanTeachingSettingRepository.Entities
on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
from spspst in tempspst.DefaultIfEmpty()
join sy in SchoolyearRepository.Entities
on sp.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on sp.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on sp.DepartmentID equals dep.DepartmentID into tempdep
from spdep in tempdep.DefaultIfEmpty()
select new SpecialtyPlanView
{
SpecialtyPlanID = sp.SpecialtyPlanID,
PlanApplicationID = sp.PlanApplicationID,
SchoolyearID = sp.SchoolyearID,
SchoolyearCode = sy.Code,
YearID = sy.Years,
Value = sy.Value,
SchoolyearNumID = (sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1)) / 2 + 1,
SchoolcodeID = sy.SchoolcodeID,
StarttermID = sy.Value - ((gr.GradeID * 2 - 1) + gr.SemesterID - 1) + 1,
GrademajorID = gr.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
GradeID = gr.GradeID,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeCode = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
StartSchoolyearID = sp.StartSchoolyearID,
StartSchoolyearCode = startsy.Code,
StartValue = startsy.Value,
StartSchoolcodeID = gr.SemesterID,
GraduatingSemesterID = gr.GraduateSchoolyearID,
GraduatingSemesterCode = gradsy.Code,
GraduatingSemesterValue = gradsy.Value,
SpecialtyID = sp.SpecialtyID,
StandardID = fa.StandardID,
StandardName = fast.Name,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
CoursematerialID = sp.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = sp.CourseStructureID,
CourseCategoryID = sp.CourseCategoryID,
CourseTypeID = sp.CourseTypeID,
CourseQualityID = sp.CourseQualityID,
Credit = spspst.Credit ?? 0,
TheoryCourse = spspst.TheoryCourse ?? 0,
Practicehours = spspst.Practicehours ?? 0,
Trialhours = spspst.Trialhours ?? 0,
Totalhours = (spspst.TheoryCourse ?? 0) + (spspst.Practicehours ?? 0),
TheoryWeeklyNum = spspst.TheoryWeeklyNum ?? 0,
PracticeWeeklyNum = spspst.PracticeWeeklyNum ?? 0,
TrialWeeklyNum = spspst.TrialWeeklyNum ?? 0,
SchoolweeksNum = (spspst.TheoryWeeklyNum ?? 0) + (spspst.PracticeWeeklyNum ?? 0),
WeeklyHours = spspst.WeeklyHours ?? 0,
WeeklyNum = spspst.WeeklyNum ?? 0,
StartWeeklyNum = spspst.StartWeeklyNum ?? 0,
EndWeeklyNum = spspst.EndWeeklyNum ?? 0,
StartEndWeeklyNum = (spspst.StartWeeklyNum ?? 0) + "-" + (spspst.EndWeeklyNum ?? 0),
DepartmentID = sp.DepartmentID,
DepartmentCode = spdep.No,
DepartmentName = spdep.Name,
CourseCollegeID = spdep.CollegeID,
CourseCollegeCode = spdep.CF_College.No,
CourseCollegeName = spdep.CF_College.Name,
IsSpecialtycore = sp.IsSpecialtycore ?? false,
IsCooperation = sp.IsCooperation ?? false,
IsRequired = sp.IsRequired ?? false,
IsElective = sp.IsElective ?? false,
IsNetworkCourse = sp.IsNetworkCourse ?? false,
IsMainCourse = sp.IsMainCourse ?? false,
IsNeedMaterial = sp.IsNeedMaterial ?? false,
CourseFineID = sp.CourseFineID,
PracticeTypeID = sp.PracticeTypeID,
TeachinglanguageID = sp.TeachinglanguageID,
ExaminationModeID = sp.ExaminationModeID,
ResultTypeID = sp.ResultTypeID,
HandleModeID = sp.HandleModeID,
TeachingModeIDList = sp.EM_SpecialtyPlanTeachingModeType.Select(x => x.TeachingModeID).ToList(),
TeachingPlaceIDList = sp.EM_SpecialtyPlanTeachingPlace.Select(x => x.TeachingPlace).ToList(),
PlanStatus = sp.EM_ExecutablePlan.Count() > 0 ? (int)EM_PlanStatus.Execute : (int)EM_PlanStatus.NotExecute,
Remark = sp.Remark,
RecordStatus = sp.RecordStatus,
CreateUserID = sp.CreateUserID,
CreateTime = sp.CreateTime,
ModifyUserID = sp.ModifyUserID,
ModifyTime = sp.ModifyTime
};
return query;
}
///
/// 查询对应的年级专业信息(根据学年学期信息、专业信息,统计年级专业对应的学生人数)
/// 注:成教版本(入学学年学期、专业信息)
///
///
///
///
public IQueryable GetAdultGrademajorViewQueryable(Expression> expSchoolyear,
Expression> expSpecialty)
{
var query = from gr in GrademajorRepository.Entities
join startsy in SchoolyearRepository.GetList(expSchoolyear)
on new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value }
equals new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID }
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join spe in SpecialtyRepository.GetList(expSpecialty)
on new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
equals new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join stu in
(
from stu in StudentRepository.Entities
group stu by stu.CF_Classmajor.CF_Grademajor.GrademajorID into gstu
select new
{
GrademajorID = gstu.Key,
StudentCount = gstu.Count()
}
)
on gr.GrademajorID equals stu.GrademajorID into tempstu
from grstu in tempstu.DefaultIfEmpty()
select new GrademajorView
{
GrademajorID = gr.GrademajorID,
Code = gr.Code,
Name = gr.Name,
Abbreviation = gr.Abbreviation,
FacultymajorID = fa.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
CollegeID = fa.CollegeID,
CollegeCode = col.No,
CollegeName = col.Name,
GradeID = gr.GradeID,
SemesterID = gr.SemesterID,
SpecialtyID = spe.SpecialtyID,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
StartSchoolyearID = startsy.SchoolyearID,
StartSchoolyearCode = startsy.Code,
StartValue = startsy.Value,
GraduateSchoolyearID = gr.GraduateSchoolyearID,
GraduateValue = gr.CF_Schoolyear.Value,
GraduateSchoolyearCode = gr.CF_Schoolyear.Code,
Professional = gr.Professional,
StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
Remark = gr.Remark,
RecordStatus = gr.RecordStatus
};
return query;
}
///
/// 查询对应的计划范围信息(根据专业计划信息,统计各年级专业对应的班级数、学生人数)
/// 注:成教版本(入学学年学期、专业信息)
///
///
///
///
public IQueryable GetAdultPlanRangeViewQueryable(Expression> expSpecialtyPlan,
Expression> expStudent)
{
var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join startsy in SchoolyearRepository.Entities
on sp.StartSchoolyearID equals startsy.SchoolyearID
join spe in SpecialtyRepository.Entities
on sp.SpecialtyID equals spe.SpecialtyID
join fa in FacultymajorRepository.Entities
on new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
equals new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join gr in GrademajorRepository.Entities
on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, FacultymajorID = fa.FacultymajorID }
equals new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value, FacultymajorID = gr.FacultymajorID.Value }
join cl in
(
from cl in ClassmajorRepository.Entities
group cl by cl.GrademajorID into gcl
select new
{
GrademajorID = gcl.Key,
ClassmajorCount = gcl.Count()
}
)
on gr.GrademajorID equals cl.GrademajorID into tempcl
from grcl in tempcl.DefaultIfEmpty()
join sc in
(
from stu in StudentRepository.GetList(expStudent)
group stu by stu.CF_Classmajor.CF_Grademajor.GrademajorID into gstu
select new
{
GrademajorID = gstu.Key,
StudentCount = gstu.Count()
}
)
on gr.GrademajorID equals sc.GrademajorID into tempstu
from grstu in tempstu.DefaultIfEmpty()
select new GrademajorView
{
GrademajorID = gr.GrademajorID,
Code = gr.Code,
Name = gr.Name,
Abbreviation = gr.Abbreviation,
FacultymajorID = fa.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CampusID = col.CampusID,
CampusNo = col.CF_Campus.No,
CampusName = col.CF_Campus.Name,
CollegeID = fa.CollegeID,
CollegeCode = col.No,
CollegeName = col.Name,
GradeID = gr.GradeID,
SemesterID = gr.SemesterID,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
GraduateSchoolyearID = gr.GraduateSchoolyearID,
GraduateValue = gr.CF_Schoolyear.Value,
GraduateSchoolyearCode = gr.CF_Schoolyear.Code,
Professional = gr.Professional,
ClassmajorCount = grcl.ClassmajorCount == null ? 0 : grcl.ClassmajorCount,
StudentCount = grstu.StudentCount == null ? 0 : grstu.StudentCount,
Remark = gr.Remark,
RecordStatus = gr.RecordStatus,
CreateUserID = gr.CreateUserID,
CreateTime = gr.CreateTime,
ModifyUserID = gr.ModifyUserID,
ModifyTime = gr.ModifyTime
};
return query;
}
///
/// 查询专业计划对应的学生信息BaseStudentView
/// 注:成教版本(入学学年学期、专业信息)
///
///
///
///
public IQueryable GetAdultBaseStudentViewQueryable(Expression> expSpecialtyPlan,
Expression> expStudent)
{
var query = from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join startsy in SchoolyearRepository.Entities
on sp.StartSchoolyearID equals startsy.SchoolyearID
join spe in SpecialtyRepository.Entities
on sp.SpecialtyID equals spe.SpecialtyID
join fa in FacultymajorRepository.Entities
on new { StandardID = spe.StandardID, EducationID = spe.EducationID, LearningformID = spe.LearningformID, LearnSystem = spe.LearnSystem }
equals new { StandardID = fa.StandardID, EducationID = fa.EducationID, LearningformID = fa.LearningformID, LearnSystem = fa.LearnSystem }
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join gr in GrademajorRepository.Entities
on new { GradeID = startsy.Years, StartSchoolcodeID = startsy.SchoolcodeID, FacultymajorID = fa.FacultymajorID }
equals new { GradeID = gr.GradeID.Value, StartSchoolcodeID = gr.SemesterID.Value, FacultymajorID = gr.FacultymajorID.Value }
join cl in ClassmajorRepository.Entities
on gr.GrademajorID equals cl.GrademajorID
join stu in StudentRepository.GetList(expStudent)
on cl.ClassmajorID equals stu.ClassmajorID
join us in UserRepository.Entities
on stu.UserID equals us.UserID
select new BaseStudentView
{
UserID = stu.UserID,
LoginID = us.LoginID,
UserName = us.Name,
SexID = stu.SexID,
IDNumber = stu.IDNumber,
StudentStatus = stu.StudentStatus,
InSchoolStatusID = stu.InSchoolStatusID,
ClassmajorID = stu.ClassmajorID,
ClassmajorCode = cl.No,
ClassmajorName = cl.Name,
ClassNum = cl.ClassNum == null ? 1 : cl.ClassNum,
SchoolyearID = gr.GradeID,
GrademajorID = cl.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name
};
return query;
}
///
/// 查询对应的未新增专业课程信息
/// 注:成教版本(入学学年学期、专业信息)
///
///
///
///
///
public IQueryable GetAdultSpecialtyCourseViewNoAddQueryable(Expression> expSpecialtyCourse,
Expression> expSchoolyear, Expression> expSpecialty,
Expression> expSpecialtyPlan)
{
var query = from sc in SpecialtyCourseRepository.GetList(expSpecialtyCourse)
join spe in SpecialtyRepository.GetList(expSpecialty)
on sc.SpecialtyID equals spe.SpecialtyID
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on spe.StandardID equals dicst.Value into tempst
from spest in tempst.DefaultIfEmpty()
join cou in CoursematerialRepository.Entities
on sc.CoursematerialID equals cou.CoursematerialID
join scts in SpecialtyCourseTeachingSettingRepository.Entities
on sc.SpecialtyCourseID equals scts.SpecialtyCourseID into tempscts
from scscts in tempscts.DefaultIfEmpty()
join dep in DepartmentRepository.Entities
on sc.DepartmentID equals dep.DepartmentID into tempdep
from scdep in tempdep.DefaultIfEmpty()
join col in CollegeRepository.Entities
on scdep.CollegeID equals col.CollegeID into tempcol
from sccol in tempcol.DefaultIfEmpty()
join sp in
(
from sp in SpecialtyPlanRepository.GetList(expSpecialtyPlan)
join sy in SchoolyearRepository.Entities
on sp.SchoolyearID equals sy.SchoolyearID
join startsy in SchoolyearRepository.GetList(expSchoolyear)
on sp.StartSchoolyearID equals startsy.SchoolyearID
join spe in SpecialtyRepository.Entities
on sp.SpecialtyID equals spe.SpecialtyID
join spst in SpecialtyPlanTeachingSettingRepository.Entities
on sp.SpecialtyPlanID equals spst.SpecialtyPlanID into tempspst
from spspst in tempspst.DefaultIfEmpty()
join dep in DepartmentRepository.Entities
on sp.DepartmentID equals dep.DepartmentID into tempdep
from spdep in tempdep.DefaultIfEmpty()
select new
{
SpecialtyPlanID = sp.SpecialtyPlanID,
SchoolyearNumID = (sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1)) / 2 + 1,
SchoolcodeID = sy.SchoolcodeID,
StarttermID = sy.Value - ((startsy.Years * 2 - 1) + startsy.SchoolcodeID - 1) + 1,
StartSchoolyearID = sp.StartSchoolyearID,
GradeID = startsy.Years,
SpecialtyID = sp.SpecialtyID,
StartSchoolcodeID = startsy.SchoolcodeID,
CoursematerialID = sp.CoursematerialID,
CourseTypeID = sp.CourseTypeID,
Credit = spspst.Credit,
DepartmentID = spdep.DepartmentID
}
)
on new { SpecialtyID = sc.SpecialtyID, StarttermID = sc.StarttermID, CoursematerialID = sc.CoursematerialID }
equals new { SpecialtyID = sp.SpecialtyID, StarttermID = sp.StarttermID, CoursematerialID = sp.CoursematerialID } into tempsp
from scsp in tempsp.DefaultIfEmpty()
where scsp.SpecialtyPlanID == null
select new SpecialtyCourseView
{
SpecialtyCourseID = sc.SpecialtyCourseID,
SpecialtyID = sc.SpecialtyID,
StandardID = spe.StandardID,
StandardName = spest.Name,
EducationID = spe.EducationID,
LearningformID = spe.LearningformID,
LearnSystem = spe.LearnSystem,
StarttermID = sc.StarttermID,
CoursematerialID = sc.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = sc.CourseStructureID,
CourseCategoryID = sc.CourseCategoryID,
CourseTypeID = sc.CourseTypeID,
CourseQualityID = sc.CourseQualityID,
Credit = scscts.Credit ?? 0,
TheoryCourse = scscts.TheoryCourse ?? 0,
Practicehours = scscts.Practicehours ?? 0,
Trialhours = scscts.Trialhours ?? 0,
Totalhours = (scscts.TheoryCourse ?? 0) + (scscts.Practicehours ?? 0),
TheoryWeeklyNum = scscts.TheoryWeeklyNum ?? 0,
PracticeWeeklyNum = scscts.PracticeWeeklyNum ?? 0,
TrialWeeklyNum = scscts.TrialWeeklyNum ?? 0,
SchoolweeksNum = (scscts.TheoryWeeklyNum ?? 0) + (scscts.PracticeWeeklyNum ?? 0),
WeeklyHours = scscts.WeeklyHours ?? 0,
WeeklyNum = scscts.WeeklyNum ?? 0,
StartWeeklyNum = scscts.StartWeeklyNum ?? 0,
EndWeeklyNum = scscts.EndWeeklyNum ?? 0,
StartEndWeeklyNum = (scscts.StartWeeklyNum ?? 0) + "-" + (scscts.EndWeeklyNum ?? 0),
DepartmentID = sc.DepartmentID,
DepartmentCode = scdep.No,
DepartmentName = scdep.Name,
CollegeID = scdep.CollegeID,
CollegeCode = sccol.No,
CollegeName = sccol.Name,
IsSpecialtycore = sc.IsSpecialtycore ?? false,
IsCooperation = sc.IsCooperation ?? false,
IsRequired = sc.IsRequired ?? false,
IsElective = sc.IsElective ?? false,
IsNetworkCourse = sc.IsNetworkCourse ?? false,
IsMainCourse = sc.IsMainCourse ?? false,
IsNeedMaterial = sc.IsNeedMaterial ?? false,
CourseFineID = sc.CourseFineID,
PracticeTypeID = sc.PracticeTypeID,
TeachinglanguageID = sc.TeachinglanguageID,
ExaminationModeID = sc.ExaminationModeID,
ResultTypeID = sc.ResultTypeID,
HandleModeID = sc.HandleModeID,
TeachingModeIDList = sc.EM_TeachingModeType.Select(x => x.TeachingModeID).ToList(),
TeachingPlaceIDList = sc.EM_TeachingPlace.Select(x => x.TeachingPlace).ToList(),
IsEnable = sc.IsEnable ?? false,
Remark = sc.Remark,
RecordStatus = sc.RecordStatus,
CreateUserID = sc.CreateUserID,
CreateTime = sc.CreateTime,
ModifyUserID = sc.ModifyUserID,
ModifyTime = sc.ModifyTime
};
return query;
}
///
/// 查询专业计划信息对应的授课方式
///
///
///
public IQueryable GetTeachingModeTypeQueryble(Expression> exp)
{
var query = from sp in SpecialtyPlanRepository.GetList(exp)
join sptm in SpecialtyPlanTeachingModeTypeRepository.Entities
on sp.SpecialtyPlanID equals sptm.SpecialtyPlanID
join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name)
on sptm.TeachingModeID equals dictm.Value
select dictm.Value;
return query;
}
///
/// 查询专业计划信息对应的授课方式
///
///
///
public IQueryable GetTeachingPlaceQueryble(Expression> exp)
{
var query = from sp in SpecialtyPlanRepository.GetList(exp)
join sptp in SpecialtyPlanTeachingPlaceRepository.Entities
on sp.SpecialtyPlanID equals sptp.SpecialtyPlanID
join dictp in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.EM_TeachingPlace).Name)
on sptp.TeachingPlace equals dictp.Value
select dictp.Value;
return query;
}
}
}