using System; using System.Collections.Generic; using System.Linq; using System.Text; using Bowin.Common.Linq; using EMISOnline.Entities; using EMISOnline.DataLogic.Repositories; using EMISOnline.ViewModel.SystemView; using System.Linq.Expressions; using EMISOnline.ViewModel.Student; namespace EMISOnline.DataLogic.Student { public class CourseScoreDAL { public TeacherScoreRepository teacherScoreRepository { get; set; } public StudentEducationMissionClassRepository studentEducationMissionClassRepository { get; set; } public IQueryable getTeacherScore(Expression> tsExpression) { var sql = teacherScoreRepository.GetList(tsExpression); return sql; } public IQueryable getStudentEducationAdd(Guid UserID,string CoursematerialName, string YearsCode) { var sql = from v in studentEducationMissionClassRepository.GetList(w => w.UserID == UserID) join sy in studentEducationMissionClassRepository.UnitOfWork.CF_Schoolyear on v.SchoolyearID equals sy.SchoolyearID join stu in studentEducationMissionClassRepository.UnitOfWork.CF_Student on v.UserID equals stu.UserID join u in studentEducationMissionClassRepository.UnitOfWork.Sys_User on v.UserID equals u.UserID select new studentEducationMissionClassAddView { CoursematerialID=v.CoursematerialID, CourseName=v.CourseName, CoverUrl=v.CoverUrl, EducationMissionClassID=v.EducationMissionClassID, EducationMissionClassName=v.EducationMissionClassName, UserID=v.UserID, SchoolyearID=v.SchoolyearID, yearCode=sy.Code, years=sy.Years, StudentCardNo=u.LoginID, StudentName=u.Name }; if (!string.IsNullOrEmpty(CoursematerialName)) { sql = sql.Where(w => w.CourseName.Contains(CoursematerialName)); } if (!string.IsNullOrEmpty(YearsCode)) { sql = sql.Where(w => w.yearCode.Contains(YearsCode)); } return sql; } } }