private JobScheduleFrequencyBase GetJobScheduleFrequency()
		{
			JobScheduleFrequencyBase jobScheduleFrequency = null;
			var timeFrequency = GetTimeFrequency();
			string frequencyType = this.ddlFrequency.Items[ddlFrequency.SelectedIndex].Value;
			switch (frequencyType)
			{
				case "daily":
					int dayCount = int.Parse(txtRecurDay.Value);
					jobScheduleFrequency = new DailyJobScheduleFrequency(dayCount, timeFrequency);
					break;
				case "weekly":
					List<DayOfWeek> weekdays = GetSelectedWeekday();
					jobScheduleFrequency = new WeeklyJobScheduleFrequency(weekdays, int.Parse(txtWeek.Value), timeFrequency);
					break;
				case "monthly":
					int days = int.Parse(this.txtDayOfWeek.Value);
					int months = int.Parse(this.txtMonthCount.Value);
					jobScheduleFrequency = new MonthlyJobScheduleFrequency(days, months, timeFrequency);
					break;
				default:
					break;
			}
			//jobScheduleFrequency.LastModifyTime = DateTime.Now;

			return jobScheduleFrequency;
		}
Beispiel #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;
        }