private WhichWeek getWhichWeek_Monthly()
        {
            WhichWeek whichWeek = new WhichWeek();

            if (cbThuTuMonthly.Text == "1")
            {
                whichWeek = WhichWeek.FirstWeek;
            }
            if (cbThuTuMonthly.Text == "2")
            {
                whichWeek = WhichWeek.SecondWeek;
            }
            if (cbThuTuMonthly.Text == "3")
            {
                whichWeek = WhichWeek.ThirdWeek;
            }
            if (cbThuTuMonthly.Text == "4")
            {
                whichWeek = WhichWeek.FourthWeek;
            }
            if (cbThuTuMonthly.Text == "5")
            {
                whichWeek = WhichWeek.LastWeek;
            }
            return(whichWeek);
        }
Esempio n. 2
0
 public MonthlyDOWTrigger(DaysOfTheWeek daysOfWeek = (DaysOfTheWeek)1, MonthsOfTheYear monthsOfYear = (MonthsOfTheYear)0xfff, WhichWeek weeksOfMonth = (WhichWeek)1)
     : base(TaskTriggerType.MonthlyDOW)
 {
     DaysOfWeek   = daysOfWeek;
     MonthsOfYear = monthsOfYear;
     WeeksOfMonth = weeksOfMonth;
 }
 /// <summary>
 /// Creates a MonthlyDowTrigger that fires during specified months only.
 /// </summary>
 /// <param name="hour">Hour of day trigger will fire.</param>
 /// <param name="minutes">Minute of the hour trigger will fire.</param>
 /// <param name="daysOfTheWeek">Days of the week trigger will fire.</param>
 /// <param name="whichWeeks">Weeks of the month trigger will fire.</param>
 /// <param name="months">Months of the year trigger will fire.</param>
 public MonthlyDowTrigger(short hour, short minutes, DaysOfTheWeek daysOfTheWeek, WhichWeek whichWeeks, MonthsOfTheYear months) : base()
 {
     SetStartTime((ushort)hour, (ushort)minutes);
     taskTrigger.Type = TaskTriggerType.TIME_TRIGGER_MONTHLYDOW;
     taskTrigger.Data.monthlyDOW.WhichWeek = (ushort)whichWeeks;
     taskTrigger.Data.monthlyDOW.DaysOfTheWeek = (ushort)daysOfTheWeek;
     taskTrigger.Data.monthlyDOW.Months = (ushort)months;
 }
Esempio n. 4
0
        private static IEnumerable <Int32> GetWeekNumbers(WhichWeek weekOfTheMonth)
        {
            foreach (var week in Enum.GetValues(typeof(WhichWeek)).Cast <WhichWeek>().Where(flag => weekOfTheMonth.HasFlag(flag)))
            {
                switch (week)
                {
                case WhichWeek.FirstWeek:   yield return(1); break;

                case WhichWeek.SecondWeek:  yield return(2); break;

                case WhichWeek.ThirdWeek:   yield return(3); break;

                case WhichWeek.FourthWeek:  yield return(4); break;

                case WhichWeek.LastWeek:    yield return(5); break;
                }
            }
        }
Esempio n. 5
0
        private static string ToWeeksOfMonthString(WhichWeek whichWeek, bool runOnLastWeekOfMonth)
        {
            var dictionary = new[]
            {
                new { Key = WhichWeek.FirstWeek, Resource = Resources.Word_First },
                new { Key = WhichWeek.SecondWeek, Resource = Resources.Word_Second },
                new { Key = WhichWeek.ThirdWeek, Resource = Resources.Word_Third },
                new { Key = WhichWeek.FourthWeek, Resource = Resources.Word_Fourth },
            };

            var weeksOfMonthString = string.Join(", ", dictionary.Where(arg => (whichWeek & arg.Key) == arg.Key).Select(arg => arg.Resource));

            if (runOnLastWeekOfMonth)
            {
                weeksOfMonthString += ", " + Resources.Word_Last;
            }

            return(weeksOfMonthString);
        }
