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); }
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; }
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; }
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; }