/// <summary> /// Alisa Roehr /// Created: 2019/02/01 /// /// for creating a new guest. /// </summary> /// <remarks> /// /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddGuest_Click(object sender, RoutedEventArgs e) { var detail = new frmAddEditGuest(); detail.ShowDialog(); _guests = _guestManager.ReadAllGuests(); dgGuests.ItemsSource = _guests; }
private void BtnViewGuestDetails_Click(object sender, RoutedEventArgs e) { frmAddEditGuest guestDetail = new frmAddEditGuest(_guest); var formResult = guestDetail.ShowDialog(); if (formResult == true) { // If the guest form was edited, refresh the guest. _guest = _guestManager.ReadGuestByGuestID(_guest.GuestID); populateGuestTextBoxes(); } }
/// <summary> /// Alisa Roehr /// Created: 2019/02/01 /// /// for loading the guest details /// </summary> /// <remarks> /// /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void dgGuests_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { if (dgGuests.SelectedItem != null && ((Guest)dgGuests.SelectedItem).Active != false) { var selectedGuest = (Guest)dgGuests.SelectedItem; var detail = new frmAddEditGuest(selectedGuest); var result = detail.ShowDialog(); _guests = _guestManager.ReadAllGuests(); dgGuests.ItemsSource = _guests; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Viewing Guest Failed!"); } }
/// <summary> /// James Heim /// Created 2019-04-26 /// /// View the Guest Detail (if exists) for the selected ViewModel. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnViewGuest_Click(object sender, RoutedEventArgs e) { if (_selectedItem != null && _selectedItem.GuestID != null) { Guest guest = null; try { guest = _guestManager.ReadGuestByGuestID((int)_selectedItem.GuestID); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (guest != null) { frmAddEditGuest window = new frmAddEditGuest(guest); window.ShowDialog(); } } }