| | 1 | | using MUNity.Models.Resolution; |
| | 2 | | using System; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using System.Text; |
| | 5 | | using System.Linq; |
| | 6 | |
|
| | 7 | | namespace MUNity.Extensions.ResolutionExtensions |
| | 8 | | { |
| | 9 | | public static class OperativeSectionExtensions |
| | 10 | | { |
| | 11 | | public static int AmendmentCount(this OperativeSection section) |
| 0 | 12 | | { |
| 0 | 13 | | return section.AddAmendments.Count + section.ChangeAmendments.Count + section.DeleteAmendments.Count + secti |
| 0 | 14 | | } |
| | 15 | |
|
| | 16 | | /// <summary> |
| | 17 | | /// Only works on one level |
| | 18 | | /// </summary> |
| | 19 | | /// <param name="section"></param> |
| | 20 | | /// <param name="paragraph"></param> |
| | 21 | | /// <returns></returns> |
| | 22 | | public static int GetIndexOfParagraphNonVirtual(this OperativeSection section, OperativeParagraph paragraph) |
| 0 | 23 | | { |
| 0 | 24 | | int index = 0; |
| 0 | 25 | | foreach(var p in section.Paragraphs) |
| 0 | 26 | | { |
| 0 | 27 | | if (!p.IsVirtual) |
| 0 | 28 | | { |
| 0 | 29 | | if (p == paragraph ||p.OperativeParagraphId == paragraph.OperativeParagraphId) |
| 0 | 30 | | { |
| 0 | 31 | | break; |
| | 32 | | } |
| 0 | 33 | | index++; |
| 0 | 34 | | } |
| 0 | 35 | | } |
| 0 | 36 | | return index; |
| 0 | 37 | | } |
| | 38 | |
|
| | 39 | | public static int GetIndexOfParagraph(this OperativeSection section, OperativeParagraph paragraph) |
| 0 | 40 | | { |
| 0 | 41 | | return section.Paragraphs.IndexOf(paragraph); |
| 0 | 42 | | } |
| | 43 | |
|
| | 44 | | public static IEnumerable<AbstractAmendment> AmendmentsOrdered (this OperativeSection section) |
| 0 | 45 | | { |
| 0 | 46 | | return section.GetOrderedAmendments(); |
| 0 | 47 | | } |
| | 48 | | } |
| | 49 | | } |