Changeset 957 for branches/eraser6/Manager/Schedule.cs
- Timestamp:
- 5/1/2009 5:24:05 AM (4 years ago)
- File:
-
- 1 edited
-
branches/eraser6/Manager/Schedule.cs (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Manager/Schedule.cs
r951 r957 133 133 switch (type) 134 134 { 135 case ScheduleUnit.Daily:135 case RecurringScheduleUnit.Daily: 136 136 if (frequency != 1) 137 137 result = S._("Once every {0} days", frequency); … … 139 139 result = S._("Once every day"); 140 140 break; 141 case ScheduleUnit.Weekdays:141 case RecurringScheduleUnit.Weekdays: 142 142 result = S._("Every weekday"); 143 143 break; 144 case ScheduleUnit.Weekly:144 case RecurringScheduleUnit.Weekly: 145 145 if ((weeklySchedule & DaysOfWeek.Monday) != 0) 146 146 result = S._("Every Monday, {0}"); … … 163 163 S._("once every {0} weeks.", frequency)); 164 164 break; 165 case ScheduleUnit.Monthly:165 case RecurringScheduleUnit.Monthly: 166 166 if (frequency == 1) 167 167 result = S._("On day {0} of every month", monthlySchedule); … … 180 180 protected RecurringSchedule(SerializationInfo info, StreamingContext context) 181 181 { 182 type = ( ScheduleUnit)info.GetValue("Type", typeof(ScheduleUnit));182 type = (RecurringScheduleUnit)info.GetValue("Type", typeof(RecurringScheduleUnit)); 183 183 frequency = (int)info.GetValue("Frequency", typeof(int)); 184 184 executionTime = (DateTime)info.GetValue("ExecutionTime", typeof(DateTime)); … … 211 211 212 212 /// <summary> 213 /// The types of schedule214 /// </summary>215 public enum ScheduleUnit216 {217 /// <summary>218 /// Daily schedule type219 /// </summary>220 Daily,221 222 /// <summary>223 /// Weekdays-only schedule type224 /// </summary>225 Weekdays,226 227 /// <summary>228 /// Weekly schedule type229 /// </summary>230 Weekly,231 232 /// <summary>233 /// Monthly schedule type234 /// </summary>235 Monthly236 }237 238 /// <summary>239 /// The days of the week, with values usable in a bitfield.240 /// </summary>241 [Flags]242 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames")]243 public enum DaysOfWeek244 {245 None = 0,246 Sunday = 1 << DayOfWeek.Sunday,247 Monday = 1 << DayOfWeek.Monday,248 Tuesday = 1 << DayOfWeek.Tuesday,249 Wednesday = 1 << DayOfWeek.Wednesday,250 Thursday = 1 << DayOfWeek.Thursday,251 Friday = 1 << DayOfWeek.Friday,252 Saturday = 1 << DayOfWeek.Saturday253 }254 255 /// <summary>256 213 /// The type of schedule. 257 214 /// </summary> 258 public ScheduleUnit ScheduleType215 public RecurringScheduleUnit ScheduleType 259 216 { 260 217 get { return type; } … … 270 227 get 271 228 { 272 if (ScheduleType != ScheduleUnit.Daily && ScheduleType !=ScheduleUnit.Weekly &&273 ScheduleType != ScheduleUnit.Monthly)229 if (ScheduleType != RecurringScheduleUnit.Daily && ScheduleType != RecurringScheduleUnit.Weekly && 230 ScheduleType != RecurringScheduleUnit.Monthly) 274 231 throw new InvalidOperationException(S._("The ScheduleUnit of the schedule " + 275 232 "does not require a frequency value, this field would contain garbage.")); … … 305 262 get 306 263 { 307 if (ScheduleType != ScheduleUnit.Weekly)264 if (ScheduleType != RecurringScheduleUnit.Weekly) 308 265 throw new InvalidOperationException(S._("The ScheduleUnit of the schedule " + 309 266 "does not require the WeeklySchedule value, this field would contain garbage")); … … 329 286 get 330 287 { 331 if (ScheduleType != ScheduleUnit.Monthly)288 if (ScheduleType != RecurringScheduleUnit.Monthly) 332 289 throw new InvalidOperationException(S._("The ScheduleUnit of the schedule does " + 333 290 "not require the MonthlySchedule value, this field would contain garbage")); … … 367 324 switch (ScheduleType) 368 325 { 369 case ScheduleUnit.Daily:326 case RecurringScheduleUnit.Daily: 370 327 { 371 328 //First assume that it is today that we are running the schedule … … 379 336 break; 380 337 } 381 case ScheduleUnit.Weekdays:338 case RecurringScheduleUnit.Weekdays: 382 339 { 383 340 while (nextRun < DateTime.Now || … … 387 344 break; 388 345 } 389 case ScheduleUnit.Weekly:346 case RecurringScheduleUnit.Weekly: 390 347 { 391 348 if (weeklySchedule == 0) … … 414 371 break; 415 372 } 416 case ScheduleUnit.Monthly:373 case RecurringScheduleUnit.Monthly: 417 374 //Step the number of months since the last run 418 375 if (LastRun != DateTime.MinValue) … … 453 410 private bool CanRunOnDay(DateTime date) 454 411 { 455 if (ScheduleType != ScheduleUnit.Weekly)412 if (ScheduleType != RecurringScheduleUnit.Weekly) 456 413 throw new ArgumentException(S._("The ScheduleUnit of the schedule does " + 457 414 "not use the WeeklySchedule value, this field would contain garbage")); … … 469 426 } 470 427 471 private ScheduleUnit type;428 private RecurringScheduleUnit type; 472 429 private int frequency; 473 430 private DateTime executionTime; … … 478 435 private DateTime nextRun; 479 436 } 437 438 /// <summary> 439 /// The types of schedule 440 /// </summary> 441 public enum RecurringScheduleUnit 442 { 443 /// <summary> 444 /// Daily schedule type 445 /// </summary> 446 Daily, 447 448 /// <summary> 449 /// Weekdays-only schedule type 450 /// </summary> 451 Weekdays, 452 453 /// <summary> 454 /// Weekly schedule type 455 /// </summary> 456 Weekly, 457 458 /// <summary> 459 /// Monthly schedule type 460 /// </summary> 461 Monthly 462 } 463 464 /// <summary> 465 /// The days of the week, with values usable in a bitfield. 466 /// </summary> 467 [Flags] 468 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames")] 469 public enum DaysOfWeek 470 { 471 None = 0, 472 Sunday = 1 << DayOfWeek.Sunday, 473 Monday = 1 << DayOfWeek.Monday, 474 Tuesday = 1 << DayOfWeek.Tuesday, 475 Wednesday = 1 << DayOfWeek.Wednesday, 476 Thursday = 1 << DayOfWeek.Thursday, 477 Friday = 1 << DayOfWeek.Friday, 478 Saturday = 1 << DayOfWeek.Saturday 479 } 480 480 }
Note: See TracChangeset
for help on using the changeset viewer.
