private void UpdateAppointmentWindow(AppointmentWindow appointmentWindow) { if (_appointmentWindow == null) { return; } if (OverrideType.HasFlag(PlanningOverrideType.Window)) { return; } // take the predefined start and end date of the appointment window // only the date portion will vary var startTimeSpan = new TimeSpan(AppointmentWindow.WindowStart.Hours, AppointmentWindow.WindowStart.Minutes, AppointmentWindow.WindowStart.Seconds); WindowStart = new DateTimeOffset(new DateTime(WindowStart.Year, WindowStart.Month, WindowStart.Day), WindowStart.Offset).Add(startTimeSpan); var endTimeSpan = new TimeSpan(AppointmentWindow.WindowEnd.Hours, AppointmentWindow.WindowEnd.Minutes, AppointmentWindow.WindowEnd.Seconds); WindowEnd = new DateTimeOffset(new DateTime(WindowEnd.Year, WindowEnd.Month, WindowEnd.Day), WindowEnd.Offset).Add(endTimeSpan); }
protected override void Redo() { base.Redo(); if (!newOverride.HasFlag(OverrideType.New) && Node.BaseNode != null) { if (Index != NodeIndex.Empty) { ((IAssetObjectNode)Node).ResetOverrideRecursively(Index); } else { Node.ResetOverrideRecursively(); } } }
/// <inheritdoc/> protected override void Undo() { // If we're undoing an add, we need to get the id of the item before removing it. var id = ItemId.Empty; if (ChangeType == ContentChangeType.CollectionAdd) { var objectNode = (IAssetObjectNode)Node; objectNode.TryIndexToId(Index, out id); } base.Undo(); // If this undo restored inheritance from the base, we have extra-work to do to cancel the override information. if (!previousOverride.HasFlag(OverrideType.New) && Node.BaseNode != null) { if (ChangeType != ContentChangeType.CollectionAdd) { // For value change or remove, we just need to indicate that the value is not overridden anymore if (Index == NodeIndex.Empty) { ((IAssetMemberNode)Node).OverrideContent(false); } else { ((IAssetObjectNode)Node).OverrideItem(false, Index); } } else { // For add, we must remove the id of the item from the list of deleted ids. if (id != ItemId.Empty) { ((IAssetObjectNode)Node).OverrideDeletedItem(false, id); } } } }