Esempio n. 1
0
        public void AddAddAmendment(ResaElement resolution, int roleId, string newText)
        {
            _context.Update(resolution);
            var paragraph = new ResaOperativeParagraph()
            {
                AllowAmendments = false,
                IsVirtual       = true,
                IsLocked        = true,
                OrderIndex      = resolution.OperativeParagraphs.Count,
                Parent          = null,
                Resolution      = resolution,
                Text            = newText
            };

            resolution.OperativeParagraphs.Add(paragraph);
            _context.OperativeParagraphs.Add(paragraph);
            var amendment = new ResaAddAmendment()
            {
                Resolution       = resolution,
                Submitter        = _context.Delegates.Find(roleId),
                VirtualParagraph = paragraph
            };

            resolution.AddAmendments.Add(amendment);
            _context.ResolutionAddAmendments.Add(amendment);
            _context.SaveChanges();
        }
Esempio n. 2
0
    public static AddAmendmentCreatedEventArgs ToSocketModel(this ResaAddAmendment amendment, string resolutionId)
    {
        var args = new AddAmendmentCreatedEventArgs()
        {
            ResolutionId = resolutionId,
            Tan          = "12345",
            Amendment    = new AddAmendment()
            {
                Activated       = amendment.Activated,
                Id              = amendment.ResaAmendmentId,
                Name            = "AddAmendment",
                SubmitterName   = amendment.SubmitterName,
                SubmitTime      = amendment.SubmitTime,
                TargetSectionId = amendment.VirtualParagraph.ResaOperativeParagraphId,
                Type            = amendment.ResaAmendmentType
            },
            VirtualParagraph = new OperativeParagraph()
            {
                Children             = new List <OperativeParagraph>(),
                Comment              = "",
                Corrected            = false,
                IsLocked             = amendment.VirtualParagraph.IsLocked,
                IsVirtual            = amendment.VirtualParagraph.IsVirtual,
                Name                 = "Virtual Paragraph",
                OperativeParagraphId = amendment.VirtualParagraph.ResaOperativeParagraphId,
                Text                 = amendment.VirtualParagraph.Text,
                Visible              = amendment.VirtualParagraph.Visible
            },
            VirtualParagraphIndex = amendment.VirtualParagraph.OrderIndex
        };

        return(args);
    }
Esempio n. 3
0
        public void RevokeAddAmendment(ResaAddAmendment amendment)
        {
            using var scope = serviceScopeFactory.CreateScope();
            var resolutionService = scope.ServiceProvider.GetRequiredService <ResolutionService>();

            resolutionService.RevokeAddAmendment(amendment);

            ResolutionChanged?.Invoke(this, Resolution);
        }
Esempio n. 4
0
        public void SubmitAddAmendment(ResaAddAmendment amendment)
        {
            _context.Update(amendment);
            amendment.VirtualParagraph.IsLocked        = false;
            amendment.VirtualParagraph.IsVirtual       = false;
            amendment.VirtualParagraph.AllowAmendments = true;
            amendment.Resolution.AddAmendments.Remove(amendment);

            _context.SaveChanges();
        }
Esempio n. 5
0
        public void RevokeAddAmendment(ResaAddAmendment amendment)
        {
            _context.Update(amendment);
            amendment.Resolution.AddAmendments.Remove(amendment);
            amendment.Resolution.OperativeParagraphs.Remove(amendment.VirtualParagraph);
            _context.OperativeParagraphs.Remove(amendment.VirtualParagraph);
            _context.ResolutionAddAmendments.Remove(amendment);

            _context.SaveChanges();
        }
Esempio n. 6
0
    public static AddAmendment ToModel(this ResaAddAmendment sourceAmendment)
    {
        var model = new AddAmendment()
        {
            Activated       = sourceAmendment.Activated,
            Id              = sourceAmendment.ResaAmendmentId,
            Name            = sourceAmendment.GetType().Name,
            SubmitterName   = sourceAmendment.SubmitterName,
            SubmitTime      = sourceAmendment.SubmitTime,
            TargetSectionId = sourceAmendment.VirtualParagraph.ResaOperativeParagraphId,
            Type            = "add"
        };

        return(model);
    }