public static bool PropertyOwnerIsInPossession(this IRationale lc, ILegalProperty SubjectProperty, ILegalPerson subj) { if (subj == null) { return(false); } var title = subj.GetLegalPersonTypeName(); if (SubjectProperty == null) { lc.AddReasonEntry($"{title} {subj.Name}, {nameof(SubjectProperty)} is unassigned"); return(false); } var hasPossession = SubjectProperty.IsInPossessionOf != null && SubjectProperty.IsInPossessionOf(subj); var isIsNot = hasPossession ? "is in possession" : "is not in possession"; lc.AddReasonEntry( $"{title} {subj.Name}, {isIsNot} " + $"of {SubjectProperty.GetType().Name} " + $"named '{SubjectProperty.Name}'"); return(hasPossession); }
public static bool PropertyOwnerIsSubjectPerson(this IRationale lc, ILegalProperty property, ILegalPerson person) { if (person == null) { return(false); } var title = person.GetLegalPersonTypeName(); if (property == null) { lc.AddReasonEntry($"{title} {person.Name}, {nameof(property)} is unassigned"); return(false); } var isOwner = property.IsEntitledTo != null && property.IsEntitledTo(person); var isIsNot = isOwner ? "is owner" : "is not owner"; lc.AddReasonEntry( $"{title} {person.Name}, {isIsNot} " + $"of {property.GetType().Name} " + $"named '{property.Name}'"); return(isOwner); }