SysHROrgUserJob.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Autofac;
  6. using Bowin.Common.Log;
  7. using EMIS.CommonLogic.UniversityManage.AdministrativeOrgan;
  8. using EMIS.CommonLogic.SystemServices;
  9. namespace EMIS.Services.ScheduleJob
  10. {
  11. public class SysHROrgUserJob : EAPServiceJob
  12. {
  13. /// <summary>
  14. /// 重写 MyJob 方法
  15. /// </summary>
  16. /// <returns></returns>
  17. protected override bool MyJob()
  18. {
  19. var result = true;
  20. try
  21. {
  22. LogHelper.WriteLog(LogType.ServiceLog, "----开始同步工作流人员及组织架构-----");
  23. using (var scop = Program.AutofacContainer.BeginLifetimeScope())
  24. {
  25. IDepartmentServices DepartmentServices = scop.Resolve<IDepartmentServices>();
  26. IUserServices UserServices = scop.Resolve<IUserServices>();
  27. DepartmentServices.SynHRServices();
  28. UserServices.SynHRServices();
  29. }
  30. LogHelper.WriteLog(LogType.ServiceLog, "----结束同步工作流人员及组织架构-----");
  31. }
  32. catch (System.Exception err)
  33. {
  34. LogHelper.WriteLog(LogType.ServiceLog, "----同步工作流人员及组织架构处理异常-----");
  35. LogHelper.WriteLog(LogType.ServiceLog, err.Message);
  36. result = false;
  37. }
  38. return result;
  39. }
  40. }
  41. }