Ejemplo n.º 1
0
 private void LoadFillLevelReadings()
 {
     foreach (var reading in m_Repository.FillLevelReadings.OfType <FillLevelReading>())
     {
         m_FillLevelReadings.Add(m_ReadingViewModelFactory.CreateFromExisting(reading));
     }
     NotifyOfPropertyChange(() => EvaluationYears);
     NotifyOfPropertyChange(() => FilteredItems);
 }
        private FillLevelReadingViewModel CreateReadingVM(FillLevelReading newItem)
        {
            var readingViewModel = m_ReadingViewModelFactory.CreateFromExisting(newItem);

            var now     = DateTime.Now;
            var dueDate = readingViewModel.Model.DueDate.Begin;

            if (dueDate.Date >= now.GetFirstDayOfWeek() &&
                dueDate.Date <= now.GetLastDayOfWeek() &&
                dueDate >= now)
            {
                //diese Woche
                readingViewModel.DateIndicator = 0;
            }
            else if (dueDate < now)
            {
                if (dueDate.Date == now.Date &&
                    readingViewModel.Model.DueDate.IsAllDay)
                {
                    //ganztägig und heute = diese Woche (duedate-zeit ignorieren)
                    readingViewModel.DateIndicator = 0;
                }
                else
                {
                    //abgelaufen
                    readingViewModel.DateIndicator = 1;
                }
            }
            else
            {
                //alle anderen
                readingViewModel.DateIndicator = 2;
            }

            return(readingViewModel);
        }