Example #1
0
        public override void OnEnter()
        {
            User = _repository.Find(Settings.CurrentUser.ID);

            Inspections.Clear();

            User.InspectionInspectors
            .Where(x => x.Inspection.DateTimePlanned > DateTime.Now.AddDays(-7))
            .Select(x => x.Inspection).ToList().ForEach(Inspections.Add);
        }
Example #2
0
        public override void OnEnter()
        {
            if (ViewBag?.Task == null)
            {
                MessageBox.Show("Er is geen inspectie geselecteerd!");
                _router.GoBack();
                return;
            }

            Task = ViewBag.Task;
            Inspections.Clear();
            Task.Inspections.ToList().ForEach(Inspections.Add);

            Inspectors.Clear();

            Task.Inspections.SelectMany(x => x.InspectionInspectors.Select(i => i.Employee)).Distinct().ToList().ForEach(Inspectors.Add);
            Remarks = Task.Remarks;

            RaisePropertyChanged(nameof(Task));
        }
        private void Search()
        {
            Inspections.Clear();

            var search = _userRepository.Find(Settings.CurrentUser.ID).InspectionInspectors
                         .Where(x => x.Inspection.DateTimePlanned > DateTime.Now.AddDays(-7))
                         .Select(x => x.Inspection).ToList();

            if (!string.IsNullOrWhiteSpace(SearchString))
            {
                search.Where(t =>
                             t.Task.Customer.Name.ToLower().Contains(SearchString.ToLower()) ||
                             t.Task.Customer.Email.ToLower().Contains(SearchString.ToLower()) ||
                             t.Task.ParkingLot.Address.City.ToLower().Contains(SearchString.ToLower()) ||
                             t.Task.ParkingLot.Address.Street.ToLower().Contains(SearchString.ToLower()) ||
                             t.Task.ParkingLot.Address.ZipCode.ToLower().Contains(SearchString.ToLower()) ||
                             t.Task.ParkingLot.Address.Number.ToLower().Contains(SearchString.ToLower()) ||
                             t.Task.ParkingLot.Address.Country.ToLower().Contains(SearchString.ToLower())
                             ).ToList().ForEach(Inspections.Add);
                return;
            }

            search.ForEach(Inspections.Add);
        }