Esempio n. 1
0
 public Week Remove(Week week)
 {
     if (week.IsPersisted)
     {
         _repo.Delete(week);
     }
     return week;
 }
Esempio n. 2
0
 public void ShouldSetWeekToSelfWhenAddingUsage()
 {
     var week = new Week();
     var usage = new HourUsage();
     week.AddUsage(usage);
     Assert.That(week.Usages.Count, Is.EqualTo(1));
     Assert.That(usage.Week, Is.EqualTo(week));
 }
Esempio n. 3
0
        public Week NewWeek(DateTime maxDate)
        {
            maxDate = new List<DateTime> {maxDate, GetMaxStartDate()}.Max();
            var startDate = _dateProvider.GetCurrentWeekStartDate();
            while(startDate <= maxDate)
            {
                startDate = startDate.AddDays(7);
            }

            var week = new Week {StartDate = startDate};
            return _repo.Save(week);
        }
Esempio n. 4
0
        public WeekViewModel(IWeekService weekService, IHourCodeProvider hourCodeProvider, Week week)
        {
            _weekService = weekService;
            Week = week;
            _hourCodeProvider = hourCodeProvider;

            Usages = new ObservableCollection<HourUsageViewModel>();
            foreach (var hourUsage in Week.Usages)
            {
                Usages.Add(new HourUsageViewModel(_hourCodeProvider, this, hourUsage));
            }
            SaveWeekCommand = new DelegateCommand(SaveWeek);
            AddUsageCommand = new DelegateCommand(AddUsage);
        }
Esempio n. 5
0
 public Week Save(Week week)
 {
     return _repo.Save(week);
 }