コード例 #1
0
ファイル: ComLawContract.cs プロジェクト: nofuture-git/31g
 public override string ToString()
 {
     AddReasonEntryRange(Assent?.GetReasonEntries());
     AddReasonEntryRange(Consideration?.GetReasonEntries());
     AddReasonEntryRange(Offer?.GetReasonEntries());
     return(base.ToString());
 }
コード例 #2
0
        public override bool IsValid(params ILegalPerson[] persons)
        {
            var offeror = this.Offeror(persons);
            var offeree = this.Offeree(persons);

            if (offeree == null || offeror == null)
            {
                return(false);
            }

            if (Assent == null)
            {
                AddReasonEntry("There is no agreement.");
                return(false);
            }

            if (!Assent.IsValid(offeror, offeree))
            {
                AddReasonEntry("The agreement is invalid");
                AddReasonEntryRange(Assent.GetReasonEntries());
                return(false);
            }

            if (!IsEnforceableInCourt)
            {
                AddReasonEntry("The contract is not enforceable in court and is therefore void.");
                return(false);
            }

            if (Offer != null && Offer.IsValid(offeror, offeree) == false)
            {
                AddReasonEntry($"The {Offer.GetType().Name} is invalid");
                AddReasonEntryRange(Offer.GetReasonEntries());
                return(false);
            }

            if (Acceptance == null)
            {
                return(true);
            }

            var acceptance = Acceptance(Offer);

            if (acceptance != null && acceptance.IsValid(offeror, offeree) == false)
            {
                AddReasonEntry($"The {acceptance.GetType().Name} is invalid");
                AddReasonEntryRange(acceptance.GetReasonEntries());
                return(false);
            }

            return(true);
        }
コード例 #3
0
ファイル: Lease.cs プロジェクト: nofuture-git/31g
        public override bool IsValid(params ILegalPerson[] persons)
        {
            var lessor = this.Lessor(persons);
            var lessee = this.Lessee(persons);

            if (lessor == null || lessee == null)
            {
                return(false);
            }

            var orTitle = lessor.GetLegalPersonTypeName();
            var eeTitle = lessee.GetLegalPersonTypeName();

            if (Inception == DateTime.MinValue)
            {
                AddReasonEntry($"{orTitle} {lessor.Name} and {eeTitle} {lessee.Name}, {nameof(Inception)} is unassigned");
                return(false);
            }

            if (Terminus != null && Terminus.Value <= Inception)
            {
                AddReasonEntry($"{orTitle} {lessor.Name} and {eeTitle} {lessee.Name}, {nameof(Terminus)} " +
                               $"date of {Terminus.Value.ToShortDateString()} is less-than-equal-to " +
                               $"the {nameof(Inception)} date of {Inception.ToShortDateString()}");
                return(false);
            }

            if (Assent != null && !Assent.IsValid(persons))
            {
                AddReasonEntryRange(Assent.GetReasonEntries());
                return(false);
            }

            if (SubjectProperty == null || Offer == null)
            {
                AddReasonEntry($"{orTitle} {lessor.Name} and {eeTitle} {lessee.Name}, " +
                               $"{nameof(SubjectProperty)} '{SubjectProperty?.Name}' " +
                               $"or {nameof(Offer)} '{Offer?.Name}' is unassigned");
                return(false);
            }

            if (Acceptance?.Invoke(Offer) == null)
            {
                AddReasonEntry($"{orTitle} {lessor.Name} and {eeTitle} {lessee.Name}, {nameof(Acceptance)} " +
                               $"using {nameof(Offer)} '{Offer.Name}' returned nothing");
                return(false);
            }

            return(true);
        }
コード例 #4
0
ファイル: Amendment.cs プロジェクト: nofuture-git/31g
        /// <summary>
        /// Two of two ways in which an amendment is valid, requires the court&apos;s permission or opposition&apos;s consent
        /// </summary>
        /// <param name="persons"></param>
        /// <param name="subjectPerson"></param>
        /// <returns></returns>
        protected internal virtual bool IsValidWithLeaveOfCourt(ILegalPerson[] persons, ILegalPerson subjectPerson)
        {
            if (Assent == null)
            {
                return(false);
            }

            var courtOfficial = LinkedLegalConceptExtensions.GetPersonsLessThisOne(this, persons, subjectPerson).CourtOfficial();

            if (Assent.IsApprovalExpressed(courtOfficial))
            {
                return(true);
            }

            if (!this.TryGetOppositionPerson(persons, subjectPerson, out var opposition))
            {
                return(false);
            }

            return(Assent.IsApprovalExpressed(opposition));
        }
コード例 #5
0
ファイル: ComLawContract.cs プロジェクト: nofuture-git/31g
        public override bool IsValid(params ILegalPerson[] persons)
        {
            var offeror = persons.Offeror();
            var offeree = persons.Offeree();

            if (!IsEnforceableInCourt)
            {
                AddReasonEntry("The contract is not enforceable in court and is therefore void.");
                return(false);
            }

            if (Consideration == null)
            {
                AddReasonEntry($"{nameof(Consideration)} is null");
                return(false);
            }

            if (!Consideration.IsValid(offeror, offeree))
            {
                AddReasonEntry($"{nameof(Consideration)}.{nameof(IsValid)} returned false");
                AddReasonEntryRange(Consideration.GetReasonEntries());
                return(false);
            }

            if (Offer == null)
            {
                AddReasonEntry($"{nameof(Offer)} is null");
                return(false);
            }

            if (!Offer.IsValid(offeror, offeree))
            {
                AddReasonEntry("the offer in invalid");
                AddReasonEntryRange(Offer.GetReasonEntries());
                return(false);
            }

            //short-circuit since this allows for no return promise
            var promissoryEstoppel = Consideration as PromissoryEstoppel <T>;

            if (promissoryEstoppel != null)
            {
                return(true);
            }

            if (!Offer.IsEnforceableInCourt)
            {
                AddReasonEntry("the offer is not enforceable in court");
                AddReasonEntryRange(Offer.GetReasonEntries());
                return(false);
            }

            if (Acceptance == null)
            {
                AddReasonEntry($"{nameof(Acceptance)} is null");
                return(false);
            }

            var returnPromise = Acceptance(Offer);

            if (returnPromise == null)
            {
                AddReasonEntry($"{nameof(returnPromise)} is null");
                return(false);
            }

            if (!returnPromise.IsEnforceableInCourt)
            {
                AddReasonEntry("the return promise is not enforceable in court");
                AddReasonEntryRange(returnPromise.GetReasonEntries());
                return(false);
            }

            if (!returnPromise.IsValid(offeror, offeree))
            {
                AddReasonEntry("the return promise is invalid");
                AddReasonEntryRange(returnPromise.GetReasonEntries());
                return(false);
            }

            if (Assent != null && !Assent.IsValid(offeror, offeree))
            {
                AddReasonEntry($"{nameof(Assent)}.{nameof(IsValid)} returned false");
                AddReasonEntryRange(Assent.GetReasonEntries());
                return(false);
            }

            return(true);
        }