using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bowin.Common.Linq.Entity;
using EMIS.ViewModel.ScoreManage;
using System.Linq.Expressions;
using EMIS.Entities;
using Bowin.Common.Linq;
using EMIS.DataLogic.ScoreManage;
using EMIS.ViewModel;
namespace EMIS.CommonLogic.ScoreManage
{
public class NotPassStudentServices: BaseServices, INotPassStudentServices
{
public NotPassStudentDAL notPassStudentDAL { get; set; }
///
/// 获取不及格学生名单
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetNotPassStudentGrid(ConfiguretView configuretView, Guid? campusID, int? years, int? standardID, Guid? classMajorID, int pageIndex, int pageSize)
{
Expression> exp = x => true;
if (campusID.HasValue)
{
exp = exp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CF_College.CF_Campus.CampusID == campusID);
}
if (standardID.HasValue)
{
exp = exp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
}
if (years.HasValue)
{
exp = exp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Schoolyear.Years == years);
}
if (classMajorID.HasValue)
{
exp = exp.And(x => x.CF_Student.CF_Classmajor.ClassmajorID == classMajorID);
}
var query = notPassStudentDAL.GetScoreViewQueryable(exp).Where(x => x.NotPassCount > 0);
//if (count.HasValue)
//{
// query = query.Where(x => x.NotPassCount == count);
//}
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
var result = query.OrderBy(x => x.CampusID).ThenBy(x => x.Years).ThenBy(x => x.StandardID).ThenBy(x => x.ClassMajorID).ToGridResultSet(pageIndex, pageSize);
return result;
}
}
}