RetakeParameterServices.cs 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel;
  6. using EMIS.ViewModel.RetakeManage;
  7. using EMIS.CommonLogic.SystemServices;
  8. using EMIS.DataLogic.RetakeManage;
  9. using EMIS.Entities;
  10. namespace EMIS.CommonLogic.RetakeManage
  11. {
  12. public class RetakeParameterServices : BaseServices, IRetakeParameterServices
  13. {
  14. public RetakeParameterDAL RetakeParameterDAL { get; set; }
  15. public Lazy<IParameterServices> ParameterServices { get; set; }
  16. /// <summary>
  17. /// 重修参数设定信息View
  18. /// </summary>
  19. /// <returns></returns>
  20. public RetakeParameterView GetRetakeParameterView()
  21. {
  22. var retakeParamterView = new RetakeParameterView();
  23. //重修对应的学年学期
  24. retakeParamterView.SchoolyearID = ParameterServices.Value.GetParameterValue<Guid>(CF_ParameterType.RetakeSchoolyearID);
  25. //重修对应的考试性质
  26. retakeParamterView.ExamsCategoryID = ParameterServices.Value.GetParameterValue<int>(CF_ParameterType.RetakeExamsCatagoryID);
  27. //重修对应的收费项目
  28. retakeParamterView.RetakeChargeProjectID = ParameterServices.Value.GetParameterValue<Guid>(CF_ParameterType.RetakeChargeProjectID);
  29. //重修对应的缴费控制
  30. retakeParamterView.IsRetakeChargeControl = ParameterServices.Value.GetParameterValue<bool>(CF_ParameterType.RetakeChargeControl) == true;
  31. return retakeParamterView;
  32. }
  33. /// <summary>
  34. /// 重修对应的预查考试性质信息List
  35. /// </summary>
  36. /// <returns></returns>
  37. public List<RetakeExamsCategoryView> GetExamsCategoryViewList()
  38. {
  39. return RetakeParameterDAL.GetRetakeExamsCategoryViewQuery().ToList();
  40. }
  41. /// <summary>
  42. /// 重修参数设定设置
  43. /// </summary>
  44. /// <param name="retakeParameterView"></param>
  45. /// <param name="retakeExamsCategoryViewList"></param>
  46. public void SaveParameterView(RetakeParameterView retakeParameterView, IList<RetakeExamsCategoryView> retakeExamsCategoryViewList)
  47. {
  48. try
  49. {
  50. //预查考试性质List
  51. var insertList = retakeExamsCategoryViewList.Where(x => x.IsSelected)
  52. .Select(x => new ER_RetakeExamsCatagory()
  53. {
  54. RetakeExamsCatagoryID = Guid.NewGuid(),
  55. ExamsCategoryID = x.ExamsCategoryID
  56. }).ToList();
  57. if (insertList == null || insertList.Count() <= 0)
  58. {
  59. throw new Exception("预查考试性质不能为空,请选择。");
  60. }
  61. else
  62. {
  63. //重修对应的学年学期
  64. ParameterServices.Value.SaveTo(CF_ParameterType.RetakeSchoolyearID, retakeParameterView.SchoolyearID);
  65. //重修对应的考试性质
  66. ParameterServices.Value.SaveTo(CF_ParameterType.RetakeExamsCatagoryID, retakeParameterView.ExamsCategoryID);
  67. //重修对应的收费项目
  68. ParameterServices.Value.SaveTo(CF_ParameterType.RetakeChargeProjectID, retakeParameterView.RetakeChargeProjectID);
  69. //重修对应的缴费控制
  70. ParameterServices.Value.SaveTo(CF_ParameterType.RetakeChargeControl, retakeParameterView.IsRetakeChargeControl);
  71. insertList.ForEach(x => this.SetNewStatus(x));
  72. UnitOfWork.Delete<ER_RetakeExamsCatagory>(x => true);
  73. UnitOfWork.BulkInsert(insertList);
  74. }
  75. }
  76. catch (Exception ex)
  77. {
  78. throw new Exception(ex.Message);
  79. }
  80. }
  81. }
  82. }