/// <summary> /// Changes the text and removes the amendment. /// </summary> /// <param name="parentSection"></param> /// <returns></returns> public override bool Apply(OperativeSection parentSection) { parentSection.ChangeAmendments.Remove(this); var target = parentSection.FindOperativeParagraph(this.TargetSectionId); if (target == null) { return(false); } target.Text = this.NewText; return(true); }
/// <summary> /// Sets the Virtual Paragraph to a real paragraph and remove the amendment. /// </summary> /// <param name="parentSection"></param> /// <returns></returns> public override bool Apply(OperativeSection parentSection) { var targetParagraph = parentSection.FindOperativeParagraph(this.TargetSectionId); if (targetParagraph == null) { return(false); } targetParagraph.IsVirtual = false; targetParagraph.Visible = true; parentSection.AddAmendments.Remove(this); return(true); }
/// <summary> /// Will delete the opld amendment and move all its settings to the currently virtual paragraph. /// </summary> /// <param name="parentSection"></param> /// <returns></returns> public override bool Apply(OperativeSection parentSection) { var placeholder = parentSection.FindOperativeParagraph(NewTargetSectionId); var target = parentSection.FindOperativeParagraph(TargetSectionId); if (target == null || placeholder == null) { return(false); } placeholder.Children = target.Children; placeholder.Corrected = target.Corrected; placeholder.IsLocked = false; placeholder.IsVirtual = false; placeholder.Name = target.Name; placeholder.OperativeParagraphId = target.OperativeParagraphId; target.OperativeParagraphId = Guid.NewGuid().ToString(); this.TargetSectionId = target.OperativeParagraphId; placeholder.Text = target.Text; placeholder.Visible = true; parentSection.RemoveOperativeParagraph(target); return(true); }
/// <summary> /// Removes the operative section with all children and amendments that are on it. /// </summary> /// <param name="parentSection"></param> /// <returns></returns> public override bool Apply(OperativeSection parentSection) { var paragraph = parentSection.FindOperativeParagraph(this.TargetSectionId); if (!parentSection.Paragraphs.Contains(paragraph)) { return(false); } parentSection.Paragraphs.Remove(paragraph); parentSection.AmendmentsForOperativeParagraph(this.TargetSectionId).ForEach(n => parentSection.RemoveAmendment(n)); return(true); }