123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMISOnline.Entities;
- using EMISOnline.DataLogic.Repositories;
- using System.Linq.Expressions;
- namespace EMISOnline.DataLogic.ExamSetting
- {
- public class ExamSettingDAL
- {
- public onlinetestRepository OnlinetestRepository { get; set; }
- public paperRepository PaperRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public ExamResultRepository ExamResultRepository { get; set; }
- public ExamineeAnswerRepository ExamineeAnswerRepository { get; set; }
- public IQueryable<test_onlinetest> GetOnlinetestList(Expression<Func<test_onlinetest, bool>> testExpression)
- {
- var query = from c in OnlinetestRepository.Entities.Where(testExpression)
- select c;
- return query.AsQueryable();
- }
- public IQueryable<test_onlinetest> GetStudentOnlinetestList(Expression<Func<test_onlinetest, bool>> testExpression,string UserID)
- {
- var query = from c in OnlinetestRepository.Entities.Where(testExpression)
- //join r in ExamResultRepository.Entities on c.onlinetest_id equals r.onlinetest_id
- //where r.user_id == UserID
- select c;
- return query.AsQueryable();
- }
- public IQueryable<test_paper> GetPaperList(Expression<Func<test_paper, bool>> testExpression)
- {
- var query = from paper in PaperRepository.Entities.Where(testExpression)
- where paper.test_paper_parent_id == 0 || paper.test_paper_parent_id == null
- select paper;
- return query.AsQueryable();
- }
- public IQueryable<CF_Student> GetExamUsers(decimal testid)
- {
- var query = from student in StudentRepository.Entities
- select student;
- return query.Take(10);
- }
- public ExamResult GetExam(string userid, decimal test_id)
- {
- //var query = from test in ExamResultRepository.Entities
- // where test.onlinetest_id == test_id
- // where test.user_id == userid
- // select test;
- var query = ExamResultRepository.UnitOfWork.Set<ExamResult>().Include("test_onlinetest").Where(q=>q.onlinetest_id==test_id&&q.user_id==userid);
- return query.SingleOrDefault();
- }
- }
- }
|