using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Text; using EMIS.DataLogic.SystemDAL; using EMIS.Entities; using EMIS.ViewModel; namespace EMIS.CommonLogic.SystemServices { public class ScheduleServices : BaseServices, IScheduleServices { public ScheduleDAL ScheduleDAL { get; set; } public void UpdateLastRun(Guid schedulerID) { this.UnitOfWork.Update((x => new Sys_Scheduling { lastrun = DateTime.Now }), (x => x.scid == schedulerID)); } public void UpdateLastRunAndLoopNum(Guid schedulerID) { var scheduling = ScheduleDAL.SchedulingRepository.GetSingle(x => x.scid == schedulerID); scheduling.lastrun = DateTime.Now; scheduling.totalloopnumb++; this.UnitOfWork.Commit(); } public void InsertLog(Sys_ScheduleLog log) { log.scheduleLogID = Guid.NewGuid(); log.RecordStatus = (int)SYS_STATUS.USABLE; log.CreateTime = DateTime.Now; this.UnitOfWork.Add(log); this.UnitOfWork.Commit(); } public List GetJobList() { return this.ScheduleDAL.SchedulingRepository.GetList(x => x.RecordStatus == (int)SYS_STATUS.USABLE && x.Sys_ScheduleJob.RecordStatus == (int)SYS_STATUS.USABLE && x.status == "1").Include(x => x.Sys_ScheduleJob).ToList(); } } }