123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.MinorManage.MinorPlanManage;
- using System.Linq.Expressions;
- using EMIS.Entities;
- namespace EMIS.DataLogic.MinorManage.MinorPlanManage
- {
- public class MinorPlanApplyDAL
- {
- public GrademinorApplicationRepository GrademinorApplicationRepository { get; set; }
- public MinorPlanApplicationRepository MinorPlanApplicationRepository { get; set; }
- public MinorPlanApplicationTeachingModeTypeRepository MinorPlanApplicationTeachingModeTypeRepository { get; set; }
- public MinorPlanApplicationTeachingPlaceRepository MinorPlanApplicationTeachingPlaceRepository { get; set; }
- public MinorPlanApplicationTeachingSettingRepository MinorPlanApplicationTeachingSettingRepository { get; set; }
- public MinorCourseRepository MinorCourseRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public MinorCourseTeachingSettingRepository MinorCourseTeachingSettingRepository { get; set; }
- public MinorCourseTeachingModeTypeRepository MinorCourseTeachingModeTypeRepository { get; set; }
- public MinorCourseTeachingPlaceRepository MinorCourseTeachingPlaceRepository { get; set; }
- public GrademinorRepository GrademinorRepository { get; set; }
- public IQueryable<MinorPlanApplyView> GetMinorPlanApplyViewQueryable(Expression<Func<CF_GrademinorApplication, bool>> exp)
- {
- var query = from GrademinorApply in GrademinorApplicationRepository.GetList(exp)
- join User in UserRepository.Entities on GrademinorApply.CreateUserID equals User.UserID into user
- from u in user.DefaultIfEmpty()
- select new MinorPlanApplyView
- {
- GradeMinorApplicationID = GrademinorApply.GradeMinorApplicationID,
- YearID = GrademinorApply.YearID,
- SchoolyearID=GrademinorApply.SchoolyearID,
- SchoolyearCode=GrademinorApply.CF_Schoolyear.Code,
- StandardID = GrademinorApply.StandardID,
- CollegeID = GrademinorApply.CollegeID,
- CollegeName = GrademinorApply.CF_College.Name,
- CollegeNo = GrademinorApply.CF_College.No,
- StudentLimit = GrademinorApply.StudentLimit,
- ApprovalStatus = GrademinorApply.RecordStatus,
- CreateUserID = GrademinorApply.CreateUserID,
- CreateTime = GrademinorApply.CreateTime,
- CreateUserName = u.Name
- };
- return query;
- }
- /// <summary>
- /// 查询所有年级和专业课程信息
- /// </summary>
- /// <returns></returns>
- public IQueryable<MinorPlanApplyView> StandardAndMinorSpecialtyCourseView(Expression<Func<EM_MinorCourse, bool>> exp,int? YearID)
- {
- var graduatingSemester = EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID;
- if (graduatingSemester == null)
- {
- throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查");
- }
- var SchoolcodeID = Convert.ToInt32(graduatingSemester);
- var query = from MinorCourse in MinorCourseRepository.GetList(exp)
- join GrademinorApply in
- (
- from GrademinorApply in GrademinorApplicationRepository.GetList(x => x.YearID == YearID)
- join MinorPlanApply in MinorPlanApplicationRepository.Entities on new { GrademinorApply.GradeMinorApplicationID }
- equals new { GradeMinorApplicationID = (Guid)MinorPlanApply.GrademinorApplicationID }
- select new
- {
- GradeMinorApplicationID = GrademinorApply.GradeMinorApplicationID,
- MinorPlanApplicationID=MinorPlanApply.MinorPlanApplicationID,
- CoursematerialID = MinorPlanApply.CoursematerialID,
- CollegeID = GrademinorApply.CollegeID,
- SchoolyearID = GrademinorApply.SchoolyearID,
- StandardID = GrademinorApply.StandardID,
- YearID=GrademinorApply.YearID
- }
- ) on new { MinorCourse.CoursematerialID, MinorCourse.StandardID } equals new { GrademinorApply.CoursematerialID, GrademinorApply.StandardID }
- into GrademinorApplication
- from GA in GrademinorApplication.DefaultIfEmpty()
- where GA.GradeMinorApplicationID == null && GA.MinorPlanApplicationID == null
- select new MinorPlanApplyView
- {
- GradeMinorApplicationID = GA.GradeMinorApplicationID,
- MinorPlanApplicationID = GA.MinorPlanApplicationID,
- MinorCourseID = MinorCourse.MinorCourseID,
- CollegeID = MinorCourse.CF_Department.CollegeID,
- CoursematerialID = MinorCourse.CoursematerialID,
- CourseCode = MinorCourse.EM_Coursematerial.CourseCode,
- CourseName = MinorCourse.EM_Coursematerial.CourseName,
- SchoolyearID = GA.SchoolyearID,
- YearID = GA.YearID,
- StandardID = MinorCourse.StandardID,
- CourseCategoryID = MinorCourse.CourseCategoryID,
- CourseQualityID = MinorCourse.CourseQualityID,
- SchoolcodeID = MinorCourse.SchoolcodeID,
- SchoolyearNumID = MinorCourse.SchoolyearNumID,
- StarttermID = ((MinorCourse.SchoolyearNumID - 1) * 2) + (MinorCourse.SchoolcodeID == SchoolcodeID ? 0 : 1) + 1,
- Credit = MinorCourse.EM_MinorCourseTeachingSetting.Credit ?? 0,
- TheoryCourse = MinorCourse.EM_MinorCourseTeachingSetting.TheoryCourse ?? 0,
- Practicehours = MinorCourse.EM_MinorCourseTeachingSetting.Practicehours ?? 0,
- Trialhours = MinorCourse.EM_MinorCourseTeachingSetting.Trialhours ?? 0,
- Totalhours = (MinorCourse.EM_MinorCourseTeachingSetting.TheoryCourse
- + MinorCourse.EM_MinorCourseTeachingSetting.Practicehours) ?? 0,
- TheoryWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.TrialWeeklyNum ?? 0,
- SchoolweeksNum = (MinorCourse.EM_MinorCourseTeachingSetting.TheoryWeeklyNum
- + MinorCourse.EM_MinorCourseTeachingSetting.PracticeWeeklyNum) ?? 0,
- StartWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.StartWeeklyNum ?? 0,
- EndWeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.EndWeeklyNum ?? 0,
- WeeklyNum = MinorCourse.EM_MinorCourseTeachingSetting.WeeklyNum ?? 0,
- WeeklyHours = MinorCourse.EM_MinorCourseTeachingSetting.WeeklyHours ?? 0,
- DepartmentID = MinorCourse.DepartmentID,
- CourseStructureID = MinorCourse.CourseStructureID,
- CourseTypeID = MinorCourse.CourseTypeID,
- ExaminationModeID = MinorCourse.ExaminationModeID,
- TeachinglanguageID = MinorCourse.TeachinglanguageID,
- PracticeTypeID = MinorCourse.PracticeTypeID,
- CourseFineID = MinorCourse.CourseFineID,
- IsSpecialtycore = MinorCourse.IsSpecialtycore ?? false,
- IsCooperation = MinorCourse.IsCooperation ?? false,
- IsRequired = MinorCourse.IsRequired ?? false,
- IsElective = MinorCourse.IsElective ?? false,
- IsNetworkCourse = MinorCourse.IsNetworkCourse ?? false,
- IsNeedMaterial=true,
- HandleModeID=(int)EMIS.ViewModel.CF_HandleMode.MinorCourse,
- IsMainCourse = MinorCourse.IsMainCourse ?? false,
- IsEnable = MinorCourse.IsEnable ?? false,
- ResultTypeID = MinorCourse.ResultTypeID
- };
- return query;
- }
- /// <summary>
- /// 查询已存在的课程信息
- /// </summary>
- /// <returns></returns>
- public IQueryable<MinorPlanApplyView> existStandardAndMinorSpecialtyCourseView(Expression<Func<CF_GrademinorApplication, bool>> exp)
- {
- var graduatingSemester = EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID;
- if (graduatingSemester == null)
- {
- throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查");
- }
- var SchoolcodeID = Convert.ToInt32(graduatingSemester);
- var query = from MinorCourse in MinorCourseRepository.GetList(x=>true)
- join GrademinorApply in
- (
- from GrademinorApply in GrademinorApplicationRepository.GetList(exp)
- join MinorPlanApply in MinorPlanApplicationRepository.Entities on new { GrademinorApply.GradeMinorApplicationID }
- equals new { GradeMinorApplicationID = (Guid)MinorPlanApply.GrademinorApplicationID }
- select new
- {
- GradeMinorApplicationID = GrademinorApply.GradeMinorApplicationID,
- MinorPlanApplicationID = MinorPlanApply.MinorPlanApplicationID,
- CoursematerialID = MinorPlanApply.CoursematerialID,
- CollegeID = GrademinorApply.CollegeID,
- SchoolyearID = GrademinorApply.SchoolyearID,
- StandardID = GrademinorApply.StandardID,
- YearID = GrademinorApply.YearID,
- MinorCourse = MinorPlanApply
- }
- ) on new { MinorCourse.CoursematerialID, MinorCourse.StandardID } equals new { GrademinorApply.CoursematerialID, GrademinorApply.StandardID }
- into GrademinorApplication
- from GA in GrademinorApplication.DefaultIfEmpty()
- where GA.GradeMinorApplicationID != null && GA.MinorPlanApplicationID != null
- select new MinorPlanApplyView
- {
- GradeMinorApplicationID = GA.GradeMinorApplicationID,
- MinorPlanApplicationID = GA.MinorPlanApplicationID,
- MinorCourseID = MinorCourse.MinorCourseID,
- CollegeID = GA.CollegeID,
- CoursematerialID = GA.MinorCourse.CoursematerialID,
- CourseCode = MinorCourse.EM_Coursematerial.CourseCode,
- CourseName = MinorCourse.EM_Coursematerial.CourseName,
- SchoolyearID = GA.SchoolyearID,
- YearID = GA.YearID,
- StandardID = MinorCourse.StandardID,
- CourseCategoryID = GA.MinorCourse.CourseCategoryID,
- CourseQualityID = GA.MinorCourse.CourseQualityID,
- SchoolcodeID = MinorCourse.SchoolcodeID,
- SchoolyearNumID = MinorCourse.SchoolyearNumID,
- StarttermID = GA.MinorCourse.StarttermID,
- Credit = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.Credit ?? 0,
- TheoryCourse = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.TheoryCourse ?? 0,
- Practicehours = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.Practicehours ?? 0,
- Trialhours = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.Trialhours ?? 0,
- Totalhours = (GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.TheoryCourse
- + GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.Practicehours) ?? 0,
- TheoryWeeklyNum = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.TrialWeeklyNum ?? 0,
- SchoolweeksNum = (GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.TheoryWeeklyNum
- + GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.PracticeWeeklyNum) ?? 0,
- StartWeeklyNum = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.StartWeeklyNum ?? 0,
- EndWeeklyNum = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.EndWeeklyNum ?? 0,
- WeeklyNum = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.WeeklyNum ?? 0,
- WeeklyHours = GA.MinorCourse.EM_MinorPlanApplicationTeachingSetting.WeeklyHours ?? 0,
- DepartmentID = MinorCourse.DepartmentID,
- CourseStructureID = GA.MinorCourse.CourseStructureID,
- CourseTypeID = GA.MinorCourse.CourseTypeID,
- ExaminationModeID = GA.MinorCourse.ExaminationModeID,
- TeachinglanguageID = GA.MinorCourse.TeachinglanguageID,
- PracticeTypeID = GA.MinorCourse.PracticeTypeID,
- CourseFineID = GA.MinorCourse.CourseFineID,
- IsSpecialtycore = GA.MinorCourse.IsSpecialtycore ?? false,
- IsCooperation = GA.MinorCourse.IsCooperation ?? false,
- IsRequired = GA.MinorCourse.IsRequired ?? false,
- IsElective = GA.MinorCourse.IsElective ?? false,
- IsNetworkCourse = GA.MinorCourse.IsNetworkCourse ?? false,
- IsMainCourse = GA.MinorCourse.IsMainCourse ?? false,
- IsEnable = MinorCourse.IsEnable ?? false,
- IsNeedMaterial = GA.MinorCourse.IsNeedMaterial ?? false,
- HandleModeID=GA.MinorCourse.HandleModeID,
- ResultTypeID = GA.MinorCourse.ResultTypeID
- };
- return query;
- }
- public int GetStandardID_MinorPlanApplication_MinorSpecialtyPlan(List<Guid> ids)
- {
- var query = from GrademinorApplication in GrademinorApplicationRepository.GetList(x => ids.Contains(x.GradeMinorApplicationID))
- join Grademinor in GrademinorRepository.Entities on new { GrademinorApplication.YearID, GrademinorApplication.StandardID }
- equals new { Grademinor.YearID, Grademinor.StandardID }
- select Grademinor;
- return query.Count();
- }
- public IQueryable<MinorPlanApplyView> GetDuplicateSpecialtyPlanApplyView(Expression<Func<CF_GrademinorApplication, bool>> exp)
- {
- var query = (from GrademinorApplication in GetMinorPlanApplyViewQueryable(exp)
- join Grademinor in GrademinorRepository.Entities on new { GrademinorApplication.YearID, GrademinorApplication.StandardID }
- equals new { Grademinor.YearID, Grademinor.StandardID }
- select GrademinorApplication);
- return query;
- }
- }
- }
|