Esempio n. 1
0
        /// <summary>
        /// Synchronizes the goods information execute.
        /// </summary>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        public override bool TaskExec(JobLog log, string mod, string rem)
        {
            foreach (var item in components)
            {
                item.TaskExec(log, mod, rem);
            }

            return true;
        }
Esempio n. 2
0
        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Execute(IJobExecutionContext context)
        {
            try
            {
                String jobName = ((JobDetailImpl)context.JobDetail).Name;
                JobName = jobName;
                Log     = new JobLog(ModuleName, jobName);
                Log.Info(string.Format("{0}:{1}-{2}", jobName, DateTime.Now, "执行开始"));
                var jobMap = context.JobDetail.JobDataMap;
                var keys   = jobMap.GetKeys();
                IDictionary <string, string> keyDic = new Dictionary <string, string>();
                foreach (var key in keys)
                {
                    keyDic.Add(key, jobMap.GetString(key));
                }

                DateTimeOffset dts       = context.FireTimeUtc ?? new DateTimeOffset();
                DateTime       localTime = dts.LocalDateTime;
                DateTimeOffset nextDts   = context.NextFireTimeUtc ?? new DateTimeOffset();
                DateTime       nextTime  = nextDts.LocalDateTime;
                var            second    = (nextTime - localTime).TotalSeconds;
                StringBuilder  sbLog     = new StringBuilder();
                DateTime       time      = DateTime.Now;
                if (String.IsNullOrEmpty(JobName))
                {
                    Helper.LogHelper <Helper.JobHelper> .Info(this.GetType().Name + ":JobName为空");

                    return;
                }

                var Switch = AppConfigHelper.GetWinServiceAutoSwitch;
                if (!String.IsNullOrEmpty(Switch) && Switch.ToUpper() == "TRUE")
                {
                    var jobId     = JobName;
                    var checkBack = CheckServerService.CheckServer(jobId, second);
                    if (!checkBack)
                    {
                        Log.Info(string.Format("{0}:{1}", JobName, "无权执行"));
                        return;
                    }
                }

                var result = Job(keyDic);
                Log.Info(string.Format("{0}:{1}-{2}", jobName, DateTime.Now, "执行结束"));
            }
            catch (Exception ex)
            {
                Log.Error("作业异常", ex, true);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Execute(IJobExecutionContext context)
        {
            try
            {
                String jobName = ((JobDetailImpl)context.JobDetail).Name;
                JobName = jobName;
                Log = new JobLog(ModuleName, jobName);
                Log.Info(string.Format("{0}:{1}-{2}", jobName, DateTime.Now, "执行开始"));
                var jobMap = context.JobDetail.JobDataMap;
                var keys = jobMap.GetKeys();
                IDictionary<string, string> keyDic = new Dictionary<string, string>();
                foreach (var key in keys)
                {
                    keyDic.Add(key, jobMap.GetString(key));
                }

                DateTimeOffset dts = context.FireTimeUtc ?? new DateTimeOffset();
                DateTime localTime = dts.LocalDateTime;
                DateTimeOffset nextDts = context.NextFireTimeUtc ?? new DateTimeOffset();
                DateTime nextTime = nextDts.LocalDateTime;
                var second = (nextTime - localTime).TotalSeconds;
                StringBuilder sbLog = new StringBuilder();
                DateTime time = DateTime.Now;
                if (String.IsNullOrEmpty(JobName))
                {
                    Helper.LogHelper<Helper.JobHelper>.Info(this.GetType().Name + ":JobName为空");
                    return;
                }

                var Switch = AppConfigHelper.GetWinServiceAutoSwitch;
                if (!String.IsNullOrEmpty(Switch) && Switch.ToUpper() == "TRUE")
                {
                    var jobId = JobName;
                    var checkBack = CheckServerService.CheckServer(jobId, second);
                    if (!checkBack)
                    {
                        Log.Info(string.Format("{0}:{1}", JobName, "无权执行"));
                        return;
                    }
                }

                var result = Job(keyDic);
                Log.Info(string.Format("{0}:{1}-{2}", jobName, DateTime.Now, "执行结束"));
            }
            catch (Exception ex)
            {
                Log.Error("作业异常", ex, true);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Executions the specified log.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="mod">The mod.</param>
        /// <param name="rem">The rem.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        public bool Execution(JobLog log, string mod, string rem)
        {
            try
            {
                var composite = new Composite();
                composite.TaskName = "TestTask";
                var taskTest = new TestTask("TestTask");
                composite.Add(taskTest);
                composite.TaskExec(log, mod, rem);
            }
            catch (Exception ex)
            {
                log.Error("失败:" + ex.Message + " " + ex.StackTrace, ex, true);
            }

            return true;
        }
Esempio n. 5
0
 /// <summary>
 /// Tasks the execute.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="mod">The mod.</param>
 /// <param name="rem">The rem.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public abstract bool TaskExec(JobLog log, string mod, string rem);
Esempio n. 6
0
 /// <summary>
 /// Tasks the execute.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="mod">The mod.</param>
 /// <param name="rem">The rem.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public override bool TaskExec(JobLog log, string mod, string rem)
 {
     //TODO:Task Exec.
     return true;
 }