123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.ViewModel;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.DQPSystem;
- using EMIS.ViewModel.CultureplanManage;
- namespace EMIS.DataLogic.DQPSystem
- {
- public class SOCTemplateDAL
- {
- public SOCTemplateDetailRepository SOCTemplateDetailRepository { get; set; }
- public SOCTemplateRepository SOCTemplateRepository { get; set; }
- public FacultymajorRepository facultymajorRepository { get; set; }
- public CoursematerialRepository coursematerialRepository { get; set; }
- public SpecialtyCourseRepository specialtyCourseRepository { get; set; }
- public DepartmentRepository departmentRepository { get; set; }
- public SOCTemplateDetailAttachmentRepository SOCTemplateDetailAttachmentRepository { get; set; }
- public DictionaryItemRepository dictionaryItemRepository { get; set; }
- //public FacultymajorRepository facultymajorRepository { get; set; }
- public IQueryable<FileUploadView> GetFileUploadViewQueryable(Expression<Func<DQP_SOCTemplateDetail, bool>> exp)
- {
- var sql = (from detail in SOCTemplateDetailRepository.GetList(exp)
- from attachment in detail.DQP_SOCTemplateDetailAttachment
- select new FileUploadView
- {
- FileID = attachment.SOCTemplateDetailAttachmentID,
- FormID = attachment.SOCTemplateItemID,
- FileUrl = attachment.Url,
- FileName = attachment.Name
- });
- return sql;
- }
- public IQueryable<SOCTemplateView> GetSOCTemplateViewQueryable(Expression<Func<DQP_SOCTemplate, bool>> exp, Expression<Func<CF_Facultymajor, bool>> facexp)
- {
- var query = from templ in SOCTemplateRepository.GetList(exp)
- join dep in departmentRepository.Entities
- on templ.DepartmentID equals dep.DepartmentID
- join fac in facultymajorRepository.GetList(facexp)
- on templ.FacultymajorID equals fac.FacultymajorID
- into dfac
- from facde in dfac.DefaultIfEmpty()
- join cou in coursematerialRepository.Entities
- on templ.CoursematerialID equals cou.CoursematerialID
- //join spc in specialtyCourseRepository.Entities
- //on new { templ.CoursematerialID, templ.DepartmentID } equals new { spc.CoursematerialID, spc.DepartmentID }
- select new SOCTemplateView
- {
- SOCTemplateID = templ.SOCTemplateID,
- StandardID = facde.StandardID,
- FacultymajorID = facde.FacultymajorID,
- FacultymajorName = facde.Name,
- EducationID = facde.EducationID,
- LearningformID = facde.LearningformID,
- LearnSystem = facde.LearnSystem,
- CoursematerialID = templ.CoursematerialID,
- CourseCode = cou.CourseCode,
- CourseName = cou.CourseName,
- Credit = templ.Credit,
- SchoolyearNumID = templ.SchoolyearNumID,
- SchoolcodeID = templ.SchoolcodeID,
- DepartmentID = templ.DepartmentID,
- DepartmentCode = dep.No,
- IsEnable = templ.RecordStatus == 1 ? true : false,
- DepartmentName = dep.Name,
- RecordStatus = templ.RecordStatus,
- SOCCount = templ.DQP_SOCTemplateDetail.Count,
- HandleModeID = templ.HandleModeID,
- OptionalCourseTypeID = templ.OptionalCourseTypeID
- };
- return query;
- }
- public IQueryable<SOCTemplateDetailView> GetSOCTemplateDetailViewByIDQueryable(Expression<Func<DQP_SOCTemplateDetail, bool>> exp)
- {
- var query = from detail in SOCTemplateDetailRepository.GetList(exp)
- //join att in SOCTemplateDetailAttachmentRepository.Entities
- //on detail.SOCTemplateItemID equals att.SOCTemplateItemID
- //into deatt
- //from gatt in deatt.DefaultIfEmpty()
- select new SOCTemplateDetailView
- {
- SOCTemplateItemID = detail.SOCTemplateItemID,
- SOCTemplateID = detail.SOCTemplateID,
- Name = detail.Name,
- Credit = detail.Credit,
- Weight = detail.Weight,
- Description = detail.Description,
- AttachmentList = detail.DQP_SOCTemplateDetailAttachment,
- IsGroup = detail.IsGroup,
- };
- return query;
- }
- public IQueryable<SpecialtyCourseView> GetSpecialtyCourseViewQueryable(Expression<Func<EM_SpecialtyCourse, bool>> exp, Expression<Func<CF_Facultymajor, bool>> facexp)
- {
- var query = from a in specialtyCourseRepository.GetList(exp)
- join fac in facultymajorRepository.GetList(facexp)
- on new { a.CF_Department.CollegeID, a.CF_Specialty.StandardID } equals new { fac.CollegeID, fac.StandardID }
- join d in dictionaryItemRepository.Entities.Where(x => x.DictionaryCode == typeof(CF_Standard).Name) on a.CF_Specialty.StandardID equals d.Value
- select new SpecialtyCourseView
- {
- SpecialtyCourseID = a.SpecialtyCourseID,
- FacultymajorID = fac.FacultymajorID,
- DepartmentID = a.DepartmentID,
- DepartmentCode = a.CF_Department.No,
- DepartmentName = a.CF_Department.Name,
- CourseStructureID = a.CourseStructureID,
- CourseCategoryID = a.CourseCategoryID,
- CourseTypeID = a.CourseTypeID,
- CourseQualityID = a.CourseQualityID,
- PracticeTypeID = a.PracticeTypeID,
- ExaminationModeID = a.ExaminationModeID,
- TeachinglanguageID = a.TeachinglanguageID,
- SchoolyearNumID = (a.StarttermID % 2) == 0 ? (a.StarttermID / 2) : (a.StarttermID / 2) + 1,
- SchoolcodeID = (a.StarttermID % 2) == 0 ? 1 : 2,
- StarttermID = a.StarttermID,
- 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,
- IsEnable = a.IsEnable ?? true,
- Credit = a.EM_SpecialtyCourseTeachingSetting.Credit ?? 0,
- TheoryCourse = a.EM_SpecialtyCourseTeachingSetting.TheoryCourse,
- Practicehours = a.EM_SpecialtyCourseTeachingSetting.Practicehours,
- Trialhours = a.EM_SpecialtyCourseTeachingSetting.Trialhours,
- Totalhours = (a.EM_SpecialtyCourseTeachingSetting.TheoryCourse + a.EM_SpecialtyCourseTeachingSetting.Practicehours),
- WeeklyNum = a.EM_SpecialtyCourseTeachingSetting.WeeklyNum,
- TheoryWeeklyNum = a.EM_SpecialtyCourseTeachingSetting.TheoryWeeklyNum,
- PracticeWeeklyNum = a.EM_SpecialtyCourseTeachingSetting.PracticeWeeklyNum,
- TrialWeeklyNum = a.EM_SpecialtyCourseTeachingSetting.TrialWeeklyNum,
- SchoolweeksNum = (a.EM_SpecialtyCourseTeachingSetting.TheoryWeeklyNum + a.EM_SpecialtyCourseTeachingSetting.PracticeWeeklyNum),
- StartWeeklyNum = a.EM_SpecialtyCourseTeachingSetting.StartWeeklyNum,
- EndWeeklyNum = a.EM_SpecialtyCourseTeachingSetting.EndWeeklyNum,
- SpecialtyID = a.CF_Specialty.SpecialtyID,
- StandardID = a.CF_Specialty.StandardID,
- LearnSystem = a.CF_Specialty.LearnSystem,
- EducationID = a.CF_Specialty.EducationID,
- LearningformID = a.CF_Specialty.LearningformID,
- CoursematerialID = a.EM_Coursematerial.CoursematerialID,
- CourseCode = a.EM_Coursematerial.CourseCode,
- CourseName = a.EM_Coursematerial.CourseName,
- WeeklyHours = a.EM_SpecialtyCourseTeachingSetting.WeeklyHours,
- ResultTypeID = a.ResultTypeID,
- CreateTime = a.CreateTime,
- CreateUserID = a.CreateUserID
- };
- return query;
- }
- }
- }
|