internal void ShowDates(DateTime?start, DateTime?end) { WPE = new Models.WeddingPlannerEntities(); DataViewItems.Children.Clear(); if (start == null && end == null) { foreach (var day in Days.Where(x => x.UserID.Equals(User.IDLogin)).OrderBy(x => x.Date).Reverse().ToList()) { var it = new ViewModel.DateView(day.Date, CalEntrys.Where(x => x.CalID.Equals(day.ID)).Select(x => x.LogEntry.Trim()).Reverse().ToList()); DataViewItems.Children.Add(new UserControls.UsercontrolDates(it, this, h)); } } else if (end == null) { foreach (var day in Days.Where(x => x.UserID.Equals(User.IDLogin) & x.Date >= start).OrderBy(x => x.Date).Reverse().ToList()) { var it = new ViewModel.DateView(day.Date, CalEntrys.Where(x => x.CalID.Equals(day.ID)).Select(x => x.LogEntry.Trim()).Reverse().ToList()); DataViewItems.Children.Add(new UserControls.UsercontrolDates(it, this, h)); } } else { foreach (var day in Days.Where(x => x.UserID.Equals(User.IDLogin) & x.Date >= start & x.Date <= end).OrderBy(x => x.Date).Reverse().ToList()) { var it = new ViewModel.DateView(day.Date, CalEntrys.Where(x => x.CalID.Equals(day.ID)).Select(x => x.LogEntry.Trim()).Reverse().ToList()); DataViewItems.Children.Add(new UserControls.UsercontrolDates(it, this, h)); } } }
public UsercontrolDates(ViewModel.DateView item, Pages.DateView _dat, Windows.Home _h) { InitializeComponent(); h = _h; ListViewItemMenu1.Visibility = item.Day != null ? Visibility.Visible : Visibility.Collapsed; ListViewItemMenu2.Visibility = item.Entry != null ? Visibility.Visible : Visibility.Collapsed; this.DataContext = item; }