Exemplo n.º 1
0
        /// <summary>
        /// Creates a new Amendment for a TextChange of a paragraph with a given Id.
        /// </summary>
        /// <param name="section">The operative Section of the resolution that this Admendment should be created in and also where the operative paragraph can be found.</param>
        /// <param name="paragraphId">The OperativeParagraphId of the target paragraph that the text should be changed in.</param>
        /// <param name="newText">The new Text that the paragraph should be set to if the created Amendment is Accepted/Applied.</param>
        /// <returns></returns>
        public static ChangeAmendment CreateChangeAmendment(this OperativeSection section, string paragraphId, string newText = "")
        {
            if (section.FindOperativeParagraph(paragraphId) == null)
            {
                throw new MUNity.Exceptions.Resolution.OperativeParagraphNotFoundException();
            }

            var newAmendment = new ChangeAmendment
            {
                TargetSectionId = paragraphId,
                NewText         = newText
            };

            section.PushAmendment(newAmendment);
            return(newAmendment);
        }
Exemplo n.º 2
0
    public static ChangeAmendment ToModel(this ResaChangeAmendment changeAmendment)
    {
        var model = new ChangeAmendment()
        {
            Activated       = changeAmendment.Activated,
            Id              = changeAmendment.ResaAmendmentId,
            Name            = changeAmendment.GetType().Name,
            NewText         = changeAmendment.NewText,
            SubmitterName   = changeAmendment.SubmitterName,
            SubmitTime      = changeAmendment.SubmitTime,
            TargetSectionId = changeAmendment.TargetParagraph.ResaOperativeParagraphId,
            Type            = "change"
        };

        return(model);
    }