123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.ViewModel.ChargeManage.ArrearsSituation;
- using EMIS.ViewModel;
- using EMIS.DataLogic.ChargeManage.ArrearsSituation;
- namespace EMIS.CommonLogic.ChargeManage.ArrearsSituation
- {
- public class ChargeControlServices:BaseServices,IChargeControlServices
- {
- public ChargeControlDAL ChargeControlDAL { get; set; }
- public Lazy<IControlItemServices> ControlItemServices { get; set; }
- /// <summary>
- /// 查询费用控制类型相应的信息View(费用控制-1,注册控制-2,评价控制-3)
- /// </summary>
- /// <returns></returns>
- public ChargeControlView GetChargeControlView()
- {
- var chargeControlView = new ChargeControlView();
- //数据字典配置控制类型(费用控制-1,注册控制-2,评价控制-3)
- var studentChargeType = SYS_ControlItemType.StudentCharge;
- //查询对应的控制类型信息
- var controlItemList = ControlItemServices.Value.GetControlItemList(studentChargeType);
- if (controlItemList == null || controlItemList.Count <= 0)
- {
- chargeControlView.IsStudentChargeLoginLock = false;
- chargeControlView.StudentChargeLoginLockMessage = "未设置。";
- chargeControlView.IsStudentChargeLoginDisplay = "none";
- chargeControlView.IsStudentChargeSelectCourseLock = false;
- chargeControlView.StudentChargeSelectCourseMessage = "未设置。";
- chargeControlView.IsStudentChargeSelectCourseDisplay = "none";
- chargeControlView.IsStudentChargeExaminationApplyLock = false;
- chargeControlView.StudentChargeExaminationApplyMessage = "未设置。";
- chargeControlView.IsStudentChargeExaminationApplyDisplay = "none";
- chargeControlView.IsStudentChargeScoreLock = false;
- chargeControlView.StudentChargeScoreLockMessage = "未设置。";
- chargeControlView.IsStudentChargeScoreDisplay = "none";
- chargeControlView.IsStudentChargeLevelScoreLock = false;
- chargeControlView.StudentChargeLevelScoreMessage = "未设置。";
- chargeControlView.IsStudentChargeLevelScoreDisplay = "none";
- }
- else
- {
- var chargeLoginLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeLogin" && x.IsLoginControl == true).SingleOrDefault();
- if (chargeLoginLock != null)
- {
- chargeControlView.IsStudentChargeLoginLock = chargeLoginLock.IsEnable ?? false;
- chargeControlView.StudentChargeLoginLockMessage = chargeLoginLock.Message;
- chargeControlView.IsStudentChargeLoginDisplay = "table-row";
- }
- else
- {
- chargeControlView.IsStudentChargeLoginLock = false;
- chargeControlView.StudentChargeLoginLockMessage = "未设置。";
- chargeControlView.IsStudentChargeLoginDisplay = "none";
- }
- var chargeSelectCourseLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeSelectCourse").SingleOrDefault();
- if (chargeSelectCourseLock != null)
- {
- chargeControlView.IsStudentChargeSelectCourseLock = chargeSelectCourseLock.IsEnable ?? false;
- chargeControlView.StudentChargeSelectCourseMessage = chargeSelectCourseLock.Message;
- chargeControlView.IsStudentChargeSelectCourseDisplay = "table-row";
- }
- else
- {
- chargeControlView.IsStudentChargeSelectCourseLock = false;
- chargeControlView.StudentChargeSelectCourseMessage = "未设置。";
- chargeControlView.IsStudentChargeSelectCourseDisplay = "none";
- }
- var chargeExaminationApplyLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeExaminationApply").SingleOrDefault();
- if (chargeExaminationApplyLock != null)
- {
- chargeControlView.IsStudentChargeExaminationApplyLock = chargeExaminationApplyLock.IsEnable ?? false;
- chargeControlView.StudentChargeExaminationApplyMessage = chargeExaminationApplyLock.Message;
- chargeControlView.IsStudentChargeExaminationApplyDisplay = "table-row";
- }
- else
- {
- chargeControlView.IsStudentChargeExaminationApplyLock = false;
- chargeControlView.StudentChargeExaminationApplyMessage = "未设置。";
- chargeControlView.IsStudentChargeExaminationApplyDisplay = "none";
- }
- var chargeScoreControlLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeScore").SingleOrDefault();
- if (chargeScoreControlLock != null)
- {
- chargeControlView.IsStudentChargeScoreLock = chargeScoreControlLock.IsEnable ?? false;
- chargeControlView.StudentChargeScoreLockMessage = chargeScoreControlLock.Message;
- chargeControlView.IsStudentChargeScoreDisplay = "table-row";
- }
- else
- {
- chargeControlView.IsStudentChargeScoreLock = false;
- chargeControlView.StudentChargeScoreLockMessage = "未设置。";
- chargeControlView.IsStudentChargeScoreDisplay = "none";
- }
- var chargeLevelScoreLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeLevelScore").SingleOrDefault();
- if (chargeLevelScoreLock != null)
- {
- chargeControlView.IsStudentChargeLevelScoreLock = chargeLevelScoreLock.IsEnable ?? false;
- chargeControlView.StudentChargeLevelScoreMessage = chargeLevelScoreLock.Message;
- chargeControlView.IsStudentChargeLevelScoreDisplay = "table-row";
- }
- else
- {
- chargeControlView.IsStudentChargeLevelScoreLock = false;
- chargeControlView.StudentChargeLevelScoreMessage = "未设置。";
- chargeControlView.IsStudentChargeLevelScoreDisplay = "none";
- }
- }
- return chargeControlView;
- }
- /// <summary>
- /// 费用控制保存
- /// </summary>
- /// <param name="chargeControlView"></param>
- public void ChargeControlSave(ChargeControlView chargeControlView)
- {
- try
- {
- var controlItemList = ControlItemServices.Value.GetControlItemList(SYS_ControlItemType.StudentCharge);
- if (controlItemList == null || controlItemList.Count <= 0)
- {
- throw new Exception("费用控制类型未配置,请配置。");
- }
- else
- {
- var chargeLoginLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeLogin" && x.IsLoginControl == true).SingleOrDefault();
- if (chargeLoginLock != null)
- {
- chargeLoginLock.IsEnable = chargeControlView.IsStudentChargeLoginLock;
- chargeLoginLock.Message = chargeControlView.StudentChargeLoginLockMessage;
- }
- var chargeSelectCourseLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeSelectCourse").SingleOrDefault();
- if (chargeSelectCourseLock != null)
- {
- chargeSelectCourseLock.IsEnable = chargeControlView.IsStudentChargeSelectCourseLock;
- chargeSelectCourseLock.Message = chargeControlView.StudentChargeSelectCourseMessage;
- }
- var chargeExaminationApplyLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeExaminationApply").SingleOrDefault();
- if (chargeExaminationApplyLock != null)
- {
- chargeExaminationApplyLock.IsEnable = chargeControlView.IsStudentChargeExaminationApplyLock;
- chargeExaminationApplyLock.Message = chargeControlView.StudentChargeExaminationApplyMessage;
- }
- var chargeScoreLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeScore").SingleOrDefault();
- if (chargeScoreLock != null)
- {
- chargeScoreLock.IsEnable = chargeControlView.IsStudentChargeScoreLock;
- chargeScoreLock.Message = chargeControlView.StudentChargeScoreLockMessage;
- }
- var chargeLevelScoreLock = controlItemList.Where(x => x.ControlItemCode == "StudentChargeLevelScore").SingleOrDefault();
- if (chargeLevelScoreLock != null)
- {
- chargeLevelScoreLock.IsEnable = chargeControlView.IsStudentChargeLevelScoreLock;
- chargeLevelScoreLock.Message = chargeControlView.StudentChargeLevelScoreMessage;
- }
- this.UnitOfWork.Commit();
- ControlItemServices.Value.RefreshCache();
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 根据userID查询能否登录系统(同时包括个性化控制登录的判断--控制放行信息)
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanLogin(Guid userID)
- {
- //查询对应的欠费信息
- var arrearsListView = ChargeControlDAL.GetArrearListViewAble(x => x.UserID == userID).SingleOrDefault();
- if (arrearsListView != null)
- {
- //查询对应的控制放行信息
- var passStudentView = ChargeControlDAL.GetPassStudentViewAble(x => x.UserID == userID).SingleOrDefault();
- if (passStudentView != null)
- {
- return true;
- }
- return false;
- }
- return true;
- }
- /// <summary>
- /// 根据userID查询能否网上选课(根据费用控制的设置,只要欠费将无法网上选课)
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanSelectCourse(Guid userID)
- {
- //查询对应的欠费信息
- var arrearsListView = ChargeControlDAL.GetArrearListViewAble(x => x.UserID == userID).SingleOrDefault();
- if (arrearsListView != null)
- {
- //注:能登录系统不一定可网上选课(注释以下代码)
- ////查询对应的控制放行信息
- //var passStudentView = ChargeControlDAL.GetPassStudentViewAble(x => x.UserID == userID).SingleOrDefault();
- //if (passStudentView != null)
- //{
- // return true;
- //}
- return false;
- }
- return true;
- }
- /// <summary>
- /// 根据userID查询能否查询成绩(根据费用控制的设置,只要欠费将无法查询成绩)
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- public bool CanViewScore(Guid userID)
- {
- //查询对应的欠费信息
- var arrearsListView = ChargeControlDAL.GetArrearListViewAble(x => x.UserID == userID).SingleOrDefault();
- if (arrearsListView != null)
- {
- //注:能登录系统不一定可查询成绩(注释以下代码)
- ////查询对应的控制放行信息
- //var passStudentView = ChargeControlDAL.GetPassStudentViewAble(x => x.UserID == userID).SingleOrDefault();
- //if (passStudentView != null)
- //{
- // return true;
- //}
- return false;
- }
- return true;
- }
- }
- }
|