public void ClearSearch(string type) { switch (type) { case "checklist": SearchChecklistText = string.Empty; Checklists.Clear(); _checklistRepository.All().ForEach(c => Checklists.Add(c)); break; case "customer": SearchCustomerText = string.Empty; Customers.Clear(); _customerRepository.All().ForEach(c => Customers.Add(c)); break; case "parkinglot": SearchLocationText = string.Empty; ParkingLots.Clear(); _parkingLotRepository.All().ForEach(p => ParkingLots.Add(p)); break; } SelectFirstComboBoxItem(); }
public override void OnEnter() { if (Settings.IsOfflineMode) { MessageBox.Show("Dit scherm is niet beschikbaar in offline mode."); _router.GoBack(); return; } if (_isEditing) { _isEditing = false; return; } if (ViewBag?.Task != null) { SelectedTask = ViewBag.Task; } else { SelectedTask = new Task { Inspections = new List <Inspection>(), TaskSchedules = new List <TaskSchedule>(), DateTimeStart = DateTime.Today, Hash = MD5.Crypt($"{DateTime.Now.ToLongDateString()}-{SelectedTask?.GetHashCode()}") }; EndDate = DateTime.Today.AddDays(1); IsRepeating = false; CanEditStartDate = true; } if (SelectedTask.Remarks == null) { SelectedTask.Remarks = ""; } SelectedTask.TaskSchedules.ToList().ForEach(t => TaskSchedules.Add(t)); Customers.Clear(); ParkingLots.Clear(); Checklists.Clear(); StartDate = DateTime.Today; EndDate = DateTime.Today.AddDays(1); _customerRepository.All().ForEach(Customers.Add); _checklistRepository.All().ForEach(Checklists.Add); _parkingLotRepository.All().ForEach(ParkingLots.Add); CalculateInspectionDates(); SelectFirstComboBoxItem(); }
private void Search() { Checklists.Clear(); var search = _repository.All().Select(x => new TemplateChecklistViewModel(x)); if (!string.IsNullOrWhiteSpace(SearchString)) { search.Where(t => t.Checklist.Name.ToLower().Contains(SearchString.ToLower())).ToList().ForEach(Checklists.Add); return; } search.ToList().ForEach(Checklists.Add); RaisePropertyChanged(nameof(Checklists)); }
public void Search(string listType) { if (listType == "checklist") { Checklists.Clear(); _checklistRepository.All() .Where(c => c.Name.ToLower().Contains(SearchChecklistText.ToLower()) || c.Remarks.ToLower().Contains(SearchChecklistText.ToLower()) ).ToList().ForEach(c => Checklists.Add(c)); } else if (listType == "parkinglot") { ParkingLots.Clear(); _parkingLotRepository.All() .Where(p => p.Address.City.ToLower().Contains(SearchLocationText.ToLower()) || p.Address.Country.ToLower().Contains(SearchLocationText.ToLower()) || p.Address.ZipCode.ToLower().Contains(SearchLocationText.ToLower()) || p.Address.Street.ToLower().Contains(SearchLocationText.ToLower()) ).ToList().ForEach(p => ParkingLots.Add(p)); SelectFirstComboBoxItem(); } else if (listType == "customer") { Customers.Clear(); _customerRepository.All() .Where(c => c.Name.ToLower().Contains(SearchCustomerText.ToLower()) || c.Email.ToLower().Contains(SearchCustomerText.ToLower()) || c.Contact.ToLower().Contains(SearchCustomerText.ToLower()) || c.PhoneNumber.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.Street.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.ZipCode.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.City.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.Country.ToLower().Contains(SearchCustomerText.ToLower()) ).ToList().ForEach(c => Customers.Add(c)); } SelectFirstComboBoxItem(); }