ConditionServices.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.CommonLogic.SystemServices;
  6. using EMIS.ViewModel.SelectCourse;
  7. using EMIS.ViewModel;
  8. using EMIS.ViewModel.CalendarManage;
  9. using EMIS.CommonLogic.CalendarManage;
  10. namespace EMIS.CommonLogic.SelectCourse
  11. {
  12. public class ConditionServices : BaseServices, IConditionServices
  13. {
  14. public Lazy<IParameterServices> ParameterServices { get; set; }
  15. public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
  16. public SelectCourseConditionView GetSelectCourseConditionView()
  17. {
  18. var result = new SelectCourseConditionView();
  19. result.Schoolyear = ParameterServices.Value.GetParameterValue<Guid>(CF_ParameterType.SelectCourseSchoolyear);
  20. result.CrossGrade = ParameterServices.Value.GetParameterValue<bool>(CF_ParameterType.SelectCourseCrossGrade) ?? false;
  21. result.IsNoLimit = ParameterServices.Value.GetParameterValue<bool>(CF_ParameterType.SelectCourseNoLimit) ?? false;
  22. return result;
  23. }
  24. public void Save(SelectCourseConditionView conditionView)
  25. {
  26. ParameterServices.Value.SaveTo(CF_ParameterType.SelectCourseSchoolyear, conditionView.Schoolyear.Value);
  27. ParameterServices.Value.SaveTo(CF_ParameterType.SelectCourseCrossGrade, conditionView.CrossGrade);
  28. ParameterServices.Value.SaveTo(CF_ParameterType.SelectCourseNoLimit, conditionView.IsNoLimit);
  29. }
  30. public SchoolYearView GetSelectCourseSchoolyear()
  31. {
  32. var selectCourseSchoolyearID = ParameterServices.Value.GetParameterValue<Guid>(CF_ParameterType.SelectCourseSchoolyear);
  33. if (!selectCourseSchoolyearID.HasValue)
  34. {
  35. return SchoolYearServices.Value.GetCurrentSchoolYear();
  36. }
  37. else
  38. {
  39. return SchoolYearServices.Value.GetSchoolYearView(selectCourseSchoolyearID);
  40. }
  41. }
  42. }
  43. }