Exemplo n.º 1
0
        public static bool TryGetOppositionPerson(this ILinkedLegalConcept llc, ILegalPerson[] persons, ILegalPerson subjectPerson,
                                                  out ILegalPerson person)
        {
            person = null;
            if (subjectPerson == null || llc == null)
            {
                return(false);
            }

            var personsLessSubj = GetPersonsLessThisOne(llc, persons, subjectPerson);

            if (personsLessSubj == null || !personsLessSubj.Any())
            {
                return(false);
            }

            if (subjectPerson is IPlaintiff)
            {
                person = llc.Defendant(personsLessSubj);
            }
            if (subjectPerson is IDefendant)
            {
                person = llc.Plaintiff(personsLessSubj);
            }

            return(person != null);
        }
Exemplo n.º 2
0
        public static bool TryGetSubjectPerson(this ILinkedLegalConcept llc, ILegalPerson[] persons, out ILegalPerson person)
        {
            person = null;

            if (persons == null || !persons.Any() || llc == null)
            {
                return(false);
            }

            if (llc.LinkedTo == null)
            {
                llc.AddReasonEntry($"{nameof(llc.LinkedTo)} is unassigned");
                return(false);
            }

            if (llc.LinkedTo is Complaint)
            {
                person = llc.Plaintiff(persons);
            }

            if (llc.LinkedTo is Answer)
            {
                person = llc.Defendant(persons);
            }

            if (person == null)
            {
                llc.AddReasonEntry($"{nameof(llc.LinkedTo)} is neither type {nameof(Complaint)} nor {nameof(Answer)}");
                return(false);
            }

            return(true);
        }