Exemplo n.º 1
0
        /// <summary>
        /// 初始化任务信息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="group"></param>
        public void InitJobInfo(string name, string group)
        {
            try
            {
                TaskEntity task = QuartzHelper.GetTask(name, group);

                this.txtTaskName.Value     = task.Name;
                this.txtTaskGroup.Value    = task.Group;
                this.txtAssemblyName.Value = task.AssemblyName;
                this.txtClassName.Value    = task.ClassName;
                this.txtTaskDecs.Value     = task.Description;
                this.txtBeginTime.Value    = task.BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
                this.txtEndTime.Value      = task.EndTime == null ? "" : task.EndTime.ToString();
                if (task.Type == 0)
                {
                    this.radTypeSimple.Checked  = true;
                    this.txtRepeatCount.Value   = task.RepeatCount.ToString();
                    this.txtRepeatHours.Value   = task.RepeatInterval.Hours.ToString();
                    this.txtRepeatMinutes.Value = task.RepeatInterval.Minutes.ToString();
                    this.txtRepeatSeconds.Value = task.RepeatInterval.Seconds.ToString();
                    divCronPanel.Style.Add("display", "none");
                    divSimplePanel.Style.Add("display", "");
                }
                else
                {
                    this.radTypeCron.Checked = true;
                    this.txtCronExp.Value    = task.CronExpression.ToString();
                    divCronPanel.Style.Add("display", "");
                    divSimplePanel.Style.Add("display", "none");
                }
            }
            catch
            {
                OpenAlertModel("error", "获取任务信息错误");
            }
        }
 /// <summary>
 /// 获取任务信息
 /// </summary>
 /// <param name="taskName"></param>
 /// <param name="groupName"></param>
 /// <returns></returns>
 public string GetTask(string taskName, string groupName)
 {
     return(JsonConvert.SerializeObject(QuartzHelper.GetTask(taskName, groupName)));
 }