private async void ExecuteFilterCommand(object parameter) { IsBusy = true; await Task.Run(() => { int i = 0; _ProjectQuery = (from item in _projects .Where(pr => Developers.FirstOrDefault(p => pr.Developer == p.Item && p.IsChecked == true) != null) .Where(pr => Status.FirstOrDefault(p => pr.Status == p.Item && p.IsChecked == true) != null) .Where(pr => Business.FirstOrDefault(p => pr.Business == p.Item && p.IsChecked == true) != null) .Where(pr => Months.FirstOrDefault(p => pr.Date.ToString("MMMM") == p.Item && p.IsChecked == true) != null) .Where(pr => Years.FirstOrDefault(p => pr.Date.Year.ToString() == p.Item && p.IsChecked == true) != null) select new Project { Id = item.Id, Row = i++, Name = item.Name, Developer = item.Developer, Status = item.Status, } ).ToList(); }); _total = _ProjectQuery.Count(); _ViewList = new CollectionViewSource(); _ViewList.Source = _ProjectQuery; _ViewList.Filter += new FilterEventHandler(view_Filter); CurrentPageIndex = 0; itemcount = _ProjectQuery.Count; CalculateTotalPages(); OnPropertyChanged("ViewList"); OnPropertyChanged("Total"); OnPropertyChanged("TotalPages"); OnPropertyChanged("CurrentPageIndex"); OnPropertyChanged("CurrentPageIndex"); OnPropertyChanged("CurrentPage"); OnPropertyChanged("Users"); ViewList.View.Refresh(); IsBusy = false; }
public LinkTrackerMonthlyClickThroughSearchModel() { var linkTrackerClickService = HostContainer.GetInstance <ILinkTrackerClickService>(); Years = linkTrackerClickService.GetYears(); var selected = Years.FirstOrDefault(i => i.Selected); if (selected != null) { Year = selected.Value.ToInt(); } }
void LoadYears() { using (IUnitOfWork unit = new UnitOfWork()) { //var years = unit.Outboxes.GetAll().Distinct(new OutboxNoComparer()).Select(x => x.OutboxNo); var years = unit.Outboxes.GetAll().Select(x => x.OutboxNo.Substring(0, 4)).Distinct();//This version is better than the above one. LatestYear = years.Max(); Years.Add(0, "الكل"); int id = 1; foreach (var year in years) { Years.Add(id, year); id++; } SelectedYear = Years.FirstOrDefault(x => x.Value == LatestYear); } }
internal override BaseItemWP FindFromSection(Guid identifier) { return(Years.FirstOrDefault(i => i.Identifier.Equals(identifier))); }