|
using System;
using System.Collections.Generic;
using System.Text;
namespace Mullivan.SharePoint.Reminders
{
public class RmdDailyRecurrence : RmdRecurrence
{
public override string Name
{
get { return "Daily"; }
}
public int StartHour
{
get;
set;
}
public override bool CanRun(DateTime lastRun)
{
DateTime dtNow = DateTime.Now;
//If never run then run
if (lastRun.Equals(DateTime.MinValue))
return true;
//If there is an day between the two then it needs to run
if (dtNow.Subtract(lastRun).Days > 1)
return true;
if (dtNow.Day == lastRun.Day)
{
//If now is greater than the start hour and the
// last run hour is less than the start hour then return true
if (dtNow.Hour >= this.StartHour &&
lastRun.Hour < this.StartHour)
return true;
}
else if (dtNow.Hour >= this.StartHour)
return true;
return false;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.