public void LendBook(Customer customer, BookCopy bookCopy) { var lend = new LendBookEvent(bookCopy, customer, _dateProvider.Now()); try { _dataRepository.AddEvent(lend); } catch (EventException e) { throw new DataServiceException(e); } }
private TimeSpan CalculateDifference() { var now = dateProvider.Now(); var target = new DateTime(now.Year, now.Month, now.Day, ScheduledTime.Hour, ScheduledTime.Minute, ScheduledTime.Seconds); return(now > target ? target.AddDays(1) - now // Schedule for tomorrow : target - now); // Schdule for today }
private string GenerateBackupFilePath() { var now = _dateProvider.Now(); var filename = new StringBuilder("backup_") .Append(now.ToString("yyyyMMdd_HHmmss")) .Append(".zip") .ToString(); return(Path.Combine(Parameters.BackupFolder, filename)); }
private void SetDatesOn(DomainObject item) { var now = _dateProvider.Now(); if (!item.IsPersisted) { item.CreatedDate = now; } item.UpdatedDate = now; }
public RetirementIncrementalApproachCalculator(IDateProvider dateProvider, IAssumptions assumptions, IPensionAgeCalc pensionAgeCalc, IStatePensionAmountCalculator statePensionAmountCalculator, ITaxSystem taxSystem) { _assumptions = assumptions; _pensionAgeCalc = pensionAgeCalc; _statePensionAmountCalculator = statePensionAmountCalculator; _taxSystem = taxSystem; _now = dateProvider.Now(); }
public void RecordDeposit(int amount) { _transactions.Add(new Transaction(amount, _dateProvider.Now())); }