using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.DataLogic.Repositories;
using EMIS.ViewModel;
using EMIS.ViewModel.StudentManage.OnlineChecking;
using EMIS.ViewModel.StudentManage.InfoCenter;
namespace EMIS.DataLogic.StudentManage.OnlineChecking
{
public class CheckingControlDAL
{
public StudentEditControlRepository StudentEditControlRepository { get; set; }
public StudentEditColumnDescriptionRepository StudentEditColumnDescriptionRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的学生校对控制信息CheckingControlView
///
///
///
public IQueryable GetStudentEditControlQueryable(Expression> exp)
{
var query = from stuec in StudentEditControlRepository.GetList(exp)
join usc in UserRepository.Entities
on stuec.CreateUserID equals usc.UserID into tempusc
from uscu in tempusc.DefaultIfEmpty()
join usm in UserRepository.Entities
on stuec.ModifyUserID equals usm.UserID into tempusm
from usmu in tempusm.DefaultIfEmpty()
select new CheckingControlView
{
StudentEditControlID = stuec.StudentEditControlID,
OrderNo = stuec.OrderNo,
ColumnName = stuec.ColumnName,
DisplayColumnName = stuec.DisplayColumnName,
Description = stuec.Description,
CheckingTypeID = stuec.CheckingTypeID,
RecordStatus = stuec.RecordStatus,
CreateUserID = stuec.CreateUserID,
CreateUserName = uscu.Name,
CreateTime = stuec.CreateTime,
ModifyUserID = stuec.ModifyUserID,
ModifyUserName = usmu.Name,
ModifyTime = stuec.ModifyTime
};
return query;
}
///
/// 查询对应的学生校对控制信息
///
///
///
public IQueryable GetStudentEditFeildQueryable(Expression> exp)
{
var query = from stuec in StudentEditControlRepository.GetList(exp)
select new EditFeildView
{
OrderNo = stuec.OrderNo ?? 0,
ColumnFeild = stuec.ColumnName,
ColumnName = stuec.DisplayColumnName,
Description = stuec.Description,
IsEdit = (stuec.CheckingTypeID != (int)CF_CheckingType.Close),
CheckingTypeID = stuec.CheckingTypeID
};
return query;
}
}
}