Skip to content

Instantly share code, notes, and snippets.

@Fodsuk
Created December 12, 2011 11:28
Show Gist options
  • Save Fodsuk/1466718 to your computer and use it in GitHub Desktop.
Save Fodsuk/1466718 to your computer and use it in GitHub Desktop.
PPS Command triggers
//scheduled trigger - one of execution
public class ScheduledTrigger : ITrigger
{
public ScheduledTrigger() { }
public ScheduledTrigger(DateTime date)
{
Date = date;
}
public DateTime Date { get; set; }
}
// Daily Trigger - Executes on a daily basis, option of a Start and End date
public class DailyTrigger : ITrigger
{
public DailyTrigger() { }
public DailyTrigger(int hour, int minute)
{
Hour = hour;
Minute = minute;
}
public DailyTrigger(int hour, int minute, DateTime? startDate, DateTime? endDate)
{
Hour = hour;
Minute = minute;
StartDate = startDate;
EndDate = endDate;
}
public int Hour { get; set; }
public int Minute { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
//Hourly Trigger - Executes hourly, option for a start and end date
public class HourlyTrigger : ITrigger
{
public HourlyTrigger() { }
public HourlyTrigger(DateTime? startDate, DateTime? endDate)
{
StartDate = startDate;
EndDate = endDate;
}
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
//monthly trigger - executes monthly, option for a start and end date
public class MonthlyTrigger : ITrigger
{
public MonthlyTrigger() { }
public MonthlyTrigger(int dayOfMonth, int hour, int minute)
{
DayOfMonth = dayOfMonth;
Hour = hour;
Minute = minute;
}
public MonthlyTrigger(int dayOfMonth, int hour, int minute, DateTime? startDate, DateTime? endDate)
{
DayOfMonth = dayOfMonth;
Hour = hour;
Minute = minute;
StartDate = startDate;
EndDate = endDate;
}
public int DayOfMonth { get; set; }
public int Hour { get; set; }
public int Minute { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
//weekly trigger - executes weekly, option of a start and end date
public class WeeklyTrigger : ITrigger
{
public WeeklyTrigger() { }
public WeeklyTrigger(DayOfWeek dayOfWeek, int hour, int minute)
{
DayOfWeek = dayOfWeek;
Hour = hour;
Minute = minute;
}
public WeeklyTrigger(DayOfWeek dayOfWeek, int hour, int minute, DateTime? startDate, DateTime? endDate)
{
DayOfWeek = dayOfWeek;
Hour = hour;
Minute = minute;
StartDate = startDate;
EndDate = endDate;
}
public DayOfWeek DayOfWeek { get; set; }
public int Hour { get; set; }
public int Minute { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment