using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel; using EMIS.ViewModel.RetakeManage; using EMIS.CommonLogic.SystemServices; using EMIS.DataLogic.RetakeManage; using EMIS.Entities; namespace EMIS.CommonLogic.RetakeManage { public class RetakeParameterServices : BaseServices, IRetakeParameterServices { public RetakeParameterDAL RetakeParameterDAL { get; set; } public Lazy ParameterServices { get; set; } /// /// 重修参数设定信息View /// /// public RetakeParameterView GetRetakeParameterView() { var retakeParamterView = new RetakeParameterView(); //重修对应的学年学期 retakeParamterView.SchoolyearID = ParameterServices.Value.GetParameterValue(CF_ParameterType.RetakeSchoolyearID); //重修对应的考试性质 retakeParamterView.ExamsCategoryID = ParameterServices.Value.GetParameterValue(CF_ParameterType.RetakeExamsCatagoryID); //重修对应的收费项目 retakeParamterView.RetakeChargeProjectID = ParameterServices.Value.GetParameterValue(CF_ParameterType.RetakeChargeProjectID); //重修对应的缴费控制 retakeParamterView.IsRetakeChargeControl = ParameterServices.Value.GetParameterValue(CF_ParameterType.RetakeChargeControl) == true; return retakeParamterView; } /// /// 重修对应的预查考试性质信息List /// /// public List GetExamsCategoryViewList() { return RetakeParameterDAL.GetRetakeExamsCategoryViewQuery().ToList(); } /// /// 重修参数设定设置 /// /// /// public void SaveParameterView(RetakeParameterView retakeParameterView, IList retakeExamsCategoryViewList) { try { //预查考试性质List var insertList = retakeExamsCategoryViewList.Where(x => x.IsSelected) .Select(x => new ER_RetakeExamsCatagory() { RetakeExamsCatagoryID = Guid.NewGuid(), ExamsCategoryID = x.ExamsCategoryID }).ToList(); if (insertList == null || insertList.Count() <= 0) { throw new Exception("预查考试性质不能为空,请选择。"); } else { //重修对应的学年学期 ParameterServices.Value.SaveTo(CF_ParameterType.RetakeSchoolyearID, retakeParameterView.SchoolyearID); //重修对应的考试性质 ParameterServices.Value.SaveTo(CF_ParameterType.RetakeExamsCatagoryID, retakeParameterView.ExamsCategoryID); //重修对应的收费项目 ParameterServices.Value.SaveTo(CF_ParameterType.RetakeChargeProjectID, retakeParameterView.RetakeChargeProjectID); //重修对应的缴费控制 ParameterServices.Value.SaveTo(CF_ParameterType.RetakeChargeControl, retakeParameterView.IsRetakeChargeControl); insertList.ForEach(x => this.SetNewStatus(x)); UnitOfWork.Delete(x => true); UnitOfWork.BulkInsert(insertList); } } catch (Exception ex) { throw new Exception(ex.Message); } } } }