using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.CommonLogic.SystemServices; using EMIS.ViewModel.SelectCourse; using EMIS.ViewModel; using EMIS.ViewModel.CalendarManage; using EMIS.CommonLogic.CalendarManage; namespace EMIS.CommonLogic.SelectCourse { public class ConditionServices : BaseServices, IConditionServices { public Lazy ParameterServices { get; set; } public Lazy SchoolYearServices { get; set; } public SelectCourseConditionView GetSelectCourseConditionView() { var result = new SelectCourseConditionView(); result.Schoolyear = ParameterServices.Value.GetParameterValue(CF_ParameterType.SelectCourseSchoolyear); result.CrossGrade = ParameterServices.Value.GetParameterValue(CF_ParameterType.SelectCourseCrossGrade) ?? false; result.IsNoLimit = ParameterServices.Value.GetParameterValue(CF_ParameterType.SelectCourseNoLimit) ?? false; return result; } public void Save(SelectCourseConditionView conditionView) { ParameterServices.Value.SaveTo(CF_ParameterType.SelectCourseSchoolyear, conditionView.Schoolyear.Value); ParameterServices.Value.SaveTo(CF_ParameterType.SelectCourseCrossGrade, conditionView.CrossGrade); ParameterServices.Value.SaveTo(CF_ParameterType.SelectCourseNoLimit, conditionView.IsNoLimit); } public SchoolYearView GetSelectCourseSchoolyear() { var selectCourseSchoolyearID = ParameterServices.Value.GetParameterValue(CF_ParameterType.SelectCourseSchoolyear); if (!selectCourseSchoolyearID.HasValue) { return SchoolYearServices.Value.GetCurrentSchoolYear(); } else { return SchoolYearServices.Value.GetSchoolYearView(selectCourseSchoolyearID); } } } }