public static SysTaskSettings GetSettings()
		{
			SysTaskSettings settings = (SysTaskSettings)ConfigurationBroker.GetSection("sysTaskSettings");

			if (settings == null)
				settings = new SysTaskSettings();

			return settings;
		}
        public static SysTaskSettings GetSettings()
        {
            SysTaskSettings settings = (SysTaskSettings)ConfigurationBroker.GetSection("sysTaskSettings");

            if (settings == null)
            {
                settings = new SysTaskSettings();
            }

            return(settings);
        }
        /// <summary>
        /// 执行任务
        /// </summary>
        public void ExecuteTask()
        {
            this.Status = SysTaskActivityStatus.Running;

            if (this.Task != null)
            {
                try
                {
                    //不需要保存在待办任务中
                    //SysTaskAdapter.Instance.Update(this.Task);

                    ISysTaskExecutor executor = SysTaskSettings.GetSettings().GetExecutor(this.Task.TaskType);

                    SysAccomplishedTask accomplishedTask = executor.Execute(this.Task);

                    //SysAccomplishedTask accomplishedTask = SysAccomplishedTaskAdapter.Instance.Load(this.Task.TaskID);

                    if (accomplishedTask != null && accomplishedTask.Status == SysTaskStatus.Aborted)
                    {
                        throw new ApplicationException(string.Format("执行ID为{0}的任务失败,错误为\n{1}",
                                                                     accomplishedTask.TaskID, accomplishedTask.StatusText));
                    }
                }
                catch (System.Exception ex)
                {
                    DateTime now = SNTPClient.AdjustedTime;

                    this.Status     = SysTaskActivityStatus.Aborted;
                    this.EndTime    = now;
                    this.StatusText = ex.ToString();

                    SysTaskProcessRuntime.ProcessContext.AffectedActivities.AddOrReplace(this);

                    this.Process.Status  = SysTaskProcessStatus.Aborted;
                    this.Process.EndTime = now;
                    SysTaskProcessRuntime.ProcessContext.AffectedProcesses.AddOrReplace(this.Process);
                }
            }
        }