123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Entities;
- using EMIS.DataLogic.MinorManage.MinorPlanManage;
- using EMIS.DataLogic.Common.CalendarManage;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.MinorManage.MinorPlanManage;
- using EMIS.ViewModel;
- using System.Linq.Expressions;
- using Bowin.Common.Linq;
- namespace EMIS.CommonLogic.MinorManage.MinorPlanManage
- {
- public class MinorPlanApproveServices : BaseWorkflowServices<CF_GrademinorApplication>, IMinorPlanApproveServices
- {
- public MinorPlanApplyDAL MinorPlanApplyDAL { get; set; }
- public SchoolYearDAL schoolYearDAL { get; set; }
- public IGridResultSet<MinorPlanApplyView> GetMinorPlanApplyViewGrid(ConfiguretView configuretView, int? yearID, int? standardID, Guid? collegeID, int? approvalStatus, int pageIndex, int pageSize)
- {
- var statusList = this.GetStatusViewList();
- Expression<Func<CF_GrademinorApplication, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (yearID.HasValue)
- exp = exp.And(x => x.YearID == yearID);
- if (standardID.HasValue)
- exp = exp.And(x => x.StandardID == standardID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CollegeID == collegeID);
- if (approvalStatus.HasValue)
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- var query = MinorPlanApplyDAL.GetMinorPlanApplyViewQueryable(exp);
- query = query.Where(x => x.ApprovalStatus == 3);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- var result = this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.YearID).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenByDescending(x => x.StandardID).ThenByDescending(x => x.CreateTime).ToGridResultSet<MinorPlanApplyView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.ApprovalStatusName = statusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- public List<MinorPlanApplyView> GetMinorPlanApplyViewList(ConfiguretView configuretView, int? yearID, int? standardID, Guid? collegeID, int? approvalStatus, List<Guid?> GradeMinorApplicationIDList)
- {
- Expression<Func<CF_GrademinorApplication, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (GradeMinorApplicationIDList != null)
- exp = exp.And(x => GradeMinorApplicationIDList.Contains(x.GradeMinorApplicationID));
- if (yearID.HasValue)
- exp = exp.And(x => x.YearID == yearID);
- if (standardID.HasValue)
- exp = exp.And(x => x.StandardID == standardID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CollegeID == collegeID);
- if (approvalStatus.HasValue)
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- var query = MinorPlanApplyDAL.GetMinorPlanApplyViewQueryable(exp);
- query = query.Where(x => x.ApprovalStatus == 3);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- return this.GetQueryByDataRangeByCollege(query).OrderByDescending(x => x.YearID).ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ThenByDescending(x => x.StandardID).ThenByDescending(x => x.CreateTime).ToList();
- }
- /// <summary>
- /// 审核完成事件,由工作流自动触发
- /// </summary>
- /// <param name="GradeMinorApplicationIDList"></param>
- /// <param name="userID"></param>
- public void OnApproveEnd(IList<Guid> GradeMinorApplicationIDList, Guid? userID)
- {
- var graduatingSemester = EMIS.Utility.Const.LOCAL_SETTING_ENTRANCESEMESTERID;
- if (graduatingSemester == null)
- {
- throw new Exception("入学学期(春季、上学期、秋季、下学期)未配置,请检查");
- }
- var SchoolcodeID = Convert.ToInt32(graduatingSemester);
- var schoolYearList = this.schoolYearDAL.schoolyearRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- var GradeMinorApplicationList = MinorPlanApplyDAL.GetMinorPlanApplyViewQueryable(x => GradeMinorApplicationIDList.Contains(x.GradeMinorApplicationID)).ToList();
- var GradeMinorApplicationIDsList = GradeMinorApplicationList.Select(x => x.GradeMinorApplicationID).ToList();
- var minorSpecialCourseList = MinorPlanApplyDAL.MinorPlanApplicationRepository.GetList(x=>GradeMinorApplicationIDsList.Contains(x.GrademinorApplicationID)).ToList();
- var minorSpecialCourseIDList = minorSpecialCourseList.Select(x => x.MinorPlanApplicationID).ToList();
- var minorSpecialCourseTeachingSettingList = MinorPlanApplyDAL.MinorPlanApplicationTeachingSettingRepository.GetList(x => minorSpecialCourseIDList.Contains((Guid)x.MinorPlanApplicationID)).ToList();
- var minorSpecialCourseTeachModeTypeList = MinorPlanApplyDAL.MinorPlanApplicationTeachingModeTypeRepository.GetList(x => minorSpecialCourseIDList.Contains((Guid)x.MinorPlanApplicationID)).ToList();
- var minorSpecialCourseTeachPlaceList = MinorPlanApplyDAL.MinorPlanApplicationTeachingPlaceRepository.GetList(x => minorSpecialCourseIDList.Contains((Guid)x.MinorPlanApplicationID)).ToList();
- #region 插入数据
- List<CF_Grademinor> GrademinorList = new List<CF_Grademinor>();
- List<EM_MinorPlan> MinorPlanList = new List<EM_MinorPlan>();
- List<EM_MinorPlanTeachingModeType> MinorPlanTeachingModeTypeList = new List<EM_MinorPlanTeachingModeType>();
- List<EM_MinorPlanTeachingPlace> MinorPlanTeachingPlaceList = new List<EM_MinorPlanTeachingPlace>();
- List<EM_MinorPlanTeachingSetting> MinorPlanTeachingSettingList = new List<EM_MinorPlanTeachingSetting>();
- //添加辅修专业
- foreach (var GrademinorPlan in GradeMinorApplicationList)
- {
- CF_Grademinor Grademinor = new CF_Grademinor();
- Grademinor.GrademinorID = Guid.NewGuid();
- Grademinor.GrademinorApplicationID = GrademinorPlan.GradeMinorApplicationID;
- Grademinor.SchoolyearID = GrademinorPlan.SchoolyearID;
- Grademinor.CollegeID=GrademinorPlan.CollegeID;
- Grademinor.YearID=GrademinorPlan.YearID;
- Grademinor.StandardID=GrademinorPlan.StandardID;
- Grademinor.StudentLimit = GrademinorPlan.StudentLimit;
- SetNewStatus(Grademinor);
- GrademinorList.Add(Grademinor);
- //添加辅修计划
- foreach (var minorSpecialCourse in minorSpecialCourseList)
- {
- if (minorSpecialCourse.GrademinorApplicationID == GrademinorPlan.GradeMinorApplicationID)
- {
- var startSchoolyear = schoolYearList.FirstOrDefault(x => x.Years == GrademinorPlan.YearID && x.SchoolcodeID == SchoolcodeID);
- var courseSchoolyear = schoolYearList.FirstOrDefault(x => x.Value == (startSchoolyear.Value + minorSpecialCourse.StarttermID - 1));
- EM_MinorPlan MinorPlan = new EM_MinorPlan();
- MinorPlan.MinorPlanID = Guid.NewGuid();
- MinorPlan.MinorPlanApplicationID = minorSpecialCourse.MinorPlanApplicationID;
- MinorPlan.CoursematerialID = minorSpecialCourse.CoursematerialID;
- MinorPlan.DepartmentID = minorSpecialCourse.DepartmentID;
- MinorPlan.GrademinorID = Grademinor.GrademinorID;
- MinorPlan.SchoolyearID = courseSchoolyear.SchoolyearID;
- MinorPlan.CourseStructureID=minorSpecialCourse.CourseStructureID;
- MinorPlan.CourseCategoryID=minorSpecialCourse.CourseCategoryID;
- MinorPlan.CourseTypeID=minorSpecialCourse.CourseTypeID;
- MinorPlan.CourseQualityID=minorSpecialCourse.CourseQualityID;
- MinorPlan.PracticeTypeID=minorSpecialCourse.PracticeTypeID;
- MinorPlan.ExaminationModeID=minorSpecialCourse.ExaminationModeID;
- MinorPlan.CourseFineID=minorSpecialCourse.CourseFineID;
- MinorPlan.IsSpecialtycore=minorSpecialCourse.IsSpecialtycore;
- MinorPlan.IsCooperation=minorSpecialCourse.IsCooperation;
- MinorPlan.IsRequired=minorSpecialCourse.IsRequired;
- MinorPlan.IsElective=minorSpecialCourse.IsElective;
- MinorPlan.IsNetworkCourse=minorSpecialCourse.IsNetworkCourse;
- MinorPlan.IsMainCourse=minorSpecialCourse.IsMainCourse;
- MinorPlan.TeachinglanguageID=minorSpecialCourse.TeachinglanguageID;
- MinorPlan.HandleModeID=minorSpecialCourse.HandleModeID;
- MinorPlan.IsNeedMaterial=minorSpecialCourse.IsNeedMaterial;
- MinorPlan.ResultTypeID = minorSpecialCourse.ResultTypeID;
- MinorPlan.Remarks = minorSpecialCourse.Remarks;
- SetNewStatus(MinorPlan);
- MinorPlanList.Add(MinorPlan);
- var minorSpecialCourseTeachingSetting = minorSpecialCourseTeachingSettingList.Where(x => x.MinorPlanApplicationID == minorSpecialCourse.MinorPlanApplicationID).FirstOrDefault();
- EM_MinorPlanTeachingSetting MinorPlanTeachingSetting = new EM_MinorPlanTeachingSetting();
- MinorPlanTeachingSetting.MinorPlanID = MinorPlan.MinorPlanID;
- MinorPlanTeachingSetting.Credit = minorSpecialCourseTeachingSetting.Credit;
- MinorPlanTeachingSetting.TheoryCourse = minorSpecialCourseTeachingSetting.TheoryCourse;
- MinorPlanTeachingSetting.Practicehours = minorSpecialCourseTeachingSetting.Practicehours;
- MinorPlanTeachingSetting.Trialhours = minorSpecialCourseTeachingSetting.Trialhours;
- MinorPlanTeachingSetting.WeeklyNum = minorSpecialCourseTeachingSetting.WeeklyNum;
- MinorPlanTeachingSetting.TheoryWeeklyNum = minorSpecialCourseTeachingSetting.TheoryWeeklyNum;
- MinorPlanTeachingSetting.PracticeWeeklyNum = minorSpecialCourseTeachingSetting.PracticeWeeklyNum;
- MinorPlanTeachingSetting.TrialWeeklyNum = minorSpecialCourseTeachingSetting.TrialWeeklyNum;
- MinorPlanTeachingSetting.StartWeeklyNum = minorSpecialCourseTeachingSetting.StartWeeklyNum;
- MinorPlanTeachingSetting.EndWeeklyNum = minorSpecialCourseTeachingSetting.EndWeeklyNum;
- MinorPlanTeachingSetting.WeeklyHours = minorSpecialCourseTeachingSetting.WeeklyHours;
- MinorPlanTeachingSettingList.Add(MinorPlanTeachingSetting);
- minorSpecialCourseTeachModeTypeList.Where(x => x.MinorPlanApplicationID == minorSpecialCourse.MinorPlanApplicationID).ToList().ForEach(x =>
- {
- EM_MinorPlanTeachingModeType MinorPlanTeachingModeType = new EM_MinorPlanTeachingModeType();
- MinorPlanTeachingModeType.MinorPlanTeachingModeTypeID = Guid.NewGuid();
- MinorPlanTeachingModeType.MinorPlanID = MinorPlan.MinorPlanID;
- MinorPlanTeachingModeType.TeachingModeID = x.TeachingModeID;
- this.SetNewStatus(MinorPlanTeachingModeType);
- MinorPlanTeachingModeTypeList.Add(MinorPlanTeachingModeType);
- });
- minorSpecialCourseTeachPlaceList.Where(x => x.MinorPlanApplicationID == minorSpecialCourse.MinorPlanApplicationID).ToList().ForEach(x =>
- {
- EM_MinorPlanTeachingPlace MinorPlanTeachingPlace = new EM_MinorPlanTeachingPlace();
- MinorPlanTeachingPlace.MinorPlanTeachingPlaceID = Guid.NewGuid();
- MinorPlanTeachingPlace.MinorPlanID = MinorPlan.MinorPlanID;
- MinorPlanTeachingPlace.TeachingPlace = x.TeachingPlace;
- this.SetNewStatus(MinorPlanTeachingPlace);
- MinorPlanTeachingPlaceList.Add(MinorPlanTeachingPlace);
- });
- }
- }
- }
- UnitOfWork.BulkInsert(GrademinorList);
- UnitOfWork.BulkInsert(MinorPlanList);
- UnitOfWork.BulkInsert(MinorPlanTeachingModeTypeList);
- UnitOfWork.BulkInsert(MinorPlanTeachingPlaceList);
- UnitOfWork.BulkInsert(MinorPlanTeachingSettingList);
- UnitOfWork.Commit();
- #endregion
- }
- }
- }
|