123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Entities;
- using EMIS.DataLogic.RetakeManage;
- using EMIS.CommonLogic.EducationSchedule;
- using System.Linq.Expressions;
- using EMIS.ViewModel;
- using EMIS.ViewModel.RetakeManage;
- using EMIS.ViewModel.EducationManage;
- using EMIS.Utility.FormValidate;
- using EMIS.DataLogic.ChargeManage.ArrearsSituation;
- namespace EMIS.CommonLogic.RetakeManage
- {
- public class RetakePlanStudentServices : BaseWorkflowServices<ER_RetakePlanStudent>, IRetakePlanStudentServices
- {
- public RetakeConditionDAL RetakeConditionDAL { get; set; }
- public RetakeOpenControlDAL RetakeOpenControlDAL { get; set; }
- public RetakePlanDAL RetakePlanDAL { get; set; }
- public ChargeControlDAL ChargeControlDAL { get; set; }
- public Lazy<IEducationMissionClassScheduleAdultServices> EducationMissionClassScheduleAdultServices { get; set; }
- public Lazy<IParameterServices> ParameterServices { get; set; }
- public Bowin.Common.Linq.Entity.IGridResultSet<ViewModel.RetakeManage.RetakeStudentListView> GetRetakeStudentListViewList(
- ViewModel.ConfiguretView retakePlanConditionView, Guid? schoolyearID, Guid? collegeID, int? year, int? standardID, Guid? classmajorID,
- bool? isNoArrear, int? learningformID, int? education, string LearnSystem, int pageIndex, int pageSize)
- {
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (collegeID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.GradeID == year);
- }
- if (standardID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (classmajorID != null)
- {
- studentExp = studentExp.And(x => x.CF_Student.ClassmajorID == classmajorID);
- }
- if (learningformID.HasValue)
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearningformID == learningformID);
- if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(LearnSystem);
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearnSystem == LearnSystems);
- }
- if (education.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.EducationID == education.Value);
- }
- var query = this.RetakePlanDAL.GetRetakeStudentListViewQuery(planExp, studentExp);
- if (!string.IsNullOrEmpty(retakePlanConditionView.ConditionValue) && !string.IsNullOrEmpty(retakePlanConditionView.Attribute))
- query = query.DynamicWhere(retakePlanConditionView.Attribute, retakePlanConditionView.Condition, retakePlanConditionView.ConditionValue);
- if (isNoArrear==false)
- {
- query = query.Where(x => x.AmountSum == 0 || x.AmountSum == null);
- }
- if (isNoArrear == true)
- {
- query = query.Where(x => x.AmountSum>0);
- }
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- //Excel导出
- public List<RetakeStudentListView> GetRetakeExcelList(ViewModel.ConfiguretView retakePlanConditionView, Guid? schoolyearID, Guid? collegeID, int? year, int? standardID, Guid? classmajorID,bool? isNoArrear,int? learningformID,int? education,string LearnSystem)
- {
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (collegeID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.GradeID == year);
- }
- if (standardID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (classmajorID != null)
- {
- studentExp = studentExp.And(x => x.CF_Student.ClassmajorID == classmajorID);
- }
- if (learningformID.HasValue)
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearningformID == learningformID);
- if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(LearnSystem);
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearnSystem == LearnSystems);
- }
- if (education.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.EducationID == education.Value);
- }
- var query = this.RetakePlanDAL.GetRetakeStudentListViewQuery(planExp, studentExp);
- if (!string.IsNullOrEmpty(retakePlanConditionView.ConditionValue) && !string.IsNullOrEmpty(retakePlanConditionView.Attribute))
- query = query.DynamicWhere(retakePlanConditionView.Attribute, retakePlanConditionView.Condition, retakePlanConditionView.ConditionValue);
- if (isNoArrear == false)
- {
- query = query.Where(x => x.AmountSum == 0 || x.AmountSum == null);
- }
- if (isNoArrear == true)
- {
- query = query.Where(x => x.AmountSum > 0);
- }
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- return query.ToList();
- }
- public Bowin.Common.Linq.Entity.IGridResultSet<ViewModel.RetakeManage.RetakeStudentListView> GetRetakeStudentDetailListView(
- Guid? userID, Guid? schoolyearID, int pageIndex, int pageSize)
- {
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
-
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- var query = this.RetakePlanDAL.GetRetakeStudentDetailListViewQuery(planExp, studentExp);
- if (userID.HasValue)
- {
- query = query.Where(x => x.UserID == userID);
- }
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- public List<ViewModel.RetakeManage.RetakeStudentListView> GetRetakeStudentListViewList(ViewModel.ConfiguretView retakePlanConditionView,
- Guid? schoolyearID, Guid? collegeID, int? year, int? standardID, Guid? classmajorID, bool? isNoArrear)
- {
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (collegeID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.GradeID == year);
- }
- if (standardID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (classmajorID != null)
- {
- studentExp = studentExp.And(x => x.CF_Student.ClassmajorID == classmajorID);
- }
- var query = this.RetakePlanDAL.GetRetakeStudentListViewQuery(planExp, studentExp);
- if (!string.IsNullOrEmpty(retakePlanConditionView.ConditionValue) && !string.IsNullOrEmpty(retakePlanConditionView.Attribute))
- query = query.DynamicWhere(retakePlanConditionView.Attribute, retakePlanConditionView.Condition, retakePlanConditionView.ConditionValue);
- if (isNoArrear.HasValue)
- {
- query = query.Where(x => x.IsNoArrears == isNoArrear);
- }
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- return query.ToList();
- }
- public void ChargePush(IList<Guid?> userIDList)
- {
- var startStatusID = this.GetStartStatus();
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => x.RecordStatus == startStatusID);
- if (userIDList.Count > 0)
- {
- studentExp = studentExp.And(x => userIDList.Contains(x.UserID));
- }
- var chargeInsertList = this.RetakePlanDAL.GetStudentChargeQueryable(x => true, studentExp).ToList()
- .Select(x => new EC_StudentCharge
- {
- StudentChargeID = x.StudentChargeID,
- UserID = x.UserID,
- ChargeProjectID = x.ChargeProjectID,
- ChargeYear = x.ChargeYear,
- Amount = 0,
- ActualAmount = 0,
- ChargeTag = (int)EC_ChargeTag.Retake,
- Remark = ""
- }).ToList();
- chargeInsertList.ForEach(x => this.SetNewStatus(x));
- UnitOfWork.BulkInsert(chargeInsertList);
- }
- public void DeleteStudent(IList<Guid?> userIDList)
- {
- var startStatusID = this.GetStartStatus();
- var retakeStudentList = this.RetakePlanDAL.RetakePlanStudentRepository.GetList(x => userIDList.Contains(x.UserID),
- (x => x.ER_RetakePlan)).ToList();
- if (retakeStudentList.Any(x => x.RecordStatus != startStatusID))
- {
- throw new Exception("部分学生的重修记录已提交,不能删除,请检查所选记录的状态。");
- }
- var retakePlanIDList = retakeStudentList.Select(x => x.RetakePlanID).Distinct().ToList();
- UnitOfWork.RemoveRange(new HashSet<ER_RetakePlanStudent>(retakeStudentList));
- UnitOfWork.Remove<ER_RetakePlan>(x => retakePlanIDList.Contains(x.RetakePlanID) && x.ER_RetakePlanStudent.Count() == 0);
- UnitOfWork.Commit();
- }
- public void AddStudent(Guid userID)
- {
- var startStatusID = this.GetStartStatus();
- var schoolyearID = ParameterServices.Value.GetParameterValue<Guid>(CF_ParameterType.RetakeSchoolyearID);
- var retakeStudentViewQueryable = this.RetakeConditionDAL.GetRetakeStudentView().Where(x => x.UserID == userID);
- var retakeStudentViewList = retakeStudentViewQueryable.ToList();
- var retakePlanGroup = retakeStudentViewList
- .GroupBy(x => new { x.CoursematerialID, x.Abbreviation, x.CourseName, x.CourseTypeID, x.CourseTypeDesc, x.Credit });
- var existRetakePlanList = this.RetakePlanDAL.GetRetakePlanByStudentQueryable(retakeStudentViewQueryable, startStatusID).ToList();
- var planInsertList = new List<ER_RetakePlan>();
- var planStudentInsertList = new List<ER_RetakePlanStudent>();
- foreach (var retakePlan in retakePlanGroup)
- {
- bool isNewPlan = false;
- var plan = existRetakePlanList.FirstOrDefault(x => x.CoursematerialID == retakePlan.Key.CoursematerialID
- && x.CourseTypeID == retakePlan.Key.CourseTypeID && x.Credit == retakePlan.Key.Credit);
- if (plan == null)
- {
- isNewPlan = true;
- plan = new ER_RetakePlan
- {
- RetakePlanID = Guid.NewGuid(),
- CoursematerialID = retakePlan.Key.CoursematerialID,
- ClassName = (retakePlan.Key.Abbreviation ?? retakePlan.Key.CourseName) + "-重修(" + retakePlan.Key.CourseTypeDesc +
- string.Format("{0:#.00}", retakePlan.Key.Credit) + "学分)",
- SchoolyearID = schoolyearID,
- CourseTypeID = retakePlan.Key.CourseTypeID,
- Credit = retakePlan.Key.Credit
- };
- this.SetNewStatus(plan);
- }
- foreach (var retakePlanStudent in retakePlan.Select(w => w).ToList())
- {
- var planStudent = new ER_RetakePlanStudent
- {
- RetakePlanStudentID = Guid.NewGuid(),
- RetakePlanID = plan.RetakePlanID,
- UserID = retakePlanStudent.UserID.Value,
- SchoolyearNumID = retakePlanStudent.SchoolyearNumID,
- StarttermID = retakePlanStudent.StarttermID
- };
- this.SetNewStatus(planStudent);
- planStudent.RecordStatus = startStatusID;
- planStudentInsertList.Add(planStudent);
- }
- if (isNewPlan)
- {
- planInsertList.Add(plan);
- }
- }
- UnitOfWork.BulkInsert(planInsertList);
- UnitOfWork.BulkInsert(planStudentInsertList);
- }
- public List<RetakeStudentApplyView> GetRetakeStudentApplyViewStudentList(Guid userID)
- {
- Expression<Func<ER_RetakePlanStudent, bool>> exp = (x => x.UserID == userID);
- var startStatusID = this.GetStartStatus();
- var statusList = this.GetStatusViewList();
- var backpointList = this.GetBackpointStatus();
- var nowDate = DateTime.Today;
- var openControl = this.RetakeOpenControlDAL.GetRetakeOpenControlViewQuery(x => x.CF_Schoolyear.IsCurrent == true
- && x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- var studentApplyViewQueryable = this.RetakePlanDAL.GetRetakeStudentApplyViewQueryable(exp);
- var teacherViewQueryable = this.RetakePlanDAL.GetRetakePlanStudentTeacherViewQueryable(exp);
- var studentApplyViewList = studentApplyViewQueryable.ToList();
- var teacherViewList = teacherViewQueryable.ToList();
- studentApplyViewList.ForEach(x => {
- x.RetakePlanStudentTeacherView = teacherViewList.Where(w => w.RetakePlanStudentID == x.RetakePlanStudentID).ToList();
- x.RecordStatusDesc = statusList.Where(w => w.ID == x.RecordStatus).Select(w => w.Name).FirstOrDefault();
- x.IsCanApply = (x.RecordStatus == startStatusID || backpointList.Contains(x.RecordStatus)) && openControl.Any(w => x.SchoolyearID == w.SchoolyearID
- && (w.StartDate ?? DateTime.MinValue).Date <= nowDate && (w.EndDate ?? DateTime.MaxValue).Date >= nowDate);
- });
- return studentApplyViewList;
- }
- public List<EducationMissionImportClassView> GetEducationMissionImportClassViewList(Guid? coursematerialID)
- {
- var schoolyearID = ParameterServices.Value.GetParameterValue<Guid>(CF_ParameterType.RetakeSchoolyearID);
- var educationMissionList = EducationMissionClassScheduleAdultServices.Value.GetEducationMissionClassScheduleViewGridExcel(new ConfiguretView(),
- null, null, schoolyearID, null, coursematerialID, (int)EM_EducationMissionClassStatus.Scheduled, null, null, null, null,null,null,null,null,null);
- return educationMissionList;
- }
- public void Submit(Guid retakePlanStudentID, Guid? educationMissionID)
- {
- this.CheckCanSubmit(retakePlanStudentID);
- var startStatusID = this.GetStartStatus();
- var retakePlanStudent = this.RetakePlanDAL.RetakePlanStudentRepository.GetSingle(x => x.RetakePlanStudentID == retakePlanStudentID);
- if (educationMissionID.HasValue)
- {
- retakePlanStudent.EducationMissionID = educationMissionID;
- }
- else
- {
- throw new Exception("请选择教学任务。");
- }
- if (retakePlanStudent.RecordStatus == startStatusID)
- {
- this.StartUp(new List<Guid> { retakePlanStudentID }, CustomPrincipal.Current.UserID);
- }
- else
- {
- var actionList = this.GetActionView(retakePlanStudentID, CustomPrincipal.Current.UserID);
- if (actionList.Count == 0)
- {
- throw new Exception("该用户没有审核下一步环节的权限。");
- }
- this.Approve(new List<Guid> { retakePlanStudentID }, CustomPrincipal.Current.UserID, actionList[0].ActionID);
- }
- }
- public void CheckCanSubmit(Guid retakePlanStudentID)
- {
- var startStatusID = this.GetStartStatus();
- var backPointIDList = this.GetBackpointStatus();
- var retakePlanStudent = this.RetakePlanDAL.RetakePlanStudentRepository.GetSingle(x => x.RetakePlanStudentID == retakePlanStudentID,
- (x => x.ER_RetakePlan.CF_Schoolyear));
- if (retakePlanStudent == null)
- {
- throw new Exception("重修记录不存在。");
- }
- if (retakePlanStudent.RecordStatus != startStatusID && !backPointIDList.Contains(retakePlanStudent.RecordStatus))
- {
- throw new Exception("该重修课程已经提交,请不要重复提交。");
- }
- var duplicatePlan = this.RetakePlanDAL.RetakePlanStudentRepository.GetSingle(x => x.ER_RetakePlan.CoursematerialID == retakePlanStudent.ER_RetakePlan.CoursematerialID
- && x.ER_RetakePlan.SchoolyearID == retakePlanStudent.ER_RetakePlan.SchoolyearID
- && x.RecordStatus != startStatusID
- && !backPointIDList.Contains(x.RecordStatus));
- if (duplicatePlan != null)
- {
- throw new Exception("你已经在这个学期申请过同一课程的重修,不能重复申请。");
- }
- if (ChargeControlDAL.GetRetakeArrearsAmountView(x => x.UserID == retakePlanStudent.UserID,
- retakePlanStudent.ER_RetakePlan.CF_Schoolyear.Years).Count() > 0)
- {
- throw new Exception("你的重修费用还没有缴,不能申请重修,请先缴清重修费用再进行申请。");
- }
- }
- public IGridResultSet<RetakeStudentApproveView> GetRetakeStudentApproveViewList(ConfiguretView retakePlanConditionView, Guid? schoolyearID,
- Guid? collegeID, int? year, int? standardID, Guid? classmajorID,int? learningformID, int? education,string LearnSystem, int pageIndex, int pageSize)
- {
- var statusList = this.GetStatusViewList();
- var approveStatusIDList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => approveStatusIDList.Contains(x.RecordStatus));
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (collegeID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.GradeID == year);
- }
- if (standardID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (classmajorID != null)
- {
- studentExp = studentExp.And(x => x.CF_Student.ClassmajorID == classmajorID);
- }
- if (learningformID.HasValue)
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearningformID == learningformID);
- if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(LearnSystem);
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearnSystem == LearnSystems);
- }
- if (education.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.EducationID == education.Value);
- }
- var query = this.RetakePlanDAL.GetRetakeStudentApproveViewQueryable(planExp, studentExp);
- if (!string.IsNullOrEmpty(retakePlanConditionView.ConditionValue) && !string.IsNullOrEmpty(retakePlanConditionView.Attribute))
- query = query.DynamicWhere(retakePlanConditionView.Attribute, retakePlanConditionView.Condition, retakePlanConditionView.ConditionValue);
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- var result = query.ToGridResultSet(pageIndex, pageSize);
- result.rows.ForEach(x =>
- {
- x.RecordStatusDesc = statusList.Where(w => w.ID == x.RecordStatus).Select(w => w.Name).FirstOrDefault();
- });
- return result;
- }
- public List<RetakeStudentApproveView> GetRetakeStudentApproveViewList(ConfiguretView retakePlanConditionView, IList<Guid?> retakePlanStudentIDList,
- Guid? schoolyearID, Guid? collegeID, int? year, int? standardID, Guid? classmajorID)
- {
- var statusList = this.GetStatusViewList();
- var approveStatusIDList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => approveStatusIDList.Contains(x.RecordStatus));
- if (retakePlanStudentIDList.Count > 0)
- {
- studentExp = studentExp.And(x => retakePlanStudentIDList.Contains(x.RetakePlanStudentID));
- }
- else
- {
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (collegeID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.GradeID == year);
- }
- if (standardID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (classmajorID != null)
- {
- studentExp = studentExp.And(x => x.CF_Student.ClassmajorID == classmajorID);
- }
- }
- var query = this.RetakePlanDAL.GetRetakeStudentApproveViewQueryable(planExp, studentExp);
- if (!string.IsNullOrEmpty(retakePlanConditionView.ConditionValue) && !string.IsNullOrEmpty(retakePlanConditionView.Attribute))
- query = query.DynamicWhere(retakePlanConditionView.Attribute, retakePlanConditionView.Condition, retakePlanConditionView.ConditionValue);
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- var result = query.ToList();
- result.ForEach(x =>
- {
- x.RecordStatusDesc = statusList.Where(w => w.ID == x.RecordStatus).Select(w => w.Name).FirstOrDefault();
- });
- return result;
- }
- public void OnApproveEnd(Guid? retakePlanStudentID, Guid? userID)
- {
- var retakePlanStudent = this.RetakePlanDAL.RetakePlanStudentRepository.GetSingle(x => x.RetakePlanStudentID == retakePlanStudentID, (x => x.CF_Student));
- if (retakePlanStudent == null)
- {
- throw new Exception("重修记录不存在。");
- }
- var educationSchedulingClassList = this.RetakePlanDAL.EducationSchedulingClassRepository.GetList(x => x.EM_EducationMissionClass.EducationMissionID == retakePlanStudent.EducationMissionID,
- (x => x.CF_Student)).ToList();
- educationSchedulingClassList.ForEach(x => x.CF_Student.Add(retakePlanStudent.CF_Student));
- this.UnitOfWork.Commit();
- }
- public IGridResultSet<RetakeStudentApproveView> GetFinalRetakeStudentApproveViewList(ConfiguretView retakePlanConditionView, Guid? schoolyearID, Guid? collegeID, int? year, int? standardID, Guid? classmajorID,int? learningformID, int? education,string LearnSystem, int pageIndex, int pageSize)
- {
- var statusList = this.GetStatusViewList();
- var endStatus = this.GetCorrectEndStatus();
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => x.RecordStatus == endStatus);
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (collegeID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.GradeID == year);
- }
- if (standardID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (classmajorID != null)
- {
- studentExp = studentExp.And(x => x.CF_Student.ClassmajorID == classmajorID);
- }
- if (learningformID.HasValue)
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearningformID == learningformID);
- if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(LearnSystem);
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearnSystem == LearnSystems);
- }
- if (education.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.EducationID == education.Value);
- }
- var query = this.RetakePlanDAL.GetRetakeStudentApproveViewQueryable(planExp, studentExp);
- if (!string.IsNullOrEmpty(retakePlanConditionView.ConditionValue) && !string.IsNullOrEmpty(retakePlanConditionView.Attribute))
- query = query.DynamicWhere(retakePlanConditionView.Attribute, retakePlanConditionView.Condition, retakePlanConditionView.ConditionValue);
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- var result = query.ToGridResultSet(pageIndex, pageSize);
- result.rows.ForEach(x =>
- {
- x.RecordStatusDesc = statusList.Where(w => w.ID == x.RecordStatus).Select(w => w.Name).FirstOrDefault();
- });
- return result;
- }
- public List<RetakeStudentApproveView> GetFinalRetakeStudentApproveViewList(ConfiguretView retakePlanConditionView, IList<Guid?> retakePlanStudentIDList, Guid? schoolyearID, Guid? collegeID, int? year, int? standardID, Guid? classmajorID, int? learningformID, int? education, string LearnSystem)
- {
- var statusList = this.GetStatusViewList();
- var endStatus = this.GetCorrectEndStatus();
- Expression<Func<ER_RetakePlan, bool>> planExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<ER_RetakePlanStudent, bool>> studentExp = (x => x.RecordStatus == endStatus);
- if (retakePlanStudentIDList.Count > 0)
- {
- studentExp = studentExp.And(x => retakePlanStudentIDList.Contains(x.RetakePlanStudentID));
- }
- else
- {
- if (schoolyearID.HasValue)
- {
- planExp = planExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (collegeID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (year.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.GradeID == year);
- }
- if (standardID.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (classmajorID != null)
- {
- studentExp = studentExp.And(x => x.CF_Student.ClassmajorID == classmajorID);
- }
- if (learningformID.HasValue)
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearningformID == learningformID);
- if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(LearnSystem);
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.LearnSystem == LearnSystems);
- }
- if (education.HasValue)
- {
- studentExp = studentExp.And(x => x.CF_Student.CF_Classmajor.CF_Grademajor.CF_Facultymajor.EducationID == education.Value);
- }
- }
- var query = this.RetakePlanDAL.GetRetakeStudentApproveViewQueryable(planExp, studentExp);
- if (!string.IsNullOrEmpty(retakePlanConditionView.ConditionValue) && !string.IsNullOrEmpty(retakePlanConditionView.Attribute))
- query = query.DynamicWhere(retakePlanConditionView.Attribute, retakePlanConditionView.Condition, retakePlanConditionView.ConditionValue);
- query = this.GetQueryByDataRangeByCollege(query);
- query = query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenBy(x => x.ClassName).ThenBy(x => x.LoginID);
- var result = query.ToList();
- result.ForEach(x =>
- {
- x.RecordStatusDesc = statusList.Where(w => w.ID == x.RecordStatus).Select(w => w.Name).FirstOrDefault();
- });
- return result;
- }
- }
- }
|