123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- 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;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.MinorManage.MinorPlanManage
- {
- public class MinorSpecialtyPlanDAL
- {
- public MinorPlanRepository MinorPlanRepository { get; set; }
- public MinorPlanTeachingModeTypeRepository MinorPlanTeachingModeTypeRepository { get; set; }
- public MinorPlanTeachingPlaceRepository MinorPlanTeachingPlaceRepository { get; set; }
- public MinorPlanTeachingSettingRepository MinorPlanTeachingSettingRepository { get; set; }
- public MinorCourseRepository MinorCourseRepository { get; set; }
- public GrademinorRepository GrademinorRepository { get; set; }
- public DepartmentRepository DepartmentRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- /// <summary>
- /// 查询专业计划
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<MinorSpecialtyPlanView> GetMinorSpecialtyPlanViewQueryable(Expression<Func<EM_MinorPlan, bool>> exp)
- {
- var graduatingSemester = EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID;
- if (graduatingSemester == null)
- {
- throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查");
- }
- var SchoolcodeID = Convert.ToInt32(graduatingSemester);
- var query = from a in MinorPlanRepository.GetList(exp)
- select new MinorSpecialtyPlanView
- {
- MinorPlanID = a.MinorPlanID,
- DepartmentID = a.DepartmentID,
- DepartmentName = a.CF_Department.Name,
- CollegeID = a.CF_Department.CF_College.CollegeID,
- CollegeName=a.CF_Department.CF_College.Name,
- MinorPlanApplicationID = a.MinorPlanApplicationID,
- YearID=a.CF_Grademinor.YearID,
- StarttermID = a.CF_Schoolyear.Value - ((a.CF_Grademinor.YearID * 2 - 1) + SchoolcodeID - 1) + 1,
- StandardID=a.CF_Grademinor.StandardID,
- SchoolcodeID=a.CF_Schoolyear.SchoolcodeID,
- SchoolyearNumID = (a.CF_Schoolyear.Value - ((a.CF_Grademinor.YearID * 2 - 1) + SchoolcodeID - 1)) / 2 + 1,
- SchoolyearID=a.CF_Schoolyear.SchoolyearID,
- SchoolcodeStr=a.CF_Schoolyear.Code,
- CoursematerialID = a.EM_Coursematerial.CoursematerialID,
- CourseCode = a.EM_Coursematerial.CourseCode,
- CourseName = a.EM_Coursematerial.CourseName,
- CourseStructureID = a.CourseStructureID,
- CourseCategoryID = a.CourseCategoryID,
- CourseTypeID = a.CourseTypeID,
- CourseQualityID = a.CourseQualityID,
- PracticeTypeID = a.PracticeTypeID,
- ExaminationModeID = a.ExaminationModeID,
- TeachinglanguageID = a.TeachinglanguageID,
- CourseFineID = a.CourseFineID,
- IsSpecialtycore = a.IsSpecialtycore ?? true,
- IsCooperation = a.IsCooperation ?? true,
- IsRequired = a.IsRequired ?? true,
- IsElective = a.IsElective ?? true,
- IsNetworkCourse = a.IsNetworkCourse ?? true,
- IsMainCourse = a.IsMainCourse ?? true,
- HandleModeID=a.HandleModeID,
- IsNeedMaterial = a.IsNeedMaterial ?? true,
- Credit = a.EM_MinorPlanTeachingSetting.Credit,
- TheoryCourse = a.EM_MinorPlanTeachingSetting.TheoryCourse,
- Practicehours = a.EM_MinorPlanTeachingSetting.Practicehours,
- Trialhours = a.EM_MinorPlanTeachingSetting.Trialhours,
- Totalhours = a.EM_MinorPlanTeachingSetting.TheoryCourse + a.EM_MinorPlanTeachingSetting.Practicehours + a.EM_MinorPlanTeachingSetting.Trialhours,
- WeeklyNum = a.EM_MinorPlanTeachingSetting.WeeklyNum,
- TheoryWeeklyNum = a.EM_MinorPlanTeachingSetting.TheoryWeeklyNum,
- PracticeWeeklyNum = a.EM_MinorPlanTeachingSetting.PracticeWeeklyNum,
- TrialWeeklyNum = a.EM_MinorPlanTeachingSetting.TrialWeeklyNum,
- StartWeeklyNum = a.EM_MinorPlanTeachingSetting.StartWeeklyNum,
- WeeklyHours = a.EM_MinorPlanTeachingSetting.WeeklyHours,
- EndWeeklyNum = a.EM_MinorPlanTeachingSetting.EndWeeklyNum,
- CreateUserID = a.CreateUserID,
- CreateTime = a.CreateTime,
- ResultTypeID = a.ResultTypeID,
- Remarks = a.Remarks,
- IsGenerateExecutablePlan = a.EM_ExecutableMinorPlan.Count > 0 ? true : false,
- };
- return query;
- }
- /// <summary>
- /// 根据辅修专业课程获取授课方式
- /// </summary>
- /// <param name="specialtyCourseID"></param>
- /// <returns></returns>
- public List<string> GetTeachingModeTypeQueryble(Guid? MinorPlanID)
- {
- var query = from a in MinorPlanTeachingModeTypeRepository.Entities.Where(x => x.MinorPlanID == MinorPlanID)
- join b in DictionaryItemRepository.Entities on new { a.TeachingModeID, DictionaryCode = DictionaryItem.CF_TeachingMode.ToString() }
- equals new { TeachingModeID = b.Value, b.DictionaryCode }
- select b.Value.Value.ToString();
- return query.ToList();
- }
- /// <summary>
- /// 根据辅修专业课程获取授课地点
- /// </summary>
- /// <param name="specialtyCourseID"></param>
- /// <returns></returns>
- public List<string> GetTeachingPlaceQueryble(Guid? MinorPlanID)
- {
- var query = from a in MinorPlanTeachingPlaceRepository.Entities.Where(x => x.MinorPlanID == MinorPlanID)
- join b in DictionaryItemRepository.Entities on new { a.TeachingPlace, DictionaryCode = DictionaryItem.EM_TeachingPlace.ToString() }
- equals new { TeachingPlace = b.Value, b.DictionaryCode }
- select b.Value.Value.ToString();
- return query.ToList();
- }
- /// <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 Grademinor in GrademinorRepository.GetList(x => x.YearID == YearID)
- join MinorPlan in MinorPlanRepository.Entities on new { Grademinor.GrademinorID }
- equals new { GrademinorID = (Guid)MinorPlan.GrademinorID }
- select new
- {
- GrademinorID = Grademinor.GrademinorID,
- MinorPlanID = MinorPlan.MinorPlanID,
- CoursematerialID = MinorPlan.CoursematerialID,
- CollegeID = Grademinor.CollegeID,
- SchoolyearID = Grademinor.SchoolyearID,
- StandardID = Grademinor.StandardID,
- YearID = Grademinor.YearID
- }
- ) on new { MinorCourse.CoursematerialID, MinorCourse.StandardID } equals new { GrademinorApply.CoursematerialID, GrademinorApply.StandardID }
- into GrademinorApplication
- from GA in GrademinorApplication.DefaultIfEmpty()
- where GA.GrademinorID == null && GA.MinorPlanID == null
- select new MinorPlanApplyView
- {
- GradeMinorApplicationID = GA.GrademinorID,
- MinorPlanApplicationID = GA.MinorPlanID,
- 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<MinorSpecialtyPlanView> GetStandardView(Expression<Func<CF_Grademinor, bool>> exp)
- {
- var query = from Grademinor in GrademinorRepository.GetList(exp)
- select new MinorSpecialtyPlanView
- {
- StandardID = Grademinor.StandardID
- };
- return query;
- }
- }
- }
|