public InspectionListViewModel() { CurrentDate = GetCurrentMonday(DayOfWeek.Monday); CurrentWeek = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(CurrentDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday); _inspectionRepository = new InspectionRepository(); NextWeekCommand = new RelayCommand(AddSevenDays); PreviousWeekCommand = new RelayCommand(SubtractSevenDays); WeekSlots = new ScheduleSlotViewModel[7]; FillSchedule(); BackToCurrentWeek = new RelayCommand(ToCurrentWeek); }
public void FillSchedule() { DateTime loopDate = new DateTime(CurrentDate.Ticks); for (int i = 0; i < WeekSlots.Length; i++) { WeekSlots[i] = new ScheduleSlotViewModel(); WeekSlots[i].Inspection = _inspectionRepository.GetInspectionsByDate(loopDate.Date, employeeid); WeekSlots[i].Date = loopDate; loopDate = loopDate.AddDays(1); } RaisePropertyChanged(() => WeekSlots); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ScheduleSlotViewModel slot = (value as ScheduleSlotViewModel); if (slot.Present == false && slot.Start != null && slot.End != null && slot.Festival != null) { return(new SolidColorBrush(Colors.IndianRed)); } else if (slot.Present == true && slot.Start != null && slot.End != null && slot.Festival != null) { return(new SolidColorBrush(Colors.LightSeaGreen)); } else { return(new SolidColorBrush(Colors.Wheat)); } }