コード例 #1
0
        /// <summary>
        /// Attempts to add the specified Subject to the collection of People. If a Subject has already
        /// been specified, an exception is thrown.
        /// </summary>
        public void AddSubject(PublicSafetyPerson subject)
        {
            // There can be only one Subject of a Citation.
            if (People.Any(x => CodeValue.ValuesMatch(x.InvolvementType, CitationPersonInvolvementTypes.Subject)))
            {
                throw new Exception("A Subject already exists on this Citation.");
            }

            // Make sure the Involvment Type is Correct
            subject.InvolvementType = CitationPersonInvolvementTypes.Subject;

            // Add the Subject to the Collection of People on the this Citation.
            People.Add(subject);
        }