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 ControlItemServices { get; set; } /// /// 查询费用控制类型相应的信息View(费用控制-1,注册控制-2,评价控制-3) /// /// 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; } /// /// 费用控制保存 /// /// 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); } } /// /// 根据userID查询能否登录系统(同时包括个性化控制登录的判断--控制放行信息) /// /// /// 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; } /// /// 根据userID查询能否网上选课(根据费用控制的设置,只要欠费将无法网上选课) /// /// /// 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; } /// /// 根据userID查询能否查询成绩(根据费用控制的设置,只要欠费将无法查询成绩) /// /// /// 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; } } }