I have an application I'm trying to create that will poll every 15 minutes. When they enter in the job, they pick Days of week, start time, frequency, times per month.
I got it to check correctly for whether it's before the start time and date, whether it's a day of the week. I'm stumped on the best way to do frequency.... Here's what I got so far...
If I need to change the data I'm capturing for the job's schedule or add things, I can do that... any help would be great.
I got it to check correctly for whether it's before the start time and date, whether it's a day of the week. I'm stumped on the best way to do frequency.... Here's what I got so far...
Code:
'Arrays have all the info regarding the jobs. Each job has different running times.
For I = 0 To ArrName.Length - 2
StartTimeTemp = CType(ArrStartTime(I), DateTime)
'Is the start time before current time? Then run job, otherwise a future job.
If DateDiff(DateInterval.DayOfYear, StartTimeTemp, DateTime.Now) > 0 Then
' ******************************* Check if Job Day is today.
checkdays = ArrDays(I).Split(",")
yesno = False
For J = 1 To checkdays.Length - 1
If checkdays(J) = Date.Now.DayOfWeek Then
yesno = True
End If
Next
If yesno = True Then
' Now here is where I check frequency and times per month I think. Now I'm stumped. If everything is good, then run the job.
currentJob.Name = ArrName(I)
currentJob.Type = ArrType(I)
currentJob.Frequency = ArrFrequency(I)
currentJob.Days = ArrDays(I)
currentJob.TimePerMonth = ArrTimePerMonth(I)
currentJob.StartTime = ArrStartTime(I)
currentJob.Script = ArrScript(I)
currentJob.Message = ArrMessage(I)
currentJob.Emailto = ArrEmailto(I)
runjob(currentJob)
End If
End If
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
If I need to change the data I'm capturing for the job's schedule or add things, I can do that... any help would be great.