public void Refresh()
        {
            _employees = connection.GetEmployees();

            // before  FilteredCars.Clear() the SelectedCar needs to point to a valid location
            // (with  FilteredCars.Clear(), the referenced object will disappear, and will give error at Display Fields)
            SelectedEmployee = null;
            FilteredEmployees.Clear();

            _employees.ForEach(x => FilteredEmployees.Add(x));
            ClearFields();
        }
Ejemplo n.º 2
0
 private void VolunteerViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "SearchValue" && SearchValue.Length > 0)
     {
         Volunteer v = VolunteerDataStore.instance.repository.findByID(SearchValue);
         FilteredEmployees.Clear();
         if (v != null)
         {
             var s = new VolunteerCardViewModel(v);
             FilteredEmployees.Add(s);
         }
     }
     else if (e.PropertyName == "SearchValue")
     {
         FilteredEmployees = _employees;
     }
 }
        public void Filter()
        {
            if (string.IsNullOrEmpty(FilterFirstName) && string.IsNullOrEmpty(FilterLastName) && string.IsNullOrEmpty(FilterICNumber) && string.IsNullOrEmpty(FilterPhone))
            {
                Refresh();
                return;
            }

            _employees = connection.GetEmployees();
            // before  FilteredCars.Clear() the SelectedCar needs to point to a valid location
            // (with  FilteredCars.Clear(), the referenced object will disappear, and will give error at Display Fields)
            SelectedEmployee = null;
            FilteredEmployees.Clear();

            List <Employee> temp = new List <Employee>();

            temp = FilterByFirstName(_employees);
            temp = Utils.FilterByLastName(temp, FilterLastName);
            temp = FilterByICNumber(temp);
            temp = FilterByPhone(temp);
            temp.ForEach(x => FilteredEmployees.Add(x));
        }