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
///
/// 重写 MyJob 方法
///
///
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();
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
}
}