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.DataLogic.Repositories; using EMIS.DataLogic.Common.Cultureplan; namespace EMIS.DataLogic.CultureplanManage.PlanManagement { public class SpecialtyCourseDAL { public SpecialtyCourseRepository SpecialtyCourseRepository { get; set; } public SpecialtyCourseTeachingSettingRepository SpecialtyCourseTeachingSettingRepository { get; set; } public TeachingModeTypeRepository TeachingModeTypeRepository { get; set; } public TeachingPlaceRepository TeachingPlaceRepository { get; set; } public SpecialtyRepository SpecialtyRepository { get; set; } public CoursematerialRepository CoursematerialRepository { get; set; } public DepartmentRepository DepartmentRepository { get; set; } public CollegeRepository CollegeRepository { get; set; } public DictionaryItemRepository DictionaryItemRepository { get; set; } /// /// 查询对应的专业课程信息SpecialtyCourseView /// /// /// public IQueryable GetSpecialtyCourseViewQueryable(Expression> exp) { var query = from sc in SpecialtyCourseRepository.GetList(exp) join spe in SpecialtyRepository.Entities 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() 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 sc in SpecialtyCourseRepository.GetList(exp) join tm in TeachingModeTypeRepository.Entities on sc.SpecialtyCourseID equals tm.SpecialtyCourseID join dictm in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_TeachingMode).Name) on tm.TeachingModeID equals dictm.Value select dictm.Value; return query; } /// /// 查询专业课程信息对应的授课地点 /// /// /// public IQueryable GetTeachingPlaceQueryble(Expression> exp) { var query = from sc in SpecialtyCourseRepository.GetList(exp) join tp in TeachingPlaceRepository.Entities on sc.SpecialtyCourseID equals tp.SpecialtyCourseID join dictp in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EMIS.ViewModel.EM_TeachingPlace).Name) on tp.TeachingPlace equals dictp.Value select dictp.Value; return query; } } }