private void dgEvents_MouseDoubleClick(object sender, MouseButtonEventArgs e) { // check if an event was actually selected if (dgEvents.SelectedIndex != -1) { var selectedEvent = (Event)dgEvents.SelectedItem; // check if a user is logged in, not a guest, and the user has a role of // "Clerk" if (_guest == null && _user != null && _user.Roles.Contains(_user.Roles.Find(r => r.RoleID.Contains("Clerk")))) { var guestForm = new frmEmpLogin(_roomManger, _guestManager, "rooms"); var guestResult = guestForm.ShowDialog(); if (guestResult == true) { _guest = guestForm.guest; } else { return; } } var detailForm = new frmEventInfo(selectedEvent, _guest, _eventManager, _roomManger); var result = detailForm.ShowDialog(); if (result.HasValue && result.Value) { refreshEventTable(); refreshRoomEvents(); } if (_user != null && _guest != null) { _guest = null; } } }
private void imgBed_MouseUp(object sender, MouseButtonEventArgs e) // Emp login { // check that no one is currently logged in. If so, do nothing. if (_guest == null && _user == null) { var loginForm = new frmEmpLogin(_roomManger, _guestManager); var result = loginForm.ShowDialog(); if (result == true) { _user = loginForm.user; _activeGuests = _guestManager.GetGuests(); dgClerkRooms.ItemsSource = _activeGuests; loggedIn(_user.FirstName); showTabs(); statusMessage.Content = "Welcome " + _user.FirstName; } } }