예제 #1
0
        public bool ChangeTarrif(ITarrif newTarrif)
        {
            if (this.Tarrif == newTarrif)
            {
                return(true);
            }

            var curDate = DateTime.Now;

            if (this.Statistic.LastDatePayment + this.PaymentPeriod >= curDate)
            {
                this.Tarrif = newTarrif;
                this.Statistic.LastChangePlan = curDate;
                return(true);
            }
            return(false);
        }
예제 #2
0
        public Account(IAgreement agreement, ITarrif tarrif, TimeSpan tarrifChangePeriod, TimeSpan paymentPeriod)
        {
            if (agreement == null) throw new ArgumentNullException(nameof(agreement));
            if (tarrif == null) throw new ArgumentNullException(nameof(tarrif));

            this.Agreement = agreement;
            this.Client = Agreement.Client;

            this.Statistic = new Statistic()
            {
                LastDatePayment = Agreement.AcceptedDate,
                LastChangePlan =  Agreement.AcceptedDate
            };

            this.Tarrif = tarrif;
            this.TarrifChangePeriod = tarrifChangePeriod;
            this.PaymentPeriod = paymentPeriod;
        }
예제 #3
0
        public Account(IAgreement agreement, ITarrif tarrif, TimeSpan tarrifChangePeriod, TimeSpan paymentPeriod)
        {
            if (agreement == null)
            {
                throw new ArgumentNullException(nameof(agreement));
            }
            if (tarrif == null)
            {
                throw new ArgumentNullException(nameof(tarrif));
            }

            this.Agreement = agreement;
            this.Client    = Agreement.Client;

            this.Statistic = new Statistic()
            {
                LastDatePayment = Agreement.AcceptedDate,
                LastChangePlan  = Agreement.AcceptedDate
            };

            this.Tarrif             = tarrif;
            this.TarrifChangePeriod = tarrifChangePeriod;
            this.PaymentPeriod      = paymentPeriod;
        }
예제 #4
0
        public bool ChangeTarrif(ITarrif newTarrif)
        {
            if (this.Tarrif == newTarrif)
                return true;

            var curDate = DateTime.Now;

            if (this.Statistic.LastDatePayment + this.PaymentPeriod >= curDate)
            {
                this.Tarrif = newTarrif;
                this.Statistic.LastChangePlan = curDate;
                return true;
            }
            return false;
        }