using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.ViewModel.MinorManage.MinorCourseManage;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.DataLogic.Repositories;
using EMIS.ViewModel;
namespace EMIS.DataLogic.MinorManage.MinorCourseManage
{
public class MinorSpecialtyCourseDAL
{
public MinorCourseRepository MinorCourseRepository { get; set; }
public MinorCourseTeachingSettingRepository MinorCourseTeachingSettingRepository { get; set; }
public MinorCourseTeachingModeTypeRepository MinorCourseTeachingModeTypeRepository { get; set; }
public MinorCourseTeachingPlaceRepository MinorCourseTeachingPlaceRepository { get; set; }
public DictionaryItemRepository DictionaryItemRepository { get; set; }
///
/// 查询专业计划
///
///
///
public IQueryable GetMinorSpecialtyCourseViewQueryable(Expression> exp)
{
var query = from a in MinorCourseRepository.GetList(exp)
select new MinorSpecialtyCourseView
{
MinorCourseID=a.MinorCourseID,
DepartmentID = a.DepartmentID,
DepartmentName = a.CF_Department.Name,
IsEnable = a.IsEnable ?? true,
CollegeID=a.CF_Department.CF_College.CollegeID,
StandardID = a.StandardID,
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,
SchoolyearNumID = a.SchoolyearNumID,
SchoolcodeID = a.SchoolcodeID,
//StarttermID = a.CF_Schoolyear.Value - ((a.CF_Grademajor.SchoolyearID * 2 - 1) + a.CF_Grademajor.SchoolcodeID - 1) + 1,
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,
Credit = a.EM_MinorCourseTeachingSetting.Credit,
TheoryCourse = a.EM_MinorCourseTeachingSetting.TheoryCourse,
Practicehours = a.EM_MinorCourseTeachingSetting.Practicehours,
Trialhours = a.EM_MinorCourseTeachingSetting.Trialhours,
Totalhours=a.EM_MinorCourseTeachingSetting.TheoryCourse+a.EM_MinorCourseTeachingSetting.Practicehours+a.EM_MinorCourseTeachingSetting.Trialhours,
WeeklyNum = a.EM_MinorCourseTeachingSetting.WeeklyNum,
TheoryWeeklyNum = a.EM_MinorCourseTeachingSetting.TheoryWeeklyNum,
PracticeWeeklyNum = a.EM_MinorCourseTeachingSetting.PracticeWeeklyNum,
TrialWeeklyNum = a.EM_MinorCourseTeachingSetting.TrialWeeklyNum,
StartWeeklyNum = a.EM_MinorCourseTeachingSetting.StartWeeklyNum,
WeeklyHours = a.EM_MinorCourseTeachingSetting.WeeklyHours,
EndWeeklyNum = a.EM_MinorCourseTeachingSetting.EndWeeklyNum,
CreateUserID = a.CreateUserID,
CreateTime = a.CreateTime,
ResultTypeID = a.ResultTypeID,
Remarks = a.Remarks,
};
return query;
}
///
/// 根据辅修专业课程获取授课方式
///
///
///
public List GetTeachingModeTypeQueryble(Guid? MinorCourseID)
{
var query = from a in MinorCourseTeachingModeTypeRepository.Entities.Where(x => x.MinorCourseID == MinorCourseID)
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();
}
///
/// 根据辅修专业课程获取授课地点
///
///
///
public List GetTeachingPlaceQueryble(Guid? MinorCourseID)
{
var query = from a in MinorCourseTeachingPlaceRepository.Entities.Where(x => x.MinorCourseID == MinorCourseID)
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();
}
}
}