123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.SelectCourse;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.SystemView;
- using EMIS.ViewModel.Students;
- using EMIS.ViewModel.UniversityManage.TeacherManage;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.CultureplanManage.PlanManagement;
- using EMIS.DataLogic.UniversityManage.SpecialtyClassManage;
- namespace EMIS.DataLogic.CultureplanManage.PlanManagement
- {
- public class OptionalCoursePlanDAL
- {
- public SchoolyearRepository schoolyearRepository { get; set; }
- public OptionalCoursePlanRepository OptionalCoursePlanRepository { get; set; }
- public OptionalCoursePlanTeachingModeRepository OptionalCoursePlanTeachingModeRepository { get; set; }
- public OptionalCoursePlanTeachingSettingRepository OptionalCoursePlanTeachingSettingRepository { get; set; }
- public StaffRepository StaffRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public SpecialtyCourseDAL specialtyCourseDAL { get; set; }
- public SpecialtyCourseRepository specialtyCourseRepository { get; set; }
- public GrademajorDAL grademajorDAL { get; set; }
- public GrademajorRepository grademajorRepository { get; set; }
- public SpecialtyRepository specialtyRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- public CoursematerialRepository coursematerialRepository { get; set; }
- public FacultymajorRepository facultymajorRepository { get; set; }
- public ClassmajorRepository classmajorRepository { get; set; }
- public DepartmentRepository departmentRepository { get; set; }
- public IQueryable<OptionalCoursePlanView> GetOptionalCourseSettingViewQueryable(Expression<Func<EM_OptionalCoursePlan, bool>> exp)
- {
- var q = from ocp in OptionalCoursePlanRepository.GetList(exp)
- join de in departmentRepository.Entities on ocp.DepartmentID equals de.DepartmentID
- into tmp1 from de in tmp1.DefaultIfEmpty()
- //join g in grademajorRepository.Entities
- //on new { SchoolcodeID = ocp.SchoolcodeID, Years = ocp.SchoolyearNumID,ocp.CF_Specialty.StandardID } equals new { SchoolcodeID = g.SchoolcodeID, Years = g.SchoolyearID,g.CF_Facultymajor.StandardID }
- //into gsPlan
- //from gr in gsPlan.DefaultIfEmpty()
- join sp in specialtyRepository.Entities on ocp.SpecialtyID equals sp.SpecialtyID
- join dr in dictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
- on sp.StandardID equals dr.Value
- into gs
- from sr in gs.DefaultIfEmpty()
- join co in coursematerialRepository.Entities on ocp.CoursematerialID equals co.CoursematerialID
- into tmp from co in tmp.DefaultIfEmpty()
- //join sc in specialtyCourseRepository.Entities on new { ocp.CoursematerialID, ocp.SpecialtyID } equals new { sc.CoursematerialID, sc.SpecialtyID }
- //into tmp
- //from gs in tmp.DefaultIfEmpty()
- select new OptionalCoursePlanView
- {
- TeachingModeID=ocp.EM_OptionalCoursePlanTeachingMode.Select(x=>x.TeachingModeID.Value).ToList(),
- OptionalCourseID = ocp.OptionalCourseID,
- //StandardID=sp.StandardID,
- //GrademajorID = gr.GrademajorID,
- //GrademajorCode = gr.Code,
- //GrademajorName = gr.Name,
- //CampusID = gr.CF_Facultymajor.CF_College.CampusID,
- //CollegeID = gr.CF_Facultymajor.CollegeID,
- //CollegeName = gr.CF_Facultymajor.CF_College.Name,
- DepartmentID = de.DepartmentID,
- DepartmentName = de.Name,
- //SpecialtyCourseID = sc.SpecialtyCourseID,
- SpecialtyID = ocp.SpecialtyID,
- //StandardID = ocp.CF_Specialty.StandardID,
- StandardID=sr.Value,
- StandardCode=sr.Code,
- StandardName=sr.Name,
- LearnSystem = sp.LearnSystem,
- EducationID =sp.EducationID,
- LearningformID = sp.LearningformID,
- CoursematerialID = ocp.CoursematerialID,
- CourseCode = co.CourseCode,
- CourseName = co.CourseName,
- //Credit = sc.EM_SpecialtyCourseTeachingSetting.Credit,
- //EndWeeklyNum = ocp.EM_SpecialtyCourse.EM_SpecialtyCourseTeachingSetting.EndWeeklyNum,
- ExaminationModeID = ocp.ExaminationModeID,
- TeachinglanguageID = ocp.TeachinglanguageID,
- //HandleModeID = ocp.HandleModeID,
- //No = ocp.No,
- //DefaultClassName = ocp.DefaultClassName,
- //SchoolyearID = ocp.SchoolyearID,
- //SchoolyearDesc = ocp.CF_Schoolyear.Code,
- //IsNeedMaterial = ocp.IsNeedMaterial ?? false,
- PeopleNumlower = ocp.PeopleNumlower,
- PeopleNumlimit = ocp.PeopleNumlimit,
- IsEnable = ocp.IsEnable ?? true,
- IsOpened = ocp.IsOpened ?? true,
- Remarks = ocp.Remarks,
- RecordStatus = ocp.RecordStatus,
- CreateUserID = ocp.CreateUserID,
- CreateTime = ocp.CreateTime,
- ModifyUserID = ocp.ModifyUserID,
- ModifyTime = ocp.ModifyTime,
- //Schoolyear = gs.SchoolyearID,
- //Sys_User = ocp.EM_OptionalCoursePlanStaff.Select(x => x.CF_Staff.Sys_User),
- CourseStructureID = ocp.CourseStructureID,
- CourseTypeID = ocp.CourseTypeID,
- Credit = ocp.EM_OptionalCoursePlanTeachingSetting.Credit ?? 0,
- TheoryCourse = ocp.EM_OptionalCoursePlanTeachingSetting.TheoryCourse ?? 0,
- Practicehours = ocp.EM_OptionalCoursePlanTeachingSetting.Practicehours ?? 0,
- Trialhours = ocp.EM_OptionalCoursePlanTeachingSetting.Trialhours ?? 0,
- WeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.WeeklyNum ?? 0,
- TheoryWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.TrialWeeklyNum ?? 0,
- StartWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.StartWeeklyNum ?? 0,
- EndWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.EndWeeklyNum ?? 0,
- WeeklyHours = ocp.EM_OptionalCoursePlanTeachingSetting.WeeklyHours ?? 0,
- SchoolyearNumID = ocp.SchoolyearNumID,
- SchoolcodeID = ocp.SchoolcodeID,
- //StarttermID = ((ocp.EM_SpecialtyCourse.SchoolyearNumID - 1) * 2) + (ocp.EM_SpecialtyCourse.SchoolcodeID == ocp.CF_Grademajor.SchoolcodeID ? 0 : 1) + 1,
- CourseCategoryID = ocp.CourseCategoryID,
- //IsMainCourse = ocp.EM_SpecialtyCourse.IsMainCourse ?? false,
- CourseQualityID = ocp.CourseQualityID,
- PracticeTypeID=ocp.PracticeTypeID,
- ResultTypeID=ocp.ResultTypeID
- };
- return q;
- }
- public IQueryable<OptionalCoursePlanView> GetGrademajorOptionalCoursePlanViewQueryable(Expression<Func<EM_OptionalCoursePlan, bool>> exp, Expression<Func<CF_Grademajor, bool>> grExp)
- {
- var q = from g in grademajorRepository.Entities
- join f in facultymajorRepository.Entities on g.FacultymajorID equals f.FacultymajorID
- join s in specialtyRepository.Entities on new { f.EducationID, f.LearningformID, f.LearnSystem,f.StandardID } equals new { s.EducationID, s.LearningformID, s.LearnSystem,s.StandardID }
- join ocp in OptionalCoursePlanRepository.GetList(exp) on s.SpecialtyID equals ocp.SpecialtyID
- join sc in schoolyearRepository.Entities on new { SchoolcodeID = g.SemesterID.Value, Years = g.GradeID.Value } equals new { SchoolcodeID = sc.SchoolcodeID, Years = sc.Years }
- join cl in classmajorRepository.Entities on g.GrademajorID equals cl.GrademajorID
- join co in coursematerialRepository.Entities on ocp.CoursematerialID equals co.CoursematerialID
-
- select new OptionalCoursePlanView
- {
- TeachingModeID = ocp.EM_OptionalCoursePlanTeachingMode.Select(x => x.TeachingModeID.Value).ToList(),
- OptionalCourseID = ocp.OptionalCourseID,
- GrademajorID = g.GrademajorID,
- //GrademajorCode = g.Code,
- GrademajorName = g.Name,
- Years = g.GradeID,
- CampusID = g.CF_Facultymajor.CF_College.CampusID,
- CollegeID = g.CF_Facultymajor.CollegeID,
- //CollegeName = g.CF_Facultymajor.CF_College.Name,
- ClassmajorID=cl.ClassmajorID,
- DefaultClassName=cl.Name,
- DepartmentID = ocp.CF_Department.DepartmentID,
- //DepartmentName = ocp.CF_Department.Name,
- SpecialtyID = ocp.SpecialtyID,
- StandardID = ocp.CF_Specialty.StandardID,
- CoursematerialID = ocp.CoursematerialID,
- //CourseCode = co.CourseCode,
- CourseName = co.CourseName,
- ExaminationModeID = ocp.ExaminationModeID,
- TeachinglanguageID = ocp.TeachinglanguageID,
- PeopleNumlower = ocp.PeopleNumlower,
- PeopleNumlimit = ocp.PeopleNumlimit,
- //IsEnable = ocp.IsEnable ?? false,
- //IsOpened = ocp.IsOpened ?? false,
- //Remarks = ocp.Remarks,
- //RecordStatus = ocp.RecordStatus,
- //CreateUserID = ocp.CreateUserID,
- //CreateTime = ocp.CreateTime,
- //ModifyUserID = ocp.ModifyUserID,
- //ModifyTime = ocp.ModifyTime,
- Credit = ocp.EM_OptionalCoursePlanTeachingSetting.Credit ?? 0,
- TheoryCourse = ocp.EM_OptionalCoursePlanTeachingSetting.TheoryCourse ?? 0,
- Practicehours = ocp.EM_OptionalCoursePlanTeachingSetting.Practicehours ?? 0,
- Trialhours = ocp.EM_OptionalCoursePlanTeachingSetting.Trialhours ?? 0,
- WeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.WeeklyNum ?? 0,
- TheoryWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.TheoryWeeklyNum ?? 0,
- PracticeWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.PracticeWeeklyNum ?? 0,
- TrialWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.TrialWeeklyNum ?? 0,
- StartWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.StartWeeklyNum ?? 0,
- EndWeeklyNum = ocp.EM_OptionalCoursePlanTeachingSetting.EndWeeklyNum ?? 0,
- WeeklyHours = ocp.EM_OptionalCoursePlanTeachingSetting.WeeklyHours ?? 0,
- CourseStructureID = ocp.CourseStructureID,
- CourseTypeID = ocp.CourseTypeID,
-
- SchoolyearNumID = ocp.SchoolyearNumID,
- SchoolcodeID = ocp.SchoolcodeID,
- //StarttermID = ((ocp.EM_SpecialtyCourse.SchoolyearNumID - 1) * 2) + (ocp.EM_SpecialtyCourse.SchoolcodeID == ocp.CF_Grademajor.SchoolcodeID ? 0 : 1) + 1,
- SchoolValue = sc.Value+((ocp.SchoolyearNumID - 1) * 2) + (ocp.SchoolcodeID == g.SemesterID ? 0 : 1) ,
- //(startSchoolyear.Value + ((specialtyCourse.SchoolyearNumID - 1) * 2) + (specialtyCourse.SchoolcodeID == grademajor.SchoolcodeID ? 0 : 1))
- CourseCategoryID = ocp.CourseCategoryID,
- CourseQualityID = ocp.CourseQualityID,
- PracticeTypeID = ocp.PracticeTypeID,
- ResultTypeID=ocp.ResultTypeID
- };
- return q;
- }
- public List<string> GetTeachingModeTypeQueryble(Guid? OptionalCourseID)
- {
- var query = from a in OptionalCoursePlanTeachingModeRepository.Entities.Where(x => x.OptionalCourseID == OptionalCourseID)
- 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();
- }
- }
- }
|