Esempio n. 6
0
 /// <summary>
 /// Creates a MonthlyDOWTrigger that fires during specified months only.
 /// </summary>
 /// <param name="hour">Hour of day trigger will fire.</param>
 /// <param name="minutes">Minute of the hour trigger will fire.</param>
 /// <param name="daysOfTheWeek">Days of the week trigger will fire.</param>
 /// <param name="whichWeeks">Weeks of the month trigger will fire.</param>
 public MonthlyDOWTrigger(short hour, short minutes, DaysOfTheWeek daysOfTheWeek, WhichWeek whichWeeks) :
     this(hour, minutes, daysOfTheWeek, whichWeeks,
          MonthsOfTheYear.January | MonthsOfTheYear.February | MonthsOfTheYear.March | MonthsOfTheYear.April | MonthsOfTheYear.May | MonthsOfTheYear.June | MonthsOfTheYear.July | MonthsOfTheYear.August | MonthsOfTheYear.September | MonthsOfTheYear.October | MonthsOfTheYear.November | MonthsOfTheYear.December)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// Creates a MonthlyDOWTrigger that fires every month.
 /// </summary>
 /// <param name="hour">Hour of day trigger will fire.</param>
 /// <param name="minutes">Minute of the hour trigger will fire.</param>
 /// <param name="daysOfTheWeek">Days of the week trigger will fire.</param>
 /// <param name="whichWeeks">Weeks of the month trigger will fire.</param>
 /// <param name="months">Months of the year trigger will fire.</param>
 public MonthlyDOWTrigger(short hour, short minutes, DaysOfTheWeek daysOfTheWeek, WhichWeek whichWeeks, MonthsOfTheYear months) : base()
 {
     SetStartTime((ushort)hour, (ushort)minutes);
     taskTrigger.Type = TaskTriggerType.TIME_TRIGGER_MONTHLYDOW;
     taskTrigger.Data.monthlyDOW.WhichWeek     = (ushort)whichWeeks;
     taskTrigger.Data.monthlyDOW.DaysOfTheWeek = (ushort)daysOfTheWeek;
     taskTrigger.Data.monthlyDOW.Months        = (ushort)months;
 }
 /// <summary>
 /// Updates a monthly trigger to specify in which weeks of the month it will run.
 /// </summary>
 /// <param name="ww">The week.</param>
 /// <returns>
 ///   <see cref="MonthlyDOWTriggerBuilder" /> instance.
 /// </returns>
 public MonthlyDOWTriggerBuilder In(WhichWeek ww)
 {
     ((MonthlyDOWTrigger)trb.trigger).WeeksOfMonth = ww;
     return this;
 }
Esempio n. 9
0
		/// <summary>
		/// Creates a MonthlyDOWTrigger that fires during specified months only.
		/// </summary>
		/// <param name="hour">Hour of day trigger will fire.</param>
		/// <param name="minutes">Minute of the hour trigger will fire.</param>
		/// <param name="daysOfTheWeek">Days of the week trigger will fire.</param>
		/// <param name="whichWeeks">Weeks of the month trigger will fire.</param>
		public MonthlyDOWTrigger(short hour, short minutes, DaysOfTheWeek daysOfTheWeek, WhichWeek whichWeeks) :
			this(hour, minutes, daysOfTheWeek, whichWeeks,
			MonthsOfTheYear.January|MonthsOfTheYear.February|MonthsOfTheYear.March|MonthsOfTheYear.April|MonthsOfTheYear.May|MonthsOfTheYear.June|MonthsOfTheYear.July|MonthsOfTheYear.August|MonthsOfTheYear.September|MonthsOfTheYear.October|MonthsOfTheYear.November|MonthsOfTheYear.December) {
		}
 /// <summary>
 /// Updates a monthly trigger to specify in which weeks of the month it will run.
 /// </summary>
 /// <param name="ww">The week.</param>
 /// <returns>
 ///   <see cref="MonthlyDOWTriggerBuilder" /> instance.
 /// </returns>
 public MonthlyDOWTriggerBuilder In(WhichWeek ww)
 {
     ((MonthlyDOWTrigger)trb.trigger).WeeksOfMonth = ww;
     return(this);
 }
Esempio n. 11
0
File: Trigger.cs Progetto: hpie/hpie
 /// <summary>
 /// Creates an unbound instance of a <see cref="MonthlyDOWTrigger"/>.
 /// </summary>
 /// <param name="daysOfWeek">The days of the week.</param>
 /// <param name="monthsOfYear">The months of the year.</param>
 /// <param name="weeksOfMonth">The weeks of the month.</param>
 public MonthlyDOWTrigger(DaysOfTheWeek daysOfWeek = DaysOfTheWeek.Sunday, MonthsOfTheYear monthsOfYear = MonthsOfTheYear.AllMonths, WhichWeek weeksOfMonth = WhichWeek.FirstWeek)
     : base(TaskTriggerType.MonthlyDOW)
 {
     this.DaysOfWeek = daysOfWeek;
     this.MonthsOfYear = monthsOfYear;
     this.WeeksOfMonth = weeksOfMonth;
 }