Exemple #1
0
        protected internal override bool StandardsTest(ILegalConcept a, ILegalConcept b)
        {
            var uccContract = Contract as UccContract <Goods>;

            if (uccContract != null && uccContract.IsInstallmentContract)
            {
                AddReasonEntry("the perfect tender rule does not apply to UCC installment contracts-(see UCC 2-612)");
                return(a.EquivalentTo(b) || b.EquivalentTo(a));
            }

            return(a.Equals(b) || b.Equals(a));
        }
Exemple #2
0
        public override bool IsValid(params ILegalPerson[] persons)
        {
            if (!base.IsValid(persons))
            {
                return(false);
            }

            var cotenants = this.Cotenants(persons).ToList();

            if (!cotenants.Any())
            {
                return(false);
            }

            DateTime?     creationDate = null;
            ILegalConcept instrument   = null;
            var           portion      = 0D;

            for (var i = 0; i < cotenants.Count; i++)
            {
                var cotenant = cotenants[i];
                var title    = cotenant.GetLegalPersonTypeName();
                if (i == 0)
                {
                    creationDate = InterestCreationDate(cotenants[i]);
                    instrument   = InterestCreationInstrument(cotenants[i]);
                    portion      = InterestFraction(cotenants[i]);
                    continue;
                }

                if (portion == 0D)
                {
                    AddReasonEntry($"{title} {cotenant.Name} {nameof(InterestFraction)} is null");
                    return(false);
                }
                if (instrument == null)
                {
                    AddReasonEntry($"{title} {cotenant.Name} {nameof(InterestCreationInstrument)} is null");
                    return(false);
                }
                if (creationDate == null)
                {
                    AddReasonEntry($"{title} {cotenant.Name} {nameof(InterestCreationDate)} is null");
                    return(false);
                }

                var nextCreationDate = InterestCreationDate(cotenant);
                if (!creationDate.Equals(nextCreationDate))
                {
                    AddReasonEntry($"{title} {cotenant.Name} {nameof(InterestCreationDate)}, {creationDate} does not equal {nextCreationDate}");
                    return(false);
                }

                var nextInstrument = InterestCreationInstrument(cotenant);
                if (!instrument.Equals(nextInstrument))
                {
                    AddReasonEntry($"{title} {cotenant.Name} {nameof(InterestCreationInstrument)}, {instrument} does not equal {nextInstrument}");
                    return(false);
                }

                var nextPortion = InterestFraction(cotenant);
                if (Math.Abs(portion - nextPortion) > 0.01)
                {
                    AddReasonEntry($"{title} {cotenant.Name} {nameof(InterestFraction)}, {portion} does not equal {nextPortion}");
                    return(false);
                }
            }

            return(true);
        }