12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.ScoreManage;
- using EMIS.Entities;
- namespace EMIS.DataLogic.ScoreManage
- {
- public class ScoreConvertByReplaceDAL
- {
- public CollegeRepository CollegeRepository { get; set; }
- public FacultymajorRepository FacultymajorRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public ScoreConvertByReplaceRepository ScoreConvertByReplaceRepository { get; set; }
- public ScoreConvertedSubmitedScoreRepository ScoreConvertedSubmitedScoreRepository { get; set; }
- public IQueryable<ScoreConvertByReplaceView> GetScoreConvertByReplaceViewQueryable(Expression<Func<ER_ScoreConvertByReplace, bool>> exp,
- Expression<Func<CF_Facultymajor, bool>> facultyExp,
- Expression<Func<CF_Grademajor, bool>> gradeExp,
- Expression<Func<CF_Classmajor, bool>> classExp)
- {
- var sql = (from convert in ScoreConvertByReplaceRepository.GetList(exp)
- from user in UserRepository.Entities.Where(x => convert.UserID == x.UserID)
- from student in StudentRepository.Entities.Where(x => user.UserID == x.UserID)
- from classmajor in ClassmajorRepository.Entities.Where(classExp).Where(x => x.ClassmajorID == student.ClassmajorID)
- from grade in GrademajorRepository.Entities.Where(gradeExp).Where(x => classmajor.GrademajorID == x.GrademajorID)
- from faculty in FacultymajorRepository.Entities.Where(facultyExp).Where(x => grade.FacultymajorID == x.FacultymajorID)
- from college in CollegeRepository.Entities.Where(x => faculty.CollegeID == x.CollegeID)
- from schoolyear in SchoolyearRepository.Entities.Where(x => convert.SchoolyearID == x.SchoolyearID)
- from sourcecourse in CoursematerialRepository.Entities.Where(x => convert.SourceCoursematerialID == x.CoursematerialID)
- from targetcourse in CoursematerialRepository.Entities.Where(x => convert.TargetCoursematerialID == x.CoursematerialID)
- select new ScoreConvertByReplaceView
- {
- ScoreConvertByReplaceID = convert.ScoreConvertByReplaceID,
- SchoolyearID = convert.SchoolyearID,
- SchoolyearCode = schoolyear.Code,
- CollegeID = faculty.CollegeID,
- CollegeNo = college.No,
- CollegeName = college.Name,
- YearID = grade.GradeID,
- StandardID = faculty.StandardID,
- ClassmajorID = student.ClassmajorID,
- ClassmajorNo = classmajor.No,
- ClassmajorName = classmajor.Name,
- UserID = convert.UserID,
- LoginID = user.LoginID,
- Name = user.Name,
- SourceCoursematerialID = convert.SourceCoursematerialID,
- SourceCourseCode = sourcecourse.CourseCode,
- SourceCourseName = sourcecourse.CourseName,
- TotalScore = convert.TotalScore,
- TargetCoursematerialID = convert.TargetCoursematerialID,
- TargetCourseCode = targetcourse.CourseCode,
- TargetCourseName = targetcourse.CourseName,
- Reason = convert.Reason,
- RecordStatus = convert.RecordStatus
- });
- return sql;
- }
- }
- }
|