private void OnSessionsGridCellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } _selectedSession = _sessionsLookUp[SessionsGrid.Rows[e.RowIndex].Cells[0].Value.ToString()]; EnableOrDisableButtons(); }
private void RefreshSeminars() { try { var sessions = _queryDao.List <SessionsListItemDto>( $"LecturerId = '{_securityService.CurrentLecturerId}'") .OrderBy(x => x.StartTime) .ToList(); SessionsGrid.DataSource = sessions; _sessionsLookUp = sessions.ToDictionary(x => x.Id, x => x); if (sessions.Count > 0) { _selectedSession = sessions.First(); EnableOrDisableButtons(); } } catch (Exception) { MessageBoxWrapper.Error("Failed to fetch sessions"); } }