/// <summary> /// Erstellt eine neue Ausnahmebeschreibung. /// </summary> /// <param name="exception">Die Ausnahmedaten.</param> /// <param name="schedule">Die zugehörige Aufzeichnung.</param> private PlanException(VCRScheduleException exception, VCRSchedule schedule) { // Remember ExceptionDurationDelta = exception.Duration.GetValueOrDefault(schedule.Duration) - schedule.Duration; ExceptionDate = new DateTime(exception.When.Date.Ticks, DateTimeKind.Utc); ExceptionStartShift = exception.ShiftTime.GetValueOrDefault(0); // Start berechnen PlannedStart = (new DateTime(exception.When.Date.Ticks, DateTimeKind.Local) + schedule.FirstStart.ToLocalTime().TimeOfDay).ToUniversalTime(); PlannedDuration = schedule.Duration; }
/// <summary> /// Erstellt eine neue Ausnahmebeschreibung. /// </summary> /// <param name="exception">Die Ausnahmedaten.</param> /// <param name="schedule">Die zugehörige Aufzeichnung.</param> /// <returns>Die neue Ausnahmebeschreibung.</returns> public static PlanException Create(VCRScheduleException exception, VCRSchedule schedule) { // Validate if (exception == null) { throw new ArgumentNullException("exception"); } if (schedule == null) { throw new ArgumentNullException("schedule"); } // Forward return(new PlanException(exception, schedule)); }
/// <summary> /// Verändert eine Ausnahme. /// </summary> /// <param name="jobIdentifier">Die eindeutige Kennung des Auftrags.</param> /// <param name="scheduleIdentifier">Die eindeutige Kennung der Aufzeichnung.</param> /// <param name="when">Der betroffene Tag.</param> /// <param name="startDelta">Die Verschiebung der Startzeit in Minuten.</param> /// <param name="durationDelta">Die Änderung der Aufzeichnungsdauer in Minuten.</param> public void ChangeException(Guid jobIdentifier, Guid scheduleIdentifier, DateTime when, int startDelta, int durationDelta) { // Locate the job var job = JobManager[jobIdentifier]; if (job == null) { return; } var schedule = job[scheduleIdentifier]; if (schedule == null) { return; } // Validate if (durationDelta < -schedule.Duration) { return; } // Create description var exception = new VCRScheduleException { When = when.Date }; // Fill all data if (startDelta != 0) { exception.ShiftTime = startDelta; } if (durationDelta != 0) { exception.Duration = schedule.Duration + durationDelta; } // Process schedule.SetException(exception.When, exception); // Store JobManager.Update(job, null); // Recalculate plan BeginNewPlan(); }