예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LimitCheckInButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CACCCheckInDb.Class selectedClass = (CACCCheckInDb.Class)LimitCheckInClassesComboBox.SelectedItem;
                if (null == selectedClass)
                {
                    _exclusiveCheckInClass = null;
                    return;
                }

                if (selectedClass.Name.Equals(String.Empty) &&
                    selectedClass.Id.Equals(new Guid("00000000-0000-0000-0000-000000000000")))
                {
                    _exclusiveCheckInClass = null;
                    return;
                }

                _exclusiveCheckInClass = selectedClass;
            }
            catch (Exception)
            {
                _exclusiveCheckInClass = null;
            }
            finally
            {
                _peopleView.MoveCurrentToPosition(-1);
                _peopleView.MoveCurrentToFirst();
                PeopleListBox.SelectedIndex = _peopleView.CurrentPosition;
                PeopleListBox.ScrollIntoView(_peopleView.CurrentItem);

                ExclusiveCheckInPanel.Visibility = Visibility.Collapsed;
            }
        }
예제 #2
0
        private void PeopleListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var selectedPerson = PeopleListBox.SelectedItem as Person;

            if (selectedPerson != null)
            {
                var window = new PersonFromListWindow(selectedPerson);

                if (window.ShowDialog() ?? false)
                {
                    UpdatePeople();
                }
                PeopleListBox.UnselectAll();
            }
        }
        /// <summary>
        /// Will filter the names which show up in the list for names
        /// </summary>
        /// <param name="filter"></param>
        private void FilterNamesInListBox(string filter)
        {
            if (_peopleView == null)
            {
                return;
            }

            _peopleView.Filter = p =>
                                 ((CACCCheckInDb.PeopleWithDepartmentAndClassView)p).LastName.ToLower().
                                 StartsWith(filter.ToLower());

            _peopleView.MoveCurrentToFirst();
            if (_peopleView.CurrentItem == null)
            {
                return;
            }
            PeopleListBox.ScrollIntoView(_peopleView.CurrentItem);
        }
 //Add/Update/Delete person
 private void AddPersonButton_Click(object sender, RoutedEventArgs e)
 {
     if (selectedPerson != null)
     {
         var window = new PersonWindow(selectedPerson);
         if (window.ShowDialog() ?? false)
         {
             UpdatePeople();
         }
     }
     else
     {
         var window = new PersonWindow(null);
         if (window.ShowDialog() ?? false)
         {
             UpdatePeople();
         }
     }
     PeopleListBox.UnselectAll();
 }