1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Autofac;
- using Bowin.Common.Log;
- using EMIS.CommonLogic.CalendarManage;
- namespace EMIS.Services.ScheduleJob
- {
- public class AutoCreateSchoolYearJob : EAPServiceJob
- {
- #region 运行JOB
- /// <summary>
- /// 重写 MyJob 方法
- /// </summary>
- /// <returns></returns>
- protected override bool MyJob()
- {
- var result = true;
- try
- {
- if (DateTime.Today.Day != 1 && DateTime.Today.Month != 9)
- {
- return true;
- }
- LogHelper.WriteLog(LogType.ServiceLog, "----开始自动添加需要预留的学期学年-----");
- using (var scop = Program.AutofacContainer.BeginLifetimeScope())
- {
- ISchoolYearServices SchoolYearServices = scop.Resolve<ISchoolYearServices>();
- SchoolYearServices.AutoCreateSchoolyearAndYears();
- }
- LogHelper.WriteLog(LogType.ServiceLog, "----结束自动添加需要预留的学期学年-----");
- }
- catch (System.Exception err)
- {
- LogHelper.WriteLog(LogType.ServiceLog, "----自动添加需要预留的学期学年处理异常-----");
- LogHelper.WriteLog(LogType.ServiceLog, err.Message);
- result = false;
- }
- return result;
- }
- #endregion
- }
- }
|