using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.DataLogic.Repositories;
using EMIS.ViewModel.GraduationManage.GraduationSetting;
using EMIS.Entities;
using System.Linq.Expressions;
namespace EMIS.DataLogic.GraduationManage.GraduationSetting
{
public class GraduationConditionPackageDAL
{
public GraduationConditionPackageRepository GraduationConditionPackageRepository { get; set; }
public GraduationConditionRepository GraduationConditionRepository { get; set; }
public GraduationApplyRepository GraduationApplyRepository { get; set; }
///
/// 查询对应的毕业公式信息View(只查询毕业公式信息,不查询毕业公式对应的毕业条件)
///
///
///
public IQueryable GetGraduationConditionPackageQueryable(Expression> exp)
{
var query = from gp in GraduationConditionPackageRepository.GetList(exp)
select new GraduationConditionPackageView
{
GraduationConditionPackageID = gp.GraduationConditionPackageID,
Title = gp.Title,
StudentTypeID = gp.StudentType,
IsDefault = gp.IsDefault.Value,
IsEnable = gp.RecordStatus.Value > 0 ? true : false,
RecordStatus = gp.RecordStatus,
CreateUserID = gp.CreateUserID,
CreateTime = gp.CreateTime,
ModifyUserID = gp.ModifyUserID,
ModifyTime = gp.ModifyTime
};
return query;
}
///
/// 查询毕业公式中对应的毕业条件信息View(GraduationConditionView)
///
///
///
public IQueryable GraduationConditionQueryable(Expression> exp)
{
var query = from gp in GraduationConditionPackageRepository.GetList(exp)
from gc in gp.ER_GraduationCondition
select new GraduationConditionView
{
GraduationConditionID = gc.GraduationConditionID,
OrderNo = gc.OrderNo,
Title = gc.Title,
MethodFullName = gc.MethodFullName,
IsEnable = gc.RecordStatus.Value > 0 ? true : false,
RecordStatus = gc.RecordStatus,
CreateUserID = gc.CreateUserID,
CreateTime = gc.CreateTime,
ModifyUserID = gc.ModifyUserID,
ModifyTime = gc.ModifyTime
};
return query;
}
///
/// 查询毕业公式中未存在的毕业条件信息View(GraduationConditionView)
///
///
///
///
public IQueryable GetGraduationConditionNoQueryable(Expression> expGraduationCondition, Guid? graduationConditionPackageID)
{
var query = from gc in GraduationConditionRepository.GetList(expGraduationCondition)
from gp in gc.ER_GraduationConditionPackage.Where(x => x.GraduationConditionPackageID == graduationConditionPackageID).DefaultIfEmpty()
where !gp.ER_GraduationCondition.Contains(gc)
select new GraduationConditionView
{
GraduationConditionID = gc.GraduationConditionID,
OrderNo = gc.OrderNo,
Title = gc.Title,
MethodFullName = gc.MethodFullName,
IsEnable = gc.RecordStatus.Value > 0 ? true : false,
RecordStatus = gc.RecordStatus,
CreateUserID = gc.CreateUserID,
CreateTime = gc.CreateTime,
ModifyUserID = gc.ModifyUserID,
ModifyTime = gc.ModifyTime
};
return query;
}
}
}