1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.ViewModel.MinorManage.MinorApply;
- using EMIS.DataLogic.MinorManage.MinorApply;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.MinorManage.MinorPlanManage;
- using EMIS.DataLogic.MinorManage.MinorPlanManage;
- using EMIS.ViewModel;
- using Bowin.Common.Linq;
- namespace EMIS.CommonLogic.MinorManage.MinorApply
- {
- public class StudentMinorServices : BaseServices, IStudentMinorServices
- {
- public StudentMinorDAL studentMinorDAL { get; set; }
- public MinorSpecialtyPlanDAL minorSpecialtyPlanDAL { get; set; }
- public IMinorApplyServices minorApplyServices { get; set; }
- public StudentMinorView GetMinorApplyView(Guid userID)
- {
- var statusList = minorApplyServices.GetStatusViewList();
- Expression<Func<EM_StudentMinorRegist, bool>> exp = x => x.UserID == userID;
- if (statusList.Where(y => y.Description.Contains("BP")).FirstOrDefault() != null)
- {
- var returnStatus = statusList.Where(y => y.Description.Contains("BP")).FirstOrDefault().ID;
- exp = exp.And(x => x.RecordStatus != returnStatus);
- }
- var query = studentMinorDAL.GetStudentMinorViewQueryable(exp).FirstOrDefault();
- if (query != null)
- {
- query.RecordStatusStr = statusList.FirstOrDefault(w => w.ID == query.RecordStatus).Name;
- }
- return query;
- }
- public IGridResultSet<MinorSpecialtyPlanView> GetMinorSpecialtyViewByUserIDGrid(Guid userID, int? pageIndex, int? pageSize)
- {
- Expression<Func<EM_MinorPlan, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var grademinorID = studentMinorDAL.GetGrademinorIDByUserID(userID);
- exp = exp.And(x => x.GrademinorID == grademinorID);
- var query = minorSpecialtyPlanDAL.GetMinorSpecialtyPlanViewQueryable(exp);
- var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StandardID).ThenBy(x => x.SchoolcodeStr)
- .ToGridResultSet<MinorSpecialtyPlanView>(pageIndex, pageSize);
- return result;
- }
- public void StudentMinorCancel(Guid? userID, Guid? studentMinorRegistID)
- {
- try
- {
- var grademinor = studentMinorDAL.grademinorRepository.GetSingle(x => x.EM_StudentMinorRegist.Any(y => y.StudentMinorRegistID == studentMinorRegistID));
- if(grademinor != null)
- {
- if (grademinor.RecordStatus == (int)CF_GrademinorStatus.Confirmed)
- {
- throw new Exception("报名的辅修专业已开班,不能取消报名");
- }
- }
- if (studentMinorDAL.classminorStudentRepository.Entities.Any(x => x.UserID == userID))
- {
- UnitOfWork.Delete<CF_ClassminorStudent>(x => x.UserID == userID);
- }
- UnitOfWork.Delete<EM_StudentMinorRegist>(x => x.StudentMinorRegistID == studentMinorRegistID);
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
-
- throw;
- }
- }
- }
- }
|