private TimeFrequencyBase GetTimeFrequency()
		{
			TimeFrequencyBase TimeFrequency = null;
			if (this.radioRecurDayOnce.Checked)
			{
				string timeValue = this.execOnceTime.Value;
				var time = DateTime.Parse(timeValue);
				TimeFrequency = new FixedTimeFrequency(time.TimeOfDay);
			}
			else if (this.radioRecurDayPeriod.Checked)
			{
				int interval = int.Parse(txtIntervalTimeFrequency.Value);
				IntervalUnit unit = (IntervalUnit)int.Parse(ddlIntervalTimeFrequencyUnit.Items[ddlIntervalTimeFrequencyUnit.SelectedIndex].Value);

				string startTimeValue = this.execTimeFrequencyStartTime.Value;
				var startTime = DateTime.Parse(startTimeValue);

				string endTimeValue = this.execTimeFrequencyEndTime.Value;
				var endTime = DateTime.Parse(endTimeValue);

				TimeFrequency = new RecurringTimeFrequency(interval, unit, startTime.TimeOfDay, endTime.TimeOfDay);
			}

			return TimeFrequency;
		}
Exemplo n.º 2
0
        /// <summary>
        /// 创建立即调度的计划
        /// </summary>
        /// <returns></returns>
        internal static JobSchedule CreateImmediateSchedule()
        {
            DateTime now = DateTime.Now;
            DateTime execTime = now.AddSeconds(2);

            FixedTimeFrequency timeFrequency = new FixedTimeFrequency(new TimeSpan(execTime.Hour, execTime.Minute, execTime.Second));
            DailyJobScheduleFrequency frequency = new DailyJobScheduleFrequency(1, timeFrequency);
            JobSchedule schedule = new JobSchedule(UuidHelper.NewUuidString(), "立即执行", DateTime.Now, frequency);

            schedule.SchduleType = JobSchduleType.Temporary;
            schedule.StartTime = now.AddHours(-1);
            schedule.EndTime = now.AddDays(1);
            return schedule;
        }