Exemplo n.º 1
0
        private DateTime GetNextLaunchTime(Tasks.ScheduleRow row)
        {
            DateTime now = DateTime.Now;

            string days = null;

            if (row.IsDaysNull())
            {
                days = "SMTWtFs";
            }
            else
            {
                days = row.Days;
            }
            DayOfWeek day = GetNextDayOfWeek(now, days);

            DateTime nextLaunch = DateTime.Now;

            //fast forward to next day to launch
            nextLaunch = FastForwardToDayOfWeek(day, nextLaunch);
            if (row.IsTimeNull())
            {
                //use interval
                nextLaunch = nextLaunch.AddSeconds(row.Interval);
            }
            else
            {
                //use time
                string[] time     = row.Time.Split(':');
                int      hour     = int.Parse(time[0]);
                int      min      = int.Parse(time[1]);
                DateTime tempDate = new DateTime(nextLaunch.Year, nextLaunch.Month, nextLaunch.Day, hour, min, 0);
                if (tempDate < nextLaunch)
                {
                    tempDate = tempDate.AddDays(1);
                    DayOfWeek d = GetNextDayOfWeek(tempDate, days);
                    tempDate = FastForwardToDayOfWeek(d, tempDate);
                }
                nextLaunch = tempDate;
            }
            return(nextLaunch);
        }
Exemplo n.º 2
0
 public ProcessWrapper(Tasks.ScheduleRow schedule)
 {
     _schedule = schedule;
 }