using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using Bowin.Common.Linq.Entity;
using Bowin.Common.Linq;
using EMIS.Entities;
using EMIS.ViewModel;
using EMIS.ViewModel.UniversityManage.SpecialtyClassManage;
using EMIS.ViewModel.Students;
using EMIS.ViewModel.CultureplanManage.PlanManagement;
using EMIS.ViewModel.EducationManagement;
using EMIS.ViewModel.GraduationManage.GraduationSetting;
using EMIS.DataLogic.SystemDAL;
using EMIS.DataLogic.GraduationManage.GraduationSetting;
using EMIS.CommonLogic.StudentManage.StudentStatistics;
namespace EMIS.CommonLogic.GraduationManage.GraduationSetting
{
public class GraduationStandardServices : BaseServices, IGraduationStandardServices
{
public GraduationStandardDAL GraduationStandardDAL { get; set; }
public IInSchoolSettingServices InSchoolSettingServices { get; set; }
///
/// 查询对应的毕业标准信息View
///
///
///
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetGraduationStandardViewGrid(ConfiguretView configuretView, Guid? gradSchoolyearID,
Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
int? inSchoolStatus, int pageIndex, int pageSize)
{
//毕业标准
Expression> expGraduationStandard = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
//执行计划(只对已提交状态进行统计)
Expression> expExecutablePlan = (x => true);
expExecutablePlan = expExecutablePlan.And(x => x.RecordStatus == (int)EM_ExecuteStatus.Submited);
//学生信息
Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (inSchoolStatus != null && inSchoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
if (inSchoolStatus == 1)
{
//表示在校
expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
}
if (inSchoolStatus == 0)
{
//不在校
expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
}
}
var query = GraduationStandardDAL.GetGraduationStandardViewQueryable(expGraduationStandard, expExecutablePlan, expStudent);
if (gradSchoolyearID.HasValue)
{
query = query.Where(x => x.GraduatingSemesterID == gradSchoolyearID);
}
if (campusID.HasValue)
{
query = query.Where(x => x.CampusID == campusID);
}
if (collegeID.HasValue)
{
query = query.Where(x => x.CollegeID == collegeID);
}
if (yearID.HasValue)
{
query = query.Where(x => x.SchoolyearID == yearID);
}
if (standardID.HasValue)
{
query = query.Where(x => x.StandardID == standardID);
}
if (educationID.HasValue)
{
query = query.Where(x => x.EducationID == educationID);
}
if (learningformID.HasValue)
{
query = query.Where(x => x.LearningformID == learningformID);
}
if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
{
var LearnSystems = Convert.ToDecimal(learnSystem);
query = query.Where(x => x.LearnSystem == LearnSystems);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query)
.OrderBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
.ThenBy(x => x.StandardID).ThenBy(x => x.EducationID)
.ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem)
.ThenBy(x => x.SchoolyearID)
.ToGridResultSet(pageIndex, pageSize);
}
///
/// 查询对应的毕业标准信息List
///
///
///
///
///
///
///
///
///
///
///
///
public List GetGraduationStandardViewList(ConfiguretView configuretView, Guid? gradSchoolyearID,
Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
int? inSchoolStatus)
{
//毕业标准
Expression> expGraduationStandard = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
//执行计划(只对已提交状态进行统计)
Expression> expExecutablePlan = (x => true);
expExecutablePlan = expExecutablePlan.And(x => x.RecordStatus == (int)EM_ExecuteStatus.Submited);
//学生信息
Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (inSchoolStatus != null && inSchoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
if (inSchoolStatus == 1)
{
//表示在校
expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
}
if (inSchoolStatus == 0)
{
//不在校
expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
}
}
var query = GraduationStandardDAL.GetGraduationStandardViewQueryable(expGraduationStandard, expExecutablePlan, expStudent);
if (gradSchoolyearID.HasValue)
{
query = query.Where(x => x.GraduatingSemesterID == gradSchoolyearID);
}
if (campusID.HasValue)
{
query = query.Where(x => x.CampusID == campusID);
}
if (collegeID.HasValue)
{
query = query.Where(x => x.CollegeID == collegeID);
}
if (yearID.HasValue)
{
query = query.Where(x => x.SchoolyearID == yearID);
}
if (standardID.HasValue)
{
query = query.Where(x => x.StandardID == standardID);
}
if (educationID.HasValue)
{
query = query.Where(x => x.EducationID == educationID);
}
if (learningformID.HasValue)
{
query = query.Where(x => x.LearningformID == learningformID);
}
if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
{
var LearnSystems = Convert.ToDecimal(learnSystem);
query = query.Where(x => x.LearnSystem == LearnSystems);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query)
.OrderBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
.ThenBy(x => x.StandardID).ThenBy(x => x.EducationID)
.ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem)
.ThenBy(x => x.SchoolyearID)
.ToList();
}
///
/// 根据毕业标准ID查询对应的毕业标准信息GraduationStandardView
///
///
///
public GraduationStandardView GetGraduationStandardView(Guid? GraduationStandardID)
{
try
{
var query = GraduationStandardDAL.GetGraduationStandardViewQueryable(x => x.GraduationStandardID == GraduationStandardID)
.SingleOrDefault();
return query;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 毕业标准生成
/// 注:年级专业对应的学生人数大于0
///
///
///
///
public string GraduationStandardGenerate(Guid? GraduatingSemesterID, Guid? collegeID)
{
try
{
//查询课程类型设置信息List
var courseTypeSelectCourseTypeList = GraduationStandardDAL.CourseTypeSelectCourseTypeRepository
.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
{
throw new Exception("课程类型设置未配置,请配置。");
}
//毕业标准
Expression> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (GraduatingSemesterID.HasValue)
{
//毕业学期
expGrademajor = expGrademajor.And(x => x.GraduateSchoolyearID == GraduatingSemesterID);
}
//学生信息
Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
var query = GraduationStandardDAL.GetGrademajorViewQueryable(expGrademajor, expStudent);
if (collegeID.HasValue)
{
//院系所
query = query.Where(x => x.CollegeID == collegeID);
}
//年级专业对应的学生人数大于0
query = query.Where(x => x.StudentCount > 0);
//查询对应的年级专业信息grademajorViewList(注:数据范围)
var grademajorViewList = this.GetQueryByDataRangeByCollege(query).ToList();
//年级专业IDList
var grademajorIDList = grademajorViewList.Select(x => x.GrademajorID).ToList();
//查询对应的毕业标准信息graduationStandardList
var graduationStandardList = GraduationStandardDAL.GraduationStandardRepository
.GetList(x => grademajorIDList.Contains((Guid)x.GrademajorID)).ToList();
int insert = 0;
int update = 0;
string tipMessage = null;
List graduationStandardInList = new List();
List graduationStandardUpList = new List();
foreach (var grademajorID in grademajorIDList)
{
//根据年级专业ID查询对应的毕业标准信息
var graduationStandard = graduationStandardList
.Where(x => x.GrademajorID == grademajorID).SingleOrDefault();
if (graduationStandard == null)
{
ER_GraduationStandard newGraduationStandard = new ER_GraduationStandard();
newGraduationStandard.GraduationStandardID = Guid.NewGuid();
newGraduationStandard.GrademajorID = grademajorID;
newGraduationStandard.RequireCourseCount = 0;
newGraduationStandard.GraduationCredit = 0;
SetNewStatus(newGraduationStandard);
graduationStandardInList.Add(newGraduationStandard);
insert++;
}
else
{
SetModifyStatus(graduationStandard);
graduationStandardUpList.Add(graduationStandard);
update++;
}
}
//批量插入
UnitOfWork.BulkInsert(graduationStandardInList);
if (graduationStandardUpList != null && graduationStandardUpList.Count() > 0)
{
//批量更新
UnitOfWork.BatchUpdate(graduationStandardUpList);
}
if (insert > 0 && update <= 0)
{
tipMessage = insert + "条";
}
else
{
tipMessage = insert + "条,更新成功" + update + "条";
}
return tipMessage;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 编辑(新增、修改,业务主键:年级专业ID)
///
///
public void GraduationStandardEdit(GraduationStandardView graduationStandardView)
{
try
{
//查询课程类型设置信息List
var courseTypeSelectCourseTypeList = GraduationStandardDAL.CourseTypeSelectCourseTypeRepository
.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
{
throw new Exception("课程类型设置未配置,请配置。");
}
//查询数据库进行验证
var graduationStandardVerification = GraduationStandardDAL.GraduationStandardRepository
.GetList(x => x.GraduationStandardID != graduationStandardView.GraduationStandardID
&& x.GrademajorID == graduationStandardView.GrademajorID).SingleOrDefault();
if (graduationStandardVerification == null)
{
//数据有误验证
if (graduationStandardView.GraduationStandardID != Guid.Empty)
{
var graduationStandard = GraduationStandardDAL.GraduationStandardRepository
.GetList(x => x.GraduationStandardID == graduationStandardView.GraduationStandardID)
.SingleOrDefault();
if (graduationStandard == null)
{
throw new Exception("数据有误,请核查");
}
else
{
//表示修改
graduationStandard.RequireCourseCount = graduationStandardView.RequireCourseCount;
graduationStandard.GraduationCredit = graduationStandardView.GraduationCredit;
SetModifyStatus(graduationStandard);
}
}
else
{
//表示新增
ER_GraduationStandard graduationStandard = new ER_GraduationStandard();
graduationStandard.GraduationStandardID = Guid.NewGuid();
graduationStandard.GrademajorID = graduationStandardView.GrademajorID;
graduationStandard.RequireCourseCount = graduationStandardView.RequireCourseCount;
graduationStandard.GraduationCredit = graduationStandardView.GraduationCredit;
SetNewStatus(graduationStandard);
UnitOfWork.Add(graduationStandard);
}
}
else
{
throw new Exception("已存在相同的毕业标准,请核查");
}
//事务提交
UnitOfWork.Commit();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 毕业标准批量新增(业务主键:年级专业ID)
///
///
///
///
public string GraduationStandardBatchAdd(List grademajorIDList, GraduationStandardView graduationStandardView)
{
try
{
//查询课程类型设置信息List
var courseTypeSelectCourseTypeList = GraduationStandardDAL.CourseTypeSelectCourseTypeRepository
.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
if (courseTypeSelectCourseTypeList == null || courseTypeSelectCourseTypeList.Count() <= 0)
{
throw new Exception("课程类型设置未配置,请配置。");
}
//查询对应的毕业标准信息graduationStandardList
var graduationStandardList = GraduationStandardDAL.GraduationStandardRepository
.GetList(x => grademajorIDList.Contains((Guid)x.GrademajorID)).ToList();
int success = 0; //成功
int fail = 0; //失败
string tipMessage = null; //提示消息
List graduationStandardInList = new List();
foreach (var grademajorID in grademajorIDList)
{
//根据年级专业ID查询对应的毕业标准信息
var graduationStandard = graduationStandardList
.Where(x => x.GrademajorID == grademajorID).SingleOrDefault();
if (graduationStandard == null)
{
ER_GraduationStandard newGraduationStandard = new ER_GraduationStandard();
newGraduationStandard.GraduationStandardID = Guid.NewGuid();
newGraduationStandard.GrademajorID = grademajorID;
newGraduationStandard.RequireCourseCount = graduationStandardView.RequireCourseCount ?? 0;
newGraduationStandard.GraduationCredit = graduationStandardView.GraduationCredit ?? 0;
SetNewStatus(newGraduationStandard);
graduationStandardInList.Add(newGraduationStandard);
success++;
}
else
{
//表示已存在相同的毕业标准信息
fail++;
}
}
//批量插入
UnitOfWork.BulkInsert(graduationStandardInList);
if (success > 0 && fail <= 0)
{
tipMessage = success + "条";
}
else
{
tipMessage = success + "条,失败" + fail + "条,原因:已存在相同的毕业标准信息,请检查";
}
return tipMessage;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 查询未新增的毕业标准对应的年级专业信息GrademajorView
///
///
///
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetGraduationStandardNoAddViewGrid(ConfiguretView configuretView, Guid? campusID,
Guid? collegeID, int? schoolyearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
int? inSchoolStatus, Guid? gradSchoolyearID, int pageIndex, int pageSize)
{
//年级专业信息
Expression> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (schoolyearID.HasValue)
{
//年级
expGrademajor = expGrademajor.And(x => x.GradeID == schoolyearID);
}
if (gradSchoolyearID.HasValue)
{
//毕业学期
expGrademajor = expGrademajor.And(x => x.GraduateSchoolyearID == gradSchoolyearID);
}
//学生信息
Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (inSchoolStatus != null && inSchoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
if (inSchoolStatus == 1)
{
//表示在校
expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
}
if (inSchoolStatus == 0)
{
//不在校
expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
}
}
var query = GraduationStandardDAL.GetGraduationStandardViewNoAddQueryable(expGrademajor, expStudent);
if (campusID.HasValue)
{
query = query.Where(x => x.CampusID == campusID);
}
if (collegeID.HasValue)
{
query = query.Where(x => x.CollegeID == collegeID);
}
if (standardID.HasValue)
{
query = query.Where(x => x.StandardID == standardID);
}
if (educationID.HasValue)
{
query = query.Where(x => x.EducationID == educationID);
}
if (learningformID.HasValue)
{
query = query.Where(x => x.LearningformID == learningformID);
}
if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
{
var LearnSystems = Convert.ToDecimal(learnSystem);
query = query.Where(x => x.LearnSystem == LearnSystems);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
.ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem).ThenBy(x => x.GradeID).ToGridResultSet(pageIndex, pageSize);
}
///
/// 查询未新增的毕业标准对应的年级专业信息List
///
///
///
///
///
///
///
///
///
///
///
///
public IList GetGraduationStandardNoAddViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? schoolyearID, int? standardID, int? educationID, int? learningformID, string learnSystem, int? inSchoolStatus, Guid? gradSchoolyearID)
{
//年级专业信息
Expression> expGrademajor = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (schoolyearID.HasValue)
{
//年级
expGrademajor = expGrademajor.And(x => x.GradeID == schoolyearID);
}
if (gradSchoolyearID.HasValue)
{
//毕业学期
expGrademajor = expGrademajor.And(x => x.GraduateSchoolyearID == gradSchoolyearID);
}
//学生信息
Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (inSchoolStatus != null && inSchoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
if (inSchoolStatus == 1)
{
//表示在校
expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
}
if (inSchoolStatus == 0)
{
//不在校
expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
}
}
var query = GraduationStandardDAL.GetGraduationStandardViewNoAddQueryable(expGrademajor, expStudent);
if (campusID.HasValue)
{
query = query.Where(x => x.CampusID == campusID);
}
if (collegeID.HasValue)
{
query = query.Where(x => x.CollegeID == collegeID);
}
if (standardID.HasValue)
{
query = query.Where(x => x.StandardID == standardID);
}
if (educationID.HasValue)
{
query = query.Where(x => x.EducationID == educationID);
}
if (learningformID.HasValue)
{
query = query.Where(x => x.LearningformID == learningformID);
}
if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
{
var LearnSystems = Convert.ToDecimal(learnSystem);
query = query.Where(x => x.LearnSystem == LearnSystems);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode).ThenBy(x => x.StandardID)
.ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem).ThenBy(x => x.GradeID).ToList();
}
///
/// 删除
///
///
///
public bool GraduationStandardDelete(List graduationStandardIDs)
{
try
{
UnitOfWork.Delete(x => graduationStandardIDs.Contains(x.GraduationStandardID));
UnitOfWork.Commit();
return true;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 查询毕业标准对应的专业计划信息SpecialtyPlanView
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetSpecialtyPlanViewGrid(ConfiguretView configuretView, Guid? graduationStandardID,
Guid? schoolyearID, int? courseTypeID, int? starttermID, int? isMainCourse, int? handleModeID, int pageIndex, int pageSize)
{
//毕业标准
Expression> expGraduationStandard = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
expGraduationStandard = expGraduationStandard.And(x => x.GraduationStandardID == graduationStandardID);
var query = GraduationStandardDAL.GetSpecialtyPlanViewQueryable(expGraduationStandard);
if (schoolyearID.HasValue)
{
query = query.Where(x => x.SchoolyearID == schoolyearID);
}
if (courseTypeID.HasValue)
{
query = query.Where(x => x.CourseTypeID == courseTypeID);
}
if (starttermID.HasValue)
{
query = query.Where(x => x.StarttermID == starttermID);
}
if (isMainCourse.HasValue)
{
//可否学位课程
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsYes)
{
query = query.Where(x => x.IsMainCourse == true);
}
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsNo)
{
query = query.Where(x => x.IsMainCourse != true);
}
}
if (handleModeID.HasValue)
{
query = query.Where(x => x.HandleModeID == handleModeID);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query)
.OrderBy(x => x.SchoolyearCode.Length).ThenBy(x => x.SchoolyearCode)
.ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
.ToGridResultSet(pageIndex, pageSize);
}
///
/// 查询毕业标准对应的专业计划信息List
///
///
///
///
///
///
///
///
///
public IList GetSpecialtyPlanViewList(ConfiguretView configuretView, Guid? graduationStandardID,
Guid? schoolyearID, int? courseTypeID, int? starttermID, int? isMainCourse, int? handleModeID)
{
//毕业标准
Expression> expGraduationStandard = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
expGraduationStandard = expGraduationStandard.And(x => x.GraduationStandardID == graduationStandardID);
var query = GraduationStandardDAL.GetSpecialtyPlanViewQueryable(expGraduationStandard);
if (schoolyearID.HasValue)
{
query = query.Where(x => x.SchoolyearID == schoolyearID);
}
if (courseTypeID.HasValue)
{
query = query.Where(x => x.CourseTypeID == courseTypeID);
}
if (starttermID.HasValue)
{
query = query.Where(x => x.StarttermID == starttermID);
}
if (isMainCourse.HasValue)
{
//可否学位课程
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsYes)
{
query = query.Where(x => x.IsMainCourse == true);
}
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsNo)
{
query = query.Where(x => x.IsMainCourse != true);
}
}
if (handleModeID.HasValue)
{
query = query.Where(x => x.HandleModeID == handleModeID);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query)
.OrderBy(x => x.SchoolyearCode.Length).ThenBy(x => x.SchoolyearCode)
.ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
.ToList();
}
///
/// 查询毕业标准对应的执行计划信息ExecutablePlanView
///
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetExecutablePlanViewGrid(ConfiguretView configuretView, Guid? graduationStandardID,
Guid? schoolyearID, int? courseTypeID, int? starttermID, int? isMainCourse, int? handleModeID, int? executablePlanStatus, int pageIndex, int pageSize)
{
//毕业标准
Expression> expGraduationStandard = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
expGraduationStandard = expGraduationStandard.And(x => x.GraduationStandardID == graduationStandardID);
var query = GraduationStandardDAL.GetExecutablePlanViewQueryable(expGraduationStandard);
if (schoolyearID.HasValue)
{
query = query.Where(x => x.SchoolyearID == schoolyearID);
}
if (courseTypeID.HasValue)
{
query = query.Where(x => x.CourseTypeID == courseTypeID);
}
if (starttermID.HasValue)
{
query = query.Where(x => x.StarttermID == starttermID);
}
if (isMainCourse.HasValue)
{
//可否学位课程
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsYes)
{
query = query.Where(x => x.IsMainCourse == true);
}
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsNo)
{
query = query.Where(x => x.IsMainCourse != true);
}
}
if (handleModeID.HasValue)
{
query = query.Where(x => x.HandleModeID == handleModeID);
}
if (executablePlanStatus.HasValue)
{
//执行计划状态
query = query.Where(x => x.RecordStatus == executablePlanStatus);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query)
.OrderBy(x => x.SchoolyearCode.Length).ThenBy(x => x.SchoolyearCode)
.ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
.ToGridResultSet(pageIndex, pageSize);
}
///
/// 查询毕业标准对应的执行计划信息List
///
///
///
///
///
///
///
///
///
///
public IList GetExecutablePlanViewList(ConfiguretView configuretView, Guid? graduationStandardID,
Guid? schoolyearID, int? courseTypeID, int? starttermID, int? isMainCourse, int? handleModeID, int? executablePlanStatus)
{
//毕业标准
Expression> expGraduationStandard = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
expGraduationStandard = expGraduationStandard.And(x => x.GraduationStandardID == graduationStandardID);
var query = GraduationStandardDAL.GetExecutablePlanViewQueryable(expGraduationStandard);
if (schoolyearID.HasValue)
{
query = query.Where(x => x.SchoolyearID == schoolyearID);
}
if (courseTypeID.HasValue)
{
query = query.Where(x => x.CourseTypeID == courseTypeID);
}
if (starttermID.HasValue)
{
query = query.Where(x => x.StarttermID == starttermID);
}
if (isMainCourse.HasValue)
{
//可否学位课程
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsYes)
{
query = query.Where(x => x.IsMainCourse == true);
}
if (isMainCourse.Value == (int)CF_GeneralPurpose.IsNo)
{
query = query.Where(x => x.IsMainCourse != true);
}
}
if (handleModeID.HasValue)
{
query = query.Where(x => x.HandleModeID == handleModeID);
}
if (executablePlanStatus.HasValue)
{
//执行计划状态
query = query.Where(x => x.RecordStatus == executablePlanStatus);
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query)
.OrderBy(x => x.SchoolyearCode.Length).ThenBy(x => x.SchoolyearCode)
.ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
.ToList();
}
///
/// 获取年级专业各在校状态学生
///
///
///
///
///
///
///
public IGridResultSet GetGradeMajorStudentViewGrid(ConfiguretView configuretView, Guid? grademajorID,
int? inschoolStatus, int pageIndex, int pageSize)
{
//在校状态
Expression> expStudent = (x => true);
if (inschoolStatus != null && inschoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
if (inschoolStatus == 1)
{
//表示在校
expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
}
if (inschoolStatus == 0)
{
//不在校
expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
}
}
var query = GraduationStandardDAL.GetGradeMajorStudentViewQueryAble(x => x.GrademajorID == grademajorID, expStudent);
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.ClassmajorCode.Length)
.OrderBy(x => x.ClassmajorCode).OrderBy(x => x.LoginID)
.ToGridResultSet(pageIndex, pageSize);
}
///
/// 获取年级专业各在校状态学生
///
///
///
///
///
public List GetGradeMajorStudentViewGrid(ConfiguretView configuretView, Guid? grademajorID,
int? inschoolStatus)
{
//在校状态
Expression> expStudent = (x => true);
if (inschoolStatus != null && inschoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
if (inschoolStatus == 1)
{
//表示在校
expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
}
if (inschoolStatus == 0)
{
//不在校
expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
}
}
var query = GraduationStandardDAL.GetGradeMajorStudentViewQueryAble(x => x.GrademajorID == grademajorID, expStudent);
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.ClassmajorCode.Length)
.OrderBy(x => x.ClassmajorCode).OrderBy(x => x.LoginID)
.ToList();
}
}
